The smart contract exposes methods to interact with a counter stored in the NEAR network.
Install cargo-near
and run:
cargo near build
cargo test
Deployment is automated with GitHub Actions CI/CD pipeline. To deploy manually,
install cargo-near
and run:
cargo near deploy <account-id>
In this example we will be using NEAR CLI to intract with the NEAR blockchain and the smart contract
If you want full control over of your interactions we recommend using the near-cli-rs.
get_num
is a read-only method (aka view
method).
View
methods can be called for free by anyone, even people without a
NEAR account!
# Use near-cli to get the counter value
near view <contract-account-id> get_num
increment
, decrement
and reset
change the contract's state, for which they
are call
methods.
Call
methods can only be invoked using a NEAR account, since the account needs
to pay GAS for the transaction.
# Use near-cli to set increment the counter
near call <contract-account-id> increment --accountId --accountId <your-account>
- cargo-near - NEAR smart contract development toolkit for Rust
- near CLI-rs - Iteract with NEAR blockchain from command line
- NEAR Rust SDK Documentation
- NEAR Documentation
- NEAR StackOverflow
- NEAR Discord
- NEAR Telegram Developers Community Group
- NEAR DevHub: Telegram, Twitter