calebjacob / console-boilerplate-template-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logo

Test Boilerplate Template JS

Report a Bug · Request a Feature . Ask a Question

Pull Requests welcome code with love by shelegdmitriy

Table of Contents

About

This project is created for easy-to-start as a JavaScript skeleton template in the Pagoda Gallery. It was initialized with create-near-app. Clone it and start to build your own gallery project!

Built With

create-near-app, amazing-github-template

Getting Started

Prerequisites

Make sure you have a current version of Node.js installed – we are targeting versions 16+.

Read about other prerequisites in our docs.

Installation

Install all dependencies:

npm install

Build your contract:

npm run build

Deploy your contract to TestNet with a temporary dev account:

npm run deploy

Usage

Test your contract:

npm test

Start your frontend:

npm start

Exploring The Code

  1. The smart-contract code lives in the /contract folder. See the README there for more info. In blockchain apps the smart contract is the "backend" of your app.
  2. The frontend code lives in the /frontend folder. /frontend/index.html is a great place to start exploring. Note that it loads in /frontend/index.js, this is your entrypoint to learn how the frontend connects to the NEAR blockchain.
  3. Test your contract: npm test, this will run the tests in integration-tests directory.

Deploy

Every smart contract in NEAR has its own associated account. When you run npm run deploy, your smart contract gets deployed to the live NEAR TestNet with a temporary dev account. When you're ready to make it permanent, here's how:

Step 0: Install near-cli (optional)

near-cli is a command line interface (CLI) for interacting with the NEAR blockchain. It was installed to the local node_modules folder when you ran npm install, but for best ergonomics you may want to install it globally:

npm install --global near-cli

Or, if you'd rather use the locally-installed version, you can prefix all near commands with npx

Ensure that it's installed with near --version (or npx near --version)

Step 1: Create an account for the contract

Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as your-name.testnet, you can deploy your contract to near-blank-project.your-name.testnet. Assuming you've already created an account on NEAR Wallet, here's how to create near-blank-project.your-name.testnet:

  1. Authorize NEAR CLI, following the commands it gives you:

    near login

  2. Create a subaccount (replace YOUR-NAME below with your actual account name):

    near create-account near-blank-project.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet

Step 2: deploy the contract

Use the CLI to deploy the contract to TestNet with your account ID. Replace PATH_TO_WASM_FILE with the wasm that was generated in contract build directory.

near deploy --accountId near-blank-project.YOUR-NAME.testnet --wasmFile PATH_TO_WASM_FILE

Step 3: set contract name in your frontend code

Modify the line in src/config.js that sets the account name of the contract. Set it to the account id you used above.

const CONTRACT_NAME = process.env.CONTRACT_NAME || 'near-blank-project.YOUR-NAME.testnet'

Troubleshooting

On Windows, if you're seeing an error containing EPERM it may be related to spaces in your path. Please see this issue for more details.

Roadmap

See the open issues for a list of proposed features (and known issues).

Support

Reach out to the maintainer:

Project assistance

If you want to say thank you or/and support active development of PROJECT_NAME:

  • Add a GitHub Star to the project.
  • Tweet about the PROJECT_NAME.
  • Write interesting articles about the project on Dev.to, Medium or your personal blog.

Together, we can make test-boilerplate-template-js better!

Contributing

First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.

Please read our contribution guidelines, and thank you for being involved!

Authors & contributors

The original setup of this repository is by Dmitriy Sheleg.

For a full list of all authors and contributors, see the contributors page.

Security

Test Boilerplate Template JS follows good practices of security, but 100% security cannot be assured. Test Boilerplate Template JS is provided "as is" without any warranty. Use at your own risk.

For more information and to report security issues, please refer to our security documentation.

About


Languages

Language:JavaScript 39.8%Language:CSS 24.3%Language:HTML 19.1%Language:TypeScript 10.6%Language:Shell 6.2%