Create App Rules
Application Rule Implementation Overview
- Ensure the [environment variables][environment-url] are set correctly.
- Create an application rule:
- Make sure you have set a [Rule Admin][admin-config] for your application, and use only an address with this role to execute all the transactions in this guide.
- Get the rule creation function from the [Application Rule Directory][appRuleDirectory-url] and invoke it on the RuleProcessorDiamond, sending in the required parameters. NOTE: Each rule requires a different parameter set. For local deployments, the RuleProcessorDiamond address can be found in previous steps, otherwise consult the [Deployment Directory][deploymentDirectory-url].
- This function will return a ruleId, please take note of this value.
- Apply the application rule to the application
- Get the rule application function from the rule directory and invoke it on the Application Handler created in previous steps.
- Repeat for each desired application rule
Example using Account Max Value by Access Level Rule
-
Create an application rule:
-
Get the Account Max Value by Access Level Rule creation function from the [Application Rule Directory][appRuleDirectory-url] and invoke it on the RuleProcessorDiamond, sending in the required parameters. NOTE: Each rule requires a different parameter set. For local deployments, the RuleProcessorDiamond address can be found in previous steps, otherwise consult the [Deployment Directory][deploymentDirectory-url].
-
This function will return a ruleId, please take note of this value. It can be found in the logs section of the output as the second value in the topics section. It will be the last digits so in the example, 00002 is the ruleId:
-
-
Apply the application rule to the application
- Get the rule application function from the rule directory and invoke it on the ApplicationHandler created in previous steps.
- Get the rule application function from the rule directory and invoke it on the ApplicationHandler created in previous steps.