Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
feat(cli): Noir contract compiler CLI (#1561)
Browse files Browse the repository at this point in the history
Exposes a Noir contract compiler to end users via the CLI. Adds a new
`compile` command in the aztec-cli, also exposed via the `noir-compiler`
package as `aztec-compile contract`. This command compiles a noir
contract using nargo or noir-wasm (defaulting to nargo until
noir-lang/noir#2210 is fixed), then reformats
it for Aztec consumption, and optionally generates typescript wrappers
and noir interfaces. All these actions are also exported as functions
from the `noir-compiler` package, and are now used in the `copy-output`
script.

This PR also makes a few changes to the generated typescript type:
`create` gets renamed to `at` (to make it clear we're not creating a new
contract but creating an instance of the ts wrapper for a contract at an
address) and the import path to the ABI is directly to the JSON file.

We could add more (sub)commands just for generating the typescript or
noir interfaces from the CLI, so it can be used in flows where nargo is
used directly. We should also update the project README and add a page
in the docs about how to compile one's own contracts (not sure if
there's already one in the skeleton).

Fixes #1457
  • Loading branch information
spalladino authored and AztecBot committed Aug 15, 2023
1 parent a3350e6 commit f0e008b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/code_examples/sandbox_example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ await viewUnencryptedLogs();
////////////// QUERYING THE TOKEN BALANCE FOR EACH ACCOUNT //////////////

// Create the contract abstraction and link to Alice's wallet for future signing
const tokenContractAlice = await PrivateTokenContract.create(receipt.contractAddress!, await accounts[0].getWallet());
const tokenContractAlice = await PrivateTokenContract.at(receipt.contractAddress!, await accounts[0].getWallet());

// Bob wants to mint some funds, the contract is already deployed, create an abstraction and link it his wallet
const tokenContractBob = await PrivateTokenContract.create(receipt.contractAddress!, await accounts[1].getWallet());
const tokenContractBob = await PrivateTokenContract.at(receipt.contractAddress!, await accounts[1].getWallet());

const checkBalances = async () => {
// Check Alice's balance
Expand Down

0 comments on commit f0e008b

Please sign in to comment.