All Projects → near-examples → counter

near-examples / counter

Licence: other
Increment and decrement a counter with this simple smart contract via a web page.

Programming Languages

HTML
75241 projects
javascript
184084 projects - #8 most used programming language
typescript
32286 projects
shell
77523 projects

Projects that are alternatives of or similar to counter

guest-book
Sign in with NEAR and add a message to the guest book!
Stars: ✭ 68 (+223.81%)
Mutual labels:  ready-to-use, assemblyscript
gomoku-wasm
A Gomoku game implements with WebAssembly
Stars: ✭ 30 (+42.86%)
Mutual labels:  assemblyscript
assemblyscript-regex
A regex engine for AssemblyScript
Stars: ✭ 81 (+285.71%)
Mutual labels:  assemblyscript
rust-counter
Simple counter in Rust. Increment, decrement, and reset. See branches for extended usage.
Stars: ✭ 53 (+152.38%)
Mutual labels:  ready-to-use
NFT
Example implementations of tokens to represent unique assets, such as collectibles or deeds, using the NEP-171 spec (similar to ERC-721)
Stars: ✭ 291 (+1285.71%)
Mutual labels:  ready-to-use
as-bignum
Fixed length big numbers for AssemblyScript 🚀
Stars: ✭ 49 (+133.33%)
Mutual labels:  assemblyscript
TensorFlow-Binary-Image-Classification-using-CNN-s
Binary Image Classification in TensorFlow
Stars: ✭ 26 (+23.81%)
Mutual labels:  ready-to-use
redstone-smartcontracts
An implementation of the Arweave SmartWeave smart contracts protocol.
Stars: ✭ 42 (+100%)
Mutual labels:  assemblyscript
assemblyscript-json
JSON encoder / decoder for AssemblyScript
Stars: ✭ 140 (+566.67%)
Mutual labels:  assemblyscript
website
AssemblyScript's website and documentation.
Stars: ✭ 47 (+123.81%)
Mutual labels:  assemblyscript
atari2600-wasm
An Atari 2600 emulator written in AssemblyScript compiled to WebAssembly
Stars: ✭ 50 (+138.1%)
Mutual labels:  assemblyscript
FT
Example implementations of money-like tokens, where one token is the same as any other, using the NEP-141 spec (similar to ERC-20)
Stars: ✭ 97 (+361.9%)
Mutual labels:  ready-to-use
ask
Ask! is a framework to write Wasm smart contracts for Substrate Frame Pallet-Contracts in AssemblyScript
Stars: ✭ 44 (+109.52%)
Mutual labels:  assemblyscript
easegress-assemblyscript-sdk
AssemblyScript SDK for Easegress
Stars: ✭ 15 (-28.57%)
Mutual labels:  assemblyscript
wasm4
Build retro games using WebAssembly for a fantasy console.
Stars: ✭ 711 (+3285.71%)
Mutual labels:  assemblyscript
examples
A collection of AssemblyScript examples.
Stars: ✭ 233 (+1009.52%)
Mutual labels:  assemblyscript
as-string-sink
An efficient dynamically sized string buffer (aka String Builder) for AssemblyScript
Stars: ✭ 23 (+9.52%)
Mutual labels:  assemblyscript
Babylon.Font
Generate text mesh for BabylonJS using WASM, written in AssemblyScript.
Stars: ✭ 22 (+4.76%)
Mutual labels:  assemblyscript
as-sha256
AssemblyScript implementation of SHA256
Stars: ✭ 15 (-28.57%)
Mutual labels:  assemblyscript
rabin-wasm
Rabin fingerprinting implemented in WASM
Stars: ✭ 26 (+23.81%)
Mutual labels:  assemblyscript

Counter example in AssemblyScript

Open in Gitpod!

Description

This contract implements simple counter backed by storage on blockchain. Contract in assembly/main.ts provides methods to increment / decrement counter and get it's current value or reset.

Plus and minus buttons increase and decrease value correspondingly. When button L is toggled, counter will add or minus 10 a time. RS button is for reset. LE and RE buttons to let the robot wink to you.

To Run

Open in the Gitpod link above or clone the repository.

git clone https://github.com/near-examples/counter

Setup Or skip to Login if in Gitpod

Install dependencies:

yarn --frozen-lockfile

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 src/config.js, changing the CONTRACT_NAME to be the NEAR account name in the file neardev/dev-account. It starts with dev-.


const CONTRACT_NAME = 'neardev/dev-account ACCOUNT ID'; /* TODO: fill this in! */

Start the example!

yarn start

To Test

yarn asp  # as-pect tests
NODE_ENV=ci yarn jest # jest tests
NODE_ENV=ci yarn test # both

To Explore

  • assembly/main.ts for the contract code
  • src/index.html for the front-end HTML
  • src/main.js for the JavaScript front-end code and how to integrate contracts
  • src/test.js for the JS tests for the contract
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].