@covalenthq/client-sdk 2.2.3 → 2.2.5
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.
- package/README.md +6 -6
- package/dist/cjs/index.js +172 -257
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/services/BalanceService.d.ts +2 -2
- package/dist/cjs/src/services/TransactionService.d.ts +41 -36
- package/dist/cjs/src/utils/types/BalanceService.types.d.ts +1 -1
- package/dist/cjs/src/utils/types/Generic.types.d.ts +27 -135
- package/dist/cjs/src/utils/types/TransactionService.types.d.ts +98 -175
- package/dist/esm/index.js +172 -257
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/src/services/BalanceService.d.ts +2 -2
- package/dist/esm/src/services/TransactionService.d.ts +41 -36
- package/dist/esm/src/utils/types/BalanceService.types.d.ts +1 -1
- package/dist/esm/src/utils/types/Generic.types.d.ts +27 -135
- package/dist/esm/src/utils/types/TransactionService.types.d.ts +98 -175
- package/package.json +4 -3
|
@@ -56,79 +56,16 @@ export type Transaction = Nullable<{
|
|
|
56
56
|
gas_quote_rate: number;
|
|
57
57
|
/** * The explorer links for this transaction. */
|
|
58
58
|
explorers: Explorer[];
|
|
59
|
-
/** * The details for the dex transaction. */
|
|
60
|
-
dex_details: DexReport[];
|
|
61
59
|
/** * The details for the NFT sale transaction. */
|
|
62
60
|
nft_sale_details: NftSalesReport[];
|
|
63
|
-
/** * The details for the lending protocol transaction. */
|
|
64
|
-
lending_details: LendingReport[];
|
|
65
61
|
/** * The log events. */
|
|
66
62
|
log_events: LogEvent[];
|
|
67
|
-
/** *
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/** *
|
|
72
|
-
|
|
73
|
-
/** * Stores the name of the protocol that facilitated the event. */
|
|
74
|
-
protocol_name: string;
|
|
75
|
-
/** * Stores the contract address of the protocol that facilitated the event. */
|
|
76
|
-
protocol_address: string;
|
|
77
|
-
/** * The protocol logo URL. */
|
|
78
|
-
protocol_logo_url: string;
|
|
79
|
-
/** * Stores the aggregator responsible for the event. */
|
|
80
|
-
aggregator_name: string;
|
|
81
|
-
/** * Stores the contract address of the aggregator responsible for the event. */
|
|
82
|
-
aggregator_address: string;
|
|
83
|
-
/** * DEXs often have multiple version - e.g Uniswap V1, V2 and V3. The `version` field allows you to look at a specific version of the DEX. */
|
|
84
|
-
version: number;
|
|
85
|
-
/** * Similarly to the `version` field, `fork_version` gives you the version of the forked DEX. For example, most DEXs are a fork of Uniswap V2; therefore, `fork` = `aave` & `fork_version` = `2` */
|
|
86
|
-
fork_version: number;
|
|
87
|
-
/** * Many DEXs are a fork of an already established DEX. The fork field allows you to see which DEX has been forked. */
|
|
88
|
-
fork: string;
|
|
89
|
-
/** * Stores the event taking place - e.g `swap`, `add_liquidity` and `remove_liquidity`. */
|
|
90
|
-
event: string;
|
|
91
|
-
/** * Stores the address of the pair that the user interacts with. */
|
|
92
|
-
pair_address: string;
|
|
93
|
-
pair_lp_fee_bps: number;
|
|
94
|
-
lp_token_address: string;
|
|
95
|
-
lp_token_ticker: string;
|
|
96
|
-
lp_token_num_decimals: number;
|
|
97
|
-
lp_token_name: string;
|
|
98
|
-
lp_token_value: string;
|
|
99
|
-
exchange_rate_usd: number;
|
|
100
|
-
/** * Stores the address of token 0 in the specific pair. */
|
|
101
|
-
token_0_address: string;
|
|
102
|
-
/** * Stores the ticker symbol of token 0 in the specific pair. */
|
|
103
|
-
token_0_ticker: string;
|
|
104
|
-
/** * Stores the number of contract decimals of token 0 in the specific pair. */
|
|
105
|
-
token_0_num_decimals: number;
|
|
106
|
-
/** * Stores the contract name of token 0 in the specific pair. */
|
|
107
|
-
token_0_name: string;
|
|
108
|
-
/** * Stores the address of token 1 in the specific pair. */
|
|
109
|
-
token_1_address: string;
|
|
110
|
-
/** * Stores the ticker symbol of token 1 in the specific pair. */
|
|
111
|
-
token_1_ticker: string;
|
|
112
|
-
/** * Stores the number of contract decimals of token 1 in the specific pair. */
|
|
113
|
-
token_1_num_decimals: number;
|
|
114
|
-
/** * Stores the contract name of token 1 in the specific pair. */
|
|
115
|
-
token_1_name: string;
|
|
116
|
-
/** * Stores the amount of token 0 used in the transaction. For example, 1 ETH, 100 USDC, 30 UNI, etc. */
|
|
117
|
-
token_0_amount: string;
|
|
118
|
-
token_0_quote_rate: number;
|
|
119
|
-
token_0_usd_quote: number;
|
|
120
|
-
pretty_token_0_usd_quote: string;
|
|
121
|
-
token_0_logo_url: string;
|
|
122
|
-
/** * Stores the amount of token 1 used in the transaction. For example, 1 ETH, 100 USDC, 30 UNI, etc. */
|
|
123
|
-
token_1_amount: string;
|
|
124
|
-
token_1_quote_rate: number;
|
|
125
|
-
token_1_usd_quote: number;
|
|
126
|
-
pretty_token_1_usd_quote: string;
|
|
127
|
-
token_1_logo_url: string;
|
|
128
|
-
/** * Stores the wallet address that initiated the transaction (i.e the wallet paying the gas fee). */
|
|
129
|
-
sender: string;
|
|
130
|
-
/** * Stores the recipient of the transaction - recipients can be other wallets or smart contracts. For example, if you want to Swap tokens on Uniswap, the Uniswap router would typically be the recipient of the transaction. */
|
|
131
|
-
recipient: string;
|
|
63
|
+
/** * List of internal transfers/transactions associated with the wallet address. */
|
|
64
|
+
internal_transfers: InternalTransfer[];
|
|
65
|
+
/** * List of state changes with before and after values and balances for involved contract and wallet addresses. */
|
|
66
|
+
state_changes: StateChange[];
|
|
67
|
+
/** * Object with a transaction's input data such as the Method ID. */
|
|
68
|
+
input_data: InputData;
|
|
132
69
|
}>;
|
|
133
70
|
export type NftSalesReport = Nullable<{
|
|
134
71
|
/** * The offset is the position of the log entry within an event log. */
|
|
@@ -181,87 +118,6 @@ export type NftSalesReport = Nullable<{
|
|
|
181
118
|
trade_type: string;
|
|
182
119
|
trade_group_type: string;
|
|
183
120
|
}>;
|
|
184
|
-
export type LendingReport = Nullable<{
|
|
185
|
-
/** * The offset is the position of the log entry within an event log. */
|
|
186
|
-
log_offset: number;
|
|
187
|
-
/** * Stores the name of the lending protocol that facilitated the event. */
|
|
188
|
-
protocol_name: string;
|
|
189
|
-
/** * Stores the contract address of the lending protocol that facilitated the event. */
|
|
190
|
-
protocol_address: string;
|
|
191
|
-
/** * The protocol logo URL. */
|
|
192
|
-
protocol_logo_url: string;
|
|
193
|
-
/** * Lending protocols often have multiple version (e.g. Aave V1, V2 and V3). The `version` field allows you to look at a specific version of the Lending protocol. */
|
|
194
|
-
version: string;
|
|
195
|
-
/** * Many lending protocols are a fork of an already established protocol. The fork column allows you to see which lending protocol has been forked. */
|
|
196
|
-
fork: string;
|
|
197
|
-
/** * Similarly to the `version` column, `fork_version` gives you the version of the forked lending protocol. For example, most lending protocols in the space are a fork of Aave V2; therefore, `fork` = `aave` & `fork_version` = `2` */
|
|
198
|
-
fork_version: string;
|
|
199
|
-
/** * Stores the event taking place - e.g `borrow`, `deposit`, `liquidation`, 'repay' and 'withdraw'. */
|
|
200
|
-
event: string;
|
|
201
|
-
/** * Stores the name of the LP token issued by the lending protocol. LP tokens can be debt or interest bearing tokens. */
|
|
202
|
-
lp_token_name: string;
|
|
203
|
-
/** * Stores the number decimal of the LP token. */
|
|
204
|
-
lp_decimals: number;
|
|
205
|
-
/** * Stores the ticker symbol of the LP token. */
|
|
206
|
-
lp_ticker_symbol: string;
|
|
207
|
-
/** * Stores the token address of the LP token. */
|
|
208
|
-
lp_token_address: string;
|
|
209
|
-
/** * Stores the amount of LP token used in the event (e.g. 1 aETH, 100 cUSDC, etc). */
|
|
210
|
-
lp_token_amount: number;
|
|
211
|
-
/** * Stores the total USD amount of all the LP Token used in the event. */
|
|
212
|
-
lp_token_price: number;
|
|
213
|
-
/** * Stores the exchange rate between the LP and underlying token. */
|
|
214
|
-
exchange_rate: number;
|
|
215
|
-
/** * Stores the USD price of the LP Token used in the event. */
|
|
216
|
-
exchange_rate_usd: number;
|
|
217
|
-
/** * Stores the name of the token going into the lending protocol (e.g the token getting deposited). */
|
|
218
|
-
token_name_in: string;
|
|
219
|
-
/** * Stores the number decimal of the token going into the lending protocol. */
|
|
220
|
-
token_decimal_in: number;
|
|
221
|
-
/** * Stores the address of the token going into the lending protocol. */
|
|
222
|
-
token_address_in: string;
|
|
223
|
-
/** * Stores the ticker symbol of the token going into the lending protocol. */
|
|
224
|
-
token_ticker_in: string;
|
|
225
|
-
/** * Stores the logo URL of the token going into the lending protocol. */
|
|
226
|
-
token_logo_in: string;
|
|
227
|
-
/** * Stores the amount of tokens going into the lending protocol (e.g 1 ETH, 100 USDC, etc). */
|
|
228
|
-
token_amount_in: number;
|
|
229
|
-
/** * Stores the total USD amount of all tokens going into the lending protocol. */
|
|
230
|
-
amount_in_usd: number;
|
|
231
|
-
pretty_amount_in_usd: string;
|
|
232
|
-
/** * Stores the name of the token going out of the lending protocol (e.g the token getting deposited). */
|
|
233
|
-
token_name_out: string;
|
|
234
|
-
/** * Stores the number decimal of the token going out of the lending protocol. */
|
|
235
|
-
token_decimals_out: number;
|
|
236
|
-
/** * Stores the address of the token going out of the lending protocol. */
|
|
237
|
-
token_address_out: string;
|
|
238
|
-
/** * Stores the ticker symbol of the token going out of the lending protocol. */
|
|
239
|
-
token_ticker_out: string;
|
|
240
|
-
/** * Stores the logo URL of the token going out of the lending protocol. */
|
|
241
|
-
token_logo_out: string;
|
|
242
|
-
/** * Stores the amount of tokens going out of the lending protocol (e.g 1 ETH, 100 USDC, etc). */
|
|
243
|
-
token_amount_out: number;
|
|
244
|
-
/** * Stores the total USD amount of all tokens going out of the lending protocol. */
|
|
245
|
-
amount_out_usd: number;
|
|
246
|
-
pretty_amount_out_usd: string;
|
|
247
|
-
/** * Stores the type of loan the user is taking out. Lending protocols enable you to take out a stable or variable loan. Only relevant to borrow events. */
|
|
248
|
-
borrow_rate_mode: number;
|
|
249
|
-
/** * Stores the interest rate of the loan. Only relevant to borrow events. */
|
|
250
|
-
borrow_rate: number;
|
|
251
|
-
on_behalf_of: string;
|
|
252
|
-
/** * Stores the wallet address liquidating the loan. Only relevant to liquidation events. */
|
|
253
|
-
liquidator: string;
|
|
254
|
-
/** * Stores the wallet address of the user initiating the event. */
|
|
255
|
-
user: string;
|
|
256
|
-
}>;
|
|
257
|
-
export type SafeDetails = Nullable<{
|
|
258
|
-
/** * The address that signed the safe transaction. */
|
|
259
|
-
owner_address: string;
|
|
260
|
-
/** * The signature of the owner for the safe transaction. */
|
|
261
|
-
signature: string;
|
|
262
|
-
/** * The type of safe signature used. */
|
|
263
|
-
signature_type: string;
|
|
264
|
-
}>;
|
|
265
121
|
export type RecentTransactionsResponse = Nullable<{
|
|
266
122
|
/** * The requested address. */
|
|
267
123
|
address: string;
|
|
@@ -316,6 +172,12 @@ export type TransactionsBlockResponse = Nullable<{
|
|
|
316
172
|
chain_name: ChainName;
|
|
317
173
|
/** * List of response items. */
|
|
318
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;
|
|
319
181
|
}>;
|
|
320
182
|
export type TransactionsSummaryResponse = Nullable<{
|
|
321
183
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
@@ -406,8 +268,12 @@ export type GetTransactionQueryParamOpts = Nullable<{
|
|
|
406
268
|
quoteCurrency?: Quote;
|
|
407
269
|
/** * Omit log events. */
|
|
408
270
|
noLogs?: boolean;
|
|
409
|
-
/** *
|
|
410
|
-
|
|
271
|
+
/** * Whether to include internal transfers/transactions. */
|
|
272
|
+
withInternal?: boolean;
|
|
273
|
+
/** * Whether to include all transaction state changes with before and after values. */
|
|
274
|
+
withState?: boolean;
|
|
275
|
+
/** * Whether to include the transaction's input data such as the Method ID. */
|
|
276
|
+
withInputData?: boolean;
|
|
411
277
|
}>;
|
|
412
278
|
export type GetAllTransactionsForAddressQueryParamOpts = Nullable<{
|
|
413
279
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
@@ -416,54 +282,111 @@ export type GetAllTransactionsForAddressQueryParamOpts = Nullable<{
|
|
|
416
282
|
noLogs?: boolean;
|
|
417
283
|
/** * Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order. */
|
|
418
284
|
blockSignedAtAsc?: boolean;
|
|
419
|
-
/** *
|
|
420
|
-
|
|
285
|
+
/** * Whether to include internal transfers/transactions. */
|
|
286
|
+
withInternal?: boolean;
|
|
287
|
+
/** * Whether to include all transaction state changes with before and after values. */
|
|
288
|
+
withState?: boolean;
|
|
289
|
+
/** * Whether to include the transaction's input data such as the Method ID. */
|
|
290
|
+
withInputData?: boolean;
|
|
421
291
|
}>;
|
|
422
|
-
export type
|
|
292
|
+
export type getTransactionsForBlockByPageQueryParamOpts = Nullable<{
|
|
423
293
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
424
294
|
quoteCurrency?: Quote;
|
|
425
295
|
/** * Omit log events. */
|
|
426
296
|
noLogs?: boolean;
|
|
427
|
-
/** * Include safe details. */
|
|
428
|
-
withSafe?: boolean;
|
|
429
297
|
}>;
|
|
430
|
-
export type
|
|
298
|
+
export type getPaginatedTransactionsForAddressQueryParamOpts = Nullable<{
|
|
431
299
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
432
300
|
quoteCurrency?: Quote;
|
|
433
301
|
/** * Omit log events. */
|
|
434
302
|
noLogs?: boolean;
|
|
435
303
|
/** * Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order. */
|
|
436
304
|
blockSignedAtAsc?: boolean;
|
|
437
|
-
/** * Include safe details. */
|
|
438
|
-
withSafe?: boolean;
|
|
439
305
|
}>;
|
|
440
306
|
export type GetTimeBucketTransactionsForAddressQueryParamOpts = Nullable<{
|
|
441
307
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
442
308
|
quoteCurrency?: Quote;
|
|
443
309
|
/** * Omit log events. */
|
|
444
310
|
noLogs?: boolean;
|
|
445
|
-
/** * Include safe details. */
|
|
446
|
-
withSafe?: boolean;
|
|
447
311
|
}>;
|
|
448
|
-
export type
|
|
312
|
+
export type GetTransactionSummaryQueryParamOpts = Nullable<{
|
|
449
313
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
450
314
|
quoteCurrency?: Quote;
|
|
451
|
-
/** *
|
|
452
|
-
|
|
453
|
-
/** * Include safe details. */
|
|
454
|
-
withSafe?: boolean;
|
|
315
|
+
/** * Include gas summary details. Additional charge of 1 credit when true. Response times may be impacted for wallets with millions of transactions. */
|
|
316
|
+
withGas?: boolean;
|
|
455
317
|
}>;
|
|
456
|
-
export type
|
|
318
|
+
export type InternalTransfer = Nullable<{
|
|
319
|
+
/** * The contract address sending the native token. */
|
|
320
|
+
from_address: string;
|
|
321
|
+
/** * The internal transfer recipient wallet address. */
|
|
322
|
+
to_address: string;
|
|
323
|
+
/** * The value of the internal transfer in wei. */
|
|
324
|
+
value: string;
|
|
325
|
+
/** * The gas available from the parent transaction or contract call. */
|
|
326
|
+
gas_limit: number;
|
|
327
|
+
}>;
|
|
328
|
+
export type StateChange = Nullable<{
|
|
329
|
+
/** * The address associated with the state change. */
|
|
330
|
+
address: string;
|
|
331
|
+
/** * The balance of the native token before the transaction in wei. */
|
|
332
|
+
balance_before: string;
|
|
333
|
+
/** * The balance of the native token after the transaction in wei. */
|
|
334
|
+
balance_after: string;
|
|
335
|
+
/** * List of before and after values in the storage address. */
|
|
336
|
+
storage_changes: StorageChange[];
|
|
337
|
+
/** * The transaction count for this address before the transaction. */
|
|
338
|
+
nonce_before: number;
|
|
339
|
+
/** * The transaction count for this address after the transaction. */
|
|
340
|
+
nonce_after: number;
|
|
341
|
+
}>;
|
|
342
|
+
export type StorageChange = Nullable<{
|
|
343
|
+
/** * The specific storage slot in the contract's storage space. */
|
|
344
|
+
storage_address: string;
|
|
345
|
+
/** * The hex value stored in the slot before the transaction. */
|
|
346
|
+
value_before: string;
|
|
347
|
+
/** * The hex value stored in the slot after the transaction. */
|
|
348
|
+
value_after: string;
|
|
349
|
+
}>;
|
|
350
|
+
export type InputData = Nullable<{
|
|
351
|
+
/** * The first 4 bytes of the invoked smart contract function signature. Used to identify the function being called in the contract. */
|
|
352
|
+
method_id: string;
|
|
353
|
+
}>;
|
|
354
|
+
export type GetEarliestTransactionsForAddressQueryParamOpts = Nullable<{
|
|
457
355
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
458
356
|
quoteCurrency?: Quote;
|
|
459
357
|
/** * Omit log events. */
|
|
460
358
|
noLogs?: boolean;
|
|
461
|
-
/** * Include safe details. */
|
|
462
|
-
withSafe?: boolean;
|
|
463
359
|
}>;
|
|
464
|
-
export type
|
|
465
|
-
/** * The
|
|
466
|
-
|
|
467
|
-
/** *
|
|
468
|
-
|
|
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[];
|
|
469
392
|
}>;
|