From 2aca36ac5e5b3e208c8ad3dec9d2d43983ac7067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Wed, 21 Feb 2024 15:58:48 +0000 Subject: [PATCH 1/3] chore(docs): removing boxes page, will iterate later as part of DIP --- .../developers/sandbox/guides/blank_box.md | 129 ------------------ 1 file changed, 129 deletions(-) delete mode 100644 docs/docs/developers/sandbox/guides/blank_box.md diff --git a/docs/docs/developers/sandbox/guides/blank_box.md b/docs/docs/developers/sandbox/guides/blank_box.md deleted file mode 100644 index 6838786c1da..00000000000 --- a/docs/docs/developers/sandbox/guides/blank_box.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -title: Run a blank Aztec Box ---- - -This page will go over Aztec Boxes, which are full stack Aztec project templates that come with: - -- example Aztec.nr contracts -- tests written in Typescript -- web interfaces for interacting with contracts - -These can make it easier to set up a new Aztec project and get started building your app as soon as possible. - -In this page, we will break down what's included in the "blank" box. This box includes the minimum amount of code to create a full-stack Aztec dapp. - -There are also boxes that include a basic React interface (`blank-react`) and another that includes an example token contract along with a React interface (`private-token`). You can see the full list on [Github](https://github.com/AztecProtocol/aztec-packages/tree/master/boxes). - -## Setup - -See the Quickstart page for [requirements](../../getting_started/quickstart.md#requirements), starting the local [Sandbox environment](../../getting_started/quickstart.md#sandbox-installation) and [installing the CLI](../../getting_started/quickstart#cli-installation). - -Aztec Boxes use [yarn](https://classic.yarnpkg.com/) for package management, so if you want to follow along exactly, make sure you have it [installed](https://classic.yarnpkg.com/en/docs/install). - -You will also need to install Aztec tooling to compile contracts. You can find instructions for installing the latest version [here](../../sandbox/references/sandbox-reference.md). - -## Getting the Box - -Once you have everything set up, you can get the plain "blank box" with "unbox" command: - -```bash -aztec-cli unbox blank new_project -``` - -This command indicates that you want to use the "blank" template to create a project in a directory called `new_project`. You can view the source code that is grabbed to create the project [on Github](https://github.com/AztecProtocol/aztec-packages/tree/#include_aztec_version/boxes). The unbox command pulls the code from the latest published version (v0.8.10 at the time of writing) for stability and compatibility. - -Running this command will give you the following structure: - -```tree -new_project -├── package.json -├── README.md -├── src -│ ├── artifacts -│ │ ├── Blank.json -│ │ └── Blank.ts -│ ├── contracts -│ │ ├── Nargo.toml -│ │ └── src -│ │ └── main.nr -│ ├── index.html -│ ├── index.ts -│ └── tests -│ └── blank.contract.test.ts -├── tsconfig.dest.json -├── tsconfig.json -├── webpack.config.js -└── yarn.lock -``` - -There may be some additional configuration files in your project, but these are the main ones. - -## Run it - -Install dependencies by running - -```bash -yarn -``` - -### Start the Sandbox - -See the Quickstart for [installing and starting the Sandbox](../../getting_started/quickstart.md#sandbox-installation). - -### Start the frontend - -Start the frontend with - -```bash -yarn start:dev -``` - -This will serve the web interface at `http://localhost:5173/`. - -You should see an interface with two buttons, "Deploy" and "Interact". Clicking these buttons will trigger actions in `./src/index.ts`. - -## `index.ts` - -### Imports - -`index.ts` imports functions and types from `@aztec/aztec.js`, `@aztec/foundation` and the contract ABI from `./artifacts/blank.js`. - -The contract ABI (Application Binary Interface) is generated from the contract artifact (a compiled Aztec contract) found at `./src/artifacts/Blank.json`. - -### Global variables - -The Sandbox runs on `localhost:8080` by default. With the `SANDBOX_URL`, we set up an Aztec Private Execution Client (PXE), which provides access to accounts and their private state. The PXE client helps facilitate deployments and interactions (reads and writes) with deployed contracts. - -### Imports - -`index.ts` imports from [`@aztec/aztec.js`](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/aztec.js). It also imports the `BlankContractAbi`, which is generated from the contract defined in `./src/contracts/src/main.nr`. - -#include_code imports boxes/blank/src/index.ts typescript - -### Deployment - -#include_code deploy boxes/blank/src/index.ts typescript - -To deploy, it gets one of the pre-initialized wallets that comes with the Sandbox with `getInitialTestAccountsWallets`. Using that wallet, the contract ABI, optional salt (used to deterministically calculate the contract address, like [CREATE2 in Ethereum](https://docs.openzeppelin.com/cli/2.8/deploying-with-create2)), and the PXE, we can create a contract deployment transaction and send it to the sandbox network. The constructor defined in the Blank contract doesn't take any arguments, so we pass an empty array. - -With the web interface running, open your browser dev tools console, click the "Deploy" button and see the successfully deployed contract address. In the terminal or Docker logs where your sandbox is running, you will see transaction and block production info printed. - -### Interaction - -#include_code interact boxes/blank/src/index.ts typescript - -Once a contract is deployed, you can interact with it by clicking the "Interact" button. This will call the `getPublicKey` function on the `Blank` contract. For this call we need to pass the contract, the contract abi, the name of the function to call, the arguments for the function, the PXE and the wallet from which to make the transaction, see `callContractFunction`. - -### Compiling Contracts - -This blank project comes with the contract artifacts, which are generated when the contracts are compiled, out of the box. - -You can modify the source contracts and regenerate the artifacts by running - -```bash -yarn compile -``` - -This will generate a [contract artifact](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/boxes/blank/src/artifacts/Blank.json) and TypeScript class for the [Aztec smart contract](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/boxes/blank/src/contracts/src/main.nr), which the frontend uses to generate the UI. - -After compiling, you can re-deploy the updated noir smart contract from the web UI. The function interaction forms are generated from parsing the contract artifact, so they should update automatically after you recompile. From d9f2e1281e46c457f22094c37bb927aca628ab54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Wed, 21 Feb 2024 16:08:48 +0000 Subject: [PATCH 2/3] it's never this easy, is it --- docs/sidebars.js | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sidebars.js b/docs/sidebars.js index a779fdf94ac..50335fcddb1 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -261,7 +261,6 @@ const sidebars = { label: "Guides", type: "category", items: [ - "developers/sandbox/guides/blank_box", "developers/sandbox/guides/run_more_than_one_pxe_sandbox", "developers/wallets/creating_schnorr_accounts", ], From 207cb7b7347aa263b324e0ad298592c31f14f0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro=20Sousa?= Date: Wed, 21 Feb 2024 16:50:34 +0000 Subject: [PATCH 3/3] it's never this easy, is it pt2 --- .../docs/developers/sandbox/references/sandbox-reference.md | 6 ------ docs/netlify.toml | 4 ---- 2 files changed, 10 deletions(-) diff --git a/docs/docs/developers/sandbox/references/sandbox-reference.md b/docs/docs/developers/sandbox/references/sandbox-reference.md index 72c31a6c177..17e57e6cde5 100644 --- a/docs/docs/developers/sandbox/references/sandbox-reference.md +++ b/docs/docs/developers/sandbox/references/sandbox-reference.md @@ -210,9 +210,3 @@ UniswapContractArtifact > Source code: /yarn-project/end-to-end/src/cli_docs_sandbox.test.ts#L95-L118 You can see all of our example contracts in the monorepo [here](https://github.com/AztecProtocol/aztec-packages/tree/master/noir-projects/noir-contracts/contracts). - -## Boxes - -The sandbox is shipped with full-stack Aztec project templates, with example Aztec.nr contracts, testing scripts, and web interfaces. - -You can read more information about how to use boxes [here](../guides/blank_box.md). diff --git a/docs/netlify.toml b/docs/netlify.toml index adb1929ab8e..4a2b63e0e92 100644 --- a/docs/netlify.toml +++ b/docs/netlify.toml @@ -190,10 +190,6 @@ from = "/dev_docs/getting_started/sandbox" to = "/developers/getting_started/quickstart" -[[redirects]] - from = "/dev_docs/getting_started/blank_box" - to = "/developers/cli/blank_box" - [[redirects]] from = "/dev_docs/getting_started/updating" to = "/developers/cli/updating"