Last active
February 4, 2019 11:58
-
-
Save Jojoooo1/ce9d8d034bbad4ab8f69d92b5338ae9d to your computer and use it in GitHub Desktop.
chaincode-3.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [..] | |
// Function for retrieving state value | |
async getDataById(stub, args) { | |
// Assigns id to data | |
const data = args[0]; | |
// Verifies id is not empty | |
if (!data) { | |
throw new Error('Por favor especifique um id'); | |
} | |
console.info('--- start getDataById ---'); | |
const dataAsBytes = await stub.getState(data); | |
console.info('=================='); | |
console.log(dataAsBytes.toString()); | |
console.info('=================='); | |
console.info('--- end getDataById ---'); | |
return dataAsBytes; | |
} | |
// [..] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment