Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@
# on changes to the AVM transpiler
/avm-transpiler/src @fcarreiro @dbanks12
#####################################################

# Notify fairies of changes to playground bundler config
/playground/vite.config.ts @Thunkar
2 changes: 1 addition & 1 deletion docs/docs/developers/guides/js_apps/pay_fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ After a user has sent fee juice from L1 to be bridged to L2, a transaction can b

The claim object:

#include_code claim_type_amount yarn-project/aztec.js/src/api/ethereum/portal_manager.ts javascript
#include_code claim_type_amount yarn-project/aztec.js/src/ethereum/portal_manager.ts javascript

Calling a function on an object (in this case checking the balance of the fee juice contract)

Expand Down
18 changes: 11 additions & 7 deletions playground/src/aztecEnv.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { createAztecNodeClient, type AztecNode } from '@aztec/aztec.js/utils';
import {
createAztecNodeClient,
type AztecNode,
AztecAddress,
AccountWalletWithSecretKey,
Contract,
type PXE,
type Logger,
createLogger,
} from '@aztec/aztec.js';

import { AztecAddress } from '@aztec/aztec.js/addresses';
import { AccountWalletWithSecretKey } from '@aztec/aztec.js/wallet';
import { Contract } from '@aztec/aztec.js/contracts';
import { type PXE } from '@aztec/aztec.js/interfaces/pxe';
import { createPXEService, type PXEServiceConfig, getPXEServiceConfig } from '@aztec/pxe/client/lazy';
import { createStore } from '@aztec/kv-store/indexeddb';
import { createContext } from 'react';
import { NetworkDB, WalletDB } from './utils/storage';
import { type ContractFunctionInteractionTx } from './utils/txs';
import { type Logger, createLogger } from '@aztec/aztec.js/log';

const logLevel = ['silent', 'fatal', 'error', 'warn', 'info', 'verbose', 'debug', 'trace'] as const;

Expand Down Expand Up @@ -155,7 +159,7 @@ export class AztecEnv {
store: WebLogger.getInstance().createLogger('pxe:data:indexeddb'),
pxe: WebLogger.getInstance().createLogger('pxe:service'),
prover: WebLogger.getInstance().createLogger('bb:wasm:lazy'),
}
},
});
return pxe;
}
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/common/fnParameter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ABIParameter, type AbiType, isAddressStruct } from '@aztec/stdlib/abi';
import { type ABIParameter, type AbiType, isAddressStruct } from '@aztec/aztec.js';
import { formatFrAsString, parseAliasedBuffersAsString } from '../../utils/conversion';
import { useContext, useState } from 'react';
import EditIcon from '@mui/icons-material/Edit';
Expand Down
39 changes: 18 additions & 21 deletions playground/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig, loadEnv, searchForWorkspaceRoot } from "vite";
import react from "@vitejs/plugin-react-swc";
import { PolyfillOptions, nodePolyfills } from "vite-plugin-node-polyfills";
import bundlesize from "vite-plugin-bundlesize";
import { defineConfig, loadEnv, searchForWorkspaceRoot } from 'vite';
import react from '@vitejs/plugin-react-swc';
import { PolyfillOptions, nodePolyfills } from 'vite-plugin-node-polyfills';
import bundlesize from 'vite-plugin-bundlesize';

// Only required for alternative bb wasm file, left as reference
// import { viteStaticCopy } from "vite-plugin-static-copy";
Expand All @@ -13,10 +13,7 @@ const nodePolyfillsFix = (options?: PolyfillOptions | undefined): Plugin => {
...nodePolyfills(options),
/* @ts-ignore */
resolveId(source: string) {
const m =
/^vite-plugin-node-polyfills\/shims\/(buffer|global|process)$/.exec(
source
);
const m = /^vite-plugin-node-polyfills\/shims\/(buffer|global|process)$/.exec(source);
if (m) {
return `./node_modules/vite-plugin-node-polyfills/shims/${m[1]}/dist/index.cjs`;
}
Expand All @@ -26,30 +23,30 @@ const nodePolyfillsFix = (options?: PolyfillOptions | undefined): Plugin => {

// https://vite.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
const env = loadEnv(mode, process.cwd(), '');
return {
logLevel: "error",
logLevel: 'error',
server: {
// Headers needed for bb WASM to work in multithreaded mode
headers: {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp",
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
},
// Allow vite to serve files from these directories, since they are symlinked
// These are the protocol circuit artifacts, noir WASMs and bb WASMs.
fs: {
allow: [
searchForWorkspaceRoot(process.cwd()),
"../yarn-project/noir-protocol-circuits-types/artifacts",
"../noir/packages/noirc_abi/web",
"../noir/packages/acvm_js/web",
"../barretenberg/ts/dest/browser",
'../yarn-project/noir-protocol-circuits-types/artifacts',
'../noir/packages/noirc_abi/web',
'../noir/packages/acvm_js/web',
'../barretenberg/ts/dest/browser',
],
},
},
plugins: [
react({ jsxImportSource: "@emotion/react" }),
nodePolyfillsFix({ include: ["buffer", "path"] }),
react({ jsxImportSource: '@emotion/react' }),
nodePolyfillsFix({ include: ['buffer', 'path'] }),
// This is unnecessary unless BB_WASM_PATH is defined (default would be /assets/barretenberg.wasm.gz)
// Left as an example of how to use a different bb wasm file than the default lazily loaded one
// viteStaticCopy({
Expand All @@ -61,11 +58,11 @@ export default defineConfig(({ mode }) => {
// ],
// }),
bundlesize({
limits: [{ name: "assets/index-*", limit: "1950kB" }],
limits: [{ name: 'assets/index-*', limit: '1600kB' }],
}),
],
define: {
"process.env": JSON.stringify({
'process.env': JSON.stringify({
LOG_LEVEL: env.LOG_LEVEL,
// The path to a custom WASM file for bb.js.
// Only the single-threaded file name is needed, the multithreaded file name will be inferred
Expand All @@ -76,7 +73,7 @@ export default defineConfig(({ mode }) => {
},
build: {
// Required by vite-plugin-bundle-size
sourcemap: "hidden",
sourcemap: 'hidden',
},
};
});
11 changes: 6 additions & 5 deletions yarn-project/aztec.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@
"type": "module",
"exports": {
".": "./dest/index.js",
"./interfaces/pxe": "./dest/api/interfaces/pxe.js",
"./interfaces": "./dest/api/interfaces.js",
"./abi": "./dest/api/abi.js",
"./account": "./dest/api/account.js",
"./addresses": "./dest/api/addresses.js",
"./cheatcodes": "./dest/api/cheatcodes.js",
"./contracts": "./dest/contract/index.js",
"./contracts": "./dest/api/contract.js",
"./deployment": "./dest/api/deployment.js",
"./entrypoint": "./dest/api/entrypoint.js",
"./eth_address": "./dest/api/eth_address.js",
"./ethereum": "./dest/api/ethereum/index.js",
"./ethereum": "./dest/api/ethereum.js",
"./fee": "./dest/api/fee.js",
"./fields": "./dest/api/fields.js",
"./log": "./dest/api/log.js",
"./log_id": "./dest/api/log_id.js",
"./rpc": "./dest/rpc_clients/index.js",
"./rpc": "./dest/api/rpc.js",
"./tx_hash": "./dest/api/tx_hash.js",
"./wallet": "./dest/api/wallet.js",
"./utils": "./dest/utils/index.js"
"./utils": "./dest/api/utils.js",
"./testing": "./dest/api/testing.js"
},
"typedocOptions": {
"entryPoints": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type { PublicKeys } from '@aztec/stdlib/keys';
import type { AuthWitnessProvider } from '../account/interface.js';
import type { Wallet } from '../account/wallet.js';
import { Contract } from '../contract/contract.js';
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
import { DeployMethod, type DeployOptions } from '../contract/deploy_method.js';
import { ContractFunctionInteraction } from '../contract/index.js';
import { EntrypointPayload, computeCombinedPayloadHash } from '../entrypoint/payload.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/account_manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { deriveKeys } from '@aztec/stdlib/keys';
import type { AccountContract } from '../account/contract.js';
import type { Salt, Wallet } from '../account/index.js';
import type { AccountInterface } from '../account/interface.js';
import { Contract } from '../contract/contract.js';
import { DeployMethod, type DeployOptions } from '../contract/deploy_method.js';
import { Contract } from '../contract/index.js';
import { DefaultWaitOpts, type WaitOpts } from '../contract/sent_tx.js';
import { DefaultMultiCallEntrypoint } from '../entrypoint/default_multi_call_entrypoint.js';
import { AccountWalletWithSecretKey, SignerlessWallet } from '../wallet/index.js';
Expand Down
11 changes: 11 additions & 0 deletions yarn-project/aztec.js/src/api/abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ export {
type FunctionArtifact,
EventSelector,
FunctionSelector,
FunctionCall,
NoteSelector,
type ABIParameter,
decodeFromAbi,
encodeArguments,
type AbiType,
isAddressStruct,
isAztecAddressStruct,
isEthAddressStruct,
isWrappedFieldStruct,
isFunctionSelectorStruct,
loadContractArtifact,
contractArtifactToBuffer,
contractArtifactFromBuffer,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/api/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export {
getAccountContractAddress,
} from '../account/index.js';

export { AccountManager } from '../account_manager/index.js';
export { AccountManager, type DeployAccountOptions } from '../account_manager/index.js';
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,28 @@
*
* @packageDocumentation
*/
export { Contract } from './contract.js';
export { Contract } from '../contract/contract.js';
export {
ContractFunctionInteraction,
type ProfileResult,
type SendMethodOptions,
} from './contract_function_interaction.js';
export { DefaultWaitOpts, SentTx, type WaitOpts } from './sent_tx.js';
export { ContractBase, type ContractMethod, type ContractNotes, type ContractStorageLayout } from './contract_base.js';
export { BatchCall } from './batch_call.js';
export { type DeployOptions, DeployMethod } from './deploy_method.js';
export { DeploySentTx } from './deploy_sent_tx.js';
} from '../contract/contract_function_interaction.js';
export { DefaultWaitOpts, SentTx, type WaitOpts } from '../contract/sent_tx.js';
export {
ContractBase,
type ContractMethod,
type ContractNotes,
type ContractStorageLayout,
} from '../contract/contract_base.js';
export { BatchCall } from '../contract/batch_call.js';
export { type DeployOptions, DeployMethod } from '../contract/deploy_method.js';
export { DeploySentTx } from '../contract/deploy_sent_tx.js';

export {
type PartialAddress,
type ContractClassWithId,
type ContractInstanceWithAddress,
getContractClassFromArtifact,
getContractInstanceFromDeployParams,
type NodeInfo,
} from '@aztec/stdlib/contract';
1 change: 1 addition & 0 deletions yarn-project/aztec.js/src/api/deployment.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { registerContractClass } from '../deployment/register_class.js';
export { broadcastPrivateFunction, broadcastUnconstrainedFunction } from '../deployment/broadcast_function.js';
export { deployInstance } from '../deployment/deploy_instance.js';
export { ContractDeployer } from '../deployment/contract_deployer.js';
11 changes: 11 additions & 0 deletions yarn-project/aztec.js/src/api/ethereum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export {
L1FeeJuicePortalManager,
L1ToL2TokenPortalManager,
L1TokenManager,
L1TokenPortalManager,
type L2AmountClaim,
type L2AmountClaimWithRecipient,
type L2Claim,
generateClaimSecret,
} from '../ethereum/portal_manager.js';
export { getL1ContractAddresses } from '../ethereum/l1_contracts.js';
19 changes: 0 additions & 19 deletions yarn-project/aztec.js/src/api/ethereum/index.ts

This file was deleted.

2 changes: 2 additions & 0 deletions yarn-project/aztec.js/src/api/rpc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { createPXEClient } from '../rpc_clients/pxe_client.js';
export { createCompatibleClient } from '../rpc_clients/node/index.js';
5 changes: 5 additions & 0 deletions yarn-project/aztec.js/src/api/testing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export { AnvilTestWatcher } from '../test/anvil_test_watcher.js';
export { RollupCheatCodes } from '../test/rollup_cheat_codes.js';
export { AztecCheatCodes } from '../test/aztec_cheat_codes.js';
export { EthCheatCodes } from '@aztec/ethereum/eth-cheatcodes';
export { CheatCodes } from '../test/cheat_codes.js';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { generatePublicKey } from './pub_key.js';
export { generatePublicKey } from '../utils/pub_key.js';
export {
type AztecAddressLike,
type EthAddressLike,
Expand All @@ -7,15 +7,15 @@ export {
type FunctionSelectorLike,
type U128Like,
type WrappedFieldLike,
} from './abi_types.js';
} from '../utils/abi_types.js';
export {
computeAuthWitMessageHash,
computeInnerAuthWitHash,
computeInnerAuthWitHashFromAction,
type IntentAction,
type IntentInnerHash,
} from './authwit.js';
export { waitForPXE } from './pxe.js';
export { waitForNode, createAztecNodeClient, type AztecNode } from './node.js';
export { getFeeJuiceBalance } from './fee_juice.js';
export { readFieldCompressedString } from './field_compressed_string.js';
} from '../utils/authwit.js';
export { waitForPXE } from '../utils/pxe.js';
export { waitForNode, createAztecNodeClient, type AztecNode } from '../utils/node.js';
export { getFeeJuiceBalance } from '../utils/fee_juice.js';
export { readFieldCompressedString } from '../utils/field_compressed_string.js';
8 changes: 1 addition & 7 deletions yarn-project/aztec.js/src/api/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
export {
AccountWallet,
AccountWalletWithSecretKey as AccountWalletWithSecretKey,
SignerlessWallet,
type Wallet,
getWallet,
} from '../wallet/index.js';
export { AccountWallet, AccountWalletWithSecretKey, SignerlessWallet, getWallet } from '../wallet/index.js';
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/contract/batch_call.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type FunctionCall, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
import type { TxExecutionRequest } from '@aztec/stdlib/tx';

import type { Wallet } from '../account/index.js';
import type { Wallet } from '../account/wallet.js';
import { type ExecutionRequestInit, mergeExecutionRequestInits } from '../entrypoint/entrypoint.js';
import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
import type { SimulateMethodOptions } from './contract_function_interaction.js';
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/contract/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
import { PublicKeys } from '@aztec/stdlib/keys';

import type { Wallet } from '../account/index.js';
import type { Wallet } from '../account/wallet.js';
import { ContractBase } from './contract_base.js';
import { DeployMethod } from './deploy_method.js';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/contract/contract_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@aztec/stdlib/abi';
import { type ContractInstanceWithAddress, computePartialAddress } from '@aztec/stdlib/contract';

import type { Wallet } from '../account/index.js';
import type { Wallet } from '../account/wallet.js';
import { ContractFunctionInteraction } from './contract_function_interaction.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/contract/deploy_method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { GasSettings } from '@aztec/stdlib/gas';
import type { PublicKeys } from '@aztec/stdlib/keys';
import type { TxExecutionRequest } from '@aztec/stdlib/tx';

import type { Wallet } from '../account/index.js';
import type { Wallet } from '../account/wallet.js';
import { deployInstance } from '../deployment/deploy_instance.js';
import { registerContractClass } from '../deployment/register_class.js';
import { type ExecutionRequestInit, mergeExecutionRequestInits } from '../entrypoint/entrypoint.js';
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/contract/deploy_proven_tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
import type { PXE } from '@aztec/stdlib/interfaces/client';
import type { Tx } from '@aztec/stdlib/tx';

import type { Wallet } from '../account/index.js';
import type { Wallet } from '../account/wallet.js';
import type { Contract } from './contract.js';
import { DeploySentTx } from './deploy_sent_tx.js';
import { ProvenTx } from './proven_tx.js';
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/contract/deploy_sent_tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
import type { AztecNode, PXE } from '@aztec/stdlib/interfaces/client';
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';

import type { Wallet } from '../account/index.js';
import type { Wallet } from '../account/wallet.js';
import type { Contract } from './contract.js';
import type { ContractBase } from './contract_base.js';
import { SentTx, type WaitOpts } from './sent_tx.js';
Expand Down
Loading