Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
results.forEach(item => {
let cloned = Object.assign({}, status);
Object.setPrototypeOf(cloned,TxStatus.prototype);
if(item === 'COMMITTED'){
cloned.SetStatusSuccess();
}else{
cloned.SetStatusFail();
}
txStatuses.push(cloned);
});
return Promise.resolve(txStatuses);
}
//Get the next block number and status of block to pending
if(currentBlockNum === 0) {
await getCurrentBlockId().then(block_num => {
currentBlockNum = block_num+1;
});
}
else {
currentBlockNum = currentBlockNum +1;
}
let batchStats = await submitBatches(currentBlockNum, batchBytes, timeout * 1000);
let txStats = [];
for(let i = 0 ; i < args.length ; i++) {
let cloned = Object.assign({}, batchStats);
Object.setPrototypeOf(cloned, TxStatus.prototype);
txStats.push(cloned);
}
return txStats;
} catch (err) {
logger.error('invokeSmartContract failed, ' + err);
let txStats = [];
for(let i = 0 ; i < args.length ; i++) {
let txStatus = new TxStatus(0);
txStatus.SetStatusFail();
txStats.push(txStatus);
}
return txStats;
}
}