Skip to content

Commit

Permalink
applying suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Feb 29, 2024
1 parent ca29b1a commit e6bae66
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 5 deletions.
2 changes: 1 addition & 1 deletion boxes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ FROM aztecprotocol/noir-projects as noir-projects
# We need yarn. Start fresh container.
FROM node:18.19.0
RUN apt update && apt install netcat-openbsd
RUN npx -y [email protected] install --with-deps
COPY --from=aztec /usr/src /usr/src
COPY --from=noir /usr/src/noir/target/release/nargo /usr/src/noir/target/release/nargo
COPY --from=noir-projects /usr/src/noir-projects/aztec-nr /usr/src/noir-projects/aztec-nr
WORKDIR /usr/src/boxes
ENV AZTEC_NARGO=/usr/src/noir/target/release/nargo
ENV AZTEC_CLI=/usr/src/yarn-project/cli/aztec-cli-dest
RUN yarn && yarn build
RUN npx -y [email protected] install --with-deps
ENTRYPOINT ["/bin/sh", "-c"]
98 changes: 98 additions & 0 deletions boxes/boxes/react/artifacts/BoxReact.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@

/* Autogenerated file, do not edit! */

/* eslint-disable */
import {
AztecAddress,
AztecAddressLike,
CompleteAddress,
Contract,
ContractArtifact,
ContractBase,
ContractFunctionInteraction,
ContractInstanceWithAddress,
ContractMethod,
DeployMethod,
EthAddress,
EthAddressLike,
FieldLike,
Fr,
FunctionSelectorLike,
loadContractArtifact,
NoirCompiledContract,
Point,
PublicKey,
Wallet,
WrappedFieldLike,
} from '@aztec/aztec.js';
import BoxReactContractArtifactJson from '../src/contracts/target/boxreact-BoxReact.json' assert { type: 'json' };
export const BoxReactContractArtifact = loadContractArtifact(BoxReactContractArtifactJson as NoirCompiledContract);

