How to use the iroha-helpers/lib/txHelper.js.default.emptyTransaction 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
if(!Array.isArray(commandArgs)){
            commands = [commandArgs];
        }else{
            commands = commandArgs;
        }

        let privateKeys = commandOption.privateKeys;
        let creatorAccountId = commandOption.creatorAccountId;
        let quorum = commandOption.quorum;
        let txClient = commandOption.commandService;
        let timeoutLimit = commandOption.timeoutLimit;

        let txToSends = [];
        for (let i = 0; i < commands.length; i++) {
            let commandArg = commands[i];
            let tx = txHelper.addCommand(txHelper.emptyTransaction(), commandArg.fn, commandArg.args);
            let txToSend = txHelper.addMeta(tx,{
                creatorAccountId: creatorAccountId,
                quorum: quorum
            });
            txToSend = irohaUtil.signWithArrayOfKeys(txToSend, privateKeys);
            txToSends.push(txToSend);
        }

        let hashes = await sendTransactions(txToSends,txClient,timeoutLimit);// batch mode
        let results = await getTxStatus(hashes,txClient,timeoutLimit);
        return Promise.resolve(results);
    }
    catch(err) {
        logger.error(err);
        return Promise.reject('Failed to submit Iroha transaction');
    }