Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/decentldotland/mem-testnet

Simulations testnet for MEM functions
https://github.com/decentldotland/mem-testnet

mem testnet

Last synced: 3 days ago
JSON representation

Simulations testnet for MEM functions

Awesome Lists containing this project

README

        





@decentldotland/mem-testnet


MEM functions simulation testnet

⚠️ We recommend using the [MEM Carbon Testnet](https://github.com/decentldotland/mem-carbon-testnet) for a smoother, production-like developer experience when testing MEM functions.

## Build & Run

```bash

git pull https://github.com/decentldotland/mem-testnet.git

npm install && npm run build && npm run start

```

## Interact With The Testnet
```js
async function testFunction() {
try {
const TESTNET_ENDPOINT = `https://mem-testnet-bfdc8ff3530f.herokuapp.com/`;
const sc = `
/**
*
* @param state is the current state your application holds
* @param action is an object containing { input, caller } . Most of the times you will only use \`action.input\` which contains the input passed as a write operation
* @returns {Promise<{ users: Array<{ username: string}> }>}
*/
export async function handle(state, action) {
const { username } = action.input;
state.users.push({ username });
return { state, result: 'Hello MEM' };
}
`;

const input = '{"username": "darwin"}';
const initState = '{"users": []}';
const options = {
contractType: 0,
initState: initState,
input: input,
contractSrc: sc,
};
const result = await axios.post(TESTNET_ENDPOINT, options);
console.log(result);
} catch (error) {
console.log(error);
}
}

```

## License
This project is licensed under the [MIT License](./LICENSE)