Code Monkey home page Code Monkey logo

mem-testnet's Introduction

@decentldotland/mem-testnet

MEM functions simulation testnet

โš ๏ธ We recommend using the MEM Carbon Testnet for a smoother, production-like developer experience when testing MEM functions.

Build & Run

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

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

Interact With The Testnet

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

mem-testnet's People

Contributors

charmful0x avatar xylophonez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.