@@ -40,51 +40,78 @@ export class EventMonitor extends EventEmitter {
4040 ( item ) => item . type === "event" && item . name === "OrderPlaced" ,
4141 )
4242
43- const unwatch = client . watchEvent ( {
44- address : addresses . IntentGateway [ `EVM-${ chainId } ` as keyof typeof addresses . IntentGateway ] ,
45- event : orderPlacedEvent ,
46- onLogs : ( logs ) => {
47- for ( const log of logs ) {
48- try {
49- const decodedLog = log as unknown as DecodedOrderPlacedLog
50- const tempOrder : Order = {
51- id : "" ,
52- user : decodedLog . args . user ,
53- sourceChain : hexToString ( decodedLog . args . sourceChain ) ,
54- destChain : hexToString ( decodedLog . args . destChain ) ,
55- deadline : decodedLog . args . deadline ,
56- nonce : decodedLog . args . nonce ,
57- fees : decodedLog . args . fees ,
58- outputs : decodedLog . args . outputs . map ( ( output ) => ( {
59- token : output . token ,
60- amount : output . amount ,
61- beneficiary : output . beneficiary ,
62- } ) ) ,
63- inputs : decodedLog . args . inputs . map ( ( input ) => ( {
64- token : input . token ,
65- amount : input . amount ,
66- } ) ) ,
67- callData : decodedLog . args . callData ,
68- transactionHash : decodedLog . transactionHash ,
69- }
43+ // const unwatch = client.watchEvent({
44+ // address: addresses.IntentGateway[`EVM-${chainId}` as keyof typeof addresses.IntentGateway],
45+ // event: orderPlacedEvent,
46+ // onLogs: (logs) => {
47+ // for (const log of logs) {
48+ // try {
49+ // const decodedLog = log as unknown as DecodedOrderPlacedLog
50+ // const tempOrder: Order = {
51+ // id: "",
52+ // user: decodedLog.args.user,
53+ // sourceChain: hexToString(decodedLog.args.sourceChain),
54+ // destChain: hexToString(decodedLog.args.destChain),
55+ // deadline: decodedLog.args.deadline,
56+ // nonce: decodedLog.args.nonce,
57+ // fees: decodedLog.args.fees,
58+ // outputs: decodedLog.args.outputs.map((output) => ({
59+ // token: output.token,
60+ // amount: output.amount,
61+ // beneficiary: output.beneficiary,
62+ // })),
63+ // inputs: decodedLog.args.inputs.map((input) => ({
64+ // token: input.token,
65+ // amount: input.amount,
66+ // })),
67+ // callData: decodedLog.args.callData,
68+ // transactionHash: decodedLog.transactionHash,
69+ // }
7070
71- const orderId = orderCommitment ( tempOrder )
71+ // const orderId = orderCommitment(tempOrder)
7272
73- const order : Order = {
74- ...tempOrder ,
75- id : orderId ,
76- }
73+ // const order: Order = {
74+ // ...tempOrder,
75+ // id: orderId,
76+ // }
7777
78- this . emit ( "newOrder" , { order } )
79- } catch ( error ) {
80- console . error ( `Error parsing event log:` , error )
81- }
82- }
83- } ,
84- poll : true ,
85- pollingInterval : 1000 ,
86- } )
87- this . unwatchFunctions . set ( chainId , unwatch )
78+ // this.emit("newOrder", { order })
79+ // } catch (error) {
80+ // console.error(`Error parsing event log:`, error)
81+ // }
82+ // }
83+ // },
84+ // poll: true,
85+ // pollingInterval: 1000,
86+ // })
87+ // this.unwatchFunctions.set(chainId, unwatch)
88+
89+ const order = {
90+ id : "0xd976bb099b04d449b6acca29d0df1cf7cb77207c5a824f596bb50170dad2700d" ,
91+ user : "0x000000000000000000000000ea4f68301acec0dc9bbe10f15730c59fb79d237e" ,
92+ sourceChain : "EVM-10200" ,
93+ destChain : "EVM-97" ,
94+ deadline : 6533729700n ,
95+ nonce : 1n ,
96+ fees : 1000000n ,
97+ outputs : [
98+ {
99+ token : "0x000000000000000000000000c043f483373072f7f27420d6e7d7ad269c018e18" ,
100+ amount : 1000000n ,
101+ beneficiary : "0x000000000000000000000000ea4f68301acec0dc9bbe10f15730c59fb79d237e" ,
102+ } ,
103+ ] ,
104+ inputs : [
105+ {
106+ token : "0x0000000000000000000000000000000000000000000000000000000000000000" ,
107+ amount : 100n ,
108+ } ,
109+ ] ,
110+ callData : "0x" ,
111+ transactionHash : "0x137b3677d8b2761e52d73be580979774852ab629b30ec51c494f25dac710651c" ,
112+ }
113+
114+ this . emit ( "newOrder" , { order } )
88115
89116 console . log ( `Started watching for OrderPlaced events on chain ${ chainId } ` )
90117 } catch ( error ) {
0 commit comments