diff --git a/docs/docs/dev_docs/cli/cli-commands.md b/docs/docs/dev_docs/cli/cli-commands.md index 2d8c444ec123..96772e5e22d6 100644 --- a/docs/docs/dev_docs/cli/cli-commands.md +++ b/docs/docs/dev_docs/cli/cli-commands.md @@ -6,12 +6,45 @@ Here you will find a reference to the commands available in the Aztec CLI. ## Installation +### NPM + This command will install the Aztec CLI. ```bash npm install -g @aztec/cli ``` +### Docker + +The CLI will be installed automatically via Docker if it is not already found locally, by running the command to install and start the sandbox, [instructions here](./sandbox-reference.md#with-docker). + +## Update + +The CLI comes with an update command. + +```bash +npx @aztec/cli@latest update . --contract src/contract1 --contract src/contract2 +``` + +This command does a few things to manage updates: + +- If you installed the CLI globally via a node package manager, it updates to the specified version. Defaults to latest. +- It looks for a `package.json` and updates all `@aztec/` dependencies to the versions the sandbox expects. +- It looks for `Nargo.toml` at the `--contract` paths specified and updates all `aztec.nr` dependencies to the versions the sandbox expects. +- It outputs the changes. + +The sandbox must be running for the update command to work unless there the project defines `@aztec/aztec-sandbox` as a dependency, in which case the command will compare against the version listed in `package.json`. + +:::info + +If you installed the CLI via Docker (with the sandbox install Docker command), the `aztec-cli update` command won't work. You can update the CLI it by [running the command again](./sandbox-reference.md#installation-with-docker). + +::: + +## Compile + +You can find more information about compiling contracts [on this page](../contracts/compiling.md). + ## Creating Accounts The first thing we want to do is create a couple of accounts. We will use the `create-account` command which will generate a new private key for us, register the account on the sandbox, and deploy a simple account contract which [uses a single key for privacy and authentication](../../concepts/foundation/accounts/keys.md): diff --git a/docs/docs/dev_docs/cli/main.md b/docs/docs/dev_docs/cli/main.md index 2c3a881eef87..be687fcdcc10 100644 --- a/docs/docs/dev_docs/cli/main.md +++ b/docs/docs/dev_docs/cli/main.md @@ -36,4 +36,4 @@ The current sandbox does not generate or verify proofs, but provides a working e The Aztec CLI is a command-line tool allowing the user to interact directly with the Aztec network and sandbox. -It aims to provide all of the functionality required to deploy and invoke contracts and query system state such as contract data, transactions and emitted logs. +It aims to provide all of the functionality required to deploy, compile, and invoke contracts and query system state such as contract data, transactions and emitted logs. diff --git a/docs/docs/dev_docs/cli/sandbox-reference.md b/docs/docs/dev_docs/cli/sandbox-reference.md index f9292e44a6e7..072584577e17 100644 --- a/docs/docs/dev_docs/cli/sandbox-reference.md +++ b/docs/docs/dev_docs/cli/sandbox-reference.md @@ -16,6 +16,8 @@ You can run the Sandbox using either Docker or npm. This will attempt to run the Sandbox on ` localhost:8080`. You can change the port defined in `./.aztec/docker-compose.yml`. Running the command again will overwrite any changes made to the `docker-compose.yml`. +If you don't have the CLI installed via a node package manager, this command will also install or update the CLI. + To install a specific version of the sandbox, you can set the environment variable `SANDBOX_VERSION` ```bash @@ -31,9 +33,11 @@ You can download and run the Sandbox package directly if you have nodejs 18 or h You will also need an Ethereum node like Anvil or Hardhat running locally on port 8545. ```bash -npx @aztec/aztec-sandbox +npx @aztec/aztec-sandbox @aztec/aztec-cli ``` +You can read [this tutorial on how to use the npm package](../tutorials/testing.md#running-sandbox-in-the-nodejs-process) + ## Running The installation command will run the sandbox, and once installed you can run like so: diff --git a/docs/docs/dev_docs/contracts/compiling.md b/docs/docs/dev_docs/contracts/compiling.md index 8ac693510cc8..36e2c7e49661 100644 --- a/docs/docs/dev_docs/contracts/compiling.md +++ b/docs/docs/dev_docs/contracts/compiling.md @@ -6,21 +6,9 @@ In this guide we will cover how to do so, both using the CLI and programmaticall We'll also cover how to generate a helper [TypeScript interface](#typescript-interfaces) and an [Aztec.nr interface](#noir-interfaces) for easily interacting with your contract from your typescript app and from other Aztec.nr contracts, respectively. -## Prerequisites - -You will need the Noir build tool `nargo`, which you can install via [`noirup`](https://github.com/noir-lang/noirup). Make sure you install the correct version of nargo: - - - -:::info -You can run `aztec-cli get-node-info` to query the version of nargo that corresponds to your current installation. -::: - ## Compile using the CLI -To compile a contract using the Aztec CLI, first install it: - -`npm install -g @aztec/cli` +To compile a contract using the Aztec CLI, first [install it](../cli/cli-commands#installation). Then run the `compile` command with the path to your [contract project folder](./layout.md#directory-structure), which is the one that contains the `Nargo.toml` file: @@ -30,6 +18,14 @@ aztec-cli compile ./path/to/my_aztec_contract_project This will output a JSON [artifact](./artifacts.md) for each contract in the project to a `target` folder containing their artifact, which you can use for deploying or interacting with your contracts. +`aztec-cli` uses `noir_wasm` by default for compiling contracts. This helps reduce the developer overhead of installation and maintaining the noir compiler, `nargo`. However, if you prefer, you can use `nargo` to compile contracts with `aztec-cli` as so: + +```bash +aztec-cli compile my-contract --compiler nargo # switches compiler to nargo +``` + +When you specify `nargo` as your compiler, you need to make sure that you are using the correct version. You can find the [latest version information here](../updating.md#updating-nargo). + ### Typescript Interfaces You can use the compiler to autogenerate type-safe typescript classes for each of your contracts. These classes define type-safe methods for deploying and interacting with your contract based on their artifact. @@ -247,7 +243,8 @@ You can also programmatically access the compiler via the `@aztec/noir-compiler` The compiler exposes the following functions: -- `compileUsingNargo`: Compiles an Aztec.nr project in the target folder using the `nargo` binary available on the shell `PATH` and returns the generated ABIs. +- `compileUsingNoirWasm`: Compiles an Aztec.nr project in the target folder using a WASM build of the compiler and returns the generated ABIs. +- `compileUsingNargo`: Does the same as `compileUsingNargo` but instead of WASM it uses the `nargo` binary available on the shell `PATH` - `generateTypescriptContractInterface`: Generates a typescript class for the given contract artifact. - `generateNoirContractInterface`: Generates a Aztec.nr interface struct for the given contract artifact. diff --git a/docs/docs/dev_docs/contracts/deploying.md b/docs/docs/dev_docs/contracts/deploying.md index 6830a1fc3142..09859bbd66e4 100644 --- a/docs/docs/dev_docs/contracts/deploying.md +++ b/docs/docs/dev_docs/contracts/deploying.md @@ -29,13 +29,15 @@ Pre-requisite - Generate type-safe typescript classes for your contract when com ```ts import { readFileSync, writeFileSync } from "fs"; +import { createConsoleLogger } from "@aztec/foundation/log"; import { - compileUsingNargo, + compileUsingNoirWasm, generateTypescriptContractInterface, } from "@aztec/noir-compiler"; -const compiled: ContractArtifact[] = await compileUsingNargo( - projectPathToContractFolder +const compiled: ContractArtifact[] = await compileUsingNoirWasm( + projectPathToContractFolder, + { log: createConsoleLogger() } ); const abiImportPath = "../target/Example.json"; writeFileSync( diff --git a/docs/docs/dev_docs/contracts/main.md b/docs/docs/dev_docs/contracts/main.md index f7fcacf82085..0fa6e8f50293 100644 --- a/docs/docs/dev_docs/contracts/main.md +++ b/docs/docs/dev_docs/contracts/main.md @@ -20,14 +20,22 @@ An **Aztec smart contract** is a smart contract with **private** state variables ## Install Noir -To write an Aztec.nr contract, you need to write Noir, which requires a build tool called Nargo: - - +To write an Aztec.nr contract, you need to write Noir, [aztec-cli](../cli/cli-commands) comes with a built-in compiler for Noir contracts. :::info -For those coming from vanilla Noir, the nargo version used for aztec.nr is tracked seaprately to nargo for vanilla noir, so be sure to use the nargo version shown above +For those coming from vanilla Noir, the version used for aztec.nr is tracked separately to nargo for vanilla noir, so be sure to use the nargo version shown above ::: +## Install `nargo` (recommended) + +The CLI comes with the Noir compiler, so installing `nargo` is not required, however it is recommended as it provides a better developer experience for writing contracts. You will need nargo installed to take advantage of the [Noir Language Server](https://noir-lang.org/nargo/language_server), which provides syntax highlighting and formatting for your Aztec contracts. + +You will also need `nargo` if you want to run unit tests in Noir. + +You can install `nargo` with the following commands: + + + ## Install Noir tooling There are a number of tools to make writing Aztec.nr contracts more pleasant. See [here](https://github.com/noir-lang/awesome-noir#get-coding). diff --git a/docs/docs/dev_docs/getting_started/aztecnr-getting-started.md b/docs/docs/dev_docs/getting_started/aztecnr-getting-started.md index 02ab3114dded..2d937685a800 100644 --- a/docs/docs/dev_docs/getting_started/aztecnr-getting-started.md +++ b/docs/docs/dev_docs/getting_started/aztecnr-getting-started.md @@ -11,32 +11,6 @@ If you already have some experience with Noir and want to build a cooler contrac - You have followed the [quickstart](./quickstart.md) - Running Aztec Sandbox -## Install nargo - -`Aztec.nr` is a framework built on top of [Noir](https://noir-lang.org), a zero-knowledge DSL. Nargo is the build tool for Noir, similar to cargo for Rust. We need it for compiling our smart contracts. - - - -You can check it has been installed correctly by running: - -```bash -aztec-cli get-node-info -``` - -It should print something similar to: - -```bash -➜ ~ aztec-cli get-node-info - -Node Info: - -Version: 1 -Chain Id: 31337 -Rollup Address: 0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9 -Client: pxe@0.7.5 -Compatible Nargo Version: 0.16.0-aztec.0 -``` - ## Set up a project Create a new directory called `aztec-private-counter` @@ -52,43 +26,30 @@ cd aztec-private-counter mkdir contracts ``` -Inside `contracts`, create a new Noir project using nargo: - -```bash -cd contracts -nargo new counter --contract -``` - -The `contract` flag will create a contract nargo project rather than using vanilla Noir. - -Your file structure should look like this: +Inside contracts create the following file structure: -```bash -aztec-private-counter -|-contracts -| |--counter -| | |--src -| | | |--main.nr -| | |Nargo.toml +```tree +. +|-aztec-private-counter +| |-contracts +| | |--counter +| | | |--src +| | | | |--main.nr +| | | |--Nargo.toml ``` The file `main.nr` will soon turn into our smart contract! -Your `Nargo.toml` file should look something like this: +Add the following content to `Nargo.toml`: ```toml [package] name = "counter" type = "contract" authors = [""] -compiler_version = "0.16.0" +compiler_version = ">=0.18.0" [dependencies] -``` - -Add the following dependencies under `[dependencies]`: - -```toml aztec = { git="https://github.com/AztecProtocol/aztec-packages", tag="#include_aztec_version", directory="yarn-project/aztec-nr/aztec" } value_note = { git="https://github.com/AztecProtocol/aztec-packages", tag="#include_aztec_version", directory="yarn-project/aztec-nr/value-note"} easy_private_state = { git="https://github.com/AztecProtocol/aztec-packages", tag="#include_aztec_version", directory="yarn-project/aztec-nr/easy-private-state"} @@ -96,7 +57,7 @@ easy_private_state = { git="https://github.com/AztecProtocol/aztec-packages", ta ## Define the functions -Go to `main.nr` and replace the code with this contract initialization: +Go to `main.nr` and start with this contract initialization: ```rust contract Counter { @@ -157,7 +118,7 @@ We have annotated this and other functions with `#[aztec(private)]` which are AB ## Incrementing our counter -Now let’s implement the `increment` functio we defined in the first step. +Now let’s implement the `increment` function we defined in the first step. #include_code increment /yarn-project/noir-contracts/src/contracts/counter_contract/src/main.nr rust @@ -228,7 +189,7 @@ Partial Address: 0x211edeb823ef3e042e91f338d0d83d0c90606dba16f678c701d8bb64e64e2 Use one of these `address`es as the `owner`. You can either copy it or export. -To deploy the counter contract, [ensure the sandbox is running](../cli/sandbox-reference.md) and run this in the root of your nargo project: +To deploy the counter contract, [ensure the sandbox is running](../cli/sandbox-reference.md) and run this in the root of your Noir project: ```bash aztec-cli deploy target/Counter.json --args 100 0x25048e8c1b7dea68053d597ac2d920637c99523651edfb123d0632da785970d0 @@ -238,6 +199,16 @@ You can also test the functions by applying what you learned in the [quickstart] Congratulations, you have now written, compiled, and deployed your first Aztec.nr smart contract! +## Install `nargo` (recommended) + +The CLI comes with the Noir compiler, so installing `nargo` is not required, however it is recommended as it provides a better developer experience for writing contracts. You will need nargo installed to take advantage of the [Noir Language Server](https://noir-lang.org/nargo/language_server), which provides syntax highlighting and formatting for your Aztec contracts. + +You will also need `nargo` if you want to run unit tests in Noir. + +You can install `nargo` with the following commands: + + + ## What's next? Now you can explore. diff --git a/docs/docs/dev_docs/getting_started/quickstart.md b/docs/docs/dev_docs/getting_started/quickstart.md index 4c9625f6320d..02cdcaf020dd 100644 --- a/docs/docs/dev_docs/getting_started/quickstart.md +++ b/docs/docs/dev_docs/getting_started/quickstart.md @@ -28,6 +28,8 @@ To install the latest Sandbox version, run: This will attempt to run the Sandbox on ` localhost:8080`, so you will have to make sure nothing else is running on that port or change the port defined in `./.aztec/docker-compose.yml`. Running the command again will overwrite any changes made to the `docker-compose.yml`. +Alternatively, you can [run the sandbox as an npm package](../cli/sandbox-reference.md#with-npm). + ## Install the CLI To interact with the Sandbox now that it's running locally, install the [Aztec CLI](https://www.npmjs.com/package/@aztec/cli): diff --git a/docs/docs/dev_docs/tutorials/token_portal/minting_on_aztec.md b/docs/docs/dev_docs/tutorials/token_portal/minting_on_aztec.md index b1ba0d07bae7..a118ee0c369e 100644 --- a/docs/docs/dev_docs/tutorials/token_portal/minting_on_aztec.md +++ b/docs/docs/dev_docs/tutorials/token_portal/minting_on_aztec.md @@ -6,7 +6,7 @@ In this step we will start writing our Aztec.nr bridge smart contract and write ## Initial contract setup -In our `token-bridge` nargo project in `aztec-contracts`, under `src` there is an example `main.nr` file. Delete all the code in here and paste this to define imports and initialize the constructor: +In our `token-bridge` Noir project in `aztec-contracts`, under `src` there is an example `main.nr` file. Delete all the code in here and paste this to define imports and initialize the constructor: ```rust mod util; diff --git a/docs/docs/dev_docs/tutorials/token_portal/setup.md b/docs/docs/dev_docs/tutorials/token_portal/setup.md index 170dc06164b2..f2a0e01dae10 100644 --- a/docs/docs/dev_docs/tutorials/token_portal/setup.md +++ b/docs/docs/dev_docs/tutorials/token_portal/setup.md @@ -6,7 +6,7 @@ In this step, we’re going to 1. Install prerequisites 2. Create a yarn project to house everything -3. Create a nargo project for our Aztec contract +3. Create a noir project for our Aztec contract 4. Create a hardhat project for our Ethereum contract(s) 5. Import all the Ethereum contracts we need 6. Create a yarn project that will interact with our contracts on L1 and the sandbox @@ -20,18 +20,12 @@ However if you’d rather skip this part, our dev-rels repo contains the starter - [node v18+](https://github.com/tj/n) - [docker](https://docs.docker.com/) - [Aztec sandbox](https://docs.aztec.network/dev_docs/getting_started/sandbox) - you should have this running before starting the tutorial +- [Aztec CLI](../../getting_started/quickstart.md) ```bash /bin/sh -c "$(curl -fsSL 'https://sandbox.aztec.network')" ``` -- Nargo - -```bash -curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | sh -noirup -v #include_noir_version -``` - # Create the root project and packages Our root project will house everything ✨ @@ -43,19 +37,11 @@ cd aztec-token-bridge && mkdir packages We will hold our projects inside of `packages` to follow the design of the project in the [repo](https://github.com/AztecProtocol/dev-rel/tree/main/tutorials/token-bridge-e2e). -# Create a nargo project +# Create a noir project Now inside `packages` create a new directory called `aztec-contracts` -Inside `aztec-contracts`, create a nargo contract project by running - -```bash -mkdir aztec-contracts -cd aztec-contracts -nargo new --contract token_bridge -``` - -Your structure will look something like this +Inside `aztec-contracts`, create the following file structure: ``` aztec-contracts @@ -65,17 +51,21 @@ aztec-contracts ├── main ``` -Inside `Nargo.toml` you will need to add some dependencies. Put this at the bottom: +Inside `Nargo.toml` add the following content: ```toml +[package] +name = "token_bridge" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + [dependencies] aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/aztec" } value_note = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/value-note"} safe_math = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/safe-math"} ``` -Inside `src` you will see a `main.nr` file. This is where our main smart contract will go. - We will also be writing some helper functions that should exist elsewhere so we don't overcomplicated our contract. In `src` create two more files - one called `util.nr` and one called `token_interface` - so your dir structure should now look like this: ``` diff --git a/docs/docs/dev_docs/tutorials/uniswap/setup.md b/docs/docs/dev_docs/tutorials/uniswap/setup.md index 7eb1051f139c..fd35afb74031 100644 --- a/docs/docs/dev_docs/tutorials/uniswap/setup.md +++ b/docs/docs/dev_docs/tutorials/uniswap/setup.md @@ -22,9 +22,9 @@ Inside `ISwapRouter.sol` paste this: This is an interface for the Uniswap V3 Router, providing token swapping functionality. The contract defines methods for token swaps, both between two tokens or via a multi-hop path. Our portal will interact with the Uniswap V3 Router via this interface to perform token swaps on L1. We’ll see more about this in the next step. -# Create another nargo project +# Create another Noir project -In `aztec-contracts` create a new nargo project. +In `aztec-contracts` create a new Noir project. ```bash cd aztec-contracts && nargo new --contract uniswap diff --git a/docs/docs/dev_docs/tutorials/writing_dapp/contract_deployment.md b/docs/docs/dev_docs/tutorials/writing_dapp/contract_deployment.md index 5e4557e2dc84..207af323c979 100644 --- a/docs/docs/dev_docs/tutorials/writing_dapp/contract_deployment.md +++ b/docs/docs/dev_docs/tutorials/writing_dapp/contract_deployment.md @@ -6,7 +6,7 @@ To add contracts to your application, we'll start by creating a new `nargo` proj Follow the instructions [here](../../contracts/setup.md) to install `nargo` if you haven't done so already. ::: -## initialize nargo project +## Initialize Noir project Create a new `contracts` folder, and from there, initialize a new project called `token`: diff --git a/docs/docs/dev_docs/tutorials/writing_token_contract.md b/docs/docs/dev_docs/tutorials/writing_token_contract.md index 8e8b6297494b..592448d9c79d 100644 --- a/docs/docs/dev_docs/tutorials/writing_token_contract.md +++ b/docs/docs/dev_docs/tutorials/writing_token_contract.md @@ -18,29 +18,7 @@ We are going to start with a blank project and fill in the token contract source ## Requirements -You will need to install nargo, the Noir build too. if you are familiar with Rust, this is similar to cargo. - - - -If you've already installed the `aztec-cli`, as described in the quickstart [here](../getting_started/quickstart.md#cli), you can check which version of Noir is compatible with your version of the CLI and sandbox by running: - -```bash -aztec-cli get-node-info -``` - -It should print something similar to: - -```bash -➜ ~ aztec-cli get-node-info - -Node Info: - -Version: 1 -Chain Id: 31337 -Rollup Address: 0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9 -Client: pxe@0.7.5 -Compatible Nargo Version: 0.11.1-aztec.0 -``` +You will need to have `aztec-cli` installed in order to compile Aztec.nr contracts. See the [quickstart guide](../getting_started/quickstart.md#cli) for installation instructions. When you are running the Sandbox, `aztec-cli`, and compiling contracts with Noir, make sure you are using matching versions--we will be shipping breaking changes so mis-matched versions may not work. @@ -62,13 +40,7 @@ inside that directory, create a `contracts` folder for the Aztec contracts. cd token_contract_tutorial && mkdir contracts && cd contracts ``` -Create a new Noir project using nargo. - -```bash -nargo new --contract token_contract -``` - -Your project should look like this: +Create the following file structure ```tree . @@ -78,7 +50,7 @@ Your project should look like this: └── main.nr ``` -Add the following dependencies to your Nargo.toml file, below the package information: +Add the following content to Nargo.toml file: ```toml [package] diff --git a/docs/docs/dev_docs/updating.md b/docs/docs/dev_docs/updating.md index 7ac17ffd8cff..3ca73a6de456 100644 --- a/docs/docs/dev_docs/updating.md +++ b/docs/docs/dev_docs/updating.md @@ -2,44 +2,42 @@ title: Updating --- -## Quick Reference - -- Aztec Sandbox - +## TL;DR +1. **Updating the sandbox:** +- If you installed sandbox via docker, run: ```shell - /bin/bash -c "$(curl -fsSL 'https://sandbox.aztec.network')" +/bin/bash -c "$(curl -fsSL 'https://sandbox.aztec.network')" ``` +- If you have installed via an npm package then step 3 handles the update. -- Aztec CLI - +2. **Updating Aztec-CLI:** +- The above command also downloads the aztec-cli if a node package version of the CLI isn't found locally. +- If you have globally installed the CLI previously, then run: ```shell -npm install -g @aztec/cli +npm install -g @aztec/aztec-cli ``` +(replace with `yarn` or your node package version manager tool). +- If you have aztec-cli listed as a local dependency in your project's `package.json`, then step 3 handles the update. -- nargo +3. **Updating aztec-nr and individual @aztec dependencies:** +Inside your project run: - - -- Aztec.nr - -```toml -#nargo.toml -[dependencies] -aztec = { git="https://github.com/AztecProtocol/aztec-packages", tag="#include_aztec_version", directory="yarn-project/aztec-nr/aztec" } -value_note = { git="https://github.com/AztecProtocol/aztec-packages", tag="#include_aztec_version", directory="yarn-project/aztec-nr/value-note" } +```shell +cd your/aztec/project +npx @aztec/cli@latest update . --contract src/contract1 --contract src/contract2 ``` -Read on to learn about versioning and other commands. +The sandbox must be running for the update command to work unless there the project defines `@aztec/aztec-sandbox` as a dependency, in which case the command will compare against the version listed in `package.json`. -There are 4 components whose versions need to be kept compatible: +--- + +There are three components whose versions need to be kept compatible: 1. Aztec Sandbox, 2. Aztec CLI, -3. Noir compiler `nargo`, -4. Noir framework for Aztec contracts `aztec.nr`. +3. Noir framework for Aztec contracts `aztec.nr`. -Aztec Sandbox, Aztec CLI and `aztec.nr` are using the same versioning scheme and their versions must match. -The Noir compiler `nargo` has its own versioning scheme and its version must match the compatible nargo version specified in Sandbox. +All three are using the same versioning scheme and their versions must match. ## Updating Aztec Sandbox @@ -49,37 +47,12 @@ To update the sandbox to the latest version, simply run the curl command we used /bin/bash -c "$(curl -fsSL 'https://sandbox.aztec.network')" ``` -It will download and start the latest version of sandbox. - -If you would like to use a fixed version of the sandbox, you can export the `SANDBOX_VERSION` environmental variable. -If you are unsure what version to use go to [aztec-packages repository](https://github.com/AztecProtocol/aztec-packages/releases) and choose the `aztec-packages` release based on the changelog. - -Then set the `SANDBOX_VERSION` environmental variable to the version you want to use. E.g.: - -```shell -export SANDBOX_VERSION=#include_aztec_short_version -``` - -Now when you run the curl command it will use the version you specified. -To verify that it's the case check the console output of the curl command. -You should see the following line: - -``` -Setting up Aztec Sandbox v#include_aztec_short_version (nargo #include_noir_version), please stand by... -``` - -Alternatively you can open a new terminal and use aztec-cli to get the version. - -#include_code node-info yarn-project/end-to-end/src/cli_docs_sandbox.test.ts bash - -This will return something like this: - -#include_code node-info yarn-project/end-to-end/src/cli_docs_sandbox.test.ts bash - -The sandbox version should be the same as the one we chose by setting the `SANDBOX_VERSION` environmental variable. +This will also update the CLI if a node package version of the CLI isn't found locally. ## Updating Aztec CLI +### npm + If the latest version was used when updating the sandbox then we can simply run the following command to update the CLI: ```shell @@ -98,20 +71,26 @@ E.g.: npm install -g @aztec/cli@#include_aztec_short_version ``` -## Updating Noir compiler - -Now we need to update the Noir compiler `nargo` to the version compatible with the sandbox. -Use `aztec-cli` to get it: -#include_code node-info yarn-project/end-to-end/src/cli_docs_sandbox.test.ts bash +### Docker -Then we install the `Compatible Nargo Version` with (replace `COMPATIBLE_NARGO_VERSION` with the version from the previous command): +If you don't have the CLI installed globally via package manager or locally in your npm project, then you can update it by running the sandbox installation command again: ```shell -noirup -v COMPATIBLE_NARGO_VERSION +/bin/bash -c "$(curl -fsSL 'https://sandbox.aztec.network')" ``` ## Updating Aztec.nr packages +### Automatic update + +`aztec-cli` will update your Aztec.nr packages to the appropriate version with the `aztec-cli update` command. Run this command from the root of your project and pass the paths to the folders containing the Nargo.toml files for your projects like so: + +```shell +aztec-cli update . --contract src/contract1 --contract src/contract2 +``` + +### Manual update + Finally we need to update the Noir framework for Aztec contracts. We need to install a version compatible with our `nargo` and Sandbox. @@ -135,3 +114,9 @@ aztec-cli compile ./ ``` If the dependencies fail to resolve ensure that the tag matches a tag in the [aztec-packages repository](https://github.com/AztecProtocol/aztec-packages/tags). + +## Updating `nargo` + +Nargo is not strictly required, but you may want to use it for the LSP or testing. More info [here](./getting_started/aztecnr-getting-started.md#install-nargo-recommended). + +