Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: remove foundation and types deps from boxes #3389

Merged
merged 19 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions yarn-project/aztec.js/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
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
// here once the issue is resolved.
export {
AztecAddress,
EthAddress,
Point,
Fr,
FunctionSelector,
GlobalVariables,
GrumpkinScalar,
Point,
getContractDeploymentInfo,
} from '@aztec/circuits.js';
export { Grumpkin, Schnorr } from '@aztec/circuits.js/barretenberg';
Expand All @@ -29,8 +29,8 @@ export {
ExtendedContractData,
ExtendedNote,
FunctionCall,
INITIAL_L2_BLOCK_NUM,
GrumpkinPrivateKey,
INITIAL_L2_BLOCK_NUM,
L2Actor,
L2Block,
L2BlockL2Logs,
Expand All @@ -39,36 +39,38 @@ export {
MerkleTreeId,
NodeInfo,
Note,
PXE,
PackedArguments,
PartialAddress,
PublicKey,
PXE,
SyncStatus,
Tx,
TxExecutionRequest,
TxHash,
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';
3 changes: 0 additions & 3 deletions yarn-project/boxes/blank-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
"dependencies": {
"@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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { callContractFunction, deployContract, viewContractFunction } from '../.
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 { AztecAddress, CompleteAddress, ContractArtifact, Fr, FunctionArtifact } from '@aztec/aztec.js';
import { useFormik } from 'formik';
import * as Yup from 'yup';

Expand Down
3 changes: 1 addition & 2 deletions yarn-project/boxes/blank-react/src/app/contract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ 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 { AztecAddress, CompleteAddress, FunctionArtifact } from '@aztec/aztec.js';
import { ReactNode, useState } from 'react';

const functionTypeSortOrder = {
Expand Down
3 changes: 1 addition & 2 deletions yarn-project/boxes/blank-react/src/config.ts
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
12 changes: 9 additions & 3 deletions yarn-project/boxes/blank-react/src/scripts/util.ts
Original file line number Diff line number Diff line change
@@ -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 => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank-react/tsconfig.dest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ".",
"references": [{ "path": "../../aztec.js" }, { "path": "../../foundation" }, { "path": "../../types" }],
"references": [{ "path": "../../aztec.js" }],
"exclude": ["src/**/*.test.ts"]
}
9 changes: 0 additions & 9 deletions yarn-project/boxes/blank-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,5 @@
{
"path": "../../aztec.js"
},
{
"path": "../../circuits.js"
},
{
"path": "../../foundation"
},
{
"path": "../../types"
}
]
}
2 changes: 0 additions & 2 deletions yarn-project/boxes/blank/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
"dependencies": {
"@aztec/aztec-ui": "^0.1.14",
"@aztec/aztec.js": "workspace:^",
"@aztec/circuits.js": "workspace:^",
"@aztec/foundation": "workspace:^",
"serve": "^14.2.1"
},
"devDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions yarn-project/boxes/blank/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank/src/tests/blank.contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/blank/tsconfig.dest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ".",
"references": [{ "path": "../../aztec.js" }, { "path": "../../foundation" }, { "path": "../../types" }],
"references": [{ "path": "../../aztec.js" }],
"exclude": ["src/**/*.test.ts"]
}
6 changes: 0 additions & 6 deletions yarn-project/boxes/blank/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,5 @@
{
"path": "../../aztec.js"
},
{
"path": "../../circuits.js"
},
{
"path": "../../foundation"
}
]
}
3 changes: 0 additions & 3 deletions yarn-project/boxes/token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
"dependencies": {
"@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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { callContractFunction, deployContract, viewContractFunction } from '../.
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 { AztecAddress, CompleteAddress, ContractArtifact, Fr, FunctionArtifact } from '@aztec/aztec.js';
import { useFormik } from 'formik';
import * as Yup from 'yup';

Expand Down
3 changes: 1 addition & 2 deletions yarn-project/boxes/token/src/app/contract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ 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 { AztecAddress, CompleteAddress, FunctionArtifact } from '@aztec/aztec.js';
import { ReactNode, useState } from 'react';

const functionTypeSortOrder = {
Expand Down
3 changes: 1 addition & 2 deletions yarn-project/boxes/token/src/config.ts
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 1 addition & 3 deletions yarn-project/boxes/token/src/scripts/deploy_contract.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
12 changes: 9 additions & 3 deletions yarn-project/boxes/token/src/scripts/util.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
7 changes: 4 additions & 3 deletions yarn-project/boxes/token/src/tests/token.contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ import { TokenContract } from '../artifacts/Token.js';
import { TokenSimulator } from './token_simulator.js';
import {
AccountWallet,
CompleteAddress,
DebugLogger,
ExtendedNote,
Fr,
Note,
PXE,
TxHash,
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
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/boxes/token/tsconfig.dest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ".",
"references": [{ "path": "../../aztec.js" }, { "path": "../../foundation" }, { "path": "../../types" }],
"references": [{ "path": "../../aztec.js" }],
"exclude": ["src/**/*.test.ts"]
}
9 changes: 0 additions & 9 deletions yarn-project/boxes/token/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,5 @@
{
"path": "../../aztec.js"
},
{
"path": "../../circuits.js"
},
{
"path": "../../foundation"
},
{
"path": "../../types"
}
]
}
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/abi/function_selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading