To get started with this template:
-
Click the "Use this template" button to create a new repo based on this template
-
Update line 2 of
Cargo.toml
with your project name -
Update line 4 of
Cargo.toml
with your project author names -
Set up the prerequisites
-
Begin writing your smart contract in
src/lib.rs
-
Test the contract
cargo test -- --nocapture
-
Build the contract
RUSTFLAGS='-C link-arg=-s' cargo build --target wasm32-unknown-unknown --release
-
Create sub subaccount
NEAR_ENV=testnet near create-account YOUR_CONTRACT.YOUR_ACCOUNT.testnet --masterAccount YOUR_ACCOUNT.testnet
-
Deploy the contract
NEAR_ENV=testnet near deploy --wasmFile target/wasm32-unknown-unknown/release/lightbulb-contract.wasm --accountId YOUR_CONTRACT.YOUR_ACCOUNT.testnet
-
Read contract
NEAR_ENV=testnet near view YOUR_CONTRACT.YOUR_ACCOUNT.testnet get_status
-
Write contract
NEAR_ENV=testnet near call YOUR_CONTRACT.YOUR_ACCOUNT.testnet toggle --accountId YOUR_ACCOUNT.testnet
Get more info at: