-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f9546a
commit 382626c
Showing
133 changed files
with
3,360 additions
and
11,848 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
|
||
node_modules | ||
dest | ||
src/contracts/target | ||
src/contracts/target |
672 changes: 336 additions & 336 deletions
672
boxes/.yarn/releases/yarn-berry.cjs → boxes/.yarn/releases/yarn-4.1.0.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
yarnPath: .yarn/releases/yarn-4.1.0.cjs | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-berry.cjs | ||
logFilters: | ||
- code: YN0013 | ||
level: discard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,42 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
'plugin:import/recommended', | ||
'plugin:import/typescript', | ||
'prettier', | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:import/recommended", | ||
"plugin:import/typescript", | ||
"prettier", | ||
], | ||
settings: { | ||
'import/resolver': { | ||
"import/resolver": { | ||
typescript: true, | ||
node: true, | ||
}, | ||
}, | ||
ignorePatterns: ['dest', 'webpack.config.js', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx'], | ||
parserOptions: { | ||
project: true, | ||
}, | ||
}, | ||
], | ||
ignorePatterns: ["dest", "webpack.config.js", ".eslintrc.cjs"], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["react-refresh"], | ||
rules: { | ||
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'@typescript-eslint/await-thenable': 'error', | ||
'@typescript-eslint/no-floating-promises': 2, | ||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }], | ||
'require-await': 2, | ||
'no-console': 'warn', | ||
'no-constant-condition': 'off', | ||
camelcase: 2, | ||
'no-restricted-imports': [ | ||
'error', | ||
{ | ||
patterns: [ | ||
{ | ||
group: ['client-dest'], | ||
message: "Fix this absolute garbage import. It's your duty to solve it before it spreads.", | ||
}, | ||
{ | ||
group: ['dest'], | ||
message: 'You should not be importing from a build directory. Did you accidentally do a relative import?', | ||
}, | ||
], | ||
}, | ||
"react-refresh/only-export-components": [ | ||
"warn", | ||
{ allowConstantExport: true }, | ||
], | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"@typescript-eslint/await-thenable": "error", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, | ||
], | ||
'import/no-unresolved': 'error', | ||
'import/no-extraneous-dependencies': 'error', | ||
"require-await": 2, | ||
"no-console": "warn", | ||
"no-constant-condition": "off", | ||
camelcase: 2, | ||
"import/no-unresolved": "error", | ||
"import/no-extraneous-dependencies": "error", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,31 @@ | ||
This is a minimal [Aztec](https://aztec.network/) Noir smart contract and frontend bootstrapped with [`aztec-cli unbox`](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/cli). It is recommended you use the `aztec-cli unbox blank-react` command so that the repository is copied with needed modifications from the monorepo subpackage. | ||
# Aztec Box | ||
|
||
## Setup | ||
This box is a one-stop-shop for Aztec that will deploy a blank React Page. You can use it as a boilerplate to start developing your own Aztec app in seconds! | ||
|
||
Dependencies can be installed from the root of the package: | ||
## Prerequisites | ||
|
||
```bash | ||
yarn | ||
yarn install:noir | ||
yarn install:sandbox | ||
``` | ||
|
||
This sandbox requires [Docker](https://www.docker.com/) to be installed _and running_ locally. In the event the image needs updating, you can run `yarn install:sandbox` (see [sandbox docs](https://docs.aztec.network/developers/cli/main) for more information.) | ||
|
||
In addition to the usual javascript dependencies, this project requires `nargo` (package manager) and `noir` (Aztec ZK smart contract language) in addition to `@aztec/aztec-cli`. The former two are installed by `yarn install:noir`. | ||
- You should have Docker installed. If you don't, follow [this guide](https://docs.aztec.network/dev_docs/getting_started/quickstart#install-docker). | ||
|
||
## Getting started | ||
## Installation | ||
|
||
After `yarn` has run,`yarn start:sandbox` in one terminal will launch a local instance of the Aztec sandbox via Docker Compose and `yarn start:dev` will launch a frontend app for deploying and interacting with an empty Aztec smart contract. | ||
Run `npx create-aztec-app` and follow the instructions to clone this repo, install the sandbox and run it on port 8080. | ||
|
||
At this point, [http://localhost:5173](http://localhost:5173) should provide a minimal smart contract frontend. | ||
|
||
This folder should have the following directory structure: | ||
|
||
``` | ||
|— README.md | ||
|— package.json | ||
|— src | ||
|-config.ts - Blank Contract specific configuration for the frontend. | ||
| You may need to update this if you modify the contract functions. | ||
|— app | ||
|— [frontend React .tsx code files] | ||
|- scripts | ||
|- [helpers for frontend to interact with contract on the sandbox] | ||
|— contracts | ||
|— src | ||
| The Noir smart contract source files are here. | ||
|— main.nr - the cloned noir contract, your starting point | ||
|- interface.nr - autogenerated from main.nr when you compile | ||
|— Nargo.toml [Noir build file, includes Aztec smart contract dependencies] | ||
|— artifacts | ||
| These are both generated from `contracts/` by the compile command | ||
|— blank_contract.json | ||
|— blank.ts | ||
|— tests | ||
| A simple end2end test deploying and testing the Blank contract deploys on a local sandbox | ||
| The test requires the sandbox and anvil to be running (`yarn start:sandbox`). | ||
| You can run the tests with `yarn test:integration` | ||
|- blank.contract.test.ts | ||
``` | ||
### 1. Install dependencies | ||
|
||
Most relevant to you is likely `src/contracts/main.nr` (and the build config `src/contracts/Nargo.toml`). This contains the example blank contract logic that the frontend interacts with and is a good place to start writing Noir. | ||
|
||
The `src/artifacts` folder can be re-generated from the command line | ||
Run: | ||
|
||
```bash | ||
yarn compile | ||
yarn | ||
``` | ||
|
||
This will generate a [Contract ABI](src/artifacts/test_contract.json) and TypeScript class for the [Aztec smart contract](src/contracts/main.nr), which the frontend uses to generate the UI. | ||
Time to build. Run: | ||
|
||
Note: the `compile` command seems to generate a Typescript file which needs a single change - | ||
|
||
``` | ||
import TestContractArtifactJson from 'text_contract.json' assert { type: 'json' }; | ||
// need to update the relative import to | ||
import TestContractArtifactJson from './test_contract.json' assert { type: 'json' }; | ||
```bash | ||
yarn dev | ||
``` | ||
|
||
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 artifacts, so they should update automatically after you recompile. | ||
|
||
## Learn More | ||
|
||
To learn more about Noir Smart Contract development, take a look at the following resources: | ||
|
||
- [Awesome Noir](https://github.com/noir-lang/awesome-noir) - learn about the Noir programming language. | ||
Your React app is waiting for you on port 5176. Time to make it your own! | ||
|
||
## Deploy on Aztec3 | ||
[Read the full Sandbox reference](https://docs.aztec.network/dev_docs/cli/sandbox-reference) for more info on what exactly is happening on your machine! | ||
|
||
Coming Soon :) | ||
Visit the [Aztec Docs](https://docs.aztec.network) for more information on how Aztec works, and the [Awesome Aztec Repository](https://github.com/AztecProtocol/awesome-aztec) for more cool projects, boilerplates and tooling. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Private Token Noir Smart Contract</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/index.js"></script> | ||
</body> | ||
<style> | ||
#root { | ||
width: 100%; | ||
text-align: center; | ||
} | ||
|
||
body { | ||
display: flex; | ||
place-items: center; | ||
background: linear-gradient(#f6fbfc, #d8d4e7); | ||
min-height: 100vh; | ||
} | ||
</style> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.