Update device in storage only when we found a transaction
This commit is contained in:
parent
755828c495
commit
9f45b2c788
@ -209,16 +209,21 @@ export default class Services {
|
||||
|
||||
async parseNewTx(tx: string) {
|
||||
try {
|
||||
console.log('==============> sending txxxxxxx parser', tx)
|
||||
// console.log('==============> sending txxxxxxx parser', tx)
|
||||
const services = await Services.getInstance();
|
||||
const parsedTx = await services.sdkClient.parse_new_tx(tx, 0, 0.01)
|
||||
console.log("🚀 ~ Services ~ parseNewTx ~ parsedTx:", parsedTx)
|
||||
if(parsedTx) {
|
||||
await this.handleApiReturn(parsedTx)
|
||||
// await this.saveTxToDb(parsedTx)
|
||||
console.log("🚀 ~ Services ~ parseNewTx ~ parsedTx:", parsedTx)
|
||||
try {
|
||||
await this.handleApiReturn(parsedTx);
|
||||
const newDevice = await this.dumpDevice();
|
||||
await services.saveDevice(newDevice);
|
||||
} catch (e) {
|
||||
console.error("Failed to update device with new tx");
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
console.trace('Not our transaction');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,6 @@ class WebSocketClient {
|
||||
switch(parsedMessage.flag) {
|
||||
case 'NewTx':
|
||||
await services.parseNewTx(parsedMessage.content)
|
||||
let device = await services.dumpDevice()
|
||||
await services.saveDevice(device)
|
||||
break;
|
||||
case 'Cipher':
|
||||
await services.parseCipher(parsedMessage.content)
|
||||
|
Loading…
x
Reference in New Issue
Block a user