scripts/caliper-workspace/node_modules/fabric-network/lib/transaction.js
/**
     * Evaluate a transaction function and return its results.
     * The transaction function will be evaluated on the endorsing peers but
     * the responses will not be sent to the ordering service and hence will
     * not be committed to the ledger.
     * This is used for querying the world state.
     * @async
     * @param {...string} [args] Transaction function arguments.
     * @returns {Buffer} Payload response from the transaction function.
     */
Evaluate a transaction function and return its results.
The transaction function will be evaluated on the endorsing peers but
the responses will not be sent to the ordering service and hence will
not be committed to the ledger.
This is used for querying the world state.
@async
@param {...string} [args] Transaction function arguments.
@returns {Buffer} Payload response from the transaction function.
Evaluate a transaction function and return its results . The transaction function will be evaluated on the endorsing peers but the responses will not be sent to the ordering service and hence will not be committed to the ledger . This is used for querying the world state . @async @param { ... string } [ args ] Transaction function arguments . @returns { Buffer } Payload response from the transaction function .
async evaluate(...args) {
        const method = `evaluate[${this._name}]`;
        logger.debug('%s - start', method);
        const queryOptions = this._options.queryHandlerOptions;
        const request = this._buildEndorsementOptions(args);
        if (Number.isInteger(queryOptions.timeout)) {
            request.requestTimeout = queryOptions.timeout * 1000; 
        }
        const queryProposal = this.contract.network.channel.newQuery(this.contract.chaincodeId);
        logger.debug('%s - build and sign the query', method);
        queryProposal.build(this.identityContext, request);
        this._transactionId = queryProposal.getTransactionId();
        queryProposal.sign(this.identityContext);
        const query = new Query(queryProposal, queryOptions);
        logger.debug('%s - handler will send', method);
        const results = await this.queryHandler.evaluate(query);
        logger.debug('%s - queryHandler completed %j', method, results);
        return results;
    }
async evaluate ( ... args ) { const method = ` ${ this . _name } ` ; logger . debug ( '%s - start' , method ) ; const queryOptions = this . _options . queryHandlerOptions ; const request = this . _buildEndorsementOptions ( args ) ; if ( Number . isInteger ( queryOptions . timeout ) ) { request . requestTimeout = queryOptions . timeout * 1000 ; } const queryProposal = this . contract . network . channel . newQuery ( this . contract . chaincodeId ) ; logger . debug ( '%s - build and sign the query' , method ) ; queryProposal . build ( this . identityContext , request ) ; this . _transactionId = queryProposal . getTransactionId ( ) ; queryProposal . sign ( this . identityContext ) ; const query = new Query ( queryProposal , queryOptions ) ; logger . debug ( '%s - handler will send' , method ) ; const results = await this . queryHandler . evaluate ( query ) ; logger . debug ( '%s - queryHandler completed %j' , method , results ) ; return results ; }
Evaluate a transaction function and return its results.
Evaluate a transaction function and return its results .
// in ms; // get the transaction ID generated by the endorsement build