Interact with testnet functions

There are two options to interact with a function to the MEM Carbon Testnet -- with the CLI or with a custom script.

Option A: Testnet interaction with the CLI

Install the MEM CLI

npm i -g mem-cli-js

Deploy a function

mem write --function-id [MEM function ID] --inputs [the function interaction stringified inputs object]

Read more in the CLI docs

Option B: Testnet interaction with a script

import axios from 'axios';

const TESTNET_ENDPOINT = "https://mem-testnet.xyz/write";

async function write() {
  try {
    const input = '{"function": "something"}'; // example: '{"function": "increment"}'
    const function_id = "your_function_id";

    const body = {
      input,
      function_id,
    };
    const result = (await axios.post(TESTNET_ENDPOINT, body))?.data;
    console.log(result);
    return result;
  } catch (error) {
    console.log(error);
  }
}

Last updated

mem.tech ยฉ 2023