Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fs = require('fs');
const grpc = require('grpc');
const IrohaService_v1Client = require('iroha-helpers/lib/proto/endpoint_grpc_pb');
const CommandService_v1Client = IrohaService_v1Client.CommandService_v1Client;
const QueryService_v1Client = IrohaService_v1Client.QueryService_v1Client;
const generateKeypair = require('iroha-helpers/lib/cryptoHelper.js').default;
const {BlockchainInterface, CaliperUtils, TxStatus} = require('@hyperledger/caliper-core');
const logger = CaliperUtils.getLogger('iroha.js');
const irohaQueries = require('iroha-helpers/lib/queries').default;
const irohaUtil = require('iroha-helpers/lib/util.js');
const txHelper = require('iroha-helpers/lib/txHelper.js').default;
const TxStatusLib = require('iroha-helpers/lib/proto/endpoint_pb.js').TxStatus;
const TxStatusRequest = require('iroha-helpers/lib/proto/endpoint_pb.js').TxStatusRequest;
/**
* Create Iroha transactions and send them to a node.
* @param {Array} txs txToSends
* @param {Object} txClient - transaction client
* @param {timeoutLimit} timeoutLimit timeout
* @returns {Array} hashes
*/
async function sendTransactions(txs, txClient, timeoutLimit){
try{
const hashes = txs.map(x => txHelper.hash(x));
const txList = txHelper.createTxListFromArray(txs);
let p = new Promise((resolve, reject) => {