From 4dc8cbe3daa70ef7a6ce572c0bc77f5d047ca20d Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Tue, 21 Nov 2023 16:55:31 -0800 Subject: [PATCH 01/12] remove founation and types deps --- yarn-project/aztec.js/src/index.ts | 33 ++++++++++--------- yarn-project/boxes/blank-react/package.json | 2 -- .../app/components/contract_function_form.tsx | 9 +++-- .../boxes/blank-react/src/app/contract.tsx | 7 ++-- .../src/scripts/call_contract_function.ts | 4 +-- .../src/scripts/deploy_contract.ts | 4 +-- .../boxes/blank-react/src/scripts/util.ts | 12 +++++-- .../src/scripts/view_contract_function.ts | 3 +- .../src/tests/blank.contract.test.ts | 2 +- yarn-project/boxes/blank/package.json | 1 - yarn-project/boxes/blank/src/index.ts | 6 ++-- yarn-project/boxes/token/package.json | 2 -- .../app/components/contract_function_form.tsx | 9 +++-- yarn-project/boxes/token/src/app/contract.tsx | 7 ++-- .../src/scripts/call_contract_function.ts | 3 +- .../token/src/scripts/deploy_contract.ts | 4 +-- yarn-project/boxes/token/src/scripts/util.ts | 12 +++++-- .../src/scripts/view_contract_function.ts | 3 +- .../token/src/tests/token.contract.test.ts | 7 ++-- 19 files changed, 65 insertions(+), 65 deletions(-) diff --git a/yarn-project/aztec.js/src/index.ts b/yarn-project/aztec.js/src/index.ts index ee1572613ee..ddb3333f347 100644 --- a/yarn-project/aztec.js/src/index.ts +++ b/yarn-project/aztec.js/src/index.ts @@ -1,10 +1,10 @@ +export * from './account/index.js'; export * from './contract/index.js'; +export * from './contract_deployer/deploy_method.js'; export * from './contract_deployer/index.js'; -export * from './utils/index.js'; export * from './pxe_client.js'; -export * from './account/index.js'; -export * from './contract_deployer/deploy_method.js'; export * from './sandbox/index.js'; +export * from './utils/index.js'; export * from './wallet/index.js'; // TODO https://github.com/AztecProtocol/aztec-packages/issues/2632 --> FunctionSelector might not need to be exposed @@ -13,11 +13,11 @@ export { AztecAddress, CircuitsWasm, EthAddress, - Point, Fr, FunctionSelector, GlobalVariables, GrumpkinScalar, + Point, getContractDeploymentInfo, } from '@aztec/circuits.js'; export { Grumpkin, Schnorr } from '@aztec/circuits.js/barretenberg'; @@ -25,13 +25,14 @@ export { Grumpkin, Schnorr } from '@aztec/circuits.js/barretenberg'; export { AuthWitness, AztecNode, + CompleteAddress, ContractData, DeployedContract, ExtendedContractData, ExtendedNote, FunctionCall, - INITIAL_L2_BLOCK_NUM, GrumpkinPrivateKey, + INITIAL_L2_BLOCK_NUM, L2Actor, L2Block, L2BlockL2Logs, @@ -40,10 +41,10 @@ export { MerkleTreeId, NodeInfo, Note, + PXE, PackedArguments, PartialAddress, PublicKey, - PXE, SyncStatus, Tx, TxExecutionRequest, @@ -51,25 +52,27 @@ export { TxReceipt, TxStatus, UnencryptedL2Log, - emptyFunctionCall, createAztecNodeClient, + emptyFunctionCall, merkleTreeIds, mockTx, } from '@aztec/types'; -export { ContractArtifact } from '@aztec/foundation/abi'; +export { ContractArtifact, FunctionArtifact, encodeArguments } from '@aztec/foundation/abi'; +export { toBigIntBE } from '@aztec/foundation/bigint-buffer'; +export * from '@aztec/foundation/crypto'; export { DebugLogger, createDebugLogger, onLog } from '@aztec/foundation/log'; -export { fileURLToPath } from '@aztec/foundation/url'; -export { sleep } from '@aztec/foundation/sleep'; -export { elapsed } from '@aztec/foundation/timer'; export { retry, retryUntil } from '@aztec/foundation/retry'; -export * from '@aztec/foundation/crypto'; export { to2Fields, toBigInt } from '@aztec/foundation/serialize'; -export { toBigIntBE } from '@aztec/foundation/bigint-buffer'; +export { sleep } from '@aztec/foundation/sleep'; +export { elapsed } from '@aztec/foundation/timer'; +export { fileURLToPath } from '@aztec/foundation/url'; export { - deployL1Contract, - deployL1Contracts, DeployL1Contracts, L1ContractArtifactsForDeployment, + deployL1Contract, + deployL1Contracts, } from '@aztec/ethereum'; + +export { FieldsOf } from '@aztec/foundation/types'; diff --git a/yarn-project/boxes/blank-react/package.json b/yarn-project/boxes/blank-react/package.json index d8d97c6ba6e..e19cbf6ba0b 100644 --- a/yarn-project/boxes/blank-react/package.json +++ b/yarn-project/boxes/blank-react/package.json @@ -38,8 +38,6 @@ "@aztec/aztec-ui": "^0.1.14", "@aztec/aztec.js": "workspace:^", "@aztec/circuits.js": "workspace:^", - "@aztec/foundation": "workspace:^", - "@aztec/types": "workspace:^", "classnames": "^2.3.2", "formik": "^2.4.3", "node-sass": "^9.0.0", diff --git a/yarn-project/boxes/blank-react/src/app/components/contract_function_form.tsx b/yarn-project/boxes/blank-react/src/app/components/contract_function_form.tsx index 484a7b10207..e241e289813 100644 --- a/yarn-project/boxes/blank-react/src/app/components/contract_function_form.tsx +++ b/yarn-project/boxes/blank-react/src/app/components/contract_function_form.tsx @@ -1,12 +1,11 @@ +import { Button, Loader } from '@aztec/aztec-ui'; +import { AztecAddress, CompleteAddress, ContractArtifact, Fr, FunctionArtifact } from '@aztec/aztec.js'; +import { useFormik } from 'formik'; +import * as Yup from 'yup'; import { CONTRACT_ADDRESS_PARAM_NAMES, pxe } from '../../config.js'; import { callContractFunction, deployContract, viewContractFunction } from '../../scripts/index.js'; import { convertArgs } from '../../scripts/util.js'; import styles from './contract_function_form.module.scss'; -import { Button, Loader } from '@aztec/aztec-ui'; -import { AztecAddress, CompleteAddress, Fr } from '@aztec/aztec.js'; -import { ContractArtifact, FunctionArtifact } from '@aztec/foundation/abi'; -import { useFormik } from 'formik'; -import * as Yup from 'yup'; type NoirFunctionYupSchema = { // hack: add `any` at the end to get the array schema to typecheck diff --git a/yarn-project/boxes/blank-react/src/app/contract.tsx b/yarn-project/boxes/blank-react/src/app/contract.tsx index 3f1bd526956..28db28c8af8 100644 --- a/yarn-project/boxes/blank-react/src/app/contract.tsx +++ b/yarn-project/boxes/blank-react/src/app/contract.tsx @@ -1,11 +1,10 @@ +import { Button, ButtonSize, ButtonTheme, Card, CardTheme, ImageButton, ImageButtonIcon } from '@aztec/aztec-ui'; +import { AztecAddress, CompleteAddress, FunctionArtifact } from '@aztec/aztec.js'; +import { ReactNode, useState } from 'react'; import { contractArtifact } from '../config.js'; import { Copy } from './components/copy.js'; import { ContractFunctionForm, Popup } from './components/index.js'; import styles from './contract.module.scss'; -import { Button, ButtonSize, ButtonTheme, Card, CardTheme, ImageButton, ImageButtonIcon } from '@aztec/aztec-ui'; -import { AztecAddress, CompleteAddress } from '@aztec/aztec.js'; -import { FunctionArtifact } from '@aztec/foundation/abi'; -import { ReactNode, useState } from 'react'; const functionTypeSortOrder = { secret: 0, diff --git a/yarn-project/boxes/blank-react/src/scripts/call_contract_function.ts b/yarn-project/boxes/blank-react/src/scripts/call_contract_function.ts index 54e971ff68d..d80037eed84 100644 --- a/yarn-project/boxes/blank-react/src/scripts/call_contract_function.ts +++ b/yarn-project/boxes/blank-react/src/scripts/call_contract_function.ts @@ -1,7 +1,5 @@ import { getWallet } from './util.js'; -import { AztecAddress, PXE, CompleteAddress, Contract, TxReceipt } from '@aztec/aztec.js'; -import { ContractArtifact } from '@aztec/foundation/abi'; -import { FieldsOf } from '@aztec/foundation/types'; +import { AztecAddress, CompleteAddress, Contract, ContractArtifact, FieldsOf, PXE, TxReceipt } from '@aztec/aztec.js'; export async function callContractFunction( address: AztecAddress, diff --git a/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts b/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts index 08725e90dd6..8cde9eb5b9d 100644 --- a/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts +++ b/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts @@ -1,6 +1,4 @@ -import { AztecAddress, CompleteAddress, DeployMethod, Fr } from '@aztec/aztec.js'; -import { ContractArtifact } from '@aztec/foundation/abi'; -import { PXE } from '@aztec/types'; +import { AztecAddress, CompleteAddress, ContractArtifact, DeployMethod, Fr, PXE } from '@aztec/aztec.js'; export async function deployContract( activeWallet: CompleteAddress, diff --git a/yarn-project/boxes/blank-react/src/scripts/util.ts b/yarn-project/boxes/blank-react/src/scripts/util.ts index bea2bcba47f..cde41403d55 100644 --- a/yarn-project/boxes/blank-react/src/scripts/util.ts +++ b/yarn-project/boxes/blank-react/src/scripts/util.ts @@ -1,6 +1,12 @@ -import { AccountWallet, Fr, getSandboxAccountsWallets } from '@aztec/aztec.js'; -import { FunctionArtifact, encodeArguments } from '@aztec/foundation/abi'; -import { PXE, CompleteAddress } from '@aztec/types'; +import { + AccountWallet, + CompleteAddress, + Fr, + FunctionArtifact, + PXE, + encodeArguments, + getSandboxAccountsWallets, +} from '@aztec/aztec.js'; export function convertArgs(functionAbi: FunctionArtifact, args: any): Fr[] { const untypedArgs = functionAbi.parameters.map(param => { diff --git a/yarn-project/boxes/blank-react/src/scripts/view_contract_function.ts b/yarn-project/boxes/blank-react/src/scripts/view_contract_function.ts index 8b3bfd8e901..beff0032c77 100644 --- a/yarn-project/boxes/blank-react/src/scripts/view_contract_function.ts +++ b/yarn-project/boxes/blank-react/src/scripts/view_contract_function.ts @@ -1,6 +1,5 @@ import { getWallet } from './util.js'; -import { AztecAddress, PXE, CompleteAddress, Contract } from '@aztec/aztec.js'; -import { ContractArtifact } from '@aztec/foundation/abi'; +import { AztecAddress, CompleteAddress, Contract, ContractArtifact, PXE } from '@aztec/aztec.js'; export async function viewContractFunction( address: AztecAddress, diff --git a/yarn-project/boxes/blank-react/src/tests/blank.contract.test.ts b/yarn-project/boxes/blank-react/src/tests/blank.contract.test.ts index 6f906bfe35c..62fc7b7d1da 100644 --- a/yarn-project/boxes/blank-react/src/tests/blank.contract.test.ts +++ b/yarn-project/boxes/blank-react/src/tests/blank.contract.test.ts @@ -9,10 +9,10 @@ import { PXE, TxStatus, Wallet, + createDebugLogger, createPXEClient, waitForSandbox, } from '@aztec/aztec.js'; -import { createDebugLogger } from '@aztec/foundation/log'; const logger = createDebugLogger('aztec:http-pxe-client'); diff --git a/yarn-project/boxes/blank/package.json b/yarn-project/boxes/blank/package.json index dd7928c6d36..34859a17ae6 100644 --- a/yarn-project/boxes/blank/package.json +++ b/yarn-project/boxes/blank/package.json @@ -38,7 +38,6 @@ "@aztec/aztec-ui": "^0.1.14", "@aztec/aztec.js": "workspace:^", "@aztec/circuits.js": "workspace:^", - "@aztec/foundation": "workspace:^", "serve": "^14.2.1" }, "devDependencies": { diff --git a/yarn-project/boxes/blank/src/index.ts b/yarn-project/boxes/blank/src/index.ts index 518e2cfc75b..000a7322f22 100644 --- a/yarn-project/boxes/blank/src/index.ts +++ b/yarn-project/boxes/blank/src/index.ts @@ -5,15 +5,17 @@ import { AztecAddress, CompleteAddress, Contract, + ContractArtifact, DeployMethod, + FieldsOf, Fr, + FunctionArtifact, PXE, TxReceipt, createPXEClient, + encodeArguments, getSandboxAccountsWallets, } from '@aztec/aztec.js'; -import { ContractArtifact, FunctionArtifact, encodeArguments } from '@aztec/foundation/abi'; -import { FieldsOf } from '@aztec/foundation/types'; // docs:end:imports diff --git a/yarn-project/boxes/token/package.json b/yarn-project/boxes/token/package.json index d80c4536a6e..4bc99417cf7 100644 --- a/yarn-project/boxes/token/package.json +++ b/yarn-project/boxes/token/package.json @@ -38,8 +38,6 @@ "@aztec/aztec-ui": "^0.1.14", "@aztec/aztec.js": "workspace:^", "@aztec/circuits.js": "workspace:^", - "@aztec/foundation": "workspace:^", - "@aztec/types": "workspace:^", "classnames": "^2.3.2", "formik": "^2.4.3", "node-sass": "^9.0.0", diff --git a/yarn-project/boxes/token/src/app/components/contract_function_form.tsx b/yarn-project/boxes/token/src/app/components/contract_function_form.tsx index 01abc409157..8ddc5acb549 100644 --- a/yarn-project/boxes/token/src/app/components/contract_function_form.tsx +++ b/yarn-project/boxes/token/src/app/components/contract_function_form.tsx @@ -1,12 +1,11 @@ +import { Button, Loader } from '@aztec/aztec-ui'; +import { AztecAddress, CompleteAddress, ContractArtifact, Fr, FunctionArtifact } from '@aztec/aztec.js'; +import { useFormik } from 'formik'; +import * as Yup from 'yup'; import { CONTRACT_ADDRESS_PARAM_NAMES, pxe } from '../../config.js'; import { callContractFunction, deployContract, viewContractFunction } from '../../scripts/index.js'; import { convertArgs } from '../../scripts/util.js'; import styles from './contract_function_form.module.scss'; -import { Button, Loader } from '@aztec/aztec-ui'; -import { AztecAddress, CompleteAddress, Fr } from '@aztec/aztec.js'; -import { ContractArtifact, FunctionArtifact } from '@aztec/foundation/abi'; -import { useFormik } from 'formik'; -import * as Yup from 'yup'; const DEFAULT_FIELD_VALUE = 100; interface BasicParamDef { diff --git a/yarn-project/boxes/token/src/app/contract.tsx b/yarn-project/boxes/token/src/app/contract.tsx index 3bf292a5b4b..39e9e1e0077 100644 --- a/yarn-project/boxes/token/src/app/contract.tsx +++ b/yarn-project/boxes/token/src/app/contract.tsx @@ -1,11 +1,10 @@ +import { Button, ButtonSize, ButtonTheme, Card, CardTheme, ImageButton, ImageButtonIcon } from '@aztec/aztec-ui'; +import { AztecAddress, CompleteAddress, FunctionArtifact } from '@aztec/aztec.js'; +import { ReactNode, useState } from 'react'; import { FILTERED_FUNCTION_NAMES, contractArtifact } from '../config.js'; import { Copy } from './components/copy.js'; import { ContractFunctionForm, Popup } from './components/index.js'; import styles from './contract.module.scss'; -import { Button, ButtonSize, ButtonTheme, Card, CardTheme, ImageButton, ImageButtonIcon } from '@aztec/aztec-ui'; -import { AztecAddress, CompleteAddress } from '@aztec/aztec.js'; -import { FunctionArtifact } from '@aztec/foundation/abi'; -import { ReactNode, useState } from 'react'; const functionTypeSortOrder = { secret: 0, diff --git a/yarn-project/boxes/token/src/scripts/call_contract_function.ts b/yarn-project/boxes/token/src/scripts/call_contract_function.ts index 854803eaa42..b05492f065f 100644 --- a/yarn-project/boxes/token/src/scripts/call_contract_function.ts +++ b/yarn-project/boxes/token/src/scripts/call_contract_function.ts @@ -1,6 +1,5 @@ import { getWallet } from './util.js'; -import { AztecAddress, PXE, CompleteAddress, Contract } from '@aztec/aztec.js'; -import { ContractArtifact } from '@aztec/foundation/abi'; +import { AztecAddress, CompleteAddress, Contract, ContractArtifact, PXE } from '@aztec/aztec.js'; export async function callContractFunction( address: AztecAddress, diff --git a/yarn-project/boxes/token/src/scripts/deploy_contract.ts b/yarn-project/boxes/token/src/scripts/deploy_contract.ts index 84c28cf6318..272ebc637ed 100644 --- a/yarn-project/boxes/token/src/scripts/deploy_contract.ts +++ b/yarn-project/boxes/token/src/scripts/deploy_contract.ts @@ -1,6 +1,4 @@ -import { AztecAddress, CompleteAddress, DeployMethod, Fr } from '@aztec/aztec.js'; -import { ContractArtifact } from '@aztec/foundation/abi'; -import { PXE } from '@aztec/types'; +import { AztecAddress, CompleteAddress, ContractArtifact, DeployMethod, Fr, PXE } from '@aztec/aztec.js'; export async function deployContract( activeWallet: CompleteAddress, diff --git a/yarn-project/boxes/token/src/scripts/util.ts b/yarn-project/boxes/token/src/scripts/util.ts index 6b6b8884ca8..f2aa3609e15 100644 --- a/yarn-project/boxes/token/src/scripts/util.ts +++ b/yarn-project/boxes/token/src/scripts/util.ts @@ -1,6 +1,12 @@ -import { AccountWallet, Fr, getSandboxAccountsWallets } from '@aztec/aztec.js'; -import { FunctionArtifact, encodeArguments } from '@aztec/foundation/abi'; -import { CompleteAddress, PXE } from '@aztec/types'; +import { + AccountWallet, + CompleteAddress, + Fr, + FunctionArtifact, + PXE, + encodeArguments, + getSandboxAccountsWallets, +} from '@aztec/aztec.js'; function convertBasicArg(paramType: string, value: any) { switch (paramType) { diff --git a/yarn-project/boxes/token/src/scripts/view_contract_function.ts b/yarn-project/boxes/token/src/scripts/view_contract_function.ts index 8b3bfd8e901..beff0032c77 100644 --- a/yarn-project/boxes/token/src/scripts/view_contract_function.ts +++ b/yarn-project/boxes/token/src/scripts/view_contract_function.ts @@ -1,6 +1,5 @@ import { getWallet } from './util.js'; -import { AztecAddress, PXE, CompleteAddress, Contract } from '@aztec/aztec.js'; -import { ContractArtifact } from '@aztec/foundation/abi'; +import { AztecAddress, CompleteAddress, Contract, ContractArtifact, PXE } from '@aztec/aztec.js'; export async function viewContractFunction( address: AztecAddress, diff --git a/yarn-project/boxes/token/src/tests/token.contract.test.ts b/yarn-project/boxes/token/src/tests/token.contract.test.ts index 0ec4dee07cc..2ff90186f74 100644 --- a/yarn-project/boxes/token/src/tests/token.contract.test.ts +++ b/yarn-project/boxes/token/src/tests/token.contract.test.ts @@ -2,6 +2,9 @@ import { TokenContract } from '../artifacts/Token.js'; import { TokenSimulator } from './token_simulator.js'; import { AccountWallet, + CompleteAddress, + DebugLogger, + ExtendedNote, Fr, Note, PXE, @@ -9,13 +12,11 @@ import { TxStatus, computeAuthWitMessageHash, computeMessageSecretHash, + createDebugLogger, createPXEClient, getSandboxAccountsWallets, waitForSandbox, } from '@aztec/aztec.js'; -import { CompleteAddress } from '@aztec/circuits.js'; -import { DebugLogger, createDebugLogger } from '@aztec/foundation/log'; -import { ExtendedNote } from '@aztec/types'; import { afterEach, beforeAll, expect, jest } from '@jest/globals'; // assumes sandbox is running locally, which this script does not trigger From d9e6ae6f461c394c0f58e8a6e03edad8dbe5e4bc Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Tue, 21 Nov 2023 16:55:56 -0800 Subject: [PATCH 02/12] yarn.lock update --- yarn-project/yarn.lock | 5 ----- 1 file changed, 5 deletions(-) diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index 310ecc555ab..2e3b30acf7e 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -7316,8 +7316,6 @@ __metadata: "@aztec/aztec-ui": ^0.1.14 "@aztec/aztec.js": "workspace:^" "@aztec/circuits.js": "workspace:^" - "@aztec/foundation": "workspace:^" - "@aztec/types": "workspace:^" "@types/jest": ^29.5.0 "@types/mocha": ^10.0.3 "@types/node": ^20.5.9 @@ -7367,7 +7365,6 @@ __metadata: "@aztec/aztec-ui": ^0.1.14 "@aztec/aztec.js": "workspace:^" "@aztec/circuits.js": "workspace:^" - "@aztec/foundation": "workspace:^" "@types/jest": ^29.5.0 "@types/mocha": ^10.0.3 "@typescript-eslint/eslint-plugin": ^6.0.0 @@ -18965,8 +18962,6 @@ __metadata: "@aztec/aztec-ui": ^0.1.14 "@aztec/aztec.js": "workspace:^" "@aztec/circuits.js": "workspace:^" - "@aztec/foundation": "workspace:^" - "@aztec/types": "workspace:^" "@jest/globals": ^29.6.4 "@types/jest": ^29.5.0 "@types/mocha": ^10.0.3 From 86570046f033f579acb71ee85351e3a2bea3f7a4 Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Tue, 21 Nov 2023 17:03:10 -0800 Subject: [PATCH 03/12] tsconfig.json --- yarn-project/boxes/blank-react/tsconfig.dest.json | 2 +- yarn-project/boxes/blank-react/tsconfig.json | 6 ------ yarn-project/boxes/blank/tsconfig.dest.json | 2 +- yarn-project/boxes/blank/tsconfig.json | 3 --- yarn-project/boxes/token/tsconfig.dest.json | 2 +- yarn-project/boxes/token/tsconfig.json | 6 ------ 6 files changed, 3 insertions(+), 18 deletions(-) diff --git a/yarn-project/boxes/blank-react/tsconfig.dest.json b/yarn-project/boxes/blank-react/tsconfig.dest.json index 1b9c3a4a72e..97c9e8ef0da 100644 --- a/yarn-project/boxes/blank-react/tsconfig.dest.json +++ b/yarn-project/boxes/blank-react/tsconfig.dest.json @@ -1,5 +1,5 @@ { "extends": ".", - "references": [{ "path": "../../aztec.js" }, { "path": "../../foundation" }, { "path": "../../types" }], + "references": [{ "path": "../../aztec.js" }], "exclude": ["src/**/*.test.ts"] } diff --git a/yarn-project/boxes/blank-react/tsconfig.json b/yarn-project/boxes/blank-react/tsconfig.json index 755ee612d17..ad21dec6045 100644 --- a/yarn-project/boxes/blank-react/tsconfig.json +++ b/yarn-project/boxes/blank-react/tsconfig.json @@ -29,11 +29,5 @@ { "path": "../../circuits.js" }, - { - "path": "../../foundation" - }, - { - "path": "../../types" - } ] } diff --git a/yarn-project/boxes/blank/tsconfig.dest.json b/yarn-project/boxes/blank/tsconfig.dest.json index 1b9c3a4a72e..97c9e8ef0da 100644 --- a/yarn-project/boxes/blank/tsconfig.dest.json +++ b/yarn-project/boxes/blank/tsconfig.dest.json @@ -1,5 +1,5 @@ { "extends": ".", - "references": [{ "path": "../../aztec.js" }, { "path": "../../foundation" }, { "path": "../../types" }], + "references": [{ "path": "../../aztec.js" }], "exclude": ["src/**/*.test.ts"] } diff --git a/yarn-project/boxes/blank/tsconfig.json b/yarn-project/boxes/blank/tsconfig.json index 4973d658b21..ad21dec6045 100644 --- a/yarn-project/boxes/blank/tsconfig.json +++ b/yarn-project/boxes/blank/tsconfig.json @@ -29,8 +29,5 @@ { "path": "../../circuits.js" }, - { - "path": "../../foundation" - } ] } diff --git a/yarn-project/boxes/token/tsconfig.dest.json b/yarn-project/boxes/token/tsconfig.dest.json index 1b9c3a4a72e..97c9e8ef0da 100644 --- a/yarn-project/boxes/token/tsconfig.dest.json +++ b/yarn-project/boxes/token/tsconfig.dest.json @@ -1,5 +1,5 @@ { "extends": ".", - "references": [{ "path": "../../aztec.js" }, { "path": "../../foundation" }, { "path": "../../types" }], + "references": [{ "path": "../../aztec.js" }], "exclude": ["src/**/*.test.ts"] } diff --git a/yarn-project/boxes/token/tsconfig.json b/yarn-project/boxes/token/tsconfig.json index 755ee612d17..ad21dec6045 100644 --- a/yarn-project/boxes/token/tsconfig.json +++ b/yarn-project/boxes/token/tsconfig.json @@ -29,11 +29,5 @@ { "path": "../../circuits.js" }, - { - "path": "../../foundation" - }, - { - "path": "../../types" - } ] } From e549db487cae7fa04077dcc122cf825dc0ee1f1f Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Tue, 21 Nov 2023 22:42:06 -0800 Subject: [PATCH 04/12] double export of CompleteAddress --- yarn-project/aztec.js/src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/yarn-project/aztec.js/src/index.ts b/yarn-project/aztec.js/src/index.ts index ddb3333f347..97428088ee3 100644 --- a/yarn-project/aztec.js/src/index.ts +++ b/yarn-project/aztec.js/src/index.ts @@ -25,7 +25,6 @@ export { Grumpkin, Schnorr } from '@aztec/circuits.js/barretenberg'; export { AuthWitness, AztecNode, - CompleteAddress, ContractData, DeployedContract, ExtendedContractData, From bacf06e26f93823e043b5ec71f2bd50a064fb735 Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Tue, 21 Nov 2023 23:00:16 -0800 Subject: [PATCH 05/12] missing import --- yarn-project/boxes/blank/src/tests/blank.contract.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/boxes/blank/src/tests/blank.contract.test.ts b/yarn-project/boxes/blank/src/tests/blank.contract.test.ts index 7e076b22bda..6fb153315f0 100644 --- a/yarn-project/boxes/blank/src/tests/blank.contract.test.ts +++ b/yarn-project/boxes/blank/src/tests/blank.contract.test.ts @@ -9,10 +9,10 @@ import { PXE, TxStatus, Wallet, + createDebugLogger, createPXEClient, waitForSandbox, } from '@aztec/aztec.js'; -import { createDebugLogger } from '@aztec/foundation/log'; const logger = createDebugLogger('aztec:blank-box-test'); From 28d7aaa3bbf547a75dc522b8650ff4e5d458308d Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Wed, 22 Nov 2023 07:38:25 -0800 Subject: [PATCH 06/12] format toen --- .../token/src/app/components/contract_function_form.tsx | 8 ++++---- yarn-project/boxes/token/src/app/contract.tsx | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/yarn-project/boxes/token/src/app/components/contract_function_form.tsx b/yarn-project/boxes/token/src/app/components/contract_function_form.tsx index 8ddc5acb549..3f736a4e667 100644 --- a/yarn-project/boxes/token/src/app/components/contract_function_form.tsx +++ b/yarn-project/boxes/token/src/app/components/contract_function_form.tsx @@ -1,11 +1,11 @@ -import { Button, Loader } from '@aztec/aztec-ui'; -import { AztecAddress, CompleteAddress, ContractArtifact, Fr, FunctionArtifact } from '@aztec/aztec.js'; -import { useFormik } from 'formik'; -import * as Yup from 'yup'; import { CONTRACT_ADDRESS_PARAM_NAMES, pxe } from '../../config.js'; import { callContractFunction, deployContract, viewContractFunction } from '../../scripts/index.js'; import { convertArgs } from '../../scripts/util.js'; import styles from './contract_function_form.module.scss'; +import { Button, Loader } from '@aztec/aztec-ui'; +import { AztecAddress, CompleteAddress, ContractArtifact, Fr, FunctionArtifact } from '@aztec/aztec.js'; +import { useFormik } from 'formik'; +import * as Yup from 'yup'; const DEFAULT_FIELD_VALUE = 100; interface BasicParamDef { diff --git a/yarn-project/boxes/token/src/app/contract.tsx b/yarn-project/boxes/token/src/app/contract.tsx index 39e9e1e0077..f4a76c2bfbe 100644 --- a/yarn-project/boxes/token/src/app/contract.tsx +++ b/yarn-project/boxes/token/src/app/contract.tsx @@ -1,10 +1,10 @@ -import { Button, ButtonSize, ButtonTheme, Card, CardTheme, ImageButton, ImageButtonIcon } from '@aztec/aztec-ui'; -import { AztecAddress, CompleteAddress, FunctionArtifact } from '@aztec/aztec.js'; -import { ReactNode, useState } from 'react'; import { FILTERED_FUNCTION_NAMES, contractArtifact } from '../config.js'; import { Copy } from './components/copy.js'; import { ContractFunctionForm, Popup } from './components/index.js'; import styles from './contract.module.scss'; +import { Button, ButtonSize, ButtonTheme, Card, CardTheme, ImageButton, ImageButtonIcon } from '@aztec/aztec-ui'; +import { AztecAddress, CompleteAddress, FunctionArtifact } from '@aztec/aztec.js'; +import { ReactNode, useState } from 'react'; const functionTypeSortOrder = { secret: 0, From a619c3e639281c8a073b789dd9e381891b15c726 Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Mon, 27 Nov 2023 08:46:18 -0800 Subject: [PATCH 07/12] lingering import --- yarn-project/boxes/token/src/config.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yarn-project/boxes/token/src/config.ts b/yarn-project/boxes/token/src/config.ts index 94a28ae43bd..86d549894a3 100644 --- a/yarn-project/boxes/token/src/config.ts +++ b/yarn-project/boxes/token/src/config.ts @@ -1,6 +1,5 @@ import { TokenContractArtifact } from './artifacts/Token.js'; -import { PXE, createPXEClient } from '@aztec/aztec.js'; -import { ContractArtifact } from '@aztec/foundation/abi'; +import { ContractArtifact, PXE, createPXEClient } from '@aztec/aztec.js'; // update this if using a different contract From f3cd8a9a4c5a17f3b0057d972bc4eb5f87916f00 Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Mon, 27 Nov 2023 09:36:17 -0800 Subject: [PATCH 08/12] formatting --- .../src/app/components/contract_function_form.tsx | 8 ++++---- yarn-project/boxes/blank-react/src/app/contract.tsx | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/yarn-project/boxes/blank-react/src/app/components/contract_function_form.tsx b/yarn-project/boxes/blank-react/src/app/components/contract_function_form.tsx index e241e289813..66609bd2ab9 100644 --- a/yarn-project/boxes/blank-react/src/app/components/contract_function_form.tsx +++ b/yarn-project/boxes/blank-react/src/app/components/contract_function_form.tsx @@ -1,11 +1,11 @@ -import { Button, Loader } from '@aztec/aztec-ui'; -import { AztecAddress, CompleteAddress, ContractArtifact, Fr, FunctionArtifact } from '@aztec/aztec.js'; -import { useFormik } from 'formik'; -import * as Yup from 'yup'; import { CONTRACT_ADDRESS_PARAM_NAMES, pxe } from '../../config.js'; import { callContractFunction, deployContract, viewContractFunction } from '../../scripts/index.js'; import { convertArgs } from '../../scripts/util.js'; import styles from './contract_function_form.module.scss'; +import { Button, Loader } from '@aztec/aztec-ui'; +import { AztecAddress, CompleteAddress, ContractArtifact, Fr, FunctionArtifact } from '@aztec/aztec.js'; +import { useFormik } from 'formik'; +import * as Yup from 'yup'; type NoirFunctionYupSchema = { // hack: add `any` at the end to get the array schema to typecheck diff --git a/yarn-project/boxes/blank-react/src/app/contract.tsx b/yarn-project/boxes/blank-react/src/app/contract.tsx index 28db28c8af8..6dfbc219589 100644 --- a/yarn-project/boxes/blank-react/src/app/contract.tsx +++ b/yarn-project/boxes/blank-react/src/app/contract.tsx @@ -1,10 +1,10 @@ -import { Button, ButtonSize, ButtonTheme, Card, CardTheme, ImageButton, ImageButtonIcon } from '@aztec/aztec-ui'; -import { AztecAddress, CompleteAddress, FunctionArtifact } from '@aztec/aztec.js'; -import { ReactNode, useState } from 'react'; import { contractArtifact } from '../config.js'; import { Copy } from './components/copy.js'; import { ContractFunctionForm, Popup } from './components/index.js'; import styles from './contract.module.scss'; +import { Button, ButtonSize, ButtonTheme, Card, CardTheme, ImageButton, ImageButtonIcon } from '@aztec/aztec-ui'; +import { AztecAddress, CompleteAddress, FunctionArtifact } from '@aztec/aztec.js'; +import { ReactNode, useState } from 'react'; const functionTypeSortOrder = { secret: 0, From 0d14ef79628de768ce5e02ccee6faced51e20d37 Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Mon, 27 Nov 2023 13:56:05 -0800 Subject: [PATCH 09/12] remove wasm and circuits.js dep! --- yarn-project/boxes/blank-react/package.json | 1 - yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts | 2 ++ yarn-project/boxes/blank-react/tsconfig.json | 3 --- yarn-project/boxes/blank/package.json | 1 - yarn-project/boxes/blank/tsconfig.json | 3 --- yarn-project/boxes/token/package.json | 1 - yarn-project/boxes/token/tsconfig.json | 3 --- yarn-project/foundation/src/abi/function_selector.ts | 2 +- yarn-project/foundation/src/aztec-address/index.ts | 2 +- yarn-project/yarn.lock | 3 --- 10 files changed, 4 insertions(+), 17 deletions(-) diff --git a/yarn-project/boxes/blank-react/package.json b/yarn-project/boxes/blank-react/package.json index e19cbf6ba0b..3174826d119 100644 --- a/yarn-project/boxes/blank-react/package.json +++ b/yarn-project/boxes/blank-react/package.json @@ -37,7 +37,6 @@ "dependencies": { "@aztec/aztec-ui": "^0.1.14", "@aztec/aztec.js": "workspace:^", - "@aztec/circuits.js": "workspace:^", "classnames": "^2.3.2", "formik": "^2.4.3", "node-sass": "^9.0.0", diff --git a/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts b/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts index 8cde9eb5b9d..cdabed895bf 100644 --- a/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts +++ b/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts @@ -10,7 +10,9 @@ export async function deployContract( const tx = new DeployMethod(activeWallet.publicKey, pxe, contractArtifact, typedArgs).send({ contractAddressSalt: salt, }); + console.log('tx', tx); await tx.wait(); + console.log('tx receipt', tx.getReceipt()); const receipt = await tx.getReceipt(); if (receipt.contractAddress) { return receipt.contractAddress; diff --git a/yarn-project/boxes/blank-react/tsconfig.json b/yarn-project/boxes/blank-react/tsconfig.json index ad21dec6045..831cd23a900 100644 --- a/yarn-project/boxes/blank-react/tsconfig.json +++ b/yarn-project/boxes/blank-react/tsconfig.json @@ -26,8 +26,5 @@ { "path": "../../aztec.js" }, - { - "path": "../../circuits.js" - }, ] } diff --git a/yarn-project/boxes/blank/package.json b/yarn-project/boxes/blank/package.json index 34859a17ae6..12d5c45576d 100644 --- a/yarn-project/boxes/blank/package.json +++ b/yarn-project/boxes/blank/package.json @@ -37,7 +37,6 @@ "dependencies": { "@aztec/aztec-ui": "^0.1.14", "@aztec/aztec.js": "workspace:^", - "@aztec/circuits.js": "workspace:^", "serve": "^14.2.1" }, "devDependencies": { diff --git a/yarn-project/boxes/blank/tsconfig.json b/yarn-project/boxes/blank/tsconfig.json index ad21dec6045..831cd23a900 100644 --- a/yarn-project/boxes/blank/tsconfig.json +++ b/yarn-project/boxes/blank/tsconfig.json @@ -26,8 +26,5 @@ { "path": "../../aztec.js" }, - { - "path": "../../circuits.js" - }, ] } diff --git a/yarn-project/boxes/token/package.json b/yarn-project/boxes/token/package.json index 4bc99417cf7..81ee3dce74a 100644 --- a/yarn-project/boxes/token/package.json +++ b/yarn-project/boxes/token/package.json @@ -37,7 +37,6 @@ "dependencies": { "@aztec/aztec-ui": "^0.1.14", "@aztec/aztec.js": "workspace:^", - "@aztec/circuits.js": "workspace:^", "classnames": "^2.3.2", "formik": "^2.4.3", "node-sass": "^9.0.0", diff --git a/yarn-project/boxes/token/tsconfig.json b/yarn-project/boxes/token/tsconfig.json index ad21dec6045..831cd23a900 100644 --- a/yarn-project/boxes/token/tsconfig.json +++ b/yarn-project/boxes/token/tsconfig.json @@ -26,8 +26,5 @@ { "path": "../../aztec.js" }, - { - "path": "../../circuits.js" - }, ] } diff --git a/yarn-project/foundation/src/abi/function_selector.ts b/yarn-project/foundation/src/abi/function_selector.ts index f2776319f15..bc3a7dcfdc0 100644 --- a/yarn-project/foundation/src/abi/function_selector.ts +++ b/yarn-project/foundation/src/abi/function_selector.ts @@ -116,7 +116,7 @@ export class FunctionSelector { static fromString(selector: string) { const buf = Buffer.from(selector.replace(/^0x/i, ''), 'hex'); if (buf.length !== FunctionSelector.SIZE) { - throw new Error(`Invalid length ${buf.length}.`); + throw new Error(`Invalid FunctionSelector length ${buf.length}.`); } return FunctionSelector.fromBuffer(buf); } diff --git a/yarn-project/foundation/src/aztec-address/index.ts b/yarn-project/foundation/src/aztec-address/index.ts index 4c042ad96c6..a03257f36de 100644 --- a/yarn-project/foundation/src/aztec-address/index.ts +++ b/yarn-project/foundation/src/aztec-address/index.ts @@ -10,7 +10,7 @@ import { Fr } from '../fields/index.js'; export class AztecAddress extends Fr { constructor(buffer: Buffer) { if (buffer.length !== 32) { - throw new Error(`Invalid length ${buffer.length}.`); + throw new Error(`Invalid AztecAddress length ${buffer.length}.`); } super(buffer); } diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index b174083b096..2a3ac61da30 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -7273,7 +7273,6 @@ __metadata: dependencies: "@aztec/aztec-ui": ^0.1.14 "@aztec/aztec.js": "workspace:^" - "@aztec/circuits.js": "workspace:^" "@types/jest": ^29.5.0 "@types/mocha": ^10.0.3 "@types/node": ^20.5.9 @@ -7322,7 +7321,6 @@ __metadata: dependencies: "@aztec/aztec-ui": ^0.1.14 "@aztec/aztec.js": "workspace:^" - "@aztec/circuits.js": "workspace:^" "@types/jest": ^29.5.0 "@types/mocha": ^10.0.3 "@typescript-eslint/eslint-plugin": ^6.0.0 @@ -18912,7 +18910,6 @@ __metadata: dependencies: "@aztec/aztec-ui": ^0.1.14 "@aztec/aztec.js": "workspace:^" - "@aztec/circuits.js": "workspace:^" "@jest/globals": ^29.6.4 "@types/jest": ^29.5.0 "@types/mocha": ^10.0.3 From 984f89bf5aad6fa9e4229d64e4321bfe4480c06d Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Mon, 27 Nov 2023 21:14:14 -0800 Subject: [PATCH 10/12] one missing dep update --- yarn-project/boxes/blank-react/src/config.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yarn-project/boxes/blank-react/src/config.ts b/yarn-project/boxes/blank-react/src/config.ts index f693a4c7fe9..6521f4df01c 100644 --- a/yarn-project/boxes/blank-react/src/config.ts +++ b/yarn-project/boxes/blank-react/src/config.ts @@ -1,6 +1,5 @@ import { BlankContractArtifact } from './artifacts/Blank.js'; -import { PXE, createPXEClient } from '@aztec/aztec.js'; -import { ContractArtifact } from '@aztec/foundation/abi'; +import { ContractArtifact, PXE, createPXEClient } from '@aztec/aztec.js'; // update this if using a different contract From a847aaa8e5a66f7a0ead4c45d7e43b4c42a29170 Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Tue, 28 Nov 2023 12:53:46 -0800 Subject: [PATCH 11/12] leftover log --- yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts b/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts index cdabed895bf..8cde9eb5b9d 100644 --- a/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts +++ b/yarn-project/boxes/blank-react/src/scripts/deploy_contract.ts @@ -10,9 +10,7 @@ export async function deployContract( const tx = new DeployMethod(activeWallet.publicKey, pxe, contractArtifact, typedArgs).send({ contractAddressSalt: salt, }); - console.log('tx', tx); await tx.wait(); - console.log('tx receipt', tx.getReceipt()); const receipt = await tx.getReceipt(); if (receipt.contractAddress) { return receipt.contractAddress; From 6556ef5f6895f6acda940d339c8687699773981c Mon Sep 17 00:00:00 2001 From: Dan Lee Date: Tue, 5 Dec 2023 12:43:16 -0800 Subject: [PATCH 12/12] format --- yarn-project/aztec.js/src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/yarn-project/aztec.js/src/index.ts b/yarn-project/aztec.js/src/index.ts index eec6bc6a268..38f1bc8970f 100644 --- a/yarn-project/aztec.js/src/index.ts +++ b/yarn-project/aztec.js/src/index.ts @@ -114,7 +114,6 @@ export { mockTx, } from '@aztec/types'; - // TODO: These kinds of things have no place on our public api. // External devs will almost certainly have their own methods of doing these things. // If we want to use them in our own "aztec.js consuming code", import them from foundation as needed.