Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/decentldotland/mem-testnet
- Owner: decentldotland
- License: mit
- Created: 2023-08-21T18:23:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-05T15:22:00.000Z (9 months ago)
- Last Synced: 2024-04-14T10:45:35.553Z (7 months ago)
- Topics: mem, testnet
- Language: TypeScript
- Homepage: https://mem.tech
- Size: 278 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)