JSPM

near-tic-tac-toe

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q56275F
  • License ISC

near-tic-tac-toe example

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (near-tic-tac-toe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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 install

    If 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)

    1. Configure your current shell by running:
    source $HOME/.cargo/env
    1. Add wasm target to your toolchain by running:
    rustup target add wasm32-unknown-unknown

    Next, make sure you have near-cli by running:

    near --version

    If you need to install near-cli:

    npm install near-cli -g

    Login

    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 login

    Modify 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.sh

    To Deploy the SmartContract

    node contract_scripts/01_deploy.js

    To run front-end

    npm run start

    To Explore

    • contract/src/lib.rs for the contract code include init function and change method
    • contract/src/views.rs for the contract code include view method
    • src/index.html for the front-end HTML
    • src/main.js for the JavaScript front-end code and how to integrate contracts