From 9af68d8bd59a84e014567b429e9c9b4aed7fee74 Mon Sep 17 00:00:00 2001 From: Cat McGee Date: Mon, 29 Apr 2024 12:08:47 +0100 Subject: [PATCH] feat(docs): Nuke CLI from docs (#5936) * removes CLI from docs * updates aztec-cli codegen -> aztec-compile codegen * removes everything from quickstart except setting up sandbox (maybe controversial but I think it's good) blocked until aztec-builder is introduced --- .../how_to_compile_contract.md | 4 +- .../how_to_deploy_contract.md | 75 ++----------------- .../accounts/write_accounts_contract.md | 14 ---- .../writing_contracts/events/emit_event.md | 37 +-------- .../aztecjs-getting-started.md | 2 +- .../aztecnr-getting-started.md | 74 ++---------------- docs/docs/developers/getting_started/main.md | 4 +- .../developers/getting_started/quickstart.md | 57 +++++--------- docs/docs/developers/sandbox/main.md | 10 +-- .../sandbox/references/sandbox-reference.md | 6 +- .../token_portal/withdrawing_to_l1.md | 2 +- .../tutorials/uniswap/typescript_glue_code.md | 2 +- .../writing_dapp/contract_deployment.md | 2 +- .../writing_private_voting_contract.md | 36 +-------- .../tutorials/writing_token_contract.md | 2 +- docs/docs/developers/versions-updating.md | 38 ++++++---- .../dev_docs/sandbox/components.md | 4 +- docs/sidebars.js | 5 +- 18 files changed, 77 insertions(+), 297 deletions(-) diff --git a/docs/docs/developers/contracts/compiling_contracts/how_to_compile_contract.md b/docs/docs/developers/contracts/compiling_contracts/how_to_compile_contract.md index c1fdb70014c..a295c7d9463 100644 --- a/docs/docs/developers/contracts/compiling_contracts/how_to_compile_contract.md +++ b/docs/docs/developers/contracts/compiling_contracts/how_to_compile_contract.md @@ -4,7 +4,7 @@ title: How to compile a contract Once you have written a [contract](../main.md) in Aztec.nr, you will need to compile it into an [artifact](./artifacts.md) in order to use it. -In this guide we will cover how to do so, both using the CLI and programmatically. +In this guide we will cover how to do so, both using the `aztec-nargo` command and programmatically. 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. @@ -36,7 +36,7 @@ members = [ You can use the code generator 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. ```bash -aztec-cli codegen ./aztec-nargo/output/target/path -o src/artifacts +aztec-builder codegen ./aztec-nargo/output/target/path -o src/artifacts ``` Below is typescript code generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) contract: diff --git a/docs/docs/developers/contracts/deploying_contracts/how_to_deploy_contract.md b/docs/docs/developers/contracts/deploying_contracts/how_to_deploy_contract.md index 656f1f9e4c8..7d9685771b9 100644 --- a/docs/docs/developers/contracts/deploying_contracts/how_to_deploy_contract.md +++ b/docs/docs/developers/contracts/deploying_contracts/how_to_deploy_contract.md @@ -4,32 +4,17 @@ title: How to deploy a contract # Deploying contracts -Once you have [compiled](../compiling_contracts/how_to_compile_contract.md) your contracts you can proceed to deploying them using the aztec-cli or using aztec.js which is a Typescript client to interact with the sandbox. +Once you have [compiled](../compiling_contracts/how_to_compile_contract.md) your contracts you can proceed to deploying them using aztec.js which is a Typescript client to interact with the sandbox. ## Prerequisites -- `aztec-cli` and `aztec-nargo` installed (go to [Sandbox and CLI section](../../sandbox/main.md) for installation instructions) +- `aztec-nargo` installed (go to [Sandbox and CLI section](../../sandbox/main.md) for installation instructions) - contract artifacts ready (go to [How to Compile Contract](../compiling_contracts/how_to_compile_contract.md) for instructions on how to compile contracts) - Aztec Sandbox running (go to [Sandbox section](../../getting_started/quickstart.md) for instructions on how to install and run the sandbox) ## Deploy -Contracts can be deployed using the `aztec-cli` or using the `aztec.js` library. - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -```bash -aztec-cli deploy /path/to/contract/artifact.json -``` - - - - -Pre-requisite - Compile the contract and generate a type-safe typescript class for it. +Contracts can be deployed using the `aztec.js` library. Compile the contract: @@ -40,7 +25,7 @@ aztec-nargo compile Generate the typescript class: ```bash -aztec-cli codegen ./aztec-nargo/output/target/path -o src/artifacts +aztec-builder ./aztec-nargo/output/target/path -o src/artifacts ``` This would create a typescript file like `Example.ts` in `./src/artifacts`. Read more on the [compiling page](../compiling_contracts/how_to_compile_contract.md). @@ -58,30 +43,9 @@ const exampleContract = await ExampleContract.at( myWallet ); ``` - - - - ### Deploy Arguments There are several optional arguments that can be passed: - - - -`aztec-cli deploy` takes 1 mandatory argument which is the path to the contract artifact file in a JSON format (e.g. `contracts/target/PrivateToken.json`). Alternatively you can pass the name of an example contract as exported by `@aztec/noir-contracts.js` (run `aztec-cli example-contracts` to see the full list of contracts available). - -The command also takes the following optional arguments: - -- `-args ` (default: `[]`): Arguments to pass to the contract constructor. -- `--rpc-url ` (default: `http://localhost:8080`): URL of the PXE to connect to. -- `--public-key ` (default: `undefined`): Optional encryption public key for this contract. - Set this only if this contract is expected to receive private notes (in such a case the public key is used during the note encryption). -- `--salt ` (default: random value): Hexadecimal string used when computing the contract address of the contract being deployed. - By default is set to a random value. - Set it, if you need a deterministic contract address (same functionality as Ethereum's `CREATE2` opcode). - - - The `deploy(...)` method is generated automatically with the typescript class representing your contract. Its arguments are `PXE` client and contract constructor arguments. @@ -98,25 +62,12 @@ const tx = ExampleContract.deploy(pxe).send({ }); ``` - - - ### Deploying token contract To give you a more complete example we will deploy a `Token` contract whose artifacts are included in the `@aztec/noir-contracts.js` package. The contract has `admin` as a constructor argument. -We will deploy the contract with the `aztec-cli` and pass the `admin` address as an argument. - - - - -```bash -aztec-cli deploy TokenContractArtifact --args 0x147392a39e593189902458f4303bc6e0a39128c5a1c1612f76527a162d36d529 -``` - - - +We will deploy the contract and pass the `admin` address as an argument. ```ts const admin = AztecAddress.from( @@ -127,34 +78,18 @@ const contract = await TokenContract.deploy(wallet, admin).send().deployed(); logger(`Contract deployed at ${contract.address}`); ``` - - - If everything went as expected you should see the following output (with a different address): > Contract deployed at `0x151de6120ae6628129ee852c5fc7bcbc8531055f76d4347cdc86003bbea96906` If we pass the salt as an argument: - - - -```bash -aztec-cli deploy TokenContractArtifact --args 0x147392a39e593189902458f4303bc6e0a39128c5a1c1612f76527a162d36d529 --salt 0x123 -``` - - - - ```ts const contract = await TokenContract.deploy(wallet, admin) .send({ contractAddressSalt: Fr.fromString("0x123") }) .deployed(); ``` - - - the resulting address will be deterministic. > **NOTE**: You can try running the deployment with the same salt the second time in which case the transaction will fail because the address has been already deployed to. diff --git a/docs/docs/developers/contracts/writing_contracts/accounts/write_accounts_contract.md b/docs/docs/developers/contracts/writing_contracts/accounts/write_accounts_contract.md index 030ea894fb1..be77b51e6e7 100644 --- a/docs/docs/developers/contracts/writing_contracts/accounts/write_accounts_contract.md +++ b/docs/docs/developers/contracts/writing_contracts/accounts/write_accounts_contract.md @@ -29,20 +29,6 @@ Let's start with the account contract itself in Aztec.nr. Create [a new Aztec.nr #include_code contract noir-projects/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr rust -:::info -You can use [the Aztec CLI](../../../sandbox/main.md) to generate a new keypair if you want to use a different one: - -```bash -$ aztec-cli generate-private-key -``` - -```bash -Private Key: 0xc06461a031058f116f087bc0161b11c039648eb47e03bad3eab089709bf9b8ae -Public Key: 0x0ede151adaef1cfcc1b3e152ea39f00c5cda3f3857cef00decb049d283672dc713c0e184340407e796411f74b7383252f1406272b58fccad6fee203f8a6db474 -``` - -::: - The important part of this contract is the `entrypoint` function, which will be the first function executed in any transaction originated from this account. This function has two main responsibilities: authenticating the transaction and executing calls. It receives a `payload` with the list of function calls to execute, and requests a corresponding auth witness from an oracle to validate it. You will find this logic implemented in the `AccountActions` module, which use the `AppPayload` and `FeePayload` structs: #include_code entrypoint noir-projects/aztec-nr/authwit/src/account.nr rust diff --git a/docs/docs/developers/contracts/writing_contracts/events/emit_event.md b/docs/docs/developers/contracts/writing_contracts/events/emit_event.md index 5ff18cce72e..001d48f7824 100644 --- a/docs/docs/developers/contracts/writing_contracts/events/emit_event.md +++ b/docs/docs/developers/contracts/writing_contracts/events/emit_event.md @@ -18,20 +18,7 @@ Unlike on Ethereum, there are 2 types of events supported by Aztec: [encrypted]( Encrypted events can only be emitted by private functions and are encrypted using a public key of a recipient. For this reason it is necessary to register a recipient in the Private Execution Environment (PXE) before encrypting the events for them. -Recipients can be registered using the Aztec CLI or Aztec.js: - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -```bash -aztec-cli register-recipient --address 0x147392a39e593189902458f4303bc6e0a39128c5a1c1612f76527a162d36d529 --public-key 0x26e193aef4f83c70651485b5526c6d01a36d763223ab24efd1f9ff91b394ac0c20ad99d0ef669dc0dde8d5f5996c63105de8e15c2c87d8260b9e6f02f72af622 --partial-address 0x200e9a6c2d2e8352012e51c6637659713d336405c29386c7c4ac56779ab54fa7 -``` - - - +Recipients can be registered using Aztec.js: ```ts const aztecAddress = AztecAddress.fromString( @@ -52,9 +39,6 @@ const completeAddress = CompleteAddress.create( await pxe.registerRecipient(completeAddress); ``` - - - :::info If a note recipient is one of the accounts inside the PXE, we don't need to register it as a recipient because we already have the public key available. You can register a recipient as shown [here](../../deploying_contracts/how_to_deploy_contract.md) @@ -105,28 +89,9 @@ To emit unencrypted logs you don't need to import any library. You call the cont ### Querying the unencrypted event Once emitted, unencrypted events are stored in AztecNode and can be queried by anyone: - - - -```bash -aztec-cli get-logs --fromBlock 5 -``` - - - #include_code get_logs /yarn-project/end-to-end/src/fixtures/utils.ts typescript - - - -Get logs functionality provides a variety of filtering options. -To display them run: - -```bash -aztec-cli get-logs --help -``` - ## Costs All event data is pushed to Ethereum as calldata by the sequencer and for this reason the cost of emitting an event is non-trivial. diff --git a/docs/docs/developers/getting_started/aztecjs-getting-started.md b/docs/docs/developers/getting_started/aztecjs-getting-started.md index 5df8bf9f1a1..acb8916c0a5 100644 --- a/docs/docs/developers/getting_started/aztecjs-getting-started.md +++ b/docs/docs/developers/getting_started/aztecjs-getting-started.md @@ -360,4 +360,4 @@ That's it! We have successfully deployed a token contract to an instance of the ## Next Steps -Learn more about writing Aztec.nr contracts on the [next page](./aztecnr-getting-started.md). +Write your first smart contract on the [next page](./aztecnr-getting-started.md). diff --git a/docs/docs/developers/getting_started/aztecnr-getting-started.md b/docs/docs/developers/getting_started/aztecnr-getting-started.md index d7b9dd1eb10..4996532e4e9 100644 --- a/docs/docs/developers/getting_started/aztecnr-getting-started.md +++ b/docs/docs/developers/getting_started/aztecnr-getting-started.md @@ -130,9 +130,9 @@ The last thing we need to implement is the function in order to retrieve a count This function is `unconstrained` which allows us to fetch data from storage without a transaction. We retrieve a reference to the `owner`'s `counter` from the `counters` Map. The `get_balance` function then operates on the owner's counter. This yields a private counter that only the private key owner can decrypt. -## Test with the CLI +## Compile -Now we've written a simple Aztec.nr smart contract, it's time to ensure everything works by testing with the CLI. +Now we've written a simple Aztec.nr smart contract, we can compile it with `aztec-nargo`. ### Compile the smart contract @@ -147,63 +147,10 @@ This will compile the smart contract and create a `target` folder with a `.json` After compiling, you can generate a typescript class. In the same directory, run this: ```bash -aztec-cli codegen target -o src/artifacts +aztec-builder target -o src/artifacts ``` -### Deploy - -You can use the previously generated artifact to deploy the smart contract. Our constructor takes two arguments - `initial_counter` and `owner` so let's make sure to pass those in. - -`initial_counter` can be any uint. In this guide we'll pick 100, but you can pick anything. - -For the `owner` you can get the account addresses in your sandbox by running: - -```bash -aztec-cli get-accounts -``` - -This will return something like this: - -```bash -➜ counter aztec-cli get-accounts -Accounts found: - -Address: 0x2fd4503a9b855a852272945df53d7173297c1469cceda31048b85118364b09a3 -Public Key: 0x27c20118733174347b8082f578a7d8fb84b3ad38be293715eee8119ee5cd8a6d0d6b7d8124b37359663e75bcd2756f544a93b821a06f8e33fba68cc8029794d9 -Partial Address: 0x11ee4cb5330545b3e82ace531526bc1995501a5596a85f90e5e60f4c1ad204dc - -Address: 0x054ae9af363c6388cc6242c6eb0ed8a5860c15290744c81ecd5109434f9bb8b1 -Public Key: 0x08145e8e8d46f51cda8d4c9cad81920236366abeafb8d387002bad879a3e87a81570b04ac829e4c007141d856d5a36d3b9c464e0f3c1c99cdbadaa6bb93f3257 -Partial Address: 0x23ae266d9f8905bc4ef42e1435560ac78f3b5b55eb99b85398eb7011cd38fd8c - -Address: 0x0d919c38d75484f8dd410cebaf0e17ccd196901d554d88f81b7e079375a4335d -Public Key: 0x13e6151ea8e7386a5e7c4c5221047bf73d0b1b7a2ad14d22b7f73e57c1fa00c614bc6da69da1b581b09ee6cdc195e5d58ae4dce01b63bbb744e58f03855a94dd -Partial Address: 0x2cf8f09aef15e219bf782049a3183a8adfd1fa254bf62bea050dc9a28fc979a7 -``` - -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](../sandbox/references/sandbox-reference.md) and run this in the root of your Noir project: - -```bash -aztec-cli deploy contracts/counter/target/counter-Counter.json --args 100 0x0a0ab6320e2981cc543fedb9ad0f524c0a750397ca3372508d14af5b3c3c7cf0 --private-key 0x2153536ff6628eee01cf4024889ff977a18d9fa61d0e414422f7681cf085c281 -``` - -You can also test the functions by applying what you learned in the [quickstart](./quickstart.md). - -Congratulations, you have now written, compiled, and deployed your first Aztec.nr smart contract! - -Deploying your contract via the CLI will not register the deployed contract with the [PXE](../../learn/concepts/pxe/main.md). To do so, use `aztec-cli add-contract`. - -```bash -aztec-cli add-contract --contract-artifact contracts/counter/target/counter-Counter.json --contract-address -``` - -:::note - -You can also deploy contracts using Aztec.js. See [the next page](./aztecjs-getting-started.md) for details. - -::: +You can now use the artifact and/or the TS class in your Aztec.js! If you skipped the Aztec.js getting-started guide, you can follow it [here](aztecjs-getting-started.md). This will teach you about deploying and calling contracts in Aztec.js. ## Install Noir LSP (recommended) @@ -222,16 +169,9 @@ Update the `Noir: Nargo Path` field to point to your desired `aztec-nargo` execu ## What's next? -Now you can explore. - -**Interested in learning more about how Aztec works under the hood?** - -Understand the high level architecture on the [Core Components page](../../learn/about_aztec/technical_overview.md). You can also explore Aztec's [hybrid state model](../../learn/concepts/hybrid_state/main.md) and [the lifecycle of a transaction](../../learn/concepts/transactions.md). - -**Want to write more contracts?** +The next recommmended steps are follow the tutorials in order. They will teach you more about contracts, Aztec.js, and how Aztec works in general. -Follow the series of tutorials, starting with the private voting contract [here](../tutorials/writing_private_voting_contract.md). +To follow the series of tutorials, start with the private voting contract [here](../tutorials/writing_private_voting_contract.md). -**Ready to dive into Aztec and Ethereum cross-chain communication?** +Alternatively, you can read about the high level architecture on the [Core Components page](../../learn/about_aztec/technical_overview.md). You can also explore Aztec's [hybrid state model](../../learn/concepts/hybrid_state/main.md) and [the lifecycle of a transaction](../../learn/concepts/transactions.md). -Read the [Portals page](../../learn/concepts/communication/cross_chain_calls.md) and learn how to practically implement portals in the [token bridge tutorial](../tutorials/token_portal/main.md). diff --git a/docs/docs/developers/getting_started/main.md b/docs/docs/developers/getting_started/main.md index 4d18453d50a..dd3ee49bef2 100644 --- a/docs/docs/developers/getting_started/main.md +++ b/docs/docs/developers/getting_started/main.md @@ -6,8 +6,8 @@ title: Getting Started If this is your first time using Aztec, and you want to get started by learning by doing, head to the [Quickstart section](quickstart.md). This section is the entry point to: -1. Set up the Aztec sandbox and deploy a sample first contract with the CLI -2. Deploy and interact with a contract using Aztec.js +1. Set up the Aztec sandbox and deploy a sample first contract with Aztec.js +2. Interact with a contract using Aztec.js 3. Write your first smart contract in Aztec.nr ## Learn diff --git a/docs/docs/developers/getting_started/quickstart.md b/docs/docs/developers/getting_started/quickstart.md index 0bbd6d1b93b..dfc66cc4d57 100644 --- a/docs/docs/developers/getting_started/quickstart.md +++ b/docs/docs/developers/getting_started/quickstart.md @@ -6,8 +6,8 @@ In this guide, you will 1. Set up the Aztec sandbox (local development environment) locally 2. Install the Aztec development kit -3. Use the CLI to deploy an example contract that comes with the sandbox -4. Use the CLI to interact with the contract you just deployed +3. Use Aztec.js to deploy an example contract that comes with the sandbox +4. Use Aztec.js to interact with the contract you just deployed ... in less than 10 minutes. @@ -48,7 +48,6 @@ bash -i <(curl -s install.aztec.network) This will install the following: - **aztec** - launches various infrastructure subsystems (sequencer, prover, pxe, etc). -- **aztec-cli** - a command line tool for interfacing and experimenting with infrastructure. - **aztec-nargo** - aztec's build of nargo, the noir compiler toolchain. - **aztec-sandbox** - a wrapper around docker-compose that launches services needed for sandbox testing. - **aztec-up** - a tool to upgrade the aztec toolchain to the latest, or specific versions. @@ -61,48 +60,26 @@ aztec-sandbox 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 installation again will overwrite any changes made to the `docker-compose.yml`. -This command will also install the CLI if a node package version of the CLI isn't found locally. +**Congratulations, you have just installed and run the Aztec Sandbox!** -## Deploy a contract using the CLI +```bash + /\ | | + / \ ___| |_ ___ ___ + / /\ \ |_ / __/ _ \/ __| + / ____ \ / /| || __/ (__ + /_/___ \_\/___|\__\___|\___| -The sandbox is preloaded with multiple accounts. Let's assign them to shell variables. Run the following in your terminal, so we can refer to the accounts as $ALICE and $BOB from now on: - -:::note -The default accounts that come with sandbox will likely change over time. Save two of the "Initial accounts" that are printed in the terminal when you started the sandbox. -::: - -#include_code declare-accounts yarn-project/end-to-end/src/guides/up_quick_start.sh bash - -Start by deploying a token contract. After it is deployed, we check that the deployment succeeded, and export the deployment address to use in future commands. For more detail on how the token contract works, see the [token contract tutorial](../tutorials/writing_token_contract.md). - -#include_code deploy yarn-project/end-to-end/src/guides/up_quick_start.sh bash - -:::note -If you're not using the default port for the Sandbox, make sure to pass the `--rpc-url` parameter, e.g.: `--rpc-url http://localhost:8000`. -::: - -Note that the deployed contract address is exported, so we can use it as `$CONTRACT` later on. - -## Call a contract with the CLI - -Alice is set up as the contract admin and token minter in the `_initialize` function. Let's get Alice some private tokens. - -We need to export the `SECRET` and `SECRET_HASH` values in order to privately mint tokens. Private tokens are claimable by anyone with the pre-image to a provided hash, see more about how the token contract works in the [token contract tutorial](../tutorials/writing_token_contract.md). After the tokens have been minted, the notes will have to added to the [Private Execution Environment](../../apis/pxe/interfaces/PXE.md) (PXE) to be consumed by private functions. Once added, Alice can claim them with the `redeem_shield` function. After this, Alice should have 1000 tokens in their private balance. - -#include_code mint-private yarn-project/end-to-end/src/guides/up_quick_start.sh bash - -We can have Alice privately transfer tokens to Bob. Only Alice and Bob will know what's happened. Here, we use Alice's private key to send a transaction to transfer tokens to Bob. Once they are transferred, we can verify that it worked as expected by checking Alice's and Bob's balances: - -#include_code transfer yarn-project/end-to-end/src/guides/up_quick_start.sh bash - -Alice and Bob should have 500 tokens. +``` -Congratulations! You are all set up with the Aztec sandbox! +In the terminal, you will see some logs: +1. Sandbox version +2. Contract addresses of rollup contracts +3. PXE (private execution environment) setup logs +4. Initial accounts that are shipped with the sandbox and can be used in tests ## What's next? -To deploy and interact with a contract using Aztec.js, go to the [next page](aztecnr-getting-started.md). +To deploy a smart contract to your sandbox and interact with it using Aztec.js, go to the [next page](aztecjs-getting-started.md). -You can also dig more into the sandbox and CLI [here](../sandbox/main.md). +To skip this and write your first smart contract, go to the [Aztec.nr getting started page](aztecnr-getting-started.md). -To learn more about writing contracts, consider jumping to the [tutorials section](../tutorials/main.md). diff --git a/docs/docs/developers/sandbox/main.md b/docs/docs/developers/sandbox/main.md index f0f3bdd22c1..1696b47c597 100644 --- a/docs/docs/developers/sandbox/main.md +++ b/docs/docs/developers/sandbox/main.md @@ -2,7 +2,7 @@ title: Sandbox and CLI --- -The Aztec Sandbox is an environment for local development on the Aztec Network. It's easy to get setup with just a single, simple command, and contains all the components needed to develop and test Aztec contracts and applications. The Aztec CLI will allow you to interact with the sandbox. +The Aztec Sandbox is an environment for local development on the Aztec Network. It's easy to get setup with just a single, simple command, and contains all the components needed to develop and test Aztec contracts and applications. ## Components of the Aztec network @@ -32,10 +32,6 @@ These provide a self contained environment which deploys Aztec on a local (empty The current sandbox does not generate or verify proofs, but provides a working end to end developer flow for writing and interacting with Aztec.nr smart contracts. -## Aztec CLI and aztec-nargo +## Command line tools -The Aztec CLI is a command-line tool allowing you 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. - -Use `aztec-nargo` for compiling contracts. See the [compiling contracts](../contracts/compiling_contracts/how_to_compile_contract.md) page for more information. +Aztec-nargo and aztec-builder are command-line tool allowing you to compile smart contracts. See the [compiling contracts](../contracts/compiling_contracts/how_to_compile_contract.md) page for more information. diff --git a/docs/docs/developers/sandbox/references/sandbox-reference.md b/docs/docs/developers/sandbox/references/sandbox-reference.md index 512ef3e31af..ecf4e04c61e 100644 --- a/docs/docs/developers/sandbox/references/sandbox-reference.md +++ b/docs/docs/developers/sandbox/references/sandbox-reference.md @@ -17,7 +17,6 @@ bash -i <(curl -s install.aztec.network) This will install the following: - **aztec** - launches various infrastructure subsystems (sequencer, prover, pxe, etc). -- **aztec-cli** - a command line tool for interfacing and experimenting with infrastructure. - **aztec-nargo** - aztec's build of nargo, the noir compiler toolchain. - **aztec-sandbox** - a wrapper around docker-compose that launches services needed for sandbox testing. - **aztec-up** - a tool to upgrade the aztec toolchain to the latest, or specific versions. @@ -175,10 +174,9 @@ You can find the cheat code reference [here](../../sandbox/references/cheat_code ## Contracts -We have shipped a number of example contracts in the `@aztec/noir-contracts.js` [npm package](https://www.npmjs.com/package/@aztec/noir-contracts.js). This is included with the cli by default so you are able to use these contracts to test with. To get a list of the names of the contracts run: +We have shipped a number of example contracts in the `@aztec/noir-contracts.js` [npm package](https://www.npmjs.com/package/@aztec/noir-contracts.js). This is included with the sandbox by default so you are able to use these contracts to test with. -```bash title="example-contracts" showLineNumbers -% aztec-cli example-contracts +```bash BenchmarkingContractArtifact CardGameContractArtifact ChildContractArtifact diff --git a/docs/docs/developers/tutorials/token_portal/withdrawing_to_l1.md b/docs/docs/developers/tutorials/token_portal/withdrawing_to_l1.md index 45ba268f200..38a5458d786 100644 --- a/docs/docs/developers/tutorials/token_portal/withdrawing_to_l1.md +++ b/docs/docs/developers/tutorials/token_portal/withdrawing_to_l1.md @@ -82,7 +82,7 @@ aztec-nargo compile And generate the TypeScript interface for the contract and add it to the test dir: ```bash -aztec-cli codegen target -o ../../src/test/fixtures +aztec-builder target -o ../../src/test/fixtures ``` This will create a TS interface in our `src/test` folder! diff --git a/docs/docs/developers/tutorials/uniswap/typescript_glue_code.md b/docs/docs/developers/tutorials/uniswap/typescript_glue_code.md index 2d5d04e4a1b..01db9de4285 100644 --- a/docs/docs/developers/tutorials/uniswap/typescript_glue_code.md +++ b/docs/docs/developers/tutorials/uniswap/typescript_glue_code.md @@ -36,7 +36,7 @@ aztec-nargo compile And then generate the typescript interface: ```bash -aztec-cli codegen ./target/ -o ../../../src/test/fixtures uniswap +aztec-builder ./target/ -o ../../../src/test/fixtures uniswap ``` This will create a TS interface in our `src/test` folder that will help us write our test. diff --git a/docs/docs/developers/tutorials/writing_dapp/contract_deployment.md b/docs/docs/developers/tutorials/writing_dapp/contract_deployment.md index 8cbaecbc608..bc3456eec79 100644 --- a/docs/docs/developers/tutorials/writing_dapp/contract_deployment.md +++ b/docs/docs/developers/tutorials/writing_dapp/contract_deployment.md @@ -34,7 +34,7 @@ The `Token` contract also requires some helper files. You can view the files [he ## Compile your contract -We'll now use `aztec-nargo` to [compile](../../contracts/compiling_contracts/how_to_compile_contract.md) our project. If you haven't installed aztec-nargo and aztec-cli already, it comes with the sandbox, so you can install it via the [Sandbox install command](../../sandbox/references/sandbox-reference.md#installation). +We'll now use `aztec-nargo` to [compile](../../contracts/compiling_contracts/how_to_compile_contract.md) our project. If you haven't installed aztec-nargo already, it comes with the sandbox, so you can install it via the [Sandbox install command](../../sandbox/references/sandbox-reference.md#installation). Now run the following from your contract folder (containing Nargo.toml): diff --git a/docs/docs/developers/tutorials/writing_private_voting_contract.md b/docs/docs/developers/tutorials/writing_private_voting_contract.md index df8a8f03a05..6af73511d58 100644 --- a/docs/docs/developers/tutorials/writing_private_voting_contract.md +++ b/docs/docs/developers/tutorials/writing_private_voting_contract.md @@ -16,7 +16,7 @@ To keep things simple, we won't create ballots or allow for delegate voting. ## Prerequisites -- You have followed the [quickstart](../getting_started/quickstart.md) to install `aztec-nargo`, `aztec-cli` and `aztec-sandbox`. +- You have followed the [quickstart](../getting_started/quickstart.md) to install `aztec-nargo` and `aztec-sandbox`. - Running Aztec Sandbox ## Set up a project @@ -158,40 +158,10 @@ aztec-nargo compile This will create a new directory called `target` and a JSON artifact inside it. To optionally create a typescript interface, run: ```bash -aztec-cli codegen target -o src/artifacts +aztec-builder target -o src/artifacts ``` -Once it is compiled you can [deploy](../contracts/deploying_contracts/how_to_deploy_contract.md) it to the sandbox. Ensure your [sandbox is running](../sandbox/references/sandbox-reference.md) and run this in the same dir as before: - -```bash -aztec-cli deploy ./target/private_voting-Voting.json --args $ADMIN_ADDRESS -``` - -The constructor takes an address as an argument to set the admin, so you can use an address that is deployed with the sandbox - check the sandbox terminal or run `aztec-cli get-accounts`. - -You should see a success message with the contract address. Now we can start calling functions! - -Cast a vote like this: - -```bash -aztec-cli send cast_vote --contract-artifact ./target/private_voting-Voting.json --contract-address $CONTRACT_ADDRESS --args 1 --private-key $PRIVATE_KEY -``` - -You can get the contract address from the sandbox terminal or the message printed when you deployed the contract. You can also get a private key from the sandbox terminal, or generate one with `aztec-cli generate-private-key`. - -This should return a `mined` success message. - -You can now try running this command again to ensure our nullifier works. - -Get the number of votes like this: - -```bash -aztec-cli call get_vote --contract-artifact ./target/private_voting-Voting.json --contract-address $CONTRACT_ADDRESS --args 1 -``` - -This should return `1n`. - -You can follow this pattern to test `end_vote()` and access control of other functions. +Once it is compiled you can [deploy](../contracts/deploying_contracts/how_to_deploy_contract.md) it to the sandbox. This is out of scope for this tutorial but you can learn how to do this in the [Aztec.js getting-started guide](../getting_started/aztecjs-getting-started.md). ## Next steps diff --git a/docs/docs/developers/tutorials/writing_token_contract.md b/docs/docs/developers/tutorials/writing_token_contract.md index 67dfcce6d19..5805cddfe55 100644 --- a/docs/docs/developers/tutorials/writing_token_contract.md +++ b/docs/docs/developers/tutorials/writing_token_contract.md @@ -431,7 +431,7 @@ aztec-nargo compile Once your contract is compiled, optionally generate a typescript interface with the following command: ```bash -aztec-cli codegen target -o src/artifacts +aztec-builder target -o src/artifacts ``` ## Next Steps diff --git a/docs/docs/developers/versions-updating.md b/docs/docs/developers/versions-updating.md index ac062cd3c61..7e2e46d8169 100644 --- a/docs/docs/developers/versions-updating.md +++ b/docs/docs/developers/versions-updating.md @@ -4,11 +4,10 @@ title: Versions and Updating ## Versions -Aztec tools (sandbox, cli, nargo), dependencies (aztec-nr), and sample contracts are constantly being improved. +Aztec tools (sandbox, nargo), dependencies (aztec-nr), and sample contracts are constantly being improved. When developing and referring to example .nr files/snippets, it is helpful to verify the versions of different components (below), and if required keep them in lock-step by [updating](#updating). ### Checking tool versions -To check your version of Aztec tools, you can use `aztec-cli -V` :::note The `aztec-nargo` versions follow `nargo` versions, which is different to the Aztec tool versions. @@ -59,9 +58,9 @@ This can present confusion when opening older contracts (and dependencies) writt The second point requires a restart of the extension, which you can trigger with the command palette (Ctrl + Shift + P) and typing "Reload Window". ## Updating -### TL;DR +### Steps to keep up to date -1. Updating Aztec sandbox to the latest version (includes `aztec-nargo`, `aztec-cli`, etc): +1. Update the Aztec sandbox to the latest version (includes `aztec-nargo`, pxe, etc): ```shell aztec-up @@ -73,34 +72,35 @@ To set `VERSION` for a particular git tag, eg for [aztec-package-v**0.35.0**](ht VERSION=0.35.0 aztec-up ``` -2. Updating aztec-nr and individual @aztec dependencies: +2. Update aztec-nr and individual @aztec dependencies: -Inside your project run: + -3. Refer [Migration Notes](../misc/migration_notes.md) on any breaking changes that might affect your dapp +Follow [updating Aztec.nr packages](#updating-aztecnr-packages) and [updating JavaScript packages](#updating-aztecjs-packages) guides. + +3. Refer to [Migration Notes](../misc/migration_notes.md) on any breaking changes that might affect your dapp --- There are four components whose versions need to be kept compatible: 1. Aztec Sandbox -2. Aztec CLI -3. aztec-nargo -4. `Aztec.nr`, the Noir framework for writing Aztec contracts +2. aztec-nargo +3. `Aztec.nr`, the Noir framework for writing Aztec contracts First three are packaged together in docker and are kept compatible by running `aztec-up`. But you need to update your Aztec.nr version manually or using `aztec-cli update`. ## Updating Aztec.nr packages -### Automatic update + To update the aztec.nr packages manually, update the tags of the `aztec.nr` dependencies in the `Nargo.toml` file. @@ -129,6 +129,18 @@ aztec-nargo 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 Aztec.js packages + +To update Aztec.js packages, go to your `package.json` and replace the versions in the dependencies. + +```diff +[dependencies] +-"@aztec/accounts": "0.7.5", ++"@aztec/accounts": "#include_aztec_short_version", +-"@aztec/noir-contracts.js": "0.35.1", ++"@aztec/accounts": "#include_aztec_short_version", +``` + ## Updating `aztec-nargo` As mentioned in the tl;dr, `aztec-nargo` is updated as part of updating the whole sandbox via: diff --git a/docs/internal_notes/dev_docs/sandbox/components.md b/docs/internal_notes/dev_docs/sandbox/components.md index 5045e2c18fd..b302af1b0e4 100644 --- a/docs/internal_notes/dev_docs/sandbox/components.md +++ b/docs/internal_notes/dev_docs/sandbox/components.md @@ -98,9 +98,9 @@ Design an Aztec.nr contract artifact, similar to a Solidity ABI which is output - Public input/output witness indices? - Sourcemap information, allowing building of stack traces in simulator error cases. -### aztec-cli +### aztec-nargo -Provides the `aztec-cli` binary for interacting with network from the command line. It's a thin wrapper around `aztec.js` to make calls out to the client services. It's stateless. +Provides the `aztec-nargo` binary for compiling contracts from the command line. ### aztec.js diff --git a/docs/sidebars.js b/docs/sidebars.js index defdf997210..b0b43724a2f 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -213,8 +213,8 @@ const sidebars = { }, items: [ "developers/getting_started/quickstart", - "developers/getting_started/aztecnr-getting-started", "developers/getting_started/aztecjs-getting-started", + "developers/getting_started/aztecnr-getting-started", ], }, @@ -226,9 +226,10 @@ const sidebars = { id: "developers/tutorials/main", }, items: [ - "developers/tutorials/writing_token_contract", "developers/tutorials/writing_private_voting_contract", + "developers/tutorials/writing_token_contract", "developers/tutorials/crowdfunding/donations", + { label: "Writing a DApp", type: "category",