Skip to content

Commit 0cd0acc

Browse files
authored
feat: granular aztec js (#17876)
Crude approach towards a granular `@aztec/aztec.js`. Makes it much more tree-shakable and tidy in general. It needs some work to move some exports around, but at least the big barrel export is gone, which will make for a brighter future.
2 parents 9bf5a5e + 02b87ee commit 0cd0acc

File tree

324 files changed

+1084
-931
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

324 files changed

+1084
-931
lines changed

boxes/boxes/react/src/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2-
import { AztecAddress, createAztecNodeClient, Wallet } from '@aztec/aztec.js';
2+
import { AztecAddress } from '@aztec/aztec.js/addresses';
3+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
4+
import type { Wallet } from '@aztec/aztec.js/wallet';
35
import { getPXEConfig } from '@aztec/pxe/client/lazy';
46
import { TestWallet } from '@aztec/test-wallet/client/lazy';
57

boxes/boxes/react/src/hooks/useContract.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { useState } from 'react';
22
import { deployerEnv } from '../config';
33

4-
import { Contract, Fr } from '@aztec/aztec.js';
4+
import { Contract } from '@aztec/aztec.js/contracts';
5+
import { Fr } from '@aztec/aztec.js/fields';
56
import { toast } from 'react-toastify';
67

78
export function useContract() {

boxes/boxes/react/src/hooks/useNumber.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from 'react';
2-
import { Contract } from '@aztec/aztec.js';
2+
import { Contract } from '@aztec/aztec.js/contracts';
33
import { toast } from 'react-toastify';
44
import { deployerEnv } from '../config';
55

boxes/boxes/react/src/pages/contract.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useState } from 'react';
2-
import { Contract, FunctionType } from '@aztec/aztec.js';
2+
import { Contract } from '@aztec/aztec.js/contracts';
3+
import { FunctionType } from '@aztec/stdlib/abi';
34
import { useNumber } from '../hooks/useNumber';
45

56
const IGNORE_FUNCTIONS = ['constructor', 'sync_private_state'];

boxes/boxes/vanilla/.env

Lines changed: 0 additions & 4 deletions
This file was deleted.

boxes/boxes/vanilla/app/embedded-wallet.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
import {
2-
Fr,
3-
createLogger,
4-
createAztecNodeClient,
5-
AztecAddress,
6-
getContractInstanceFromInstantiationParams,
7-
SponsoredFeePaymentMethod,
8-
BaseWallet,
9-
Account,
10-
SignerlessAccount,
11-
AccountManager,
12-
FeeOptions,
13-
UserFeeOptions,
14-
DeployAccountOptions,
15-
SimulateOptions,
16-
} from '@aztec/aztec.js';
1+
import { Account, SignerlessAccount } from '@aztec/aztec.js/account';
2+
import { AztecAddress } from '@aztec/aztec.js/addresses';
3+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
4+
import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
5+
import { Fr } from '@aztec/aztec.js/fields';
6+
import { createLogger } from '@aztec/aztec.js/log';
7+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
8+
import { type UserFeeOptions, type FeeOptions, BaseWallet, AccountManager, DeployAccountOptions, SimulateOptions } from '@aztec/aztec.js/wallet';
179
import { SPONSORED_FPC_SALT } from '@aztec/constants';
1810
import { randomBytes } from '@aztec/foundation/crypto';
1911
import { EcdsaRAccountContract } from '@aztec/accounts/ecdsa/lazy';

boxes/boxes/vanilla/app/main.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import './style.css';
2-
import {
3-
AztecAddress,
4-
Fr,
5-
getContractInstanceFromInstantiationParams,
6-
type Wallet,
7-
} from '@aztec/aztec.js';
1+
import { AztecAddress } from '@aztec/aztec.js/addresses';
2+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
3+
import { Fr } from '@aztec/aztec.js/fields';
4+
import type { Wallet } from '@aztec/aztec.js/wallet';
85
import { EmbeddedWallet } from './embedded-wallet';
96
import { PrivateVotingContract } from '../artifacts/PrivateVoting';
107

boxes/boxes/vanilla/scripts/deploy.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
import {
2-
AztecAddress,
3-
createAztecNodeClient,
4-
type DeployAccountOptions,
5-
DeployMethod,
6-
Fr,
7-
getContractInstanceFromInstantiationParams,
8-
PublicKeys,
9-
SponsoredFeePaymentMethod,
10-
type Wallet,
11-
} from '@aztec/aztec.js';
12-
import { type AztecNode } from '@aztec/aztec.js/interfaces';
1+
import { AztecAddress } from '@aztec/aztec.js/addresses';
2+
import { DeployMethod, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
3+
import { SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
4+
import { Fr } from '@aztec/aztec.js/fields';
5+
import { PublicKeys } from '@aztec/aztec.js/keys';
6+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
7+
import type { DeployAccountOptions, Wallet } from '@aztec/aztec.js/wallet';
8+
import { type AztecNode } from '@aztec/aztec.js/node';
139
import { SPONSORED_FPC_SALT } from '@aztec/constants';
1410
import { createStore } from '@aztec/kv-store/lmdb';
1511
import { SponsoredFPCContractArtifact } from '@aztec/noir-contracts.js/SponsoredFPC';

boxes/boxes/vite/src/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { getInitialTestAccountsData } from "@aztec/accounts/testing";
2-
import { AztecAddress, createAztecNodeClient, Wallet } from "@aztec/aztec.js";
2+
import { AztecAddress } from '@aztec/aztec.js/addresses';
3+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
4+
import { Wallet } from '@aztec/aztec.js/wallet';
35
import { getPXEConfig } from "@aztec/pxe/client/lazy";
46
import { TestWallet } from "@aztec/test-wallet/client/lazy";
57

boxes/boxes/vite/src/hooks/useContract.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { useState } from "react";
22
import { deployerEnv } from "../config";
33

4-
import { Contract, Fr } from "@aztec/aztec.js";
4+
import { Contract } from "@aztec/aztec.js/contracts";
5+
import { Fr } from "@aztec/aztec.js/fields";
56
import { toast } from "react-toastify";
67

78
export function useContract() {

0 commit comments

Comments
 (0)