convertOnChainRuleStructToString(Defined in: src/parsing/reverse-parsing-logic.ts:600 Convert RuleOnChain + metadata into a { data, json } pair. Builds a human-readablefunctionString,encodedValues,ruleS,ruleM,foreignCalls,trackers,mappings,ruleId):RuleJSON
RuleJSON and a RuleData that includes the id,
by reverse-parsing the condition and effects and resolving placeholders.
Parameters
| Parameter | Type | Description |
|---|---|---|
functionString | string | Calling function signature for the rule JSON. |
encodedValues | string | Encoded calling-function args used to derive names. |
ruleS | RuleOnChain | RuleOnChain (instructionSet, placeholders, effects). |
ruleM | RuleMetadataStruct | Rule metadata (name, description). |
foreignCalls | ForeignCallOnChain[] | Foreign calls referenced by placeholders. |
trackers | TrackerOnChain[] | Trackers referenced by placeholders. |
mappings | hexToFunctionString[] | Hex-to-function mappings to resolve signatures. |
ruleId | number | Optional id to include in the returned RuleData. |
Returns
RuleJSON
RuleDataAndJSON: { data: RuleData, json: RuleJSON }.
The function processes the RuleOnChain object to:
- Extract placeholder names and append them to
plhArray. - Parse and format positive and negative effects into strings.
- Reverse parse the rule’s instruction set to generate a condition string.
- Populate the
ruleJSONobject with the processed data.