Crates.io | cargo-near |
lib.rs | cargo-near |
version | 0.11.0 |
source | src |
created_at | 2022-06-01 09:04:27.238114 |
updated_at | 2024-10-30 07:19:06.055631 |
description | Cargo extension for building Rust smart contracts on NEAR |
homepage | |
repository | https://github.com/near/cargo-near |
max_upload_size | |
id | 598073 |
size | 193,241 |
Release notes and unreleased changes can be found in the CHANGELOG
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh
irm https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.ps1 | iex
npm install cargo-near
cargo install --locked cargo-near
or, install the most recent version from git repository:
$ git clone https://github.com/near/cargo-near
$ cargo install --locked --path cargo-near
See cargo near --help
for a complete list of available commands or run cargo near
to dive into interactive mode. Help is also available for each individual command with a --help
flag, e.g. cargo near build --help
.
cargo near
Starts interactive mode that will allow to explore all the available commands.
Additionally depends on Git binary being installed, besides cargo.
cargo near new
Initializes a new project skeleton to create a contract from a template.
Example of github workflows configuration, created by cargo near new
.
cargo near build
Builds a NEAR smart contract along with its ABI (while in the directory containing contract's Cargo.toml).
By default, this runs a reproducible build in a Docker container, which:
Cargo.lock
of project is created (e.g. via cargo update
) and added to git.
--locked
build by downstream cargo
command.[package.metadata.near.reproducible_build]
section of contract's Cargo.toml
and package.repository
field
Cargo.toml
of
template project, generated by cargo near new
Important flags:
--no-docker
cargo-near
cli.--no-locked
Cargo.lock
and simultaneously build the contract.wasm
mismatch as the result.cargo near abi
Generates NEAR smart contract's ABI (while in the directory containing contract's Cargo.toml).
Once contract is deployed, this will allow you to call a view function __contract_abi
to retrieve a ZST-compressed ABI.
cargo near create-dev-account
Guides you through creation of a new NEAR account on testnet.
cargo near deploy
Builds the smart contract (equivalent to cargo near build
) and guides you to deploy it to the blockchain.
By default, this runs a reproducible build in a Docker container.
deploy
command from Docker build requires that contract's source code:
package.repository
.Important flags:
--no-docker
build
command, in this case none of the git-related concerns and restrictions apply.--no-locked
build
resultUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.
Licensed under either of
at your option.