How to use the @hyperledger/caliper-core.TxStatus.prototype function in @hyperledger/caliper-core

To help you get started, we’ve selected a few @hyperledger/caliper-core 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
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);
github hyperledger / caliper / packages / caliper-sawtooth / lib / sawtooth.js View on Github external
}
            //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;
        }
    }