How to use the iroha-helpers/lib/proto/endpoint_pb.js.TxStatusRequest function in iroha-helpers

To help you get started, we’ve selected a few iroha-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / caliper / packages / caliper-iroha / lib / iroha.js View on Github external
let requests = hashes.map(hash => new Promise((resolve, reject) =>{
            let statuses = [];
            let request = new TxStatusRequest();
            request.setTxHash(hash.toString('hex'));
            let timer = setTimeout(()=>{
                txClient.$channel.close();
                reject(new Error('Query txStatus timeout'));
            }, timeoutLimit);

            let stream = txClient.statusStream(request);
            stream.on('data', function (response){
                statuses.push(response);
            });
            stream.on('end', function (end){
                clearTimeout(timer);
                statuses.length > 0? resolve(statuses[statuses.length - 1].getTxStatus()) : resolve(null);
            });
        }));
        let values = await Promise.all(requests);