inti25-near-example v1.0.0
NEAR Tic Tac Toe
Description
This contract implements simple online game use near sdk
Contract in contract/src/lib.rs
Demo
https://inti25.github.io/near-tic-tac-toe/index.html
Setup
Install dependencies:
npm installIf you don't have Rust installed, complete the following 3 steps:
1) Install Rustup by running:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh(Taken from official installation guide)
2) Configure your current shell by running:
source $HOME/.cargo/env3) Add wasm target to your toolchain by running:
rustup target add wasm32-unknown-unknownNext, make sure you have near-cli by running:
near --versionIf you need to install near-cli:
npm install near-cli -gLogin
If you do not have a NEAR account, please create one with NEAR Wallet.
In the project root, login with near-cli by following the instructions after this command:
near loginModify the top of contract_scripts/*.js, changing the CONTRACT_NAME and ACCOUNT_ID to be the NEAR account that was just used to log in.
const ACCOUNT_ID = 'YOUR_ACCOUNT_NAME_HERE'; /* TODO: fill this in! */
const CONTRACT_ID = 'YOUR_ACCOUNT_NAME_HERE'; /* TODO: fill this in! */To Build the SmartContract
cd contract
./complie.shTo Deploy the SmartContract
node contract_scripts/01_deploy.jsTo run front-end
npm run startTo Explore
contract/src/lib.rsfor the contract code include init function and change methodcontract/src/views.rsfor the contract code include view methodsrc/index.htmlfor the front-end HTMLsrc/main.jsfor the JavaScript front-end code and how to integrate contracts
2 years ago