Skip to content

Commit ac710cb

Browse files
committed
minded events catch
1 parent ef8624b commit ac710cb

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/services/EventsParserService.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,44 @@ const subscribeForMinedCancelEvents = () => {
113113
}
114114

115115

116+
const subscribeForMinedWithdrawEvents = () => {
117+
log.debug("Subscribing for mined cancel events.");
118+
119+
const withdrawEvent = escrowContract.LogWithdraw();
120+
121+
withdrawEvent.watch(async (error, result) => {
122+
try {
123+
log.debug("Got mined withdraw event");
124+
console.log(result);
125+
126+
const event = {
127+
txStatus: 'success',
128+
txHash: result.transactionHash,
129+
eventName: 'withdraw',
130+
};
131+
const transferFilterParams = {
132+
senderAddress: result.args.sender,
133+
transitAddress: result.args.transitAddress
134+
};
135+
136+
await TransferService.addEvent({
137+
transferStatus: 'completed',
138+
event,
139+
transferFilterParams
140+
});
141+
142+
} catch(err) {
143+
log.debug(err);
144+
}
145+
});
146+
}
147+
148+
116149
const start = () => {
117150
subscribeForPendingEvents();
118151
subscribeForMinedDepositEvents();
119-
subscribeForMinedCancelEvents();
152+
subscribeForMinedCancelEvents();
153+
subscribeForMinedWithdrawEvents();
120154
}
121155

122156

0 commit comments

Comments
 (0)