/**
* Type-safe interface for contract BoxReact;
*/
export class BoxReactContract extends ContractBase {

private constructor(
instance: ContractInstanceWithAddress,
wallet: Wallet,
) {
super(instance, BoxReactContractArtifact, wallet);
}



/**
* Creates a contract instance.
* @param address - The deployed contract's address.
* @param wallet - The wallet to use when interacting with the contract.
* @returns A promise that resolves to a new Contract instance.
*/
public static async at(
address: AztecAddress,
wallet: Wallet,
) {
return Contract.at(address, BoxReactContract.artifact, wallet) as Promise<BoxReactContract>;
}


/**
* Creates a tx to deploy a new instance of this contract.
*/
public static deploy(wallet: Wallet, number: FieldLike, owner: AztecAddressLike) {
return new DeployMethod<BoxReactContract>(Point.ZERO, wallet, BoxReactContractArtifact, BoxReactContract.at, Array.from(arguments).slice(1));
}

/**
* Creates a tx to deploy a new instance of this contract using the specified public key to derive the address.
*/
public static deployWithPublicKey(publicKey: PublicKey, wallet: Wallet, number: FieldLike, owner: AztecAddressLike) {
return new DeployMethod<BoxReactContract>(publicKey, wallet, BoxReactContractArtifact, BoxReactContract.at, Array.from(arguments).slice(2));
}



/**
* Returns this contract's artifact.
*/
public static get artifact(): ContractArtifact {
return BoxReactContractArtifact;
}


/** Type-safe wrappers for the public methods exposed by the contract. */
public methods!: {

/** setNumber(number: field, owner: struct) */
setNumber: ((number: FieldLike, owner: AztecAddressLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;

/** compute_note_hash_and_nullifier(contract_address: struct, nonce: field, storage_slot: field, note_type_id: field, serialized_note: array) */
compute_note_hash_and_nullifier: ((contract_address: AztecAddressLike, nonce: FieldLike, storage_slot: FieldLike, note_type_id: FieldLike, serialized_note: FieldLike[]) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;

/** constructor(number: field, owner: struct) */
constructor: ((number: FieldLike, owner: AztecAddressLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;

/** getNumber(owner: struct) */
getNumber: ((owner: AztecAddressLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
};
}

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions boxes/boxes/vanilla/artifacts/Vanilla.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@

/* Autogenerated file, do not edit! */

/* eslint-disable */
import {
AztecAddress,
AztecAddressLike,
CompleteAddress,
Contract,
ContractArtifact,
ContractBase,
ContractFunctionInteraction,
ContractInstanceWithAddress,
ContractMethod,
DeployMethod,
EthAddress,
EthAddressLike,
FieldLike,
Fr,
FunctionSelectorLike,
loadContractArtifact,
NoirCompiledContract,
Point,
PublicKey,
Wallet,
WrappedFieldLike,
} from '@aztec/aztec.js';
import VanillaContractArtifactJson from '../src/contracts/target/vanilla-Vanilla.json' assert { type: 'json' };
export const VanillaContractArtifact = loadContractArtifact(VanillaContractArtifactJson as NoirCompiledContract);

/**
* Type-safe interface for contract Vanilla;
*/
export class VanillaContract extends ContractBase {

private constructor(
instance: ContractInstanceWithAddress,
wallet: Wallet,
) {
super(instance, VanillaContractArtifact, wallet);
}



/**
* Creates a contract instance.
* @param address - The deployed contract's address.
* @param wallet - The wallet to use when interacting with the contract.
* @returns A promise that resolves to a new Contract instance.
*/
public static async at(
address: AztecAddress,
wallet: Wallet,
) {
return Contract.at(address, VanillaContract.artifact, wallet) as Promise<VanillaContract>;
}


/**
* Creates a tx to deploy a new instance of this contract.
*/
public static deploy(wallet: Wallet, number: FieldLike, owner: AztecAddressLike) {
return new DeployMethod<VanillaContract>(Point.ZERO, wallet, VanillaContractArtifact, VanillaContract.at, Array.from(arguments).slice(1));
}

/**
* Creates a tx to deploy a new instance of this contract using the specified public key to derive the address.
*/
public static deployWithPublicKey(publicKey: PublicKey, wallet: Wallet, number: FieldLike, owner: AztecAddressLike) {
return new DeployMethod<VanillaContract>(publicKey, wallet, VanillaContractArtifact, VanillaContract.at, Array.from(arguments).slice(2));
}



/**
* Returns this contract's artifact.
*/
public static get artifact(): ContractArtifact {
return VanillaContractArtifact;
}


/** Type-safe wrappers for the public methods exposed by the contract. */
public methods!: {

/** constructor(number: field, owner: struct) */
constructor: ((number: FieldLike, owner: AztecAddressLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;

/** getNumber(owner: struct) */
getNumber: ((owner: AztecAddressLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;

/** setNumber(number: field, owner: struct) */
setNumber: ((number: FieldLike, owner: AztecAddressLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;

/** compute_note_hash_and_nullifier(contract_address: struct, nonce: field, storage_slot: field, note_type_id: field, serialized_note: array) */
compute_note_hash_and_nullifier: ((contract_address: AztecAddressLike, nonce: FieldLike, storage_slot: FieldLike, note_type_id: FieldLike, serialized_note: FieldLike[]) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
};
}
1 change: 1 addition & 0 deletions boxes/boxes/vanilla/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Aztec Vanilla JS Box</title><style></style><script defer="defer" src="main.js"></script></head><body><button id="deploy">Deploy</button> <button id="get" hidden>Get Number</button><form id="set" hidden><input id="number" type="number" value="0"/> <button type="submit">Set Number</button></form></body></html>
3 changes: 3 additions & 0 deletions boxes/boxes/vanilla/dist/main.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions boxes/boxes/vanilla/dist/main.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

/*! For license information please see index.js.LICENSE.txt */

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
1 change: 1 addition & 0 deletions boxes/boxes/vanilla/dist/main.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions boxes/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ services:
while ! nc -z aztec 8080; do sleep 1; done;
yarn workspace @aztec/$BOX test
'
ipc: host
cap_add:
- SYS_ADMIN
init: true
environment:
DEBUG: "aztec:*"
DEBUG_COLORS: "true"
Expand Down

0 comments on commit e6bae66

Please sign in to comment.