Function ABI

Defining functions and arguments in a function's state

A MEM function state can optionally include a publicFunctions object as an ABI which helps to document the function and make it interactive in the IDE.

The ABI simplifies capturing public callable functions and their input object arguments in MEM functions. It provides a clear and standardized structure that helps developers avoid manual errors and maintain consistency across functions during writing and testing.

How to write a MEM ABI

The publicFunctions object is structured such that each key represents a function name, and the associated value is an array of strings detailing the input object arguments for that function.

Example: state.json

{
  "publicFunctions": {
    "addUser": ["username", "bio", "id"],
    "deleteUser": ["id"]
  }
}

In the IDE, this will populate the interaction pane with function names and fields that can be used to test the function.

Last updated

mem.tech ยฉ 2023