To run this project locally:
npm install --global yarn(or just
npm i -g yarn)
yarn install(or just
package.jsonfor a full list of
scriptsyou can run with
Now you'll have a local development environment backed by the NEAR TestNet! Running
yarn dev will tell you the URL you can visit in your browser to see the app.
/assemblyfolder. This code gets deployed to the NEAR blockchain when you run
yarn deploy:contract. This sort of code-that-runs-on-a-blockchain is called a "smart contract" – learn more about NEAR smart contracts.
/srcfolder. /src/index.html is a great place to start exploring. Note that it loads in
/src/index.js, where you can learn how the frontend connects to the NEAR blockchain.
Both contract and client-side code will auto-reload as you change source files.
Every smart contract in NEAR has its own associated account. When you run
yarn dev, your smart contracts get deployed to the live NEAR TestNet with a throwaway account. When you're ready to make it permanent, here's how.
You need near-shell installed globally. Here's how:
npm install --global near-shell
This will give you the
near CLI tool. Ensure that it's installed with:
Visit NEAR Wallet and make a new account. You'll be deploying these smart contracts to this new account.
Now authorize NEAR shell for this new account, and follow the instructions it gives you:
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 || 'your-account-here!'
As you can see in
package.json, this does two things:
package.jsonto deploy elsewhere.