Last active
June 29, 2018 08:42
-
-
Save sneljo1/8f5fc1941fb11fa5c6b5563e6a525dc0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
async queryCar(stubHelper: StubHelper, args: string[]): Promise<any> { | |
const verifiedArgs = await Helpers.checkArgs<{ key: string }>(args[0], Yup.object() | |
.shape({ | |
key: Yup.string().required(), | |
})); | |
const car = stubHelper.getStateAsObject(verifiedArgs.key); //get the car from chaincode state | |
if (!car) { | |
throw new ChaincodeError('Car does not exist'); | |
} | |
return car; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment