File tree 2 files changed +17
-11
lines changed
2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -26,19 +26,11 @@ const handleDecode = async (
26
26
"x-covalent-api-key"
27
27
] ;
28
28
const { network, tx_hash } = req . body as DecodeTXRequest ;
29
- const tx = await fetchTxDataFromHash (
29
+ const { log_events , metadata } = await fetchTxDataFromHash (
30
30
network as Chain ,
31
31
tx_hash ,
32
32
covalentApiKey
33
33
) ;
34
- const {
35
- dex_details,
36
- nft_sale_details,
37
- lending_details,
38
- safe_details,
39
- log_events,
40
- ...metadata
41
- } = tx ;
42
34
const events = await fetchEventsFromLogs (
43
35
network as Chain ,
44
36
log_events ,
Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ export const fetchTxDataFromHash = async (
10
10
network : Chain ,
11
11
tx_hash : string ,
12
12
covalentApiKey : string
13
- ) => {
13
+ ) : Promise < {
14
+ log_events : LogEvent [ ] ;
15
+ metadata : TransactionMetadata ;
16
+ } > => {
14
17
const covalentClient = new CovalentClient ( covalentApiKey ) ;
15
18
const { data, error_code, error_message } =
16
19
await covalentClient . TransactionService . getTransaction (
@@ -27,7 +30,18 @@ export const fetchTxDataFromHash = async (
27
30
) ;
28
31
const tx = data ?. items ?. [ 0 ] ;
29
32
if ( tx ) {
30
- return tx ;
33
+ const {
34
+ log_events,
35
+ dex_details,
36
+ nft_sale_details,
37
+ lending_details,
38
+ safe_details,
39
+ ...metadata
40
+ } = tx ;
41
+ return {
42
+ log_events : log_events ,
43
+ metadata : metadata ,
44
+ } ;
31
45
} else {
32
46
throw {
33
47
errorCode : error_code ,
You can’t perform that action at this time.
0 commit comments