@aztec/aztec.js 0.65.2 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,5 +31,8 @@ export class SignerlessWallet extends BaseWallet {
31
31
  createAuthWit(_intent) {
32
32
  throw new Error('SignerlessWallet: Method createAuthWit not implemented.');
33
33
  }
34
+ isL1ToL2MessageSynced(l1ToL2Message) {
35
+ return this.pxe.isL1ToL2MessageSynced(l1ToL2Message);
36
+ }
34
37
  }
35
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lnbmVybGVzc193YWxsZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd2FsbGV0L3NpZ25lcmxlc3Nfd2FsbGV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHFDQUFxQyxDQUFDO0FBR3hFLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUU5Qzs7R0FFRztBQUNILE1BQU0sT0FBTyxnQkFBaUIsU0FBUSxVQUFVO0lBQzlDLFlBQVksR0FBUSxFQUFVLFVBQWdDO1FBQzVELEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQztRQURpQixlQUFVLEdBQVYsVUFBVSxDQUFzQjtJQUU5RCxDQUFDO0lBQ0QsS0FBSyxDQUFDLHdCQUF3QixDQUFDLFNBQStCO1FBQzVELElBQUksVUFBVSxHQUFHLElBQUksQ0FBQyxVQUFVLENBQUM7UUFDakMsSUFBSSxDQUFDLFVBQVUsRUFBRSxDQUFDO1lBQ2hCLE1BQU0sRUFBRSxTQUFTLEVBQUUsT0FBTyxFQUFFLGVBQWUsRUFBRSxHQUFHLE1BQU0sSUFBSSxDQUFDLEdBQUcsQ0FBQyxXQUFXLEVBQUUsQ0FBQztZQUM3RSxVQU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JQUN2RCxDQUFDO0NBQ0YifQ==
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aztec/aztec.js",
3
3
  "homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/aztec.js",
4
- "version": "0.65.2",
4
+ "version": "0.66.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": "./dest/index.js",
@@ -76,13 +76,13 @@
76
76
  ]
77
77
  },
78
78
  "dependencies": {
79
- "@aztec/circuit-types": "0.65.2",
80
- "@aztec/circuits.js": "0.65.2",
81
- "@aztec/ethereum": "0.65.2",
82
- "@aztec/foundation": "0.65.2",
83
- "@aztec/l1-artifacts": "0.65.2",
84
- "@aztec/protocol-contracts": "0.65.2",
85
- "@aztec/types": "0.65.2",
79
+ "@aztec/circuit-types": "0.66.0",
80
+ "@aztec/circuits.js": "0.66.0",
81
+ "@aztec/ethereum": "0.66.0",
82
+ "@aztec/foundation": "0.66.0",
83
+ "@aztec/l1-artifacts": "0.66.0",
84
+ "@aztec/protocol-contracts": "0.66.0",
85
+ "@aztec/types": "0.66.0",
86
86
  "axios": "^1.7.2",
87
87
  "tslib": "^2.4.0",
88
88
  "viem": "^2.7.15"
@@ -89,6 +89,11 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
89
89
  * it returns a promise for an array instead of a function call directly.
90
90
  */
91
91
  public async request(options: DeployOptions = {}): Promise<ExecutionRequestInit> {
92
+ const deployment = await this.getDeploymentFunctionCalls(options);
93
+
94
+ // NOTE: MEGA HACK. Remove with #10007
95
+ // register the contract after generating deployment function calls in order to publicly register the class and (optioanlly) emit its bytecode
96
+ //
92
97
  // TODO: Should we add the contracts to the DB here, or once the tx has been sent or mined?
93
98
  // Note that we need to run this registerContract here so it's available when computeFeeOptionsFromEstimatedGas
94
99
  // runs, since it needs the contract to have been registered in order to estimate gas for its initialization,
@@ -97,7 +102,6 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
97
102
  // once this tx has gone through.
98
103
  await this.wallet.registerContract({ artifact: this.artifact, instance: this.getInstance(options) });
99
104
 
100
- const deployment = await this.getDeploymentFunctionCalls(options);
101
105
  const bootstrap = await this.getInitializeFunctionCalls(options);
102
106
 
103
107
  if (deployment.calls.length + bootstrap.calls.length === 0) {
@@ -11,8 +11,6 @@ export class ProvenTx extends Tx {
11
11
  super(
12
12
  tx.data,
13
13
  tx.clientIvcProof,
14
- tx.noteEncryptedLogs,
15
- tx.encryptedLogs,
16
14
  tx.unencryptedLogs,
17
15
  tx.contractClassLogs,
18
16
  tx.enqueuedPublicFunctionCalls,
@@ -25,8 +23,6 @@ export class ProvenTx extends Tx {
25
23
  return new Tx(
26
24
  this.data,
27
25
  this.clientIvcProof,
28
- this.noteEncryptedLogs,
29
- this.encryptedLogs,
30
26
  this.unencryptedLogs,
31
27
  this.contractClassLogs,
32
28
  this.enqueuedPublicFunctionCalls,
@@ -5,15 +5,22 @@ import { type ContractFunctionInteraction } from '../contract/contract_function_
5
5
  import { type Wallet } from '../wallet/index.js';
6
6
  import { getRegistererContract } from './protocol_contracts.js';
7
7
 
8
+ const defaultEmitPublicBytecode =
9
+ // guard against `process` not being defined (e.g. in the browser)
10
+ typeof process === 'object' && typeof process.env === 'object'
11
+ ? ['1', 'true', 'yes', ''].includes(process.env.AZTEC_EMIT_PUBLIC_BYTECODE ?? '')
12
+ : true;
13
+
8
14
  /** Sets up a call to register a contract class given its artifact. */
9
15
  export async function registerContractClass(
10
16
  wallet: Wallet,
11
17
  artifact: ContractArtifact,
18
+ emitPublicBytecode = defaultEmitPublicBytecode,
12
19
  ): Promise<ContractFunctionInteraction> {
13
20
  const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment, packedBytecode } =
14
21
  getContractClassFromArtifact(artifact);
15
22
  const encodedBytecode = bufferAsFields(packedBytecode, MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS);
16
23
  const registerer = getRegistererContract(wallet);
17
24
  await wallet.addCapsule(encodedBytecode);
18
- return registerer.methods.register(artifactHash, privateFunctionsRoot, publicBytecodeCommitment);
25
+ return registerer.methods.register(artifactHash, privateFunctionsRoot, publicBytecodeCommitment, emitPublicBytecode);
19
26
  }
package/src/index.ts CHANGED
@@ -32,9 +32,9 @@ export {
32
32
  type ContractNotes,
33
33
  type ContractStorageLayout,
34
34
  type DeployOptions,
35
+ type ProfileResult,
35
36
  type SendMethodOptions,
36
37
  type WaitOpts,
37
- type ProfileResult,
38
38
  } from './contract/index.js';
39
39
 
40
40
  export { ContractDeployer } from './deployment/index.js';
@@ -42,7 +42,6 @@ export { ContractDeployer } from './deployment/index.js';
42
42
  export {
43
43
  AnvilTestWatcher,
44
44
  CheatCodes,
45
- EthCheatCodes,
46
45
  L1FeeJuicePortalManager,
47
46
  L1ToL2TokenPortalManager,
48
47
  L1TokenManager,
@@ -60,8 +59,8 @@ export {
60
59
  type FieldLike,
61
60
  type FunctionSelectorLike,
62
61
  type L2AmountClaim,
63
- type L2Claim,
64
62
  type L2AmountClaimWithRecipient,
63
+ type L2Claim,
65
64
  type WrappedFieldLike,
66
65
  } from './utils/index.js';
67
66
 
@@ -112,9 +111,7 @@ export {
112
111
  Comparator,
113
112
  CompleteAddress,
114
113
  ContractClass2BlockL2Logs,
115
- EncryptedL2BlockL2Logs,
116
114
  EncryptedLogPayload,
117
- EncryptedNoteL2BlockL2Logs,
118
115
  EpochProofQuote,
119
116
  EpochProofQuotePayload,
120
117
  EventMetadata,
@@ -127,9 +124,7 @@ export {
127
124
  L1ToL2Message,
128
125
  L2Actor,
129
126
  L2Block,
130
- L2BlockL2Logs,
131
127
  LogId,
132
- LogType,
133
128
  MerkleTreeId,
134
129
  Note,
135
130
  PackedValues,
@@ -143,10 +138,12 @@ export {
143
138
  UnencryptedL2Log,
144
139
  UniqueNote,
145
140
  createAztecNodeClient,
141
+ getTimestampRangeForEpoch,
146
142
  merkleTreeIds,
147
143
  mockEpochProofQuote,
148
144
  mockTx,
149
145
  type AztecNode,
146
+ type EpochConstants,
150
147
  type LogFilter,
151
148
  type PXE,
152
149
  type PartialAddress,
@@ -161,7 +158,7 @@ export { decodeFromAbi, encodeArguments, type AbiType } from '@aztec/foundation/
161
158
  export { toBigIntBE } from '@aztec/foundation/bigint-buffer';
162
159
  export { sha256 } from '@aztec/foundation/crypto';
163
160
  export { makeFetch } from '@aztec/foundation/json-rpc/client';
164
- export { createDebugLogger, onLog, type DebugLogger } from '@aztec/foundation/log';
161
+ export { createDebugLogger, type DebugLogger } from '@aztec/foundation/log';
165
162
  export { retry, retryUntil } from '@aztec/foundation/retry';
166
163
  export { to2Fields, toBigInt } from '@aztec/foundation/serialize';
167
164
  export { sleep } from '@aztec/foundation/sleep';
@@ -169,7 +166,7 @@ export { elapsed } from '@aztec/foundation/timer';
169
166
  export { type FieldsOf } from '@aztec/foundation/types';
170
167
  export { fileURLToPath } from '@aztec/foundation/url';
171
168
 
172
- export { deployL1Contract, deployL1Contracts, type DeployL1Contracts } from '@aztec/ethereum';
169
+ export { EthCheatCodes, deployL1Contract, deployL1Contracts, type DeployL1Contracts } from '@aztec/ethereum';
173
170
 
174
171
  // Start of section that exports public api via granular api.
175
172
  // Here you *can* do `export *` as the granular api defacto exports things explicitly.
@@ -1,13 +1,10 @@
1
1
  import { type EpochProofClaim, type Note, type PXE } from '@aztec/circuit-types';
2
2
  import { type AztecAddress, EthAddress, Fr } from '@aztec/circuits.js';
3
3
  import { deriveStorageSlotInMap } from '@aztec/circuits.js/hash';
4
- import { type L1ContractAddresses } from '@aztec/ethereum';
5
- import { toBigIntBE, toHex } from '@aztec/foundation/bigint-buffer';
6
- import { keccak256 } from '@aztec/foundation/crypto';
4
+ import { EthCheatCodes, type L1ContractAddresses } from '@aztec/ethereum';
7
5
  import { createDebugLogger } from '@aztec/foundation/log';
8
6
  import { RollupAbi } from '@aztec/l1-artifacts';
9
7
 
10
- import fs from 'fs';
11
8
  import {
12
9
  type GetContractReturnType,
13
10
  type Hex,
@@ -49,248 +46,6 @@ export class CheatCodes {
49
46
  }
50
47
  }
51
48
 
52
- /**
53
- * A class that provides utility functions for interacting with ethereum (L1).
54
- */
55
- export class EthCheatCodes {
56
- constructor(
57
- /**
58
- * The RPC URL to use for interacting with the chain
59
- */
60
- public rpcUrl: string,
61
- /**
62
- * The logger to use for the eth cheatcodes
63
- */
64
- public logger = createDebugLogger('aztec:cheat_codes:eth'),
65
- ) {}
66
-
67
- async rpcCall(method: string, params: any[]) {
68
- const paramsString = JSON.stringify(params);
69
- const content = {
70
- body: `{"jsonrpc":"2.0", "method": "${method}", "params": ${paramsString}, "id": 1}`,
71
- method: 'POST',
72
- headers: { 'Content-Type': 'application/json' },
73
- };
74
- return await (await fetch(this.rpcUrl, content)).json();
75
- }
76
-
77
- /**
78
- * Get the auto mine status of the underlying chain
79
- * @returns True if automine is on, false otherwise
80
- */
81
- public async isAutoMining(): Promise<boolean> {
82
- try {
83
- const res = await this.rpcCall('anvil_getAutomine', []);
84
- return res.result;
85
- } catch (err) {
86
- this.logger.error(`Calling "anvil_getAutomine" failed with:`, err);
87
- }
88
- return false;
89
- }
90
-
91
- /**
92
- * Get the current blocknumber
93
- * @returns The current block number
94
- */
95
- public async blockNumber(): Promise<number> {
96
- const res = await this.rpcCall('eth_blockNumber', []);
97
- return parseInt(res.result, 16);
98
- }
99
-
100
- /**
101
- * Get the current chainId
102
- * @returns The current chainId
103
- */
104
- public async chainId(): Promise<number> {
105
- const res = await this.rpcCall('eth_chainId', []);
106
- return parseInt(res.result, 16);
107
- }
108
-
109
- /**
110
- * Get the current timestamp
111
- * @returns The current timestamp
112
- */
113
- public async timestamp(): Promise<number> {
114
- const res = await this.rpcCall('eth_getBlockByNumber', ['latest', true]);
115
- return parseInt(res.result.timestamp, 16);
116
- }
117
-
118
- /**
119
- * Advance the chain by a number of blocks
120
- * @param numberOfBlocks - The number of blocks to mine
121
- * @returns The current chainId
122
- */
123
- public async mine(numberOfBlocks = 1): Promise<void> {
124
- const res = await this.rpcCall('hardhat_mine', [numberOfBlocks]);
125
- if (res.error) {
126
- throw new Error(`Error mining: ${res.error.message}`);
127
- }
128
- this.logger.verbose(`Mined ${numberOfBlocks} L1 blocks`);
129
- }
130
-
131
- /**
132
- * Set the balance of an account
133
- * @param account - The account to set the balance for
134
- * @param balance - The balance to set
135
- */
136
- public async setBalance(account: EthAddress, balance: bigint): Promise<void> {
137
- const res = await this.rpcCall('anvil_setBalance', [account.toString(), toHex(balance)]);
138
- if (res.error) {
139
- throw new Error(`Error setting balance for ${account}: ${res.error.message}`);
140
- }
141
- this.logger.verbose(`Set balance for ${account} to ${balance}`);
142
- }
143
-
144
- /**
145
- * Set the interval between blocks (block time)
146
- * @param interval - The interval to use between blocks
147
- */
148
- public async setBlockInterval(interval: number): Promise<void> {
149
- const res = await this.rpcCall('anvil_setBlockTimestampInterval', [interval]);
150
- if (res.error) {
151
- throw new Error(`Error setting block interval: ${res.error.message}`);
152
- }
153
- this.logger.verbose(`Set L1 block interval to ${interval}`);
154
- }
155
-
156
- /**
157
- * Set the next block timestamp
158
- * @param timestamp - The timestamp to set the next block to
159
- */
160
- public async setNextBlockTimestamp(timestamp: number): Promise<void> {
161
- const res = await this.rpcCall('evm_setNextBlockTimestamp', [timestamp]);
162
- if (res.error) {
163
- throw new Error(`Error setting next block timestamp: ${res.error.message}`);
164
- }
165
- this.logger.verbose(`Set L1 next block timestamp to ${timestamp}`);
166
- }
167
-
168
- /**
169
- * Set the next block timestamp and mines the block
170
- * @param timestamp - The timestamp to set the next block to
171
- */
172
- public async warp(timestamp: number | bigint): Promise<void> {
173
- const res = await this.rpcCall('evm_setNextBlockTimestamp', [Number(timestamp)]);
174
- if (res.error) {
175
- throw new Error(`Error warping: ${res.error.message}`);
176
- }
177
- await this.mine();
178
- this.logger.verbose(`Warped L1 timestamp to ${timestamp}`);
179
- }
180
-
181
- /**
182
- * Dumps the current chain state to a file.
183
- * @param fileName - The file name to dump state into
184
- */
185
- public async dumpChainState(fileName: string): Promise<void> {
186
- const res = await this.rpcCall('hardhat_dumpState', []);
187
- if (res.error) {
188
- throw new Error(`Error dumping state: ${res.error.message}`);
189
- }
190
- const jsonContent = JSON.stringify(res.result);
191
- fs.writeFileSync(`${fileName}.json`, jsonContent, 'utf8');
192
- this.logger.verbose(`Dumped state to ${fileName}`);
193
- }
194
-
195
- /**
196
- * Loads the chain state from a file.
197
- * @param fileName - The file name to load state from
198
- */
199
- public async loadChainState(fileName: string): Promise<void> {
200
- const data = JSON.parse(fs.readFileSync(`${fileName}.json`, 'utf8'));
201
- const res = await this.rpcCall('hardhat_loadState', [data]);
202
- if (res.error) {
203
- throw new Error(`Error loading state: ${res.error.message}`);
204
- }
205
- this.logger.verbose(`Loaded state from ${fileName}`);
206
- }
207
-
208
- /**
209
- * Load the value at a storage slot of a contract address on eth
210
- * @param contract - The contract address
211
- * @param slot - The storage slot
212
- * @returns - The value at the storage slot
213
- */
214
- public async load(contract: EthAddress, slot: bigint): Promise<bigint> {
215
- const res = await this.rpcCall('eth_getStorageAt', [contract.toString(), toHex(slot), 'latest']);
216
- return BigInt(res.result);
217
- }
218
-
219
- /**
220
- * Set the value at a storage slot of a contract address on eth
221
- * @param contract - The contract address
222
- * @param slot - The storage slot
223
- * @param value - The value to set the storage slot to
224
- */
225
- public async store(contract: EthAddress, slot: bigint, value: bigint): Promise<void> {
226
- // for the rpc call, we need to change value to be a 32 byte hex string.
227
- const res = await this.rpcCall('hardhat_setStorageAt', [contract.toString(), toHex(slot), toHex(value, true)]);
228
- if (res.error) {
229
- throw new Error(`Error setting storage for contract ${contract} at ${slot}: ${res.error.message}`);
230
- }
231
- this.logger.verbose(`Set L1 storage for contract ${contract} at ${slot} to ${value}`);
232
- }
233
-
234
- /**
235
- * Computes the slot value for a given map and key.
236
- * @param baseSlot - The base slot of the map (specified in Aztec.nr contract)
237
- * @param key - The key to lookup in the map
238
- * @returns The storage slot of the value in the map
239
- */
240
- public keccak256(baseSlot: bigint, key: bigint): bigint {
241
- // abi encode (removing the 0x) - concat key and baseSlot (both padded to 32 bytes)
242
- const abiEncoded = toHex(key, true).substring(2) + toHex(baseSlot, true).substring(2);
243
- return toBigIntBE(keccak256(Buffer.from(abiEncoded, 'hex')));
244
- }
245
-
246
- /**
247
- * Send transactions impersonating an externally owned account or contract.
248
- * @param who - The address to impersonate
249
- */
250
- public async startImpersonating(who: EthAddress | Hex): Promise<void> {
251
- const res = await this.rpcCall('hardhat_impersonateAccount', [who.toString()]);
252
- if (res.error) {
253
- throw new Error(`Error impersonating ${who}: ${res.error.message}`);
254
- }
255
- this.logger.verbose(`Impersonating ${who}`);
256
- }
257
-
258
- /**
259
- * Stop impersonating an account that you are currently impersonating.
260
- * @param who - The address to stop impersonating
261
- */
262
- public async stopImpersonating(who: EthAddress | Hex): Promise<void> {
263
- const res = await this.rpcCall('hardhat_stopImpersonatingAccount', [who.toString()]);
264
- if (res.error) {
265
- throw new Error(`Error when stopping the impersonation of ${who}: ${res.error.message}`);
266
- }
267
- this.logger.verbose(`Stopped impersonating ${who}`);
268
- }
269
-
270
- /**
271
- * Set the bytecode for a contract
272
- * @param contract - The contract address
273
- * @param bytecode - The bytecode to set
274
- */
275
- public async etch(contract: EthAddress, bytecode: `0x${string}`): Promise<void> {
276
- const res = await this.rpcCall('hardhat_setCode', [contract.toString(), bytecode]);
277
- if (res.error) {
278
- throw new Error(`Error setting bytecode for ${contract}: ${res.error.message}`);
279
- }
280
- this.logger.verbose(`Set bytecode for ${contract} to ${bytecode}`);
281
- }
282
-
283
- /**
284
- * Get the bytecode for a contract
285
- * @param contract - The contract address
286
- * @returns The bytecode for the contract
287
- */
288
- public async getBytecode(contract: EthAddress): Promise<`0x${string}`> {
289
- const res = await this.rpcCall('eth_getCode', [contract.toString(), 'latest']);
290
- return res.result;
291
- }
292
- }
293
-
294
49
  /** Cheat codes for the L1 rollup contract. */
295
50
  export class RollupCheatCodes {
296
51
  private client: WalletClient & PublicClient;
@@ -327,8 +82,11 @@ export class RollupCheatCodes {
327
82
  /** The pending chain tip */ pending: bigint;
328
83
  /** The proven chain tip */ proven: bigint;
329
84
  }> {
330
- const [pending, proven] = await this.rollup.read.tips();
331
- return { pending, proven };
85
+ const res = await this.rollup.read.getTips();
86
+ return {
87
+ pending: res.pendingBlockNumber,
88
+ proven: res.provenBlockNumber,
89
+ };
332
90
  }
333
91
 
334
92
  /** Fetches the epoch and slot duration config from the rollup contract */
@@ -370,8 +128,13 @@ export class RollupCheatCodes {
370
128
  /** Returns the current proof claim (if any) */
371
129
  public async getProofClaim(): Promise<EpochProofClaim | undefined> {
372
130
  // REFACTOR: This code is duplicated from l1-publisher
373
- const [epochToProve, basisPointFee, bondAmount, bondProviderHex, proposerClaimantHex] =
374
- await this.rollup.read.proofClaim();
131
+ const {
132
+ epochToProve,
133
+ basisPointFee,
134
+ bondAmount,
135
+ bondProvider: bondProviderHex,
136
+ proposerClaimant: proposerClaimantHex,
137
+ } = await this.rollup.read.getProofClaim();
375
138
 
376
139
  const bondProvider = EthAddress.fromString(bondProviderHex);
377
140
  const proposerClaimant = EthAddress.fromString(proposerClaimantHex);
@@ -396,7 +159,7 @@ export class RollupCheatCodes {
396
159
  public async markAsProven(maybeBlockNumber?: number | bigint) {
397
160
  const blockNumber = maybeBlockNumber
398
161
  ? BigInt(maybeBlockNumber)
399
- : await this.rollup.read.tips().then(([pending]) => pending);
162
+ : await this.rollup.read.getTips().then(({ pendingBlockNumber }) => pendingBlockNumber);
400
163
 
401
164
  await this.asOwner(async account => {
402
165
  await this.rollup.write.setAssumeProvenThroughBlockNumber([blockNumber], { account, chain: this.client.chain });
@@ -34,6 +34,10 @@ export class AccountWallet extends BaseWallet {
34
34
  return this.account.getVersion();
35
35
  }
36
36
 
37
+ override isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean> {
38
+ return this.pxe.isL1ToL2MessageSynced(l1ToL2Message);
39
+ }
40
+
37
41
  /**
38
42
  * Computes an authentication witness from either a message hash or an intent.
39
43
  *
@@ -44,6 +44,8 @@ import { type IntentAction, type IntentInnerHash } from '../utils/authwit.js';
44
44
  export abstract class BaseWallet implements Wallet {
45
45
  constructor(protected readonly pxe: PXE, private scopes?: AztecAddress[]) {}
46
46
 
47
+ abstract isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
48
+
47
49
  abstract getCompleteAddress(): CompleteAddress;
48
50
 
49
51
  abstract getChainId(): Fr;
@@ -42,4 +42,8 @@ export class SignerlessWallet extends BaseWallet {
42
42
  createAuthWit(_intent: Fr | Buffer | IntentInnerHash | IntentAction): Promise<AuthWitness> {
43
43
  throw new Error('SignerlessWallet: Method createAuthWit not implemented.');
44
44
  }
45
+
46
+ override isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean> {
47
+ return this.pxe.isL1ToL2MessageSynced(l1ToL2Message);
48
+ }
45
49
  }