Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: boxes boostrap dont use ts-node directly and add .prettierignore #2890

Merged
merged 6 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions yarn-project/boxes/blank-react/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/artifacts/**/*.{ts,json}
1 change: 1 addition & 0 deletions yarn-project/boxes/blank-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"formatting": "prettier --check ./src && eslint ./src",
"formatting:fix": "prettier -w ./src",
"compile": "aztec-cli compile src/contracts --outdir ../artifacts --typescript ../artifacts",
"compile:local": "ts-node --esm ../../cli/src/bin/index.ts compile \"src/contracts\" --outdir \"../artifacts\" --typescript \"../artifacts\"",
"test:integration": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand"
},
"jest": {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank-react/src/artifacts/Blank.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
}
}
}
}
}
36 changes: 27 additions & 9 deletions yarn-project/boxes/blank-react/src/artifacts/Blank.ts
Original file line number Diff line number Diff line change
@@ -1,67 +1,85 @@

/* Autogenerated file, do not edit! */

/* eslint-disable */
import {
AztecAddress,
AztecAddressLike,
CompleteAddress,
Contract,
ContractArtifact,
ContractBase,
ContractFunctionInteraction,
ContractMethod,
DeployMethod,
EthAddress,
FieldLike,
AztecAddressLike,
EthAddressLike,
FieldLike,
Fr,
PXE,
Point,
PublicKey,
Wallet,
} from '@aztec/aztec.js';
import { Fr, Point } from '@aztec/foundation/fields';
import { PXE, PublicKey } from '@aztec/types';
import { ContractArtifact } from '@aztec/foundation/abi';
import BlankContractArtifactJson from './Blank.json' assert { type: 'json' };
export const BlankContractArtifact = BlankContractArtifactJson as ContractArtifact;

/**
* Type-safe interface for contract Blank;
*/
export class BlankContract extends ContractBase {
private constructor(completeAddress: CompleteAddress, wallet: Wallet, portalContract = EthAddress.ZERO) {

private constructor(
completeAddress: CompleteAddress,
wallet: Wallet,
portalContract = EthAddress.ZERO
) {
super(completeAddress, BlankContractArtifact, wallet, portalContract);
}



/**
* 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) {
public static async at(
address: AztecAddress,
wallet: Wallet,
) {
return Contract.at(address, BlankContract.artifact, wallet) as Promise<BlankContract>;
}


/**
* Creates a tx to deploy a new instance of this contract.
*/
public static deploy(pxe: PXE) {
public static deploy(pxe: PXE, ) {
return new DeployMethod<BlankContract>(Point.ZERO, pxe, BlankContractArtifact, 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(pxe: PXE, publicKey: PublicKey) {
public static deployWithPublicKey(pxe: PXE, publicKey: PublicKey, ) {
return new DeployMethod<BlankContract>(publicKey, pxe, BlankContractArtifact, Array.from(arguments).slice(2));
}



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


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

/** getPublicKey(address: field) */
getPublicKey: ((address: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
};
Expand Down
1 change: 1 addition & 0 deletions yarn-project/boxes/blank/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/artifacts/**/*.{ts,json}
1 change: 1 addition & 0 deletions yarn-project/boxes/blank/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"formatting": "prettier --check ./src && eslint ./src",
"formatting:fix": "prettier -w ./src",
"compile": "aztec-cli compile src/contracts --outdir ../artifacts --typescript ../artifacts",
"compile:local": "ts-node --esm ../../cli/src/bin/index.ts compile \"src/contracts\" --outdir \"../artifacts\" --typescript \"../artifacts\"",
"test:integration": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand"
},
"jest": {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank/src/artifacts/Blank.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
}
}
}
}
}
36 changes: 27 additions & 9 deletions yarn-project/boxes/blank/src/artifacts/Blank.ts
Original file line number Diff line number Diff line change
@@ -1,67 +1,85 @@

/* Autogenerated file, do not edit! */

/* eslint-disable */
import {
AztecAddress,
AztecAddressLike,
CompleteAddress,
Contract,
ContractArtifact,
ContractBase,
ContractFunctionInteraction,
ContractMethod,
DeployMethod,
EthAddress,
FieldLike,
AztecAddressLike,
EthAddressLike,
FieldLike,
Fr,
PXE,
Point,
PublicKey,
Wallet,
} from '@aztec/aztec.js';
import { Fr, Point } from '@aztec/foundation/fields';
import { PXE, PublicKey } from '@aztec/types';
import { ContractArtifact } from '@aztec/foundation/abi';
import BlankContractArtifactJson from './Blank.json' assert { type: 'json' };
export const BlankContractArtifact = BlankContractArtifactJson as ContractArtifact;

/**
* Type-safe interface for contract Blank;
*/
export class BlankContract extends ContractBase {
private constructor(completeAddress: CompleteAddress, wallet: Wallet, portalContract = EthAddress.ZERO) {

private constructor(
completeAddress: CompleteAddress,
wallet: Wallet,
portalContract = EthAddress.ZERO
) {
super(completeAddress, BlankContractArtifact, wallet, portalContract);
}



/**
* 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) {
public static async at(
address: AztecAddress,
wallet: Wallet,
) {
return Contract.at(address, BlankContract.artifact, wallet) as Promise<BlankContract>;
}


/**
* Creates a tx to deploy a new instance of this contract.
*/
public static deploy(pxe: PXE) {
public static deploy(pxe: PXE, ) {
return new DeployMethod<BlankContract>(Point.ZERO, pxe, BlankContractArtifact, 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(pxe: PXE, publicKey: PublicKey) {
public static deployWithPublicKey(pxe: PXE, publicKey: PublicKey, ) {
return new DeployMethod<BlankContract>(publicKey, pxe, BlankContractArtifact, Array.from(arguments).slice(2));
}



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


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

/** getPublicKey(address: field) */
getPublicKey: ((address: FieldLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>;
};
Expand Down
11 changes: 3 additions & 8 deletions yarn-project/boxes/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash


# should be run from yarn-project/boxes
original_path=$(pwd)

Expand All @@ -9,16 +8,12 @@ for dir in *; do
# Check if it's a directory
if [ -d "${dir}" ]; then

cd "${dir}"
# Run the compile command
echo "Running compile command inside ${dir}..."

# Change directory to ../cli
cd ../cli

# Run ts-node command to use latest "compile" code
ts-node --esm src/bin/index.ts compile "${original_path}/${dir}/src/contracts" --outdir "${original_path}/${dir}/src/artifacts" --typescript "${original_path}/${dir}/src/artifacts"

yarn formatting:fix
# Runs ts-node command from "../cli" to use latest "compile" code. this uses the yarn command to use the subpackage ts-node dep
yarn compile:local
dan-aztec marked this conversation as resolved.
Show resolved Hide resolved

# Change back to the original directory
cd "${original_path}"
Expand Down
1 change: 1 addition & 0 deletions yarn-project/boxes/token/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/artifacts/**/*.{ts,json}
1 change: 1 addition & 0 deletions yarn-project/boxes/token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"formatting": "prettier --check ./src && eslint ./src",
"formatting:fix": "prettier -w ./src",
"compile": "aztec-cli compile src/contracts --outdir ../artifacts --typescript ../artifacts",
"compile:local": "ts-node --esm ../../cli/src/bin/index.ts compile \"src/contracts\" --outdir \"../artifacts\" --typescript \"../artifacts\"",
"test:integration": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand"
},
"jest": {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/token/src/artifacts/Token.json
Original file line number Diff line number Diff line change
Expand Up @@ -3357,4 +3357,4 @@
}
}
}
}
}
Loading