@@ -9,6 +9,7 @@ import axios from "axios";
9
9
import { PublishedEvent } from "typebridge" ;
10
10
import { FetchAccountTxsEvent } from "../lib/events" ;
11
11
import { getFromEnv } from "../lib/cdk-stack" ;
12
+ import { print } from "util" ;
12
13
13
14
const envs = [ "mainnet" , "goerli" , "goerli-2" ] ;
14
15
const ddb = new DynamoDBClient ( { } ) ;
@@ -36,6 +37,9 @@ async function checkIfTxStatusChanged(env: string, event: Event) {
36
37
continue ;
37
38
}
38
39
const previousItem = await getPreviousItem ( item . hash ) ;
40
+ console . log ( `Previous item: ${ JSON . stringify ( previousItem , null , 2 ) } ` ) ;
41
+ console . log ( `Previous item status -${ previousItem ?. status } -` ) ;
42
+ console . log ( `Item status -${ item ?. status } -` ) ;
39
43
if ( previousItem === null || previousItem . status !== item . status ) {
40
44
console . log ( `Transaction status changed to ${ item . status } ` ) ;
41
45
await setTransactionStatus ( item ) ;
@@ -47,8 +51,11 @@ async function checkIfTxStatusChanged(env: string, event: Event) {
47
51
async function getPreviousItem ( hash : string ) : Promise < Item | null > {
48
52
const params = {
49
53
TableName : process . env . TX_STATUSES_TABLE ,
50
- Key : { transactionHash : { S : hash } } ,
54
+ Key : { hash : { S : hash } } ,
51
55
} ;
56
+ console . log (
57
+ `Calling previous items with command: ${ JSON . stringify ( params , null , 2 ) } `
58
+ ) ;
52
59
53
60
const res = await ddb . send ( new GetItemCommand ( params ) ) ;
54
61
if ( res . Item == null ) {
@@ -63,8 +70,8 @@ async function setTransactionStatus(item: Item) {
63
70
const params = {
64
71
TableName : process . env . TX_STATUSES_TABLE ,
65
72
Item : {
66
- transactionHash : { S : item . hash } ,
67
- transactionStatus : { S : item . status } ,
73
+ hash : { S : item . hash } ,
74
+ status : { S : item . status } ,
68
75
} ,
69
76
} ;
70
77
0 commit comments