diff --git a/docs/docs/migration_notes.md b/docs/docs/migration_notes.md index 348697ad9eb..5e376e4909a 100644 --- a/docs/docs/migration_notes.md +++ b/docs/docs/migration_notes.md @@ -6,6 +6,12 @@ keywords: [sandbox, aztec, notes, migration, updating, upgrading] Aztec is in full-speed development. Literally every version breaks compatibility with the previous ones. This page attempts to target errors and difficulties you might encounter when upgrading, and how to resolve them. +## 0.68.0 + +### Noir contracts package no longer exposes artifacts as default export + +To reduce loading times, the package `@aztec/noir-contracts.js` no longer exposes all artifacts as its default export. Instead, it exposes a `ContractNames` variable with the list of all contract names available. To import a given artifact, use the corresponding export, such as `@aztec/noir-contracts.js/FPC`. + ## 0.67.0 ### L2 Gas limit of 6M enforced for public portion of TX @@ -24,10 +30,11 @@ The `Header` struct has been renamed to `BlockHeader`, and the `get_header()` fa ### Outgoing Events removed Previously, every event which was emitted included: + - Incoming Header (to convey the app contract address to the recipient) - Incoming Ciphertext (to convey the note contents to the recipient) - Outgoing Header (served as a backup, to convey the app contract address to the "outgoing viewer" - most likely the sender) -- Outgoing Ciphertext (served as a backup, encrypting the summetric key of the incoming ciphertext to the "outgoing viewer" - most likely the sender) +- Outgoing Ciphertext (served as a backup, encrypting the symmetric key of the incoming ciphertext to the "outgoing viewer" - most likely the sender) The latter two have been removed from the `.emit()` functions, so now only an Incoming Header and Incoming Ciphertext will be emitted. @@ -43,6 +50,7 @@ The `getOutgoingNotes` function is removed from the PXE interface. Some aztec.nr library methods' arguments are simplified to remove an `outgoing_viewer` parameter. E.g. `ValueNote::increment`, `ValueNote::decrement`, `ValueNote::decrement_by_at_most`, `EasyPrivateUint::add`, `EasyPrivateUint::sub`. Further changes are planned, so that: + - Outgoing ciphertexts (or any kind of abstract ciphertext) can be emitted by a contract, and on the other side discovered and then processed by the contract. - Headers will be removed, due to the new tagging scheme. diff --git a/yarn-project/archiver/src/factory.ts b/yarn-project/archiver/src/factory.ts index 45ab9705429..afeb43cf7cb 100644 --- a/yarn-project/archiver/src/factory.ts +++ b/yarn-project/archiver/src/factory.ts @@ -8,7 +8,8 @@ import { createLogger } from '@aztec/foundation/log'; import { type Maybe } from '@aztec/foundation/types'; import { type DataStoreConfig } from '@aztec/kv-store/config'; import { createStore } from '@aztec/kv-store/lmdb'; -import { TokenBridgeContractArtifact, TokenContractArtifact } from '@aztec/noir-contracts.js'; +import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token'; +import { TokenBridgeContractArtifact } from '@aztec/noir-contracts.js/TokenBridge'; import { getCanonicalProtocolContract, protocolContractNames } from '@aztec/protocol-contracts'; import { type TelemetryClient } from '@aztec/telemetry-client'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; diff --git a/yarn-project/bot/src/bot.ts b/yarn-project/bot/src/bot.ts index 0cf02b758fe..3a9c9e48871 100644 --- a/yarn-project/bot/src/bot.ts +++ b/yarn-project/bot/src/bot.ts @@ -10,7 +10,8 @@ import { import { type AztecNode, type FunctionCall, type PXE } from '@aztec/circuit-types'; import { Gas } from '@aztec/circuits.js'; import { times } from '@aztec/foundation/collection'; -import { type EasyPrivateTokenContract, type TokenContract } from '@aztec/noir-contracts.js'; +import { type EasyPrivateTokenContract } from '@aztec/noir-contracts.js/EasyPrivateToken'; +import { type TokenContract } from '@aztec/noir-contracts.js/Token'; import { type BotConfig } from './config.js'; import { BotFactory } from './factory.js'; diff --git a/yarn-project/bot/src/factory.ts b/yarn-project/bot/src/factory.ts index 03098a3095c..440b219a3f5 100644 --- a/yarn-project/bot/src/factory.ts +++ b/yarn-project/bot/src/factory.ts @@ -9,7 +9,7 @@ import { } from '@aztec/aztec.js'; import { type AztecNode, type FunctionCall, type PXE } from '@aztec/circuit-types'; import { Fr, deriveSigningKey } from '@aztec/circuits.js'; -import { EasyPrivateTokenContract } from '@aztec/noir-contracts.js'; +import { EasyPrivateTokenContract } from '@aztec/noir-contracts.js/EasyPrivateToken'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { type BotConfig, SupportedTokenContracts } from './config.js'; diff --git a/yarn-project/bot/src/utils.ts b/yarn-project/bot/src/utils.ts index 0bc402c6a34..9a463598263 100644 --- a/yarn-project/bot/src/utils.ts +++ b/yarn-project/bot/src/utils.ts @@ -1,5 +1,5 @@ import { type AztecAddress } from '@aztec/circuits.js'; -import { type EasyPrivateTokenContract } from '@aztec/noir-contracts.js'; +import { type EasyPrivateTokenContract } from '@aztec/noir-contracts.js/EasyPrivateToken'; import { type TokenContract } from '@aztec/noir-contracts.js/Token'; /** diff --git a/yarn-project/cli/src/cmds/contracts/inspect_contract.ts b/yarn-project/cli/src/cmds/contracts/inspect_contract.ts index f1d4bbbb8ed..0c79238ae00 100644 --- a/yarn-project/cli/src/cmds/contracts/inspect_contract.ts +++ b/yarn-project/cli/src/cmds/contracts/inspect_contract.ts @@ -25,10 +25,18 @@ export async function inspectContract(contractArtifactFile: string, debugLogger: log(`\tprivate function tree root: ${contractClass.privateFunctionsRoot.toString()}`); log(`\tpublic bytecode commitment: ${contractClass.publicBytecodeCommitment.toString()}`); log(`\tpublic bytecode length: ${contractClass.packedBytecode.length} bytes (${bytecodeLengthInFields} fields)`); - log(`\nExternal functions:`); - contractFns.filter(f => !f.isInternal).forEach(f => logFunction(f, log)); - log(`\nInternal functions:`); - contractFns.filter(f => f.isInternal).forEach(f => logFunction(f, log)); + + const externalFunctions = contractFns.filter(f => !f.isInternal); + if (externalFunctions.length > 0) { + log(`\nExternal functions:`); + externalFunctions.forEach(f => logFunction(f, log)); + } + + const internalFunctions = contractFns.filter(f => f.isInternal); + if (internalFunctions.length > 0) { + log(`\nInternal functions:`); + internalFunctions.forEach(f => logFunction(f, log)); + } } function logFunction(fn: FunctionArtifact, log: LogFn) { diff --git a/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts b/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts index 462ae4649bd..9ba166fad9d 100644 --- a/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts +++ b/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts @@ -161,7 +161,10 @@ async function deployToken( ): Promise<{ token: ContractDeploymentInfo; bridge: ContractDeploymentInfo }> { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment - const { TokenContract, TokenBridgeContract } = await import('@aztec/noir-contracts.js'); + const { TokenContract } = await import('@aztec/noir-contracts.js/Token'); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment + const { TokenBridgeContract } = await import('@aztec/noir-contracts.js/TokenBridge'); const devCoin = await TokenContract.deploy(wallet, wallet.getAddress(), 'DevCoin', 'DEV', 18) .send({ universalDeploy: true }) .deployed(waitOpts); @@ -223,7 +226,7 @@ async function deployFPC( ): Promise { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment - const { FPCContract } = await import('@aztec/noir-contracts.js'); + const { FPCContract } = await import('@aztec/noir-contracts.js/FPC'); const fpc = await FPCContract.deploy(wallet, tokenAddress, feeRecipient) .send({ universalDeploy: true }) .deployed(waitOpts); @@ -238,7 +241,7 @@ async function deployFPC( async function deployCounter(wallet: Wallet): Promise { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment - const { CounterContract } = await import('@aztec/noir-contracts.js'); + const { CounterContract } = await import('@aztec/noir-contracts.js/Counter'); const counter = await CounterContract.deploy(wallet, 1, wallet.getAddress()) .send({ universalDeploy: true }) .deployed(waitOpts); @@ -260,7 +263,10 @@ async function fundFPC( ) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment - const { FeeJuiceContract, CounterContract } = await import('@aztec/noir-contracts.js'); + const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice'); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment + const { CounterContract } = await import('@aztec/noir-contracts.js/Counter'); const { protocolContractAddresses: { feeJuice }, } = await wallet.getPXEInfo(); diff --git a/yarn-project/cli/src/cmds/misc/example_contracts.ts b/yarn-project/cli/src/cmds/misc/example_contracts.ts index c2f9d172b45..1c012f59f0c 100644 --- a/yarn-project/cli/src/cmds/misc/example_contracts.ts +++ b/yarn-project/cli/src/cmds/misc/example_contracts.ts @@ -1,9 +1,12 @@ import { type LogFn } from '@aztec/foundation/log'; -import { getExampleContractArtifacts } from '../../utils/aztec.js'; +import { getExampleContractNames } from '../../utils/aztec.js'; export async function exampleContracts(log: LogFn) { - const abisList = await getExampleContractArtifacts(); - const names = Object.keys(abisList).filter(name => name !== 'AvmTestContractArtifact'); - names.forEach(name => log(name)); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment + return (await getExampleContractNames()) + .filter(name => name !== 'AvmTest') + .sort() + .forEach(name => log(name)); } diff --git a/yarn-project/cli/src/cmds/misc/setup_contracts.ts b/yarn-project/cli/src/cmds/misc/setup_contracts.ts index 70ea4b79dc6..d2d13c5ad1c 100644 --- a/yarn-project/cli/src/cmds/misc/setup_contracts.ts +++ b/yarn-project/cli/src/cmds/misc/setup_contracts.ts @@ -14,7 +14,7 @@ export async function setupCanonicalL2FeeJuice( ) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment - const { FeeJuiceContract } = await import('@aztec/noir-contracts.js'); + const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice'); const feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, deployer); diff --git a/yarn-project/cli/src/utils/aztec.ts b/yarn-project/cli/src/utils/aztec.ts index 97759f65ec5..9949adb635a 100644 --- a/yarn-project/cli/src/utils/aztec.ts +++ b/yarn-project/cli/src/utils/aztec.ts @@ -23,13 +23,6 @@ import { import { encodeArgs } from './encoding.js'; -/** - * Helper type to dynamically import contracts. - */ -interface ArtifactsType { - [key: string]: ContractArtifact; -} - /** * Helper to get an ABI function or throw error if it doesn't exist. * @param artifact - Contract's build artifact in JSON format. @@ -98,13 +91,13 @@ export async function setAssumeProvenThrough( /** * Gets all contracts available in \@aztec/noir-contracts.js. - * @returns The contract ABIs. + * @returns The contract names. */ -export async function getExampleContractArtifacts(): Promise { +export async function getExampleContractNames(): Promise { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment - const imports = await import('@aztec/noir-contracts.js'); - return Object.fromEntries(Object.entries(imports).filter(([key]) => key.endsWith('Artifact'))) as any; + const { ContractNames } = await import('@aztec/noir-contracts.js'); + return ContractNames; } /** @@ -114,11 +107,17 @@ export async function getExampleContractArtifacts(): Promise { */ export async function getContractArtifact(fileDir: string, log: LogFn) { // first check if it's a noir-contracts example - const artifacts = await getExampleContractArtifacts(); - for (const key of [fileDir, fileDir + 'Artifact', fileDir + 'ContractArtifact']) { - if (artifacts[key]) { - return artifacts[key] as ContractArtifact; + const allNames = await getExampleContractNames(); + const contractName = fileDir.replace(/Contract(Artifact)?$/, ''); + if (allNames.includes(contractName)) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment + const imported = await import(`@aztec/noir-contracts.js/${contractName}`); + const artifact = imported[`${contractName}ContractArtifact`] as ContractArtifact; + if (!artifact) { + throw Error(`Could not import ${contractName}ContractArtifact from @aztec/noir-contracts.js/${contractName}`); } + return artifact; } let contents: string; diff --git a/yarn-project/end-to-end/src/benchmarks/bench_prover.test.ts b/yarn-project/end-to-end/src/benchmarks/bench_prover.test.ts index 49a09404359..5cfda3ff9d6 100644 --- a/yarn-project/end-to-end/src/benchmarks/bench_prover.test.ts +++ b/yarn-project/end-to-end/src/benchmarks/bench_prover.test.ts @@ -3,7 +3,10 @@ import { PublicFeePaymentMethod, TxStatus, sleep } from '@aztec/aztec.js'; import { type AccountWallet } from '@aztec/aztec.js/wallet'; import { BBCircuitVerifier } from '@aztec/bb-prover'; import { CompleteAddress, FEE_FUNDING_FOR_TESTER_ACCOUNT, Fq, Fr, GasSettings } from '@aztec/circuits.js'; -import { FPCContract, FeeJuiceContract, TestContract, TokenContract } from '@aztec/noir-contracts.js'; +import { FPCContract } from '@aztec/noir-contracts.js/FPC'; +import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice'; +import { TestContract } from '@aztec/noir-contracts.js/Test'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { ProtocolContractAddress } from '@aztec/protocol-contracts'; import { type PXEService, type PXEServiceConfig, createPXEService } from '@aztec/pxe'; diff --git a/yarn-project/end-to-end/src/benchmarks/bench_tx_size_fees.test.ts b/yarn-project/end-to-end/src/benchmarks/bench_tx_size_fees.test.ts index 63f485f9c1a..a998193f7f8 100644 --- a/yarn-project/end-to-end/src/benchmarks/bench_tx_size_fees.test.ts +++ b/yarn-project/end-to-end/src/benchmarks/bench_tx_size_fees.test.ts @@ -8,7 +8,9 @@ import { TxStatus, } from '@aztec/aztec.js'; import { FEE_FUNDING_FOR_TESTER_ACCOUNT, GasSettings } from '@aztec/circuits.js'; -import { FPCContract, FeeJuiceContract, TokenContract } from '@aztec/noir-contracts.js'; +import { FPCContract } from '@aztec/noir-contracts.js/FPC'; +import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { ProtocolContractAddress } from '@aztec/protocol-contracts'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/devnet/e2e_smoke.test.ts b/yarn-project/end-to-end/src/devnet/e2e_smoke.test.ts index 1a12baf2596..776b09f6865 100644 --- a/yarn-project/end-to-end/src/devnet/e2e_smoke.test.ts +++ b/yarn-project/end-to-end/src/devnet/e2e_smoke.test.ts @@ -19,7 +19,8 @@ import { deriveSigningKey } from '@aztec/circuits.js'; import { createNamespacedSafeJsonRpcServer, startHttpRpcServer } from '@aztec/foundation/json-rpc/server'; import { type Logger } from '@aztec/foundation/log'; import { promiseWithResolvers } from '@aztec/foundation/promise'; -import { FeeJuiceContract, TestContract } from '@aztec/noir-contracts.js'; +import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice'; +import { TestContract } from '@aztec/noir-contracts.js/Test'; import getPort from 'get-port'; import { exec } from 'node:child_process'; diff --git a/yarn-project/end-to-end/src/e2e_2_pxes.test.ts b/yarn-project/end-to-end/src/e2e_2_pxes.test.ts index eaa70fa10ff..d52f3494ecd 100644 --- a/yarn-project/end-to-end/src/e2e_2_pxes.test.ts +++ b/yarn-project/end-to-end/src/e2e_2_pxes.test.ts @@ -10,7 +10,9 @@ import { type Wallet, sleep, } from '@aztec/aztec.js'; -import { ChildContract, TestContract, TokenContract } from '@aztec/noir-contracts.js'; +import { ChildContract } from '@aztec/noir-contracts.js/Child'; +import { TestContract } from '@aztec/noir-contracts.js/Test'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { expect, jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_amm.test.ts b/yarn-project/end-to-end/src/e2e_amm.test.ts index 476bfb8be8b..9e87c17cc45 100644 --- a/yarn-project/end-to-end/src/e2e_amm.test.ts +++ b/yarn-project/end-to-end/src/e2e_amm.test.ts @@ -1,5 +1,6 @@ import { type AccountWallet, Fr, type Logger, type Wallet } from '@aztec/aztec.js'; -import { AMMContract, type TokenContract } from '@aztec/noir-contracts.js'; +import { AMMContract } from '@aztec/noir-contracts.js/AMM'; +import { type TokenContract } from '@aztec/noir-contracts.js/Token'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_authwit.test.ts b/yarn-project/end-to-end/src/e2e_authwit.test.ts index b8e19acb6f1..71d4331f054 100644 --- a/yarn-project/end-to-end/src/e2e_authwit.test.ts +++ b/yarn-project/end-to-end/src/e2e_authwit.test.ts @@ -1,5 +1,6 @@ import { type AccountWallet, Fr, computeAuthWitMessageHash, computeInnerAuthWitHash } from '@aztec/aztec.js'; -import { AuthRegistryContract, AuthWitTestContract } from '@aztec/noir-contracts.js'; +import { AuthRegistryContract } from '@aztec/noir-contracts.js/AuthRegistry'; +import { AuthWitTestContract } from '@aztec/noir-contracts.js/AuthWitTest'; import { ProtocolContractAddress } from '@aztec/protocol-contracts'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_avm_simulator.test.ts b/yarn-project/end-to-end/src/e2e_avm_simulator.test.ts index 8ec9c96f24d..b8e26d7f97e 100644 --- a/yarn-project/end-to-end/src/e2e_avm_simulator.test.ts +++ b/yarn-project/end-to-end/src/e2e_avm_simulator.test.ts @@ -1,5 +1,6 @@ import { type AccountWallet, AztecAddress, BatchCall, Fr, TxStatus } from '@aztec/aztec.js'; -import { AvmInitializerTestContract, AvmTestContract } from '@aztec/noir-contracts.js'; +import { AvmInitializerTestContract } from '@aztec/noir-contracts.js/AvmInitializerTest'; +import { AvmTestContract } from '@aztec/noir-contracts.js/AvmTest'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts index d7dc45a2ca6..da4af23cdcc 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +++ b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts @@ -10,7 +10,9 @@ import { computeSecretHash, createLogger, } from '@aztec/aztec.js'; -import { DocsExampleContract, TokenBlacklistContract, type TokenContract } from '@aztec/noir-contracts.js'; +import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample'; +import { type TokenContract } from '@aztec/noir-contracts.js/Token'; +import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_block_building.test.ts b/yarn-project/end-to-end/src/e2e_block_building.test.ts index 29635955b8b..71ae0eeab25 100644 --- a/yarn-project/end-to-end/src/e2e_block_building.test.ts +++ b/yarn-project/end-to-end/src/e2e_block_building.test.ts @@ -20,7 +20,7 @@ import { import { getL1ContractsConfigEnvVars } from '@aztec/ethereum'; import { times } from '@aztec/foundation/collection'; import { poseidon2Hash } from '@aztec/foundation/crypto'; -import { StatefulTestContract, StatefulTestContractArtifact } from '@aztec/noir-contracts.js'; +import { StatefulTestContract, StatefulTestContractArtifact } from '@aztec/noir-contracts.js/StatefulTest'; import { TestContract } from '@aztec/noir-contracts.js/Test'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; diff --git a/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts b/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts index 6dc08e64aee..280a8e5b743 100644 --- a/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts +++ b/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts @@ -1,6 +1,6 @@ import { type AztecAddress, type CheatCodes, EthAddress, Fr, type Wallet } from '@aztec/aztec.js'; import { RollupAbi } from '@aztec/l1-artifacts'; -import { TokenContract } from '@aztec/noir-contracts.js'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { type Account, diff --git a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts index 2ee9eee8b68..b0d724f44f5 100644 --- a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +++ b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts @@ -12,7 +12,8 @@ import { } from '@aztec/aztec.js'; import { createL1Clients } from '@aztec/ethereum'; import { InboxAbi, OutboxAbi, RollupAbi } from '@aztec/l1-artifacts'; -import { TokenBridgeContract, TokenContract } from '@aztec/noir-contracts.js'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; +import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge'; import { type Chain, type HttpTransport, type PublicClient, getContract } from 'viem'; diff --git a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/l1_to_l2.test.ts b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/l1_to_l2.test.ts index 7ff83ac3156..8c67dd634ba 100644 --- a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/l1_to_l2.test.ts +++ b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/l1_to_l2.test.ts @@ -1,5 +1,5 @@ import { type AztecAddress, Fr, generateClaimSecret } from '@aztec/aztec.js'; -import { TestContract } from '@aztec/noir-contracts.js'; +import { TestContract } from '@aztec/noir-contracts.js/Test'; import { sendL1ToL2Message } from '../fixtures/l1_to_l2_messaging.js'; import { CrossChainMessagingTest } from './cross_chain_messaging_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/l2_to_l1.test.ts b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/l2_to_l1.test.ts index 60eb205af6e..bbe6be8e993 100644 --- a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/l2_to_l1.test.ts +++ b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/l2_to_l1.test.ts @@ -1,7 +1,7 @@ import { Fr } from '@aztec/aztec.js'; import { sha256ToField } from '@aztec/foundation/crypto'; import { OutboxAbi } from '@aztec/l1-artifacts'; -import { TestContract } from '@aztec/noir-contracts.js'; +import { TestContract } from '@aztec/noir-contracts.js/Test'; import { type Hex, decodeEventLog, getContract } from 'viem'; diff --git a/yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts b/yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts index 4dcc22cad57..0ac2e55f332 100644 --- a/yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts +++ b/yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts @@ -12,9 +12,9 @@ import { deriveKeys, } from '@aztec/aztec.js'; import { GasSettings, TxContext, computePartialAddress } from '@aztec/circuits.js'; -import { InclusionProofsContract } from '@aztec/noir-contracts.js'; import { ClaimContract } from '@aztec/noir-contracts.js/Claim'; import { CrowdfundingContract } from '@aztec/noir-contracts.js/Crowdfunding'; +import { InclusionProofsContract } from '@aztec/noir-contracts.js/InclusionProofs'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts index 4ef0d5014d8..3cb28f8d7f2 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts @@ -23,8 +23,9 @@ import { import { type ContractClassIdPreimage, PublicKeys, computeContractClassId } from '@aztec/circuits.js'; import { FunctionSelector, FunctionType } from '@aztec/foundation/abi'; import { writeTestData } from '@aztec/foundation/testing'; -import { StatefulTestContract, TokenContractArtifact } from '@aztec/noir-contracts.js'; +import { StatefulTestContract } from '@aztec/noir-contracts.js/StatefulTest'; import { TestContract } from '@aztec/noir-contracts.js/Test'; +import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token'; import { DUPLICATE_NULLIFIER_ERROR } from '../fixtures/fixtures.js'; import { DeployTest, type StatefulContractCtorArgs } from './deploy_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts index a4d305c089e..5f2fe0781b4 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts @@ -1,6 +1,7 @@ import { getDeployedTestAccountsWallets } from '@aztec/accounts/testing'; import { AztecAddress, type Logger, type PXE, type Wallet, createPXEClient, makeFetch } from '@aztec/aztec.js'; -import { CounterContract, StatefulTestContract } from '@aztec/noir-contracts.js'; +import { CounterContract } from '@aztec/noir-contracts.js/Counter'; +import { StatefulTestContract } from '@aztec/noir-contracts.js/StatefulTest'; import { TestContract } from '@aztec/noir-contracts.js/Test'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts index 2632b9e4d6d..4dbbc665577 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts @@ -13,7 +13,7 @@ import { createLogger, getContractInstanceFromDeployParams, } from '@aztec/aztec.js'; -import { type StatefulTestContract } from '@aztec/noir-contracts.js'; +import { type StatefulTestContract } from '@aztec/noir-contracts.js/StatefulTest'; import { type ISnapshotManager, addAccounts, createSnapshotManager } from '../fixtures/snapshot_manager.js'; diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts index 1187950bbe9..81603e318ea 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts @@ -8,7 +8,7 @@ import { type Wallet, getContractInstanceFromDeployParams, } from '@aztec/aztec.js'; -import { StatefulTestContract } from '@aztec/noir-contracts.js'; +import { StatefulTestContract } from '@aztec/noir-contracts.js/StatefulTest'; import { TestContractArtifact } from '@aztec/noir-contracts.js/Test'; import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token'; diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts index 8978e4f6a62..788ba730118 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts @@ -1,6 +1,6 @@ import { BatchCall, Fr, type Logger, type PXE, SignerlessWallet, type Wallet } from '@aztec/aztec.js'; import { siloNullifier } from '@aztec/circuits.js/hash'; -import { StatefulTestContract } from '@aztec/noir-contracts.js'; +import { StatefulTestContract } from '@aztec/noir-contracts.js/StatefulTest'; import { TestContract } from '@aztec/noir-contracts.js/Test'; import { DeployTest, type StatefulContractCtorArgs } from './deploy_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_event_logs.test.ts b/yarn-project/end-to-end/src/e2e_event_logs.test.ts index cdaf45e61d6..914b99ad8ac 100644 --- a/yarn-project/end-to-end/src/e2e_event_logs.test.ts +++ b/yarn-project/end-to-end/src/e2e_event_logs.test.ts @@ -9,7 +9,7 @@ import { import { EventSelector } from '@aztec/foundation/abi'; import { makeTuple } from '@aztec/foundation/array'; import { type Tuple } from '@aztec/foundation/serialize'; -import { type ExampleEvent0, type ExampleEvent1, TestLogContract } from '@aztec/noir-contracts.js'; +import { type ExampleEvent0, type ExampleEvent1, TestLogContract } from '@aztec/noir-contracts.js/TestLog'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_fees/account_init.test.ts b/yarn-project/end-to-end/src/e2e_fees/account_init.test.ts index 820d2a51ea5..f4464e972c4 100644 --- a/yarn-project/end-to-end/src/e2e_fees/account_init.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/account_init.test.ts @@ -20,7 +20,9 @@ import { Fq, type GasSettings, } from '@aztec/circuits.js'; -import { type TokenContract as BananaCoin, type FPCContract, SchnorrAccountContract } from '@aztec/noir-contracts.js'; +import { type FPCContract } from '@aztec/noir-contracts.js/FPC'; +import { SchnorrAccountContract } from '@aztec/noir-contracts.js/SchnorrAccount'; +import { type TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_fees/dapp_subscription.test.ts b/yarn-project/end-to-end/src/e2e_fees/dapp_subscription.test.ts index 45665cfc883..262272d194c 100644 --- a/yarn-project/end-to-end/src/e2e_fees/dapp_subscription.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/dapp_subscription.test.ts @@ -9,12 +9,10 @@ import { PublicFeePaymentMethod, } from '@aztec/aztec.js'; import { FEE_FUNDING_FOR_TESTER_ACCOUNT, type GasSettings } from '@aztec/circuits.js'; -import { - type AppSubscriptionContract, - type TokenContract as BananaCoin, - type CounterContract, - type FPCContract, -} from '@aztec/noir-contracts.js'; +import { type AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription'; +import { type CounterContract } from '@aztec/noir-contracts.js/Counter'; +import { type FPCContract } from '@aztec/noir-contracts.js/FPC'; +import { type TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token'; import { expectMapping, expectMappingDelta } from '../fixtures/utils.js'; import { FeesTest } from './fees_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_fees/failures.test.ts b/yarn-project/end-to-end/src/e2e_fees/failures.test.ts index 57a7559e12f..26ce82243ed 100644 --- a/yarn-project/end-to-end/src/e2e_fees/failures.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/failures.test.ts @@ -10,7 +10,8 @@ import { } from '@aztec/aztec.js'; import { Gas, GasSettings } from '@aztec/circuits.js'; import { FunctionType } from '@aztec/foundation/abi'; -import { type TokenContract as BananaCoin, type FPCContract } from '@aztec/noir-contracts.js'; +import { type FPCContract } from '@aztec/noir-contracts.js/FPC'; +import { type TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token'; import { expectMapping } from '../fixtures/utils.js'; import { FeesTest } from './fees_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_fees/fee_juice_payments.test.ts b/yarn-project/end-to-end/src/e2e_fees/fee_juice_payments.test.ts index 112425fafaf..8183915875c 100644 --- a/yarn-project/end-to-end/src/e2e_fees/fee_juice_payments.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/fee_juice_payments.test.ts @@ -5,7 +5,8 @@ import { FeeJuicePaymentMethodWithClaim, } from '@aztec/aztec.js'; import { FEE_FUNDING_FOR_TESTER_ACCOUNT, type GasSettings } from '@aztec/circuits.js'; -import { type TokenContract as BananaCoin, type FeeJuiceContract } from '@aztec/noir-contracts.js'; +import { type FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice'; +import { type TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token'; import { FeesTest } from './fees_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_fees/fees_test.ts b/yarn-project/end-to-end/src/e2e_fees/fees_test.ts index ffbf4d01f66..427816c6d9a 100644 --- a/yarn-project/end-to-end/src/e2e_fees/fees_test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/fees_test.ts @@ -13,13 +13,11 @@ import { DefaultMultiCallEntrypoint } from '@aztec/aztec.js/entrypoint'; import { EthAddress, FEE_FUNDING_FOR_TESTER_ACCOUNT, GasSettings, computePartialAddress } from '@aztec/circuits.js'; import { createL1Clients } from '@aztec/ethereum'; import { TestERC20Abi } from '@aztec/l1-artifacts'; -import { - AppSubscriptionContract, - TokenContract as BananaCoin, - CounterContract, - FPCContract, - FeeJuiceContract, -} from '@aztec/noir-contracts.js'; +import { AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription'; +import { CounterContract } from '@aztec/noir-contracts.js/Counter'; +import { FPCContract } from '@aztec/noir-contracts.js/FPC'; +import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice'; +import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token'; import { ProtocolContractAddress } from '@aztec/protocol-contracts'; import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice'; diff --git a/yarn-project/end-to-end/src/e2e_fees/gas_estimation.test.ts b/yarn-project/end-to-end/src/e2e_fees/gas_estimation.test.ts index f3655716c22..522004039e4 100644 --- a/yarn-project/end-to-end/src/e2e_fees/gas_estimation.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/gas_estimation.test.ts @@ -8,7 +8,8 @@ import { } from '@aztec/aztec.js'; import { GasSettings } from '@aztec/circuits.js'; import { type Logger } from '@aztec/foundation/log'; -import { TokenContract as BananaCoin, type FPCContract } from '@aztec/noir-contracts.js'; +import { type FPCContract } from '@aztec/noir-contracts.js/FPC'; +import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token'; import { inspect } from 'util'; diff --git a/yarn-project/end-to-end/src/e2e_fees/private_payments.test.ts b/yarn-project/end-to-end/src/e2e_fees/private_payments.test.ts index fd59e1f2140..e9518e69f08 100644 --- a/yarn-project/end-to-end/src/e2e_fees/private_payments.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/private_payments.test.ts @@ -1,6 +1,7 @@ import { type AccountWallet, type AztecAddress, BatchCall, PrivateFeePaymentMethod, sleep } from '@aztec/aztec.js'; import { GasSettings } from '@aztec/circuits.js'; -import { type TokenContract as BananaCoin, FPCContract } from '@aztec/noir-contracts.js'; +import { FPCContract } from '@aztec/noir-contracts.js/FPC'; +import { type TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token'; import { expectMapping } from '../fixtures/utils.js'; import { FeesTest } from './fees_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_fees/public_payments.test.ts b/yarn-project/end-to-end/src/e2e_fees/public_payments.test.ts index 83f4a4ef68b..22e4fbcb46a 100644 --- a/yarn-project/end-to-end/src/e2e_fees/public_payments.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/public_payments.test.ts @@ -1,6 +1,7 @@ import { type AccountWallet, type AztecAddress, PublicFeePaymentMethod } from '@aztec/aztec.js'; import { GasSettings } from '@aztec/circuits.js'; -import { type TokenContract as BananaCoin, type FPCContract } from '@aztec/noir-contracts.js'; +import { type FPCContract } from '@aztec/noir-contracts.js/FPC'; +import { type TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token'; import { expectMapping } from '../fixtures/utils.js'; import { FeesTest } from './fees_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_keys.test.ts b/yarn-project/end-to-end/src/e2e_keys.test.ts index 7cab699963e..c114ec46a7c 100644 --- a/yarn-project/end-to-end/src/e2e_keys.test.ts +++ b/yarn-project/end-to-end/src/e2e_keys.test.ts @@ -19,7 +19,7 @@ import { } from '@aztec/circuits.js'; import { siloNullifier } from '@aztec/circuits.js/hash'; import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto'; -import { TestContract } from '@aztec/noir-contracts.js'; +import { TestContract } from '@aztec/noir-contracts.js/Test'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts index 6c0df07c5da..0b64d5aac47 100644 --- a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts @@ -1,6 +1,8 @@ import { type AccountWallet, type CheatCodes, type DeployL1Contracts, Fr, type Logger } from '@aztec/aztec.js'; import { RollupAbi } from '@aztec/l1-artifacts'; -import { LendingContract, PriceFeedContract, TokenContract } from '@aztec/noir-contracts.js'; +import { LendingContract } from '@aztec/noir-contracts.js/Lending'; +import { PriceFeedContract } from '@aztec/noir-contracts.js/PriceFeed'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { afterAll, jest } from '@jest/globals'; import { getContract } from 'viem'; diff --git a/yarn-project/end-to-end/src/e2e_max_block_number.test.ts b/yarn-project/end-to-end/src/e2e_max_block_number.test.ts index 0c05164a2c1..b83d613ad36 100644 --- a/yarn-project/end-to-end/src/e2e_max_block_number.test.ts +++ b/yarn-project/end-to-end/src/e2e_max_block_number.test.ts @@ -1,5 +1,5 @@ import { Fr, type PXE, type Wallet } from '@aztec/aztec.js'; -import { TestContract } from '@aztec/noir-contracts.js'; +import { TestContract } from '@aztec/noir-contracts.js/Test'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_nested_contract/importer.test.ts b/yarn-project/end-to-end/src/e2e_nested_contract/importer.test.ts index e11ce439df9..c4f49e20cd3 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract/importer.test.ts +++ b/yarn-project/end-to-end/src/e2e_nested_contract/importer.test.ts @@ -1,4 +1,5 @@ -import { ImportTestContract, TestContract } from '@aztec/noir-contracts.js'; +import { ImportTestContract } from '@aztec/noir-contracts.js/ImportTest'; +import { TestContract } from '@aztec/noir-contracts.js/Test'; import { NestedContractTest } from './nested_contract_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_nested_contract/manual_private_enqueue.test.ts b/yarn-project/end-to-end/src/e2e_nested_contract/manual_private_enqueue.test.ts index a0ba5c148c0..57cd7354c6a 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract/manual_private_enqueue.test.ts +++ b/yarn-project/end-to-end/src/e2e_nested_contract/manual_private_enqueue.test.ts @@ -1,5 +1,6 @@ import { type AztecAddress, Fr } from '@aztec/aztec.js'; -import { ChildContract, ParentContract } from '@aztec/noir-contracts.js'; +import { ChildContract } from '@aztec/noir-contracts.js/Child'; +import { ParentContract } from '@aztec/noir-contracts.js/Parent'; import { NestedContractTest } from './nested_contract_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts b/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts index 11db0cb233c..733ecde7318 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts +++ b/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts @@ -1,6 +1,7 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; import { type AccountWallet, type CompleteAddress, type Logger, type PXE, createLogger } from '@aztec/aztec.js'; -import { ChildContract, ParentContract } from '@aztec/noir-contracts.js'; +import { ChildContract } from '@aztec/noir-contracts.js/Child'; +import { ParentContract } from '@aztec/noir-contracts.js/Parent'; import { type ISnapshotManager, diff --git a/yarn-project/end-to-end/src/e2e_nft.test.ts b/yarn-project/end-to-end/src/e2e_nft.test.ts index e79ffaed49f..b39228d5643 100644 --- a/yarn-project/end-to-end/src/e2e_nft.test.ts +++ b/yarn-project/end-to-end/src/e2e_nft.test.ts @@ -1,5 +1,5 @@ import { type AccountWallet, AztecAddress, Fr } from '@aztec/aztec.js'; -import { NFTContract } from '@aztec/noir-contracts.js'; +import { NFTContract } from '@aztec/noir-contracts.js/NFT'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_note_getter.test.ts b/yarn-project/end-to-end/src/e2e_note_getter.test.ts index e7aea9067a0..86c91c658af 100644 --- a/yarn-project/end-to-end/src/e2e_note_getter.test.ts +++ b/yarn-project/end-to-end/src/e2e_note_getter.test.ts @@ -1,5 +1,6 @@ import { type AztecAddress, Comparator, Fr, type Wallet } from '@aztec/aztec.js'; -import { DocsExampleContract, TestContract } from '@aztec/noir-contracts.js'; +import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample'; +import { TestContract } from '@aztec/noir-contracts.js/Test'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_outbox.test.ts b/yarn-project/end-to-end/src/e2e_outbox.test.ts index a3eb8fb43a6..dfcc7979543 100644 --- a/yarn-project/end-to-end/src/e2e_outbox.test.ts +++ b/yarn-project/end-to-end/src/e2e_outbox.test.ts @@ -11,7 +11,7 @@ import { sha256ToField } from '@aztec/foundation/crypto'; import { truncateAndPad } from '@aztec/foundation/serialize'; import { OutboxAbi, RollupAbi } from '@aztec/l1-artifacts'; import { SHA256 } from '@aztec/merkle-tree'; -import { TestContract } from '@aztec/noir-contracts.js'; +import { TestContract } from '@aztec/noir-contracts.js/Test'; import { beforeEach, describe, expect, it } from '@jest/globals'; import { decodeEventLog, getContract } from 'viem'; diff --git a/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts b/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts index a218e4e7fe3..c033061b6d9 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts @@ -4,7 +4,7 @@ import { type AccountWalletWithSecretKey } from '@aztec/aztec.js'; import { EthCheatCodes, MINIMUM_STAKE, getL1ContractsConfigEnvVars } from '@aztec/ethereum'; import { type Logger, createLogger } from '@aztec/foundation/log'; import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts'; -import { SpamContract } from '@aztec/noir-contracts.js'; +import { SpamContract } from '@aztec/noir-contracts.js/Spam'; import { type BootstrapNode } from '@aztec/p2p'; import { createBootstrapNodeFromPrivateKey } from '@aztec/p2p/mocks'; diff --git a/yarn-project/end-to-end/src/e2e_p2p/shared.ts b/yarn-project/end-to-end/src/e2e_p2p/shared.ts index a3fb06b49ae..5ff6a421157 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/shared.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/shared.ts @@ -3,7 +3,7 @@ import { type AztecNodeService } from '@aztec/aztec-node'; import { type Logger, type SentTx } from '@aztec/aztec.js'; import { CompleteAddress, TxStatus } from '@aztec/aztec.js'; import { Fr, GrumpkinScalar } from '@aztec/foundation/fields'; -import { type SpamContract } from '@aztec/noir-contracts.js'; +import { type SpamContract } from '@aztec/noir-contracts.js/Spam'; import { type PXEService, createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe'; import { type NodeContext } from '../fixtures/setup_p2p_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts b/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts index c6d0bab98a7..aac3af2db0a 100644 --- a/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts +++ b/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts @@ -23,7 +23,7 @@ import { import { compileContract } from '@aztec/ethereum'; import { Buffer32 } from '@aztec/foundation/buffer'; import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts'; -import { TokenContract } from '@aztec/noir-contracts.js'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node'; import { type PXEService } from '@aztec/pxe'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; diff --git a/yarn-project/end-to-end/src/e2e_state_vars.test.ts b/yarn-project/end-to-end/src/e2e_state_vars.test.ts index 7a47098bc32..a32d0985945 100644 --- a/yarn-project/end-to-end/src/e2e_state_vars.test.ts +++ b/yarn-project/end-to-end/src/e2e_state_vars.test.ts @@ -1,5 +1,6 @@ import { BatchCall, Fr, type PXE, type Wallet } from '@aztec/aztec.js'; -import { AuthContract, DocsExampleContract } from '@aztec/noir-contracts.js'; +import { AuthContract } from '@aztec/noir-contracts.js/Auth'; +import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_static_calls.test.ts b/yarn-project/end-to-end/src/e2e_static_calls.test.ts index 1d670377c1a..b8d806de1c0 100644 --- a/yarn-project/end-to-end/src/e2e_static_calls.test.ts +++ b/yarn-project/end-to-end/src/e2e_static_calls.test.ts @@ -1,5 +1,6 @@ import { type AztecAddress, type Wallet } from '@aztec/aztec.js'; -import { StaticChildContract, StaticParentContract } from '@aztec/noir-contracts.js'; +import { StaticChildContract } from '@aztec/noir-contracts.js/StaticChild'; +import { StaticParentContract } from '@aztec/noir-contracts.js/StaticParent'; import { STATIC_CALL_STATE_MODIFICATION_ERROR, STATIC_CONTEXT_ASSERTION_ERROR } from './fixtures/fixtures.js'; import { setup } from './fixtures/utils.js'; diff --git a/yarn-project/end-to-end/src/e2e_synching.test.ts b/yarn-project/end-to-end/src/e2e_synching.test.ts index d4a5563fa37..50857c56baf 100644 --- a/yarn-project/end-to-end/src/e2e_synching.test.ts +++ b/yarn-project/end-to-end/src/e2e_synching.test.ts @@ -51,7 +51,9 @@ import { type AztecAddress } from '@aztec/circuits.js'; import { getL1ContractsConfigEnvVars } from '@aztec/ethereum'; import { Timer } from '@aztec/foundation/timer'; import { RollupAbi } from '@aztec/l1-artifacts'; -import { SchnorrHardcodedAccountContract, SpamContract, TokenContract } from '@aztec/noir-contracts.js'; +import { SchnorrHardcodedAccountContract } from '@aztec/noir-contracts.js/SchnorrHardcodedAccount'; +import { SpamContract } from '@aztec/noir-contracts.js/Spam'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { type PXEService } from '@aztec/pxe'; import { L1Publisher } from '@aztec/sequencer-client'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; diff --git a/yarn-project/end-to-end/src/e2e_token_contract/private_transfer_recursion.test.ts b/yarn-project/end-to-end/src/e2e_token_contract/private_transfer_recursion.test.ts index 7039882ac10..43e789c6887 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/private_transfer_recursion.test.ts +++ b/yarn-project/end-to-end/src/e2e_token_contract/private_transfer_recursion.test.ts @@ -1,5 +1,5 @@ import { BatchCall } from '@aztec/aztec.js'; -import { TokenContract, type Transfer } from '@aztec/noir-contracts.js'; +import { TokenContract, type Transfer } from '@aztec/noir-contracts.js/Token'; import { TokenContractTest } from './token_contract_test.js'; diff --git a/yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts b/yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts index 9453ef7692f..98b117652c7 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts +++ b/yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts @@ -1,6 +1,7 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; import { type AccountWallet, type CompleteAddress, type Logger, createLogger } from '@aztec/aztec.js'; -import { DocsExampleContract, TokenContract } from '@aztec/noir-contracts.js'; +import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/e2e_token_contract/transfer.test.ts b/yarn-project/end-to-end/src/e2e_token_contract/transfer.test.ts index 619f24c3a7d..f586644a680 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/transfer.test.ts +++ b/yarn-project/end-to-end/src/e2e_token_contract/transfer.test.ts @@ -1,5 +1,5 @@ import { AztecAddress, CompleteAddress } from '@aztec/aztec.js'; -import { TokenContract, type Transfer } from '@aztec/noir-contracts.js'; +import { TokenContract, type Transfer } from '@aztec/noir-contracts.js/Token'; import { TokenContractTest } from './token_contract_test.js'; diff --git a/yarn-project/end-to-end/src/fixtures/token_utils.ts b/yarn-project/end-to-end/src/fixtures/token_utils.ts index ab573d3bbc5..503db51c48b 100644 --- a/yarn-project/end-to-end/src/fixtures/token_utils.ts +++ b/yarn-project/end-to-end/src/fixtures/token_utils.ts @@ -1,6 +1,6 @@ // docs:start:token_utils import { type AztecAddress, type Logger, type Wallet } from '@aztec/aztec.js'; -import { TokenContract } from '@aztec/noir-contracts.js'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; export async function deployToken(adminWallet: Wallet, initialAdminBalance: bigint, logger: Logger) { logger.info(`Deploying Token contract...`); diff --git a/yarn-project/end-to-end/src/flakey_e2e_inclusion_proofs_contract.test.ts b/yarn-project/end-to-end/src/flakey_e2e_inclusion_proofs_contract.test.ts index 534300c633a..7fc07cea262 100644 --- a/yarn-project/end-to-end/src/flakey_e2e_inclusion_proofs_contract.test.ts +++ b/yarn-project/end-to-end/src/flakey_e2e_inclusion_proofs_contract.test.ts @@ -9,8 +9,8 @@ import { } from '@aztec/aztec.js'; import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment'; import { randomInt } from '@aztec/foundation/crypto'; -import { StatefulTestContract, StatefulTestContractArtifact } from '@aztec/noir-contracts.js'; import { InclusionProofsContract } from '@aztec/noir-contracts.js/InclusionProofs'; +import { StatefulTestContract, StatefulTestContractArtifact } from '@aztec/noir-contracts.js/StatefulTest'; import { jest } from '@jest/globals'; import { type MemDown, default as memdown } from 'memdown'; diff --git a/yarn-project/end-to-end/src/prover-coordination/e2e_prover_coordination.test.ts b/yarn-project/end-to-end/src/prover-coordination/e2e_prover_coordination.test.ts index 25755714a88..7e70f26a566 100644 --- a/yarn-project/end-to-end/src/prover-coordination/e2e_prover_coordination.test.ts +++ b/yarn-project/end-to-end/src/prover-coordination/e2e_prover_coordination.test.ts @@ -15,7 +15,7 @@ import { Buffer32 } from '@aztec/foundation/buffer'; import { times } from '@aztec/foundation/collection'; import { Secp256k1Signer, keccak256, randomBigInt, randomInt } from '@aztec/foundation/crypto'; import { ProofCommitmentEscrowAbi, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts'; -import { StatefulTestContract, StatefulTestContractArtifact } from '@aztec/noir-contracts.js'; +import { StatefulTestContract, StatefulTestContractArtifact } from '@aztec/noir-contracts.js/StatefulTest'; import { createPXEService, getPXEServiceConfig } from '@aztec/pxe'; import { diff --git a/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts b/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts index 984260e425c..d78898c8bd8 100644 --- a/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts +++ b/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts @@ -1,6 +1,6 @@ import { createAccounts } from '@aztec/accounts/testing'; import { Fr, type Logger, type PXE } from '@aztec/aztec.js'; -import { EasyPrivateTokenContract } from '@aztec/noir-contracts.js'; +import { EasyPrivateTokenContract } from '@aztec/noir-contracts.js/EasyPrivateToken'; import { foundry, sepolia } from 'viem/chains'; diff --git a/yarn-project/end-to-end/src/sample-dapp/deploy.mjs b/yarn-project/end-to-end/src/sample-dapp/deploy.mjs index 43217454be6..841ea5f7474 100644 --- a/yarn-project/end-to-end/src/sample-dapp/deploy.mjs +++ b/yarn-project/end-to-end/src/sample-dapp/deploy.mjs @@ -2,7 +2,8 @@ import { getInitialTestAccountsWallets } from '@aztec/accounts/testing'; import { Contract, createPXEClient, loadContractArtifact, waitForPXE } from '@aztec/aztec.js'; // docs:end:deploy-imports -import { TokenContract, TokenContractArtifact } from '@aztec/noir-contracts.js'; +import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { writeFileSync } from 'fs'; import { fileURLToPath } from 'url'; diff --git a/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts b/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts index 0d54c623f2c..0f1e1ace4ad 100644 --- a/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts +++ b/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts @@ -9,7 +9,7 @@ import { type PXE, type Wallet, } from '@aztec/aztec.js'; -import { FeeJuiceContract } from '@aztec/noir-contracts.js'; +import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice'; import { ProtocolContractAddress } from '@aztec/protocol-contracts'; import { type Account, type Chain, type HttpTransport, type PublicClient, type WalletClient } from 'viem'; diff --git a/yarn-project/end-to-end/src/spartan/4epochs.test.ts b/yarn-project/end-to-end/src/spartan/4epochs.test.ts index 43d2a0da7ba..1ba5be9d3ab 100644 --- a/yarn-project/end-to-end/src/spartan/4epochs.test.ts +++ b/yarn-project/end-to-end/src/spartan/4epochs.test.ts @@ -1,7 +1,7 @@ import { EthCheatCodes, readFieldCompressedString } from '@aztec/aztec.js'; import { getL1ContractsConfigEnvVars } from '@aztec/ethereum'; import { createLogger } from '@aztec/foundation/log'; -import { TokenContract } from '@aztec/noir-contracts.js'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { jest } from '@jest/globals'; diff --git a/yarn-project/end-to-end/src/spartan/setup_test_wallets.ts b/yarn-project/end-to-end/src/spartan/setup_test_wallets.ts index bb4528707a9..ae3abd9b625 100644 --- a/yarn-project/end-to-end/src/spartan/setup_test_wallets.ts +++ b/yarn-project/end-to-end/src/spartan/setup_test_wallets.ts @@ -1,7 +1,7 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; import { type AccountWalletWithSecretKey, type AztecAddress, type PXE, createCompatibleClient } from '@aztec/aztec.js'; import { type Logger } from '@aztec/foundation/log'; -import { TokenContract } from '@aztec/noir-contracts.js'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { addAccounts } from '../fixtures/snapshot_manager.js'; diff --git a/yarn-project/end-to-end/src/spartan/transfer.test.ts b/yarn-project/end-to-end/src/spartan/transfer.test.ts index 4f0d79215f7..28905e96afb 100644 --- a/yarn-project/end-to-end/src/spartan/transfer.test.ts +++ b/yarn-project/end-to-end/src/spartan/transfer.test.ts @@ -1,6 +1,6 @@ import { readFieldCompressedString } from '@aztec/aztec.js'; import { createLogger } from '@aztec/foundation/log'; -import { TokenContract } from '@aztec/noir-contracts.js'; +import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { jest } from '@jest/globals'; diff --git a/yarn-project/noir-contracts.js/package.json b/yarn-project/noir-contracts.js/package.json index c54eb0a5965..3eed2ad6ae2 100644 --- a/yarn-project/noir-contracts.js/package.json +++ b/yarn-project/noir-contracts.js/package.json @@ -81,4 +81,4 @@ "engines": { "node": ">=18" } -} +} \ No newline at end of file diff --git a/yarn-project/noir-contracts.js/scripts/generate-types.sh b/yarn-project/noir-contracts.js/scripts/generate-types.sh index 26a7eb20560..fb380b01264 100755 --- a/yarn-project/noir-contracts.js/scripts/generate-types.sh +++ b/yarn-project/noir-contracts.js/scripts/generate-types.sh @@ -40,7 +40,10 @@ done node --no-warnings ../builder/dest/bin/cli.js codegen -o $OUT_DIR artifacts # Append exports for each generated TypeScript file to index.ts +echo "/** List of contract names exported by this package. */" >>"$INDEX" +echo "export const ContractNames = [" >>"$INDEX" find "$OUT_DIR" -maxdepth 1 -type f -name '*.ts' ! -name 'index.ts' | while read -r TS_FILE; do CONTRACT_NAME=$(basename "$TS_FILE" .ts) # Remove the .ts extension to get the contract name - echo "export * from './${CONTRACT_NAME}.js';" >>"$INDEX" + echo " '$CONTRACT_NAME'," >>"$INDEX" done +echo "];" >>"$INDEX" diff --git a/yarn-project/sequencer-client/src/tx_validator/gas_validator.test.ts b/yarn-project/sequencer-client/src/tx_validator/gas_validator.test.ts index eec83ad034f..68a7c4f8427 100644 --- a/yarn-project/sequencer-client/src/tx_validator/gas_validator.test.ts +++ b/yarn-project/sequencer-client/src/tx_validator/gas_validator.test.ts @@ -2,7 +2,7 @@ import { type Tx, mockTx } from '@aztec/circuit-types'; import { AztecAddress, Fr, FunctionSelector, GasFees, GasSettings, PUBLIC_DISPATCH_SELECTOR } from '@aztec/circuits.js'; import { poseidon2Hash } from '@aztec/foundation/crypto'; import { type Writeable } from '@aztec/foundation/types'; -import { FeeJuiceContract } from '@aztec/noir-contracts.js'; +import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice'; import { ProtocolContractAddress } from '@aztec/protocol-contracts'; import { type MockProxy, mock, mockFn } from 'jest-mock-extended'; diff --git a/yarn-project/simulator/src/avm/fixtures/index.ts b/yarn-project/simulator/src/avm/fixtures/index.ts index 53a259419a8..fce5fb7eff4 100644 --- a/yarn-project/simulator/src/avm/fixtures/index.ts +++ b/yarn-project/simulator/src/avm/fixtures/index.ts @@ -4,7 +4,7 @@ import { type FunctionArtifact, FunctionSelector } from '@aztec/foundation/abi'; import { AztecAddress } from '@aztec/foundation/aztec-address'; import { EthAddress } from '@aztec/foundation/eth-address'; import { Fr } from '@aztec/foundation/fields'; -import { AvmTestContractArtifact } from '@aztec/noir-contracts.js'; +import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; import { strict as assert } from 'assert'; import { mock } from 'jest-mock-extended'; diff --git a/yarn-project/simulator/src/client/private_execution.test.ts b/yarn-project/simulator/src/client/private_execution.test.ts index 19d96f8b043..cc38e3ad1fa 100644 --- a/yarn-project/simulator/src/client/private_execution.test.ts +++ b/yarn-project/simulator/src/client/private_execution.test.ts @@ -55,14 +55,12 @@ import { type Logger, createLogger } from '@aztec/foundation/log'; import { type FieldsOf } from '@aztec/foundation/types'; import { openTmpStore } from '@aztec/kv-store/lmdb'; import { type AppendOnlyTree, Poseidon, StandardTree, newTree } from '@aztec/merkle-tree'; -import { - ChildContractArtifact, - ImportTestContractArtifact, - ParentContractArtifact, - PendingNoteHashesContractArtifact, - StatefulTestContractArtifact, - TestContractArtifact, -} from '@aztec/noir-contracts.js'; +import { ChildContractArtifact } from '@aztec/noir-contracts.js/Child'; +import { ImportTestContractArtifact } from '@aztec/noir-contracts.js/ImportTest'; +import { ParentContractArtifact } from '@aztec/noir-contracts.js/Parent'; +import { PendingNoteHashesContractArtifact } from '@aztec/noir-contracts.js/PendingNoteHashes'; +import { StatefulTestContractArtifact } from '@aztec/noir-contracts.js/StatefulTest'; +import { TestContractArtifact } from '@aztec/noir-contracts.js/Test'; import { jest } from '@jest/globals'; import { type MockProxy, mock } from 'jest-mock-extended'; diff --git a/yarn-project/simulator/src/client/simulator.test.ts b/yarn-project/simulator/src/client/simulator.test.ts index 30cb6d85b6d..bf67b300f06 100644 --- a/yarn-project/simulator/src/client/simulator.test.ts +++ b/yarn-project/simulator/src/client/simulator.test.ts @@ -3,7 +3,7 @@ import { KeyValidationRequest, computeAppNullifierSecretKey, deriveKeys } from ' import { type FunctionArtifact, getFunctionArtifact } from '@aztec/foundation/abi'; import { AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr, type Point } from '@aztec/foundation/fields'; -import { TokenBlacklistContractArtifact } from '@aztec/noir-contracts.js'; +import { TokenBlacklistContractArtifact } from '@aztec/noir-contracts.js/TokenBlacklist'; import { type MockProxy, mock } from 'jest-mock-extended'; diff --git a/yarn-project/simulator/src/public/fixtures/index.ts b/yarn-project/simulator/src/public/fixtures/index.ts index bf4940feb8e..691c0f4ae85 100644 --- a/yarn-project/simulator/src/public/fixtures/index.ts +++ b/yarn-project/simulator/src/public/fixtures/index.ts @@ -29,7 +29,7 @@ import { type ContractArtifact, type FunctionArtifact } from '@aztec/foundation/ import { AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr, Point } from '@aztec/foundation/fields'; import { openTmpStore } from '@aztec/kv-store/lmdb'; -import { AvmTestContractArtifact } from '@aztec/noir-contracts.js'; +import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; import { PublicTxSimulator, WorldStateDB } from '@aztec/simulator'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; import { MerkleTrees } from '@aztec/world-state';