"transaction" Process Function Syntax

Q

What is the syntax of "transaction" process function in the JavaScript file?

✍: FYIcenter.com

A

A "transaction" process function is a regular JavaScription function that has two extra decorators: "@transaction" and "@param". Here is the syntax of a "transaction" process function statement:

/* @transaction
 * @param {transaction_type} param_name 
 */

[async] function function_name(param_name) {
   ... JavaScript statements ...
} 

Syntax elements used in a "transaction" process function statement:

  • "@transaction" - A required decorator to indicate that the following function is a "transaction" process function. The decorator should be placed in a JavaScript comment statement.
  • "@param ..." - A required decorator to specify the "transaction" data type and parameter name that represents the object of this data type parsed from the transaction request input message. The decorator should be placed in a JavaScript comment statement.
  • "transaction_type" - A required field to specify the "transaction" data type name including its namespace.
  • "param_name" - A required field to specify the parameter name to represent the object parsed from the transaction request input message.
  • "async" - An optional flag to indicate that this transaction process function will be invoked asynchronously.
  • "function_name" - A required field to specify the name of this transaction process function.

 

⇒ "transaction" Data Type Declared in CTO

⇐ What Is JS Scripting Language

⇑ Business Network JS Scripting Language

⇑⇑ Hyperledger Composer Tutorials

2021-06-05, 880🔥, 0💬