convertRuleStructToString(Defined in: src/parsing/reverse-parsing-logic.ts:511 Convert on-chain RuleStruct + metadata into a { data, json } pair. Builds a human-readablefunctionString
,encodedValues
,ruleS
,ruleM
,foreignCalls
,trackers
,mappings
,ruleId
?):RuleDataAndJSON
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 | RuleStruct | On-chain RuleStruct (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
RuleDataAndJSON
RuleDataAndJSON: { data: RuleData, json: RuleJSON }
.
The function processes the RuleStruct
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
ruleJSON
object with the processed data.