Git Product home page Git Product logo

near-delegation-contract's Introduction





Template for NEAR dapps

Requirements

IMPORTANT: Make sure you have the latest version of NEAR Shell and Node Version > 10.x
  1. Node.js
  2. (optional) near-shell
npm i -g near-shell
  1. (optional) yarn
npm i -g yarn

To run on NEAR testnet

npm install && npm dev

with yarn:

yarn && yarn dev

The server that starts is for static assets and by default serves them to http://localhost:1234. Navigate there in your browser to see the app running!

NOTE: Both contract and client-side code will auto-reload once you change source files.

To run tests

npm test

with yarn:

yarn test

Deploy

Step 1: Create account for the contract

You'll now want to authorize NEAR shell on your NEAR account, which will allow NEAR Shell to deploy contracts on your NEAR account's behalf (and spend your NEAR account balance to do so).

Type the command near login which opens a webpage at NEAR Wallet. Follow the instructions there and it will create a key for you, stored in the /neardev directory.

Step 2:

Modify src/config.js line that sets the account name of the contract. Set it to the account id from step 1.

NOTE: When you use create-near-app to create the project it'll infer and pre-populate name of contract based on project folder name.

const CONTRACT_NAME = 'react-template'; /* TODO: Change this to your contract's name! */
const DEFAULT_ENV = 'development';
...

Step 3:

Check the scripts in the package.json, for frontend and backend both, run the command:

npm run deploy

with yarn:

yarn deploy

NOTE: This uses gh-pages to publish resulting website on GitHub pages. It'll only work if project already has repository set up on GitHub. Feel free to modify deploy:pages script in package.json to deploy elsewhere.

To Explore

  • assembly/main.ts for the contract code
  • src/index.html for the front-end HTML
  • src/index.js for the JavaScript front-end code and how to integrate contracts
  • src/App.js for the main React component
  • src/main.test.js for the JavaScript integration tests of smart contract
  • src/App.test.js for the main React component tests

near-delegation-contract's People

Contributors

gabsong 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.