Customize Wrapper APIs for Stablecoin
The stablecoin wrapper API is a modified version of the wrapper API package that is generated by Blockchain App Builder.
Complete the following steps if you regenerate the wrapper API package after adding custom methods to the stablecoin chaincode. To ensure that your changes are compatible, you must modify the newly generated wrapper API package by using the stablecoin wrapper API package that is bundled with the product.
- Use Blockchain App Builder to generate a wrapper API package for the stablecoin chaincode.
- Extract the files from the package.
- Back up the
routes.gofile, and then replace the OCI function folder in the new wrapper API package with theStablecoinOCIFunctionfolder from the bundledStablecoinwrapper API package. Restore the backup version of theroutes.gofile. - Edit the
function_pathJSON variable at the end of theterraform.varsfile to add entries for any new methods. Thefunction_pathvariable defines API endpoints as an array of objects in the following format.
Append entries for the new methodsfunction_paths="[{\"endpoint\":\"/activateStablecoinAccount\",\"methodType\":[\"POST\"]}]"createIDCSUserandcreateStablecoinAccountat the end of thefunction_pathvariable, as shown in the following example.function_paths="[{\"endpoint\":\"/activateStablecoinAccount\",\"methodType\":[\"POST\"]},{\"endpoint\":\"/createStablecoinAccount\",\"methodType\":[\"POST\"]}, {\"endpoint\":\"/createIDCSUser\",\"methodType\":[\"POST\"]}]" - Replace the
main.tffile in the newly generated wrapper API package with themain.tffile from the wrapper API package that is bundled with the product.