parseEffect
parseEffect(
effect
,names
,placeholders
,indexMap
):EffectDefinition
Parses an effect string and extracts its type, text, instruction set, parameter type, and parameter value. The function supports three types of effects: “emit”, “revert”, and general expressions.
Parameters
Parameter | Type | Description |
---|---|---|
effect | string | The effect string to parse. |
names | any [] | An array of names used for interpreting expressions. |
placeholders | PlaceholderStruct [] | An array to store placeholder structures extracted during parsing. |
indexMap | trackerIndexNameMapping [] | A mapping of tracker index names used for interpreting expressions. |
Returns
An object containing:
type
: The type of the effect (e.g.,EffectType.REVERT
,EffectType.EVENT
, orEffectType.EXPRESSION
).text
: The extracted text of the effect.instructionSet
: An array of instructions for expression effects.pType
: The parameter type (0 for address, 1 for string, 2 for numeric).parameterValue
: The extracted parameter value (address, string, or numeric).