Skip to content

Commit e8f20a0

Browse files
committed
feat: add getMultipleStates method to ChaincodeStub class
1 parent 96d934e commit e8f20a0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

libraries/fabric-shim/lib/stub.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,19 @@ class ChaincodeStub {
477477
return await this.handler.handleGetState(collection, key, this.channel_id, this.txId);
478478
}
479479

480+
/**
481+
* Retrieves the current values of the state variables for the given keys
482+
* @async
483+
* @param {...string} keys State variable keys to retrieve from the state store
484+
* @returns {Promise<byte[][]>} Promise for the array of current values of the given keys
485+
*/
486+
async getMultipleStates(...keys) {
487+
logger.debug('getMultipleStates called with keys:%o', keys);
488+
// Access public data by setting the collection to empty string
489+
const collection = '';
490+
return await this.handler.handleGetMultipleStates(collection, keys, this.channel_id, this.txId);
491+
}
492+
480493
/**
481494
* Writes the state variable <code>key</code> of value <code>value</code>
482495
* to the state store. If the variable already exists, the value will be

0 commit comments

Comments
 (0)