@covalenthq/client-sdk 0.2.6 → 0.2.8
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 +11 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/services/BalanceService.js.map +1 -1
- package/dist/services/BaseService.d.ts +26 -2
- package/dist/services/BaseService.js +75 -1
- package/dist/services/BaseService.js.map +1 -1
- package/dist/services/Client.d.ts +2 -2
- package/dist/services/Client.js +1 -1
- package/dist/services/NftService.d.ts +11 -11
- package/dist/services/NftService.js +7 -7
- package/dist/services/NftService.js.map +1 -1
- package/dist/services/TransactionService.d.ts +197 -0
- package/dist/services/TransactionService.js +123 -0
- package/dist/services/TransactionService.js.map +1 -1
- package/dist/services/XykService.d.ts +126 -29
- package/dist/services/XykService.js +186 -17
- package/dist/services/XykService.js.map +1 -1
- package/dist/util/types/BalanceServiceTypes.d.ts +259 -0
- package/dist/util/types/BalanceServiceTypes.js +3 -0
- package/dist/util/types/BalanceServiceTypes.js.map +1 -0
- package/dist/util/types/BaseServiceTypes.d.ts +172 -0
- package/dist/util/types/BaseServiceTypes.js +3 -0
- package/dist/util/types/BaseServiceTypes.js.map +1 -0
- package/dist/util/types/GenericTypes.d.ts +75 -0
- package/dist/util/types/GenericTypes.js +3 -0
- package/dist/util/types/GenericTypes.js.map +1 -0
- package/dist/util/types/NftServiceTypes.d.ts +213 -0
- package/dist/util/types/NftServiceTypes.js +3 -0
- package/dist/util/types/NftServiceTypes.js.map +1 -0
- package/dist/util/types/PricingServiceTypes.d.ts +44 -0
- package/dist/util/types/PricingServiceTypes.js +3 -0
- package/dist/util/types/PricingServiceTypes.js.map +1 -0
- package/dist/util/types/SecurityServiceTypes.d.ts +70 -0
- package/dist/util/types/SecurityServiceTypes.js +3 -0
- package/dist/util/types/SecurityServiceTypes.js.map +1 -0
- package/dist/util/types/TransactionServiceTypes.d.ts +314 -0
- package/dist/util/types/TransactionServiceTypes.js +3 -0
- package/dist/util/types/TransactionServiceTypes.js.map +1 -0
- package/dist/util/types/XykServiceTypes.d.ts +465 -0
- package/dist/util/types/XykServiceTypes.js +3 -0
- package/dist/util/types/XykServiceTypes.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { LogEvent } from "./GenericTypes";
|
|
2
|
+
export interface TransactionResponse {
|
|
3
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
4
|
+
updated_at: Date;
|
|
5
|
+
/** * The requested chain ID eg: `1`. */
|
|
6
|
+
chain_id: number;
|
|
7
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
8
|
+
chain_name: string;
|
|
9
|
+
/** * List of response items. */
|
|
10
|
+
items: Transaction[];
|
|
11
|
+
}
|
|
12
|
+
export interface Transaction {
|
|
13
|
+
/** * The block signed timestamp in UTC. */
|
|
14
|
+
block_signed_at: Date;
|
|
15
|
+
/** * The height of the block. */
|
|
16
|
+
block_height: number;
|
|
17
|
+
/** * The requested transaction hash. */
|
|
18
|
+
tx_hash: string;
|
|
19
|
+
/** * The offset is the position of the tx in the block. */
|
|
20
|
+
tx_offset: number;
|
|
21
|
+
/** * Indicates whether a transaction failed or succeeded. */
|
|
22
|
+
successful: boolean;
|
|
23
|
+
from_address: string;
|
|
24
|
+
from_address_label: string;
|
|
25
|
+
to_address: string;
|
|
26
|
+
to_address_label: string;
|
|
27
|
+
/** * The value attached to this tx. */
|
|
28
|
+
value: bigint | null;
|
|
29
|
+
/** * The value attached in `quote-currency` to this tx. */
|
|
30
|
+
value_quote: number;
|
|
31
|
+
/** * A prettier version of the quote for rendering purposes. */
|
|
32
|
+
pretty_value_quote: string;
|
|
33
|
+
/** * The requested chain native gas token metadata. */
|
|
34
|
+
gas_metadata: ContractMetadata;
|
|
35
|
+
gas_offered: string;
|
|
36
|
+
gas_spent: string;
|
|
37
|
+
gas_price: string;
|
|
38
|
+
/** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */
|
|
39
|
+
fees_paid: bigint | null;
|
|
40
|
+
/** * The gas spent in `quote-currency` denomination. */
|
|
41
|
+
gas_quote: number;
|
|
42
|
+
/** * A prettier version of the quote for rendering purposes. */
|
|
43
|
+
pretty_gas_quote: string;
|
|
44
|
+
/** * The native gas exchange rate for the requested `quote-currency`. */
|
|
45
|
+
gas_quote_rate: number;
|
|
46
|
+
/** * The details for the dex transaction. */
|
|
47
|
+
dex_details: DexReport;
|
|
48
|
+
/** * The details for the NFT sale transaction. */
|
|
49
|
+
nft_sale_details: NftSalesReport;
|
|
50
|
+
/** * The details for the lending protocol transaction. */
|
|
51
|
+
lending_details: LendingReport;
|
|
52
|
+
log_events: LogEvent[];
|
|
53
|
+
}
|
|
54
|
+
export interface ContractMetadata {
|
|
55
|
+
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
56
|
+
contract_decimals: number;
|
|
57
|
+
/** * The string returned by the `name()` method. */
|
|
58
|
+
contract_name: string;
|
|
59
|
+
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
|
|
60
|
+
contract_ticker_symbol: string;
|
|
61
|
+
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
|
|
62
|
+
contract_address: string;
|
|
63
|
+
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
|
|
64
|
+
supports_erc: string;
|
|
65
|
+
/** * The contract logo URL. */
|
|
66
|
+
logo_url: string;
|
|
67
|
+
}
|
|
68
|
+
export interface DexReport {
|
|
69
|
+
log_offset: number;
|
|
70
|
+
/** * Stores the name of the protocol that facilitated the event. */
|
|
71
|
+
protocol_name: string;
|
|
72
|
+
/** * Stores the contract address of the protocol that facilitated the event. */
|
|
73
|
+
protocol_address: string;
|
|
74
|
+
/** * Stores the URL of the logo for the protocol that facilitated the event. */
|
|
75
|
+
protocol_logo_url: string;
|
|
76
|
+
/** * Stores the aggregator responsible for the event. */
|
|
77
|
+
aggregator_name: string;
|
|
78
|
+
/** * Stores the contract address of the aggregator responsible for the event. */
|
|
79
|
+
aggregator_address: string;
|
|
80
|
+
/** * 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. */
|
|
81
|
+
version: number;
|
|
82
|
+
/** * 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` */
|
|
83
|
+
fork_version: number;
|
|
84
|
+
/** * Many DEXs are a fork of an already established DEX. The fork field allows you to see which DEX has been forked. */
|
|
85
|
+
fork: string;
|
|
86
|
+
/** * Stores the event taking place - e.g `swap`, `add_liquidity` and `remove_liquidity`. */
|
|
87
|
+
event: string;
|
|
88
|
+
/** * Stores the address of the pair that the user interacts with. */
|
|
89
|
+
pair_address: string;
|
|
90
|
+
pair_lp_fee_bps: number;
|
|
91
|
+
lp_token_address: string;
|
|
92
|
+
lp_token_ticker: string;
|
|
93
|
+
lp_token_num_decimals: number;
|
|
94
|
+
lp_token_name: string;
|
|
95
|
+
lp_token_value: number;
|
|
96
|
+
exchange_rate_usd: number;
|
|
97
|
+
/** * Stores the address of token 0 in the specific pair. */
|
|
98
|
+
token_0_address: string;
|
|
99
|
+
/** * Stores the ticker symbol of token 0 in the specific pair. */
|
|
100
|
+
token_0_ticker: string;
|
|
101
|
+
/** * Stores the number of contract decimals of token 0 in the specific pair. */
|
|
102
|
+
token_0_num_decimals: number;
|
|
103
|
+
/** * Stores the contract name of token 0 in the specific pair. */
|
|
104
|
+
token_0_name: string;
|
|
105
|
+
/** * Stores the address of token 1 in the specific pair. */
|
|
106
|
+
token_1_address: string;
|
|
107
|
+
/** * Stores the ticker symbol of token 1 in the specific pair. */
|
|
108
|
+
token_1_ticker: string;
|
|
109
|
+
/** * Stores the number of contract decimals of token 1 in the specific pair. */
|
|
110
|
+
token_1_num_decimals: number;
|
|
111
|
+
/** * Stores the contract name of token 1 in the specific pair. */
|
|
112
|
+
token_1_name: string;
|
|
113
|
+
/** * Stores the amount of token 0 used in the transaction. For example, 1 ETH, 100 USDC, 30 UNI, etc. */
|
|
114
|
+
token_0_amount: number;
|
|
115
|
+
token_0_quote_rate: number;
|
|
116
|
+
token_0_usd_quote: number;
|
|
117
|
+
pretty_token_0_usd_quote: string;
|
|
118
|
+
token_0_logo_url: string;
|
|
119
|
+
/** * Stores the amount of token 1 used in the transaction. For example, 1 ETH, 100 USDC, 30 UNI, etc. */
|
|
120
|
+
token_1_amount: number;
|
|
121
|
+
token_1_quote_rate: number;
|
|
122
|
+
token_1_usd_quote: number;
|
|
123
|
+
pretty_token_1_usd_quote: string;
|
|
124
|
+
token_1_logo_url: string;
|
|
125
|
+
/** * Stores the wallet address that initiated the transaction (i.e the wallet paying the gas fee). */
|
|
126
|
+
sender: string;
|
|
127
|
+
/** * 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. */
|
|
128
|
+
recipient: string;
|
|
129
|
+
}
|
|
130
|
+
export interface NftSalesReport {
|
|
131
|
+
log_offset: number;
|
|
132
|
+
/** * Stores the topic event hash. All events have a unique topic event hash. */
|
|
133
|
+
topic0: string;
|
|
134
|
+
/** * Stores the contract address of the protocol that facilitated the event. */
|
|
135
|
+
protocol_contract_address: string;
|
|
136
|
+
/** * Stores the name of the protocol that facilitated the event. */
|
|
137
|
+
protocol_name: string;
|
|
138
|
+
/** * Stores the URL of the logo for the protocol that facilitated the event. */
|
|
139
|
+
protocol_logo_url: string;
|
|
140
|
+
/** * Stores the address of the transaction recipient. */
|
|
141
|
+
to: string;
|
|
142
|
+
/** * Stores the address of the transaction sender. */
|
|
143
|
+
from: string;
|
|
144
|
+
/** * Stores the address selling the NFT. */
|
|
145
|
+
maker: string;
|
|
146
|
+
/** * Stores the address buying the NFT. */
|
|
147
|
+
taker: string;
|
|
148
|
+
/** * Stores the NFTs token ID. All NFTs have a token ID. Within a collection, these token IDs are unique. If the NFT is transferred to another owner, the token id remains the same, as this number is its identifier within a collection. For example, if a collection has 10K NFTs then an NFT in that collection can have a token ID from 1-10K. */
|
|
149
|
+
token_id: number;
|
|
150
|
+
/** * Stores the address of the collection. For example, [Bored Ape Yacht Club](https://etherscan.io/token/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d) */
|
|
151
|
+
collection_address: string;
|
|
152
|
+
/** * Stores the name of the collection. */
|
|
153
|
+
collection_name: string;
|
|
154
|
+
/** * Stores the address of the token used to purchase the NFT. */
|
|
155
|
+
token_address: string;
|
|
156
|
+
/** * Stores the name of the token used to purchase the NFT. */
|
|
157
|
+
token_name: string;
|
|
158
|
+
/** * Stores the ticker symbol of the token used to purchase the NFT. */
|
|
159
|
+
ticker_symbol: string;
|
|
160
|
+
/** * Stores the number decimal of the token used to purchase the NFT. */
|
|
161
|
+
num_decimals: number;
|
|
162
|
+
contract_quote_rate: number;
|
|
163
|
+
/** * The token amount used to purchase the NFT. For example, if the user purchased an NFT for 1 ETH. The `nft_token_price` field will hold `1`. */
|
|
164
|
+
nft_token_price: number;
|
|
165
|
+
/** * The USD amount used to purchase the NFT. */
|
|
166
|
+
nft_token_price_usd: number;
|
|
167
|
+
pretty_nft_token_price_usd: string;
|
|
168
|
+
/** * The price of the NFT denominated in the chains native token. Even if a seller sells their NFT for DAI or MANA, this field denominates the price in the native token (e.g. ETH, AVAX, FTM, etc.) */
|
|
169
|
+
nft_token_price_native: number;
|
|
170
|
+
pretty_nft_token_price_native: string;
|
|
171
|
+
/** * Stores the number of NFTs involved in the sale. It's quick routine to see multiple NFTs involved in a single sale. */
|
|
172
|
+
token_count: number;
|
|
173
|
+
num_token_ids_sold_per_sale: number;
|
|
174
|
+
num_token_ids_sold_per_tx: number;
|
|
175
|
+
num_collections_sold_per_sale: number;
|
|
176
|
+
num_collections_sold_per_tx: number;
|
|
177
|
+
trade_type: string;
|
|
178
|
+
trade_group_type: string;
|
|
179
|
+
}
|
|
180
|
+
export interface LendingReport {
|
|
181
|
+
log_offset: number;
|
|
182
|
+
/** * Stores the name of the lending protocol that facilitated the event. */
|
|
183
|
+
protocol_name: string;
|
|
184
|
+
/** * Stores the contract address of the lending protocol that facilitated the event. */
|
|
185
|
+
protocol_address: string;
|
|
186
|
+
/** * Stores the logo URL of the lending protocol that facilitated the event. */
|
|
187
|
+
protocol_logo_url: string;
|
|
188
|
+
/** * 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. */
|
|
189
|
+
version: string;
|
|
190
|
+
/** * Many lending protocols are a fork of an already established protocol. The fork column allows you to see which lending protocol has been forked. */
|
|
191
|
+
fork: string;
|
|
192
|
+
/** * 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` */
|
|
193
|
+
fork_version: string;
|
|
194
|
+
/** * Stores the event taking place - e.g `borrow`, `deposit`, `liquidation`, 'repay' and 'withdraw'. */
|
|
195
|
+
event: string;
|
|
196
|
+
/** * Stores the name of the LP token issued by the lending protocol. LP tokens can be debt or interest bearing tokens. */
|
|
197
|
+
lp_token_name: string;
|
|
198
|
+
/** * Stores the number decimal of the LP token. */
|
|
199
|
+
lp_decimals: number;
|
|
200
|
+
/** * Stores the ticker symbol of the LP token. */
|
|
201
|
+
lp_ticker_symbol: string;
|
|
202
|
+
/** * Stores the token address of the LP token. */
|
|
203
|
+
lp_token_address: string;
|
|
204
|
+
/** * Stores the amount of LP token used in the event (e.g. 1 aETH, 100 cUSDC, etc). */
|
|
205
|
+
lp_token_amount: number;
|
|
206
|
+
/** * Stores the total USD amount of all the LP Token used in the event. */
|
|
207
|
+
lp_token_price: number;
|
|
208
|
+
/** * Stores the exchange rate between the LP and underlying token. */
|
|
209
|
+
exchange_rate: number;
|
|
210
|
+
/** * Stores the USD price of the LP Token used in the event. */
|
|
211
|
+
exchange_rate_usd: number;
|
|
212
|
+
/** * Stores the name of the token going into the lending protocol (e.g the token getting deposited). */
|
|
213
|
+
token_name_in: string;
|
|
214
|
+
/** * Stores the number decimal of the token going into the lending protocol. */
|
|
215
|
+
token_decimal_in: number;
|
|
216
|
+
/** * Stores the address of the token going into the lending protocol. */
|
|
217
|
+
token_address_in: string;
|
|
218
|
+
/** * Stores the ticker symbol of the token going into the lending protocol. */
|
|
219
|
+
token_ticker_in: string;
|
|
220
|
+
/** * Stores the logo URL of the token going into the lending protocol. */
|
|
221
|
+
token_logo_in: string;
|
|
222
|
+
/** * Stores the amount of tokens going into the lending protocol (e.g 1 ETH, 100 USDC, etc). */
|
|
223
|
+
token_amount_in: number;
|
|
224
|
+
/** * Stores the total USD amount of all tokens going into the lending protocol. */
|
|
225
|
+
amount_in_usd: number;
|
|
226
|
+
pretty_amount_in_usd: string;
|
|
227
|
+
/** * Stores the name of the token going out of the lending protocol (e.g the token getting deposited). */
|
|
228
|
+
token_name_out: string;
|
|
229
|
+
/** * Stores the number decimal of the token going out of the lending protocol. */
|
|
230
|
+
token_decimals_out: number;
|
|
231
|
+
/** * Stores the address of the token going out of the lending protocol. */
|
|
232
|
+
token_address_out: string;
|
|
233
|
+
/** * Stores the ticker symbol of the token going out of the lending protocol. */
|
|
234
|
+
token_ticker_out: string;
|
|
235
|
+
/** * Stores the logo URL of the token going out of the lending protocol. */
|
|
236
|
+
token_logo_out: string;
|
|
237
|
+
/** * Stores the amount of tokens going out of the lending protocol (e.g 1 ETH, 100 USDC, etc). */
|
|
238
|
+
token_amount_out: number;
|
|
239
|
+
/** * Stores the total USD amount of all tokens going out of the lending protocol. */
|
|
240
|
+
amount_out_usd: number;
|
|
241
|
+
pretty_amount_out_usd: string;
|
|
242
|
+
/** * 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. */
|
|
243
|
+
borrow_rate_mode: number;
|
|
244
|
+
/** * Stores the interest rate of the loan. Only relevant to borrow events. */
|
|
245
|
+
borrow_rate: number;
|
|
246
|
+
on_behalf_of: string;
|
|
247
|
+
/** * Stores the wallet address liquidating the loan. Only relevant to liquidation events. */
|
|
248
|
+
liquidator: string;
|
|
249
|
+
/** * Stores the wallet address of the user initiating the event. */
|
|
250
|
+
user: string;
|
|
251
|
+
}
|
|
252
|
+
export interface RecentTransactionsResponse {
|
|
253
|
+
/** * The requested address. */
|
|
254
|
+
address: string;
|
|
255
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
256
|
+
updated_at: Date;
|
|
257
|
+
/** * DEPRECATED */
|
|
258
|
+
next_update_at: Date;
|
|
259
|
+
/** * The requested quote currency eg: `USD`. */
|
|
260
|
+
quote_currency: string;
|
|
261
|
+
/** * The requested chain ID eg: `1`. */
|
|
262
|
+
chain_id: number;
|
|
263
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
264
|
+
chain_name: string;
|
|
265
|
+
/** * The current page of the response. */
|
|
266
|
+
current_page: number;
|
|
267
|
+
links: PaginationLinks;
|
|
268
|
+
/** * List of response items. */
|
|
269
|
+
items: Transaction[];
|
|
270
|
+
}
|
|
271
|
+
export interface PaginationLinks {
|
|
272
|
+
/** * URL link to the next page. */
|
|
273
|
+
prev: string;
|
|
274
|
+
/** * URL link to the previous page. */
|
|
275
|
+
next: string;
|
|
276
|
+
}
|
|
277
|
+
export interface TransactionsBlockResponse {
|
|
278
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
279
|
+
updated_at: Date;
|
|
280
|
+
/** * The requested chain ID eg: `1`. */
|
|
281
|
+
chain_id: number;
|
|
282
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
283
|
+
chain_name: string;
|
|
284
|
+
/** * List of response items. */
|
|
285
|
+
items: Transaction[];
|
|
286
|
+
}
|
|
287
|
+
export interface TransactionsSummaryResponse {
|
|
288
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
289
|
+
updated_at: Date;
|
|
290
|
+
/** * The requested address. */
|
|
291
|
+
address: string;
|
|
292
|
+
/** * The requested chain ID eg: `1`. */
|
|
293
|
+
chain_id: number;
|
|
294
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
295
|
+
chain_name: string;
|
|
296
|
+
/** * List of response items. */
|
|
297
|
+
items: TransactionsSummary[];
|
|
298
|
+
}
|
|
299
|
+
export interface TransactionsSummary {
|
|
300
|
+
/** * The total number of transactions. */
|
|
301
|
+
total_count: number;
|
|
302
|
+
/** * The earliest transaction detected. */
|
|
303
|
+
earliest_transaction: TransactionSummary;
|
|
304
|
+
/** * The latest transaction detected. */
|
|
305
|
+
latest_transaction: TransactionSummary;
|
|
306
|
+
}
|
|
307
|
+
export interface TransactionSummary {
|
|
308
|
+
/** * The block signed timestamp in UTC. */
|
|
309
|
+
block_signed_at: Date;
|
|
310
|
+
/** * The requested transaction hash. */
|
|
311
|
+
tx_hash: string;
|
|
312
|
+
/** * The link to the transaction details using the Covalent API. */
|
|
313
|
+
tx_detail_link: string;
|
|
314
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionServiceTypes.js","sourceRoot":"","sources":["../../../src/util/types/TransactionServiceTypes.ts"],"names":[],"mappings":""}
|