There are two options to interact with a function to the MEM Carbon Testnet -- with the CLI or with a custom script.
mem write --function-id [MEM function ID] --inputs [the function interaction stringified inputs object]
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);
}
}