-
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.
chore: Remove TypeScript tooling from noir-projects. (#4867)
As title.
- Loading branch information
1 parent
c7c24b2
commit 15c5399
Showing
224 changed files
with
60 additions
and
262 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
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
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
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
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
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
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
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,2 +1 @@ | ||
target/ | ||
/src | ||
target |
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,144 +1,3 @@ | ||
# Aztec.nr contracts | ||
# Aztec Example Contracts | ||
|
||
This package contains the source code and the Aztec ABIs for the example contracts used in tests. | ||
|
||
## Disclaimer | ||
|
||
Please note that any example contract set out herein is provided solely for informational purposes only and does not constitute any inducement to use or deploy. Any implementation of any such contract with an interface or any other infrastructure should be used in accordance with applicable laws and regulations. | ||
|
||
## Setup | ||
|
||
### Installing Noir | ||
|
||
An essential tool for managing noir versions is noirup. | ||
|
||
- Install [noirup](https://github.com/noir-lang/noirup) | ||
``` | ||
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash | ||
``` | ||
|
||
### Happy Path | ||
|
||
Currently we all work from a single `aztec` tagged noir release. This release updates independently from noir's regular cadence to allow us to rapidly prototype new features. | ||
It has prebuilt binaries and is super easy to install using `noirup` | ||
|
||
- Install [noirup](https://github.com/noir-lang/noirup) | ||
``` | ||
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash | ||
``` | ||
- Install `aztec` tagged nargo | ||
``` | ||
noirup -v aztec | ||
``` | ||
|
||
> Pinning Aztec flavoured noir releases | ||
> Aztec noir is released with semver alongside noir. If you would like to pin to a specific version you can run: | ||
> | ||
> ```bash | ||
> noirup -v <noir-version>-aztec.<patch version> | ||
> ``` | ||
> | ||
> e.g `noirup -v 0.11.1-aztec.0` | ||
### Building from source (If working with custom features) | ||
- Install [noirup](https://github.com/noir-lang/noirup) | ||
``` | ||
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash | ||
``` | ||
- Nix is already globally installed but path to this installation needs to be added in $HOME/.zshenv so correct configuration can be found by VSCode, do so with: | ||
``` | ||
echo -e '\n# Nix path set globally\nexport PATH="$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$PATH"' >> $HOME/.zshenv | ||
``` | ||
- Enable nix flake command in ~/.config/nix/nix.conf with commands: | ||
``` | ||
mkdir -p $HOME/.config/nix && echo -e '\nexperimental-features = nix-command\nextra-experimental-features = flakes' >> $HOME/.config/nix/nix.conf | ||
``` | ||
- Install direnv into your Nix profile by running: | ||
``` | ||
nix profile install nixpkgs#direnv | ||
``` | ||
- Add direnv to your shell following their guide | ||
``` | ||
echo -e '\n# Adds direnv initialization\neval "$(direnv hook zsh)"' >> $HOME/.zshenv | ||
``` | ||
- VSCode needs to be restarted so direnv plugin can notice env changes with: | ||
``` | ||
kill -9 ps aux | grep $(whoami)/.vscode-server | awk '{print $2}' | ||
``` | ||
- Restart shell | ||
|
||
- Clone noir repo: | ||
|
||
``` | ||
git clone https://github.com/noir-lang/noir.git | ||
``` | ||
|
||
- Checkout your target noir branch | ||
|
||
``` | ||
cd noir | ||
git checkout <branch> | ||
``` | ||
|
||
- Enable direnv | ||
|
||
``` | ||
direnv allow | ||
``` | ||
|
||
- Restart shell | ||
|
||
- Go to the noir dir and install Noir: | ||
``` | ||
cd noir | ||
noirup -p ./ | ||
``` | ||
|
||
### Building the contracts | ||
|
||
- In the aztec-packages repository, go to the directory noir-contracts | ||
|
||
- Use the `noir:build:all` script to compile the contracts you want and prepare the ABI for consumption | ||
|
||
``` | ||
yarn noir:build:all | ||
``` | ||
|
||
Alternatively you can run `yarn noir:build CONTRACT1 CONTRACT2...` to build a subset of contracts: | ||
|
||
``` | ||
yarn noir:build private_token public_token | ||
``` | ||
|
||
To view compilation output, including errors, run with the `VERBOSE=1` flag: | ||
|
||
``` | ||
VERBOSE=1 yarn noir:build private_token public_token | ||
``` | ||
|
||
## Creating a new contract package | ||
|
||
1. Go to `src/contracts` folder. | ||
2. Create a new package whose name has to end with **\_contract**. E.g.: | ||
``` | ||
nargo new --contract example_contract | ||
``` | ||
3. Add the aztec dependency to `nargo.toml`: | ||
|
||
``` | ||
[package] | ||
authors = [""] | ||
compiler_version = "0>=.18.0" | ||
[dependencies] | ||
aztec = { path = "../../../../aztec-nr/aztec" } | ||
``` | ||
|
||
4. Replace the content of the generated `example_contract/src/main.nr` file with your contract code. | ||
5. Go to `noir-contracts` root folder and run `yarn noir:build example` to compile the contract. | ||
6. Export the abi in `src/artifacts/index.ts` to be able to use the contract in the rest of the project: | ||
``` | ||
import ExampleContractJson from './example_contract.json' assert { type: 'json' }; | ||
export const ExampleContractArtifact = ExampleContractJson as ContractArtifact; | ||
``` | ||
You're smart enough to figure it out. |
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
Oops, something went wrong.