Giter VIP home page Giter VIP logo

smart-contract-webapp-template's Introduction

Terra development template

This is a basic template for developing smart contract and web app together. This template is based on cw-template of CosmWasm.

โš ๏ธ This template was tested only in macOS. We will conduct tests in a wider OS.

How to use

Requirements

This template requires Docker to run LocalTerra, Rust and Cargo to build Smart Contract, and Node.js.

Please refer to the above links and install them.

Start development

First, LocalTerra must be running. Please run LocalTerra using docker-compose.

git clone --depth=1 https://github.com/terra-money/localterra
cd localterra
docker-compose up

Start app development

npx terra-templates get smart-contract:basic myapp
cd myapp

npm install

npm run deploy # build contracts, build schema and build contract types 
npm run app:start # run web app

# After that, if you have modified the /contracts source codes, run this again
npm run deploy

screen shot

Commands

All commands are organized in npm script. Please check the commands below.

  • npm run contract:build This command builds sources in the ~/contracts/* directories to ~/target.
  • npm run contract:schema This command create ~/schema/*/*.json schema files.
  • npm run contract:types This command creates app/src/contract.ts file using the ~/schema/*/*.json schema files.
  • npm run app:start This command run the web app.
  • npm run build This command runs npm run contract:build, npm run contract:schema, and npm run contract:types sequentially.
  • npm run deploy This command runs npm run build and deploy *.wasm files built thereafter to LocalTerra.
  • npm run test This command runs all the tests in the ~/contracts and ~/app.
  • npm run test:integration This command runs the integration tests on the ~/test directory.

Configuration

If you run run app:start, you can see a new chrome browser with station extension installed.

You can run the chrome browser with the test conditions you want just by modifying this station.config.json file without having to set the station extension separately for your test.

All scripts in this template were wrote using Google zx. You can modify these script files when you need to modify build or deploy conditions.

smart-contract-webapp-template's People

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.