@aztec/bot 5.0.0-private.20260318 → 5.0.0-rc.1

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.
package/dest/factory.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
- import { AztecAddress } from '@aztec/aztec.js/addresses';
3
2
  import { BatchCall, NO_WAIT } from '@aztec/aztec.js/contracts';
4
3
  import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
5
4
  import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
@@ -7,36 +6,38 @@ import { deriveKeys } from '@aztec/aztec.js/keys';
7
6
  import { createLogger } from '@aztec/aztec.js/log';
8
7
  import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
9
8
  import { waitForTx } from '@aztec/aztec.js/node';
9
+ import { getFeeJuiceBalance } from '@aztec/aztec.js/utils';
10
10
  import { createEthereumChain } from '@aztec/ethereum/chain';
11
11
  import { createExtendedL1Client } from '@aztec/ethereum/client';
12
12
  import { RollupContract } from '@aztec/ethereum/contracts';
13
13
  import { Fr } from '@aztec/foundation/curves/bn254';
14
14
  import { EthAddress } from '@aztec/foundation/eth-address';
15
- import { Timer } from '@aztec/foundation/timer';
16
15
  import { AMMContract } from '@aztec/noir-contracts.js/AMM';
17
16
  import { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
18
17
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
19
18
  import { TestContract } from '@aztec/noir-test-contracts.js/Test';
20
- import { GasSettings } from '@aztec/stdlib/gas';
21
19
  import { deriveSigningKey } from '@aztec/stdlib/keys';
22
20
  import { SupportedTokenContracts } from './config.js';
23
21
  import { seedL1ToL2Message } from './l1_to_l2_seeding.js';
24
22
  import { getBalances, getPrivateBalance, isStandardTokenContract } from './utils.js';
25
23
  const MINT_BALANCE = 1e12;
26
24
  const MIN_BALANCE = 1e3;
25
+ const FEE_JUICE_TOP_UP_THRESHOLD = 100n * 10n ** 18n;
27
26
  export class BotFactory {
28
27
  config;
29
28
  wallet;
30
29
  store;
31
30
  aztecNode;
32
31
  aztecNodeAdmin;
32
+ syncChainTip;
33
33
  log;
34
- constructor(config, wallet, store, aztecNode, aztecNodeAdmin){
34
+ constructor(config, wallet, store, aztecNode, aztecNodeAdmin, syncChainTip){
35
35
  this.config = config;
36
36
  this.wallet = wallet;
37
37
  this.store = store;
38
38
  this.aztecNode = aztecNode;
39
39
  this.aztecNodeAdmin = aztecNodeAdmin;
40
+ this.syncChainTip = syncChainTip;
40
41
  this.log = createLogger('bot');
41
42
  // Set fee padding on the wallet so that all transactions during setup
42
43
  // (token deploy, minting, etc.) use the configured padding, not the default.
@@ -48,6 +49,7 @@ export class BotFactory {
48
49
  */ async setup() {
49
50
  const defaultAccountAddress = await this.setupAccount();
50
51
  const recipient = (await this.wallet.createSchnorrAccount(Fr.random(), Fr.random())).address;
52
+ await this.ensureFeeJuiceBalance(defaultAccountAddress);
51
53
  const token = await this.setupToken(defaultAccountAddress);
52
54
  await this.mintTokens(token, defaultAccountAddress);
53
55
  return {
@@ -60,6 +62,7 @@ export class BotFactory {
60
62
  }
61
63
  async setupAmm() {
62
64
  const defaultAccountAddress = await this.setupAccount();
65
+ await this.ensureFeeJuiceBalance(defaultAccountAddress);
63
66
  const token0 = await this.setupTokenContract(defaultAccountAddress, this.config.tokenSalt, 'BotToken0', 'BOT0');
64
67
  const token1 = await this.setupTokenContract(defaultAccountAddress, this.config.tokenSalt, 'BotToken1', 'BOT1');
65
68
  const liquidityToken = await this.setupTokenContract(defaultAccountAddress, this.config.tokenSalt, 'BotLPToken', 'BOTLP');
@@ -80,6 +83,7 @@ export class BotFactory {
80
83
  * seeding initial L1→L2 messages, and waiting for the first to be ready.
81
84
  */ async setupCrossChain() {
82
85
  const defaultAccountAddress = await this.setupAccount();
86
+ await this.ensureFeeJuiceBalance(defaultAccountAddress);
83
87
  // Create L1 client (same pattern as bridgeL1FeeJuice)
84
88
  const l1RpcUrls = this.config.l1RpcUrls;
85
89
  if (!l1RpcUrls?.length) {
@@ -95,7 +99,7 @@ export class BotFactory {
95
99
  // Fetch Rollup version (needed for Inbox L2Actor struct)
96
100
  const rollupContract = new RollupContract(l1Client, l1ContractAddresses.rollupAddress.toString());
97
101
  const rollupVersion = await rollupContract.getVersion();
98
- // Deploy TestContract
102
+ // Deploy TestContract (pays from the standing balance funded above).
99
103
  const contract = await this.setupTestContract(defaultAccountAddress);
100
104
  // Recover any pending messages from store (clean up stale ones first)
101
105
  await this.store.cleanupOldPendingMessages();
@@ -111,7 +115,8 @@ export class BotFactory {
111
115
  this.log.info(`Waiting for first L1→L2 message to be ready...`);
112
116
  const firstMsg = allMessages[0];
113
117
  await waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(firstMsg.msgHash), {
114
- timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
118
+ timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
119
+ chainTip: this.syncChainTip
115
120
  });
116
121
  this.log.info(`First L1→L2 message is ready`);
117
122
  }
@@ -126,11 +131,12 @@ export class BotFactory {
126
131
  }
127
132
  async setupTestContract(deployer) {
128
133
  const deployOpts = {
129
- from: deployer,
130
- contractAddressSalt: this.config.tokenSalt,
131
- universalDeploy: true
134
+ from: deployer
132
135
  };
133
- const deploy = TestContract.deploy(this.wallet);
136
+ const deploy = TestContract.deploy(this.wallet, {
137
+ salt: this.config.tokenSalt,
138
+ universalDeploy: true
139
+ });
134
140
  const instance = await this.registerOrDeployContract('TestContract', deploy, deployOpts);
135
141
  return TestContract.at(instance.address, this.wallet);
136
142
  }
@@ -147,80 +153,57 @@ export class BotFactory {
147
153
  return await this.setupTestAccount();
148
154
  }
149
155
  }
156
+ /**
157
+ * Keyless fallback for tests and local dev: reuses the first genesis test account, whose address is
158
+ * pre-funded with fee juice via `initialFundedAccounts`. The test accounts are initializerless, so this
159
+ * must create an initializerless account for the address to match the funded one. Production bots set a
160
+ * sender private key and fund the resulting initializerless account from L1 instead; see
161
+ * setupAccountWithPrivateKey.
162
+ */ async setupTestAccount() {
163
+ const [initialAccountData] = await getInitialTestAccountsData();
164
+ const accountManager = await this.wallet.createSchnorrInitializerlessAccount(initialAccountData.secret, initialAccountData.salt, initialAccountData.signingKey);
165
+ return accountManager.address;
166
+ }
150
167
  async setupAccountWithPrivateKey(secret) {
151
168
  const salt = this.config.senderSalt ?? Fr.ONE;
152
169
  const signingKey = deriveSigningKey(secret);
153
- const accountManager = await this.wallet.createSchnorrAccount(secret, salt, signingKey);
154
- const metadata = await this.wallet.getContractMetadata(accountManager.address);
155
- if (metadata.isContractInitialized) {
156
- this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
157
- const timer = new Timer();
158
- const address = accountManager.address;
159
- this.log.info(`Account at ${address} registered. duration=${timer.ms()}`);
160
- await this.store.deleteBridgeClaim(address);
161
- return address;
162
- } else {
163
- const address = accountManager.address;
164
- this.log.info(`Deploying account at ${address}`);
165
- const claim = await this.getOrCreateBridgeClaim(address);
166
- const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
167
- const deployMethod = await accountManager.getDeployMethod();
168
- const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
169
- const gasSettings = GasSettings.default({
170
- maxFeesPerGas
171
- });
172
- await this.withNoMinTxsPerBlock(async ()=>{
173
- const { txHash } = await deployMethod.send({
174
- from: AztecAddress.ZERO,
175
- fee: {
176
- gasSettings,
177
- paymentMethod
178
- },
179
- wait: NO_WAIT
180
- });
181
- this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`);
182
- return waitForTx(this.aztecNode, txHash, {
183
- timeout: this.config.txMinedWaitSeconds
184
- });
185
- });
186
- this.log.info(`Account deployed at ${address}`);
187
- // Clean up the consumed bridge claim
188
- await this.store.deleteBridgeClaim(address);
189
- return accountManager.address;
190
- }
191
- }
192
- async setupTestAccount() {
193
- const [initialAccountData] = await getInitialTestAccountsData();
194
- const accountManager = await this.wallet.createSchnorrAccount(initialAccountData.secret, initialAccountData.salt, initialAccountData.signingKey);
170
+ const accountManager = await this.wallet.createSchnorrInitializerlessAccount(secret, salt, signingKey);
195
171
  return accountManager.address;
196
172
  }
197
173
  /**
198
174
  * Checks if the token contract is deployed and deploys it if necessary.
199
- * @param wallet - Wallet to deploy the token contract from.
200
- * @returns The TokenContract instance.
175
+ * Uses a bridge claim for deploy when balance is below threshold to avoid failing before refuel.
176
+ * @param sender - Aztec address to deploy the token contract from.
177
+ * @param existingToken - Optional token instance when called from setupTokenWithOptionalEarlyRefuel.
178
+ * @returns The TokenContract or PrivateTokenContract instance.
201
179
  */ async setupToken(sender) {
202
180
  let deploy;
203
- let tokenInstance;
181
+ const salt = this.config.tokenSalt;
204
182
  const deployOpts = {
205
- from: sender,
206
- contractAddressSalt: this.config.tokenSalt,
207
- universalDeploy: true
183
+ from: sender
208
184
  };
209
185
  let token;
210
186
  if (this.config.contract === SupportedTokenContracts.TokenContract) {
211
- deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18);
212
- tokenInstance = await deploy.getInstance(deployOpts);
213
- token = TokenContract.at(tokenInstance.address, this.wallet);
187
+ deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18, {
188
+ salt,
189
+ universalDeploy: true
190
+ });
191
+ const instance = await deploy.getInstance();
192
+ token = TokenContract.at(instance.address, this.wallet);
214
193
  } else if (this.config.contract === SupportedTokenContracts.PrivateTokenContract) {
215
194
  // Generate keys for the contract since PrivateToken uses SinglePrivateMutable which requires keys
216
195
  const tokenSecretKey = Fr.random();
217
196
  const tokenPublicKeys = (await deriveKeys(tokenSecretKey)).publicKeys;
218
- deploy = PrivateTokenContract.deployWithPublicKeys(tokenPublicKeys, this.wallet, MINT_BALANCE, sender);
197
+ deploy = PrivateTokenContract.deploy(this.wallet, MINT_BALANCE, sender, {
198
+ salt,
199
+ universalDeploy: true,
200
+ publicKeys: tokenPublicKeys
201
+ });
219
202
  deployOpts.skipInstancePublication = true;
220
203
  deployOpts.skipClassPublication = true;
221
204
  deployOpts.skipInitialization = false;
222
205
  // Register the contract with the secret key before deployment
223
- tokenInstance = await deploy.getInstance(deployOpts);
206
+ const tokenInstance = await deploy.getInstance();
224
207
  token = PrivateTokenContract.at(tokenInstance.address, this.wallet);
225
208
  await this.wallet.registerContract(tokenInstance, PrivateTokenContract.artifact, tokenSecretKey);
226
209
  // The contract constructor initializes private storage vars that need the contract's own nullifier key.
@@ -230,52 +213,37 @@ export class BotFactory {
230
213
  } else {
231
214
  throw new Error(`Unsupported token contract type: ${this.config.contract}`);
232
215
  }
233
- const address = tokenInstance?.address ?? (await deploy.getInstance(deployOpts)).address;
234
- const metadata = await this.wallet.getContractMetadata(address);
235
- if (metadata.isContractPublished) {
236
- this.log.info(`Token at ${address.toString()} already deployed`);
237
- await deploy.register();
238
- } else {
239
- this.log.info(`Deploying token contract at ${address.toString()}`);
240
- const { txHash } = await deploy.send({
241
- ...deployOpts,
242
- wait: NO_WAIT
243
- });
244
- this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`);
245
- await this.withNoMinTxsPerBlock(async ()=>{
246
- await waitForTx(this.aztecNode, txHash, {
247
- timeout: this.config.txMinedWaitSeconds
248
- });
249
- return token;
250
- });
251
- }
216
+ await this.registerOrDeployContract('token', deploy, deployOpts);
252
217
  return token;
253
218
  }
254
219
  /**
255
220
  * Checks if the token contract is deployed and deploys it if necessary.
256
221
  * @param wallet - Wallet to deploy the token contract from.
257
222
  * @returns The TokenContract instance.
258
- */ async setupTokenContract(deployer, contractAddressSalt, name, ticker, decimals = 18) {
223
+ */ async setupTokenContract(deployer, salt, name, ticker, decimals = 18) {
259
224
  const deployOpts = {
260
- from: deployer,
261
- contractAddressSalt,
262
- universalDeploy: true
225
+ from: deployer
263
226
  };
264
- const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals);
227
+ const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals, {
228
+ salt,
229
+ universalDeploy: true
230
+ });
265
231
  const instance = await this.registerOrDeployContract('Token - ' + name, deploy, deployOpts);
266
232
  return TokenContract.at(instance.address, this.wallet);
267
233
  }
268
- async setupAmmContract(deployer, contractAddressSalt, token0, token1, lpToken) {
234
+ async setupAmmContract(deployer, salt, token0, token1, lpToken) {
269
235
  const deployOpts = {
270
- from: deployer,
271
- contractAddressSalt,
272
- universalDeploy: true
236
+ from: deployer
273
237
  };
274
- const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address);
238
+ const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address, {
239
+ salt,
240
+ universalDeploy: true
241
+ });
275
242
  const instance = await this.registerOrDeployContract('AMM', deploy, deployOpts);
276
243
  const amm = AMMContract.at(instance.address, this.wallet);
277
244
  this.log.info(`AMM deployed at ${amm.address}`);
278
- const { receipt: minterReceipt } = await lpToken.methods.set_minter(amm.address, true).send({
245
+ const setMinterInteraction = lpToken.methods.set_minter(amm.address, true);
246
+ const { receipt: minterReceipt } = await setMinterInteraction.send({
279
247
  from: deployer,
280
248
  wait: {
281
249
  timeout: this.config.txMinedWaitSeconds
@@ -314,17 +282,19 @@ export class BotFactory {
314
282
  caller: amm.address,
315
283
  call: await token1.methods.transfer_to_public_and_prepare_private_balance_increase(liquidityProvider, amm.address, amount1Max, authwitNonce).getFunctionCall()
316
284
  });
317
- const { receipt: mintReceipt } = await new BatchCall(this.wallet, [
285
+ const mintBatch = new BatchCall(this.wallet, [
318
286
  token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
319
287
  token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE)
320
- ]).send({
288
+ ]);
289
+ const { receipt: mintReceipt } = await mintBatch.send({
321
290
  from: liquidityProvider,
322
291
  wait: {
323
292
  timeout: this.config.txMinedWaitSeconds
324
293
  }
325
294
  });
326
295
  this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}`);
327
- const { receipt: addLiquidityReceipt } = await amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce).send({
296
+ const addLiquidityInteraction = amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce);
297
+ const { receipt: addLiquidityReceipt } = await addLiquidityInteraction.send({
328
298
  from: liquidityProvider,
329
299
  authWitnesses: [
330
300
  token0Authwit,
@@ -340,31 +310,75 @@ export class BotFactory {
340
310
  this.log.info(`Updated private balances of ${defaultAccountAddress} after minting and funding AMM: token0=${newT0Bal}, token1=${newT1Bal}, lp=${newLPBal}`);
341
311
  }
342
312
  async registerOrDeployContract(name, deploy, deployOpts) {
343
- const instance = await deploy.getInstance(deployOpts);
313
+ const instance = await deploy.getInstance();
344
314
  const address = instance.address;
345
315
  const metadata = await this.wallet.getContractMetadata(address);
346
316
  if (metadata.isContractPublished) {
347
317
  this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
348
318
  await deploy.register();
349
- } else {
350
- this.log.info(`Deploying contract ${name} at ${address.toString()}`);
319
+ return instance;
320
+ }
321
+ // Setup always runs ensureFeeJuiceBalance before any deploy, so the account pays from its standing
322
+ // balance here. No manual gas estimation: the embedded wallet simulates before sending and derives
323
+ // the gas limits and padded maxFeesPerGas itself.
324
+ this.log.info(`Deploying contract ${name} at ${address.toString()}`);
325
+ await this.withNoMinTxsPerBlock(async ()=>{
326
+ const { txHash } = await deploy.send({
327
+ ...deployOpts,
328
+ wait: NO_WAIT
329
+ });
330
+ this.log.info(`Sent contract ${name} deploy tx ${txHash.toString()}`);
331
+ return waitForTx(this.aztecNode, txHash, {
332
+ timeout: this.config.txMinedWaitSeconds
333
+ });
334
+ });
335
+ return instance;
336
+ }
337
+ /** True when the config allows bridging fee juice from L1 (fee_juice mode, an L1 RPC, and an L1 key). */ isL1BridgingConfigured() {
338
+ const mnemonicOrPrivateKey = this.config.l1PrivateKey?.getValue() ?? this.config.l1Mnemonic?.getValue();
339
+ return this.config.feePaymentMethod === 'fee_juice' && !!this.config.l1RpcUrls?.length && !!mnemonicOrPrivateKey;
340
+ }
341
+ /**
342
+ * Ensures the account holds enough fee juice before any other setup step. The account starts empty
343
+ * (initializerless accounts have no deployment tx) and the runtime loop pays fees from this balance and
344
+ * never refuels itself, so every flow funds the account up front. Bridges claims from L1 and consumes
345
+ * each with a claim-only tx until the balance clears the threshold, working from a zero (fresh run) or
346
+ * drained (restart) balance. Each bridge mints a fixed amount well above the threshold, so this is a
347
+ * single bridge in practice. No-op when L1 bridging is not configured or the balance is already above
348
+ * the threshold.
349
+ */ async ensureFeeJuiceBalance(account) {
350
+ if (!this.isL1BridgingConfigured()) {
351
+ return;
352
+ }
353
+ let balance = await getFeeJuiceBalance(account, this.aztecNode);
354
+ if (balance >= FEE_JUICE_TOP_UP_THRESHOLD) {
355
+ this.log.info(`Fee juice balance ${balance} above threshold ${FEE_JUICE_TOP_UP_THRESHOLD}, skipping top-up`);
356
+ return;
357
+ }
358
+ this.log.info(`Fee juice balance ${balance} below threshold ${FEE_JUICE_TOP_UP_THRESHOLD}, bridging from L1`);
359
+ while(balance < FEE_JUICE_TOP_UP_THRESHOLD){
360
+ // Persist the claim before consuming it: if the top-up tx fails or the bot crashes mid-loop, the
361
+ // next run reuses the pending claim instead of bridging again (and wasting the bridged funds).
362
+ const claim = await this.getOrCreateBridgeClaim(account);
363
+ const paymentMethod = new FeeJuicePaymentMethodWithClaim(account, claim);
351
364
  await this.withNoMinTxsPerBlock(async ()=>{
352
- const { txHash } = await deploy.send({
353
- ...deployOpts,
365
+ const executionPayload = await paymentMethod.getExecutionPayload();
366
+ const { txHash } = await this.wallet.sendTx(executionPayload, {
367
+ from: account,
354
368
  wait: NO_WAIT
355
369
  });
356
- this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
370
+ this.log.info(`Sent fee juice top-up tx ${txHash.toString()}`);
357
371
  return waitForTx(this.aztecNode, txHash, {
358
372
  timeout: this.config.txMinedWaitSeconds
359
373
  });
360
374
  });
375
+ await this.store.deleteBridgeClaim(account);
376
+ balance = await getFeeJuiceBalance(account, this.aztecNode);
377
+ this.log.info(`Fee juice balance after top-up: ${balance}`);
361
378
  }
362
- return instance;
379
+ this.log.info(`Fee juice top-up complete for ${account.toString()}`);
363
380
  }
364
- /**
365
- * Mints private and public tokens for the sender if their balance is below the minimum.
366
- * @param token - Token contract.
367
- */ async mintTokens(token, minter) {
381
+ async mintTokens(token, minter) {
368
382
  const isStandardToken = isStandardTokenContract(token);
369
383
  let privateBalance = 0n;
370
384
  let publicBalance = 0n;
@@ -390,8 +404,9 @@ export class BotFactory {
390
404
  const additionalScopes = isStandardToken ? undefined : [
391
405
  token.address
392
406
  ];
407
+ const mintBatch = new BatchCall(token.wallet, calls);
393
408
  await this.withNoMinTxsPerBlock(async ()=>{
394
- const { txHash } = await new BatchCall(token.wallet, calls).send({
409
+ const { txHash } = await mintBatch.send({
395
410
  from: minter,
396
411
  additionalScopes,
397
412
  wait: NO_WAIT
@@ -403,19 +418,18 @@ export class BotFactory {
403
418
  });
404
419
  }
405
420
  /**
406
- * Gets or creates a bridge claim for the recipient.
407
- * Checks if a claim already exists in the store and reuses it if valid.
408
- * Only creates a new bridge if fee juice balance is below threshold.
421
+ * Returns a usable bridge claim for the recipient, reusing a persisted one when its L1→L2 message is
422
+ * still available (resuming a top-up that failed or crashed before the claim was consumed) and bridging
423
+ * a fresh claim otherwise. The caller deletes the claim from the store once it has been consumed.
409
424
  */ async getOrCreateBridgeClaim(recipient) {
410
- // Check if we have an existing claim in the store
411
425
  const existingClaim = await this.store.getBridgeClaim(recipient);
412
426
  if (existingClaim) {
413
427
  this.log.info(`Found existing bridge claim for ${recipient.toString()}, checking validity...`);
414
- // Check if the message is ready on L2
415
428
  try {
416
429
  const messageHash = Fr.fromHexString(existingClaim.claim.messageHash);
417
430
  await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.aztecNode, messageHash, {
418
- timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
431
+ timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
432
+ chainTip: this.syncChainTip
419
433
  }));
420
434
  return existingClaim.claim;
421
435
  } catch (err) {
@@ -443,7 +457,8 @@ export class BotFactory {
443
457
  const mintAmount = await portal.getTokenManager().getMintAmount();
444
458
  const claim = await portal.bridgeTokensPublic(recipient, mintAmount, true);
445
459
  await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(claim.messageHash), {
446
- timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
460
+ timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
461
+ chainTip: this.syncChainTip
447
462
  }));
448
463
  this.log.info(`Created a claim for ${mintAmount} L1 fee juice to ${recipient}.`, claim);
449
464
  return claim;
@@ -4,11 +4,7 @@ import { z } from 'zod';
4
4
  import { type BotConfig } from './config.js';
5
5
  export declare const BotInfoSchema: z.ZodObject<{
6
6
  botAddress: import("@aztec/stdlib/schemas").ZodFor<AztecAddress>;
7
- }, "strip", z.ZodTypeAny, {
8
- botAddress: AztecAddress;
9
- }, {
10
- botAddress?: any;
11
- }>;
7
+ }, z.core.$strip>;
12
8
  export type BotInfo = z.infer<typeof BotInfoSchema>;
13
9
  export interface BotRunnerApi {
14
10
  start(): Promise<void>;
@@ -20,4 +16,4 @@ export interface BotRunnerApi {
20
16
  update(config: BotConfig): Promise<void>;
21
17
  }
22
18
  export declare const BotRunnerApiSchema: ApiSchemaFor<BotRunnerApi>;
23
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsT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,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5B,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,YAAY,CAQzD,CAAC"}
package/dest/interface.js CHANGED
@@ -5,11 +5,34 @@ export const BotInfoSchema = z.object({
5
5
  botAddress: AztecAddress.schema
6
6
  });
7
7
  export const BotRunnerApiSchema = {
8
- start: z.function().args().returns(z.void()),
9
- stop: z.function().args().returns(z.void()),
10
- run: z.function().args().returns(z.void()),
11
- setup: z.function().args().returns(z.void()),
12
- getInfo: z.function().args().returns(BotInfoSchema),
13
- getConfig: z.function().args().returns(BotConfigSchema),
14
- update: z.function().args(BotConfigSchema).returns(z.void())
8
+ start: z.function({
9
+ input: z.tuple([]),
10
+ output: z.void()
11
+ }),
12
+ stop: z.function({
13
+ input: z.tuple([]),
14
+ output: z.void()
15
+ }),
16
+ run: z.function({
17
+ input: z.tuple([]),
18
+ output: z.void()
19
+ }),
20
+ setup: z.function({
21
+ input: z.tuple([]),
22
+ output: z.void()
23
+ }),
24
+ getInfo: z.function({
25
+ input: z.tuple([]),
26
+ output: BotInfoSchema
27
+ }),
28
+ getConfig: z.function({
29
+ input: z.tuple([]),
30
+ output: BotConfigSchema
31
+ }),
32
+ update: z.function({
33
+ input: z.tuple([
34
+ BotConfigSchema
35
+ ]),
36
+ output: z.void()
37
+ })
15
38
  };
package/dest/runner.d.ts CHANGED
@@ -13,13 +13,14 @@ export declare class BotRunner implements BotRunnerApi, Traceable {
13
13
  private readonly telemetry;
14
14
  private readonly aztecNodeAdmin;
15
15
  private readonly store;
16
+ private readonly syncChainTip?;
16
17
  private log;
17
18
  private bot?;
18
19
  private runningPromise;
19
20
  private consecutiveErrors;
20
21
  private healthy;
21
22
  readonly tracer: Tracer;
22
- constructor(config: BotConfig, wallet: EmbeddedWallet, aztecNode: AztecNode, telemetry: TelemetryClient, aztecNodeAdmin: AztecNodeAdmin | undefined, store: BotStore);
23
+ constructor(config: BotConfig, wallet: EmbeddedWallet, aztecNode: AztecNode, telemetry: TelemetryClient, aztecNodeAdmin: AztecNodeAdmin | undefined, store: BotStore, syncChainTip?: "checkpointed" | "finalized" | "latest" | "proposed" | "proven" | undefined);
23
24
  /** Initializes the bot if needed. Blocks until the bot setup is finished. */
24
25
  setup(): Promise<void>;
25
26
  private doSetup;
@@ -50,4 +51,4 @@ export declare class BotRunner implements BotRunnerApi, Traceable {
50
51
  /** Returns the bot sender address. */
51
52
  getInfo(): Promise<BotInfo>;
52
53
  }
53
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVubmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcnVubmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBR3RELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ3RFLE9BQU8sRUFBRSxLQUFLLGVBQWUsRUFBRSxLQUFLLFNBQVMsRUFBRSxLQUFLLE1BQU0sRUFBYSxNQUFNLHlCQUF5QixDQUFDO0FBQ3ZHLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBSzlELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUU3QyxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDNUQsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRTVDLHFCQUFhLFNBQVUsWUFBVyxZQUFZLEVBQUUs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AAG,SAAS,EAC1C,KAAK,EAAE,QAAQ,EACf,YAAY,CAAC,6EAAU,EAKzC;IAED,6EAA6E;IAChE,KAAK,kBAIjB;YAGa,OAAO;IAMrB;;;OAGG;IACU,KAAK,kBAMjB;IAED;;OAEG;IACU,IAAI,kBAOhB;IAEM,SAAS,YAEf;IAED,0CAA0C;IACnC,SAAS,YAEf;IAED;;;OAGG;IACU,MAAM,CAAC,MAAM,EAAE,SAAS,iBAapC;IAED;;;OAGG;IACU,GAAG,kBAsBf;IAED,qDAAqD;IAC9C,SAAS,uBAGf;IAED,sCAAsC;IACzB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAMvC;CAwEF"}
package/dest/runner.js CHANGED
@@ -386,6 +386,7 @@ export class BotRunner {
386
386
  telemetry;
387
387
  aztecNodeAdmin;
388
388
  store;
389
+ syncChainTip;
389
390
  static{
390
391
  ({ e: [_call_work, _initProto] } = _apply_decs_2203_r(this, [
391
392
  [
@@ -428,13 +429,14 @@ export class BotRunner {
428
429
  consecutiveErrors;
429
430
  healthy;
430
431
  tracer;
431
- constructor(config, wallet, aztecNode, telemetry, aztecNodeAdmin, store){
432
+ constructor(config, wallet, aztecNode, telemetry, aztecNodeAdmin, store, syncChainTip){
432
433
  this.config = config;
433
434
  this.wallet = wallet;
434
435
  this.aztecNode = aztecNode;
435
436
  this.telemetry = telemetry;
436
437
  this.aztecNodeAdmin = aztecNodeAdmin;
437
438
  this.store = store;
439
+ this.syncChainTip = syncChainTip;
438
440
  this.log = (_initProto(this), createLogger('bot'));
439
441
  this.consecutiveErrors = 0;
440
442
  this.healthy = true;
@@ -538,13 +540,13 @@ export class BotRunner {
538
540
  try {
539
541
  switch(this.config.botMode){
540
542
  case 'crosschain':
541
- this.bot = CrossChainBot.create(this.config, this.wallet, this.aztecNode, this.aztecNodeAdmin, this.store);
543
+ this.bot = CrossChainBot.create(this.config, this.wallet, this.aztecNode, this.aztecNodeAdmin, this.store, this.syncChainTip);
542
544
  break;
543
545
  case 'amm':
544
- this.bot = AmmBot.create(this.config, this.wallet, this.aztecNode, this.aztecNodeAdmin, this.store);
546
+ this.bot = AmmBot.create(this.config, this.wallet, this.aztecNode, this.aztecNodeAdmin, this.store, this.syncChainTip);
545
547
  break;
546
548
  case 'transfer':
547
- this.bot = Bot.create(this.config, this.wallet, this.aztecNode, this.aztecNodeAdmin, this.store);
549
+ this.bot = Bot.create(this.config, this.wallet, this.aztecNode, this.aztecNodeAdmin, this.store, this.syncChainTip);
548
550
  break;
549
551
  default:
550
552
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/bot",
3
- "version": "5.0.0-private.20260318",
3
+ "version": "5.0.0-rc.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -54,24 +54,24 @@
54
54
  ]
55
55
  },
56
56
  "dependencies": {
57
- "@aztec/accounts": "5.0.0-private.20260318",
58
- "@aztec/aztec.js": "5.0.0-private.20260318",
59
- "@aztec/entrypoints": "5.0.0-private.20260318",
60
- "@aztec/ethereum": "5.0.0-private.20260318",
61
- "@aztec/foundation": "5.0.0-private.20260318",
62
- "@aztec/kv-store": "5.0.0-private.20260318",
63
- "@aztec/l1-artifacts": "5.0.0-private.20260318",
64
- "@aztec/noir-contracts.js": "5.0.0-private.20260318",
65
- "@aztec/noir-protocol-circuits-types": "5.0.0-private.20260318",
66
- "@aztec/noir-test-contracts.js": "5.0.0-private.20260318",
67
- "@aztec/protocol-contracts": "5.0.0-private.20260318",
68
- "@aztec/stdlib": "5.0.0-private.20260318",
69
- "@aztec/telemetry-client": "5.0.0-private.20260318",
70
- "@aztec/wallets": "5.0.0-private.20260318",
57
+ "@aztec/accounts": "5.0.0-rc.1",
58
+ "@aztec/aztec.js": "5.0.0-rc.1",
59
+ "@aztec/entrypoints": "5.0.0-rc.1",
60
+ "@aztec/ethereum": "5.0.0-rc.1",
61
+ "@aztec/foundation": "5.0.0-rc.1",
62
+ "@aztec/kv-store": "5.0.0-rc.1",
63
+ "@aztec/l1-artifacts": "5.0.0-rc.1",
64
+ "@aztec/noir-contracts.js": "5.0.0-rc.1",
65
+ "@aztec/noir-protocol-circuits-types": "5.0.0-rc.1",
66
+ "@aztec/noir-test-contracts.js": "5.0.0-rc.1",
67
+ "@aztec/protocol-contracts": "5.0.0-rc.1",
68
+ "@aztec/stdlib": "5.0.0-rc.1",
69
+ "@aztec/telemetry-client": "5.0.0-rc.1",
70
+ "@aztec/wallets": "5.0.0-rc.1",
71
71
  "source-map-support": "^0.5.21",
72
72
  "tslib": "^2.4.0",
73
73
  "viem": "npm:@aztec/viem@2.38.2",
74
- "zod": "^3.23.8"
74
+ "zod": "^4"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@jest/globals": "^30.0.0",