@aztec/bot 0.0.1-commit.3469e52 → 0.0.1-commit.350e0a4d

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.
Files changed (50) hide show
  1. package/dest/amm_bot.d.ts +7 -7
  2. package/dest/amm_bot.d.ts.map +1 -1
  3. package/dest/amm_bot.js +30 -19
  4. package/dest/base_bot.d.ts +8 -8
  5. package/dest/base_bot.d.ts.map +1 -1
  6. package/dest/base_bot.js +24 -35
  7. package/dest/bot.d.ts +7 -6
  8. package/dest/bot.d.ts.map +1 -1
  9. package/dest/bot.js +11 -11
  10. package/dest/config.d.ts +47 -82
  11. package/dest/config.d.ts.map +1 -1
  12. package/dest/config.js +42 -15
  13. package/dest/cross_chain_bot.d.ts +56 -0
  14. package/dest/cross_chain_bot.d.ts.map +1 -0
  15. package/dest/cross_chain_bot.js +138 -0
  16. package/dest/factory.d.ts +25 -11
  17. package/dest/factory.d.ts.map +1 -1
  18. package/dest/factory.js +241 -141
  19. package/dest/index.d.ts +2 -1
  20. package/dest/index.d.ts.map +1 -1
  21. package/dest/index.js +1 -0
  22. package/dest/interface.d.ts +2 -6
  23. package/dest/interface.d.ts.map +1 -1
  24. package/dest/interface.js +30 -7
  25. package/dest/l1_to_l2_seeding.d.ts +8 -0
  26. package/dest/l1_to_l2_seeding.d.ts.map +1 -0
  27. package/dest/l1_to_l2_seeding.js +63 -0
  28. package/dest/runner.d.ts +4 -3
  29. package/dest/runner.d.ts.map +1 -1
  30. package/dest/runner.js +20 -2
  31. package/dest/store/bot_store.d.ts +30 -5
  32. package/dest/store/bot_store.d.ts.map +1 -1
  33. package/dest/store/bot_store.js +37 -6
  34. package/dest/store/index.d.ts +2 -2
  35. package/dest/store/index.d.ts.map +1 -1
  36. package/dest/utils.js +3 -3
  37. package/package.json +17 -14
  38. package/src/amm_bot.ts +30 -22
  39. package/src/base_bot.ts +19 -40
  40. package/src/bot.ts +14 -12
  41. package/src/config.ts +47 -18
  42. package/src/cross_chain_bot.ts +208 -0
  43. package/src/factory.ts +276 -129
  44. package/src/index.ts +1 -0
  45. package/src/interface.ts +7 -7
  46. package/src/l1_to_l2_seeding.ts +79 -0
  47. package/src/runner.ts +41 -5
  48. package/src/store/bot_store.ts +60 -5
  49. package/src/store/index.ts +1 -1
  50. package/src/utils.ts +3 -3
package/dest/factory.js CHANGED
@@ -1,46 +1,55 @@
1
- import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
2
1
  import { getInitialTestAccountsData } from '@aztec/accounts/testing';
3
- import { AztecAddress } from '@aztec/aztec.js/addresses';
4
- import { BatchCall } from '@aztec/aztec.js/contracts';
2
+ import { BatchCall, NO_WAIT } from '@aztec/aztec.js/contracts';
5
3
  import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
6
4
  import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
7
5
  import { deriveKeys } from '@aztec/aztec.js/keys';
8
6
  import { createLogger } from '@aztec/aztec.js/log';
9
7
  import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
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
+ import { RollupContract } from '@aztec/ethereum/contracts';
12
13
  import { Fr } from '@aztec/foundation/curves/bn254';
13
- import { Timer } from '@aztec/foundation/timer';
14
+ import { EthAddress } from '@aztec/foundation/eth-address';
14
15
  import { AMMContract } from '@aztec/noir-contracts.js/AMM';
15
16
  import { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
16
17
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
17
- import { GasSettings } from '@aztec/stdlib/gas';
18
+ import { TestContract } from '@aztec/noir-test-contracts.js/Test';
18
19
  import { deriveSigningKey } from '@aztec/stdlib/keys';
19
20
  import { SupportedTokenContracts } from './config.js';
21
+ import { seedL1ToL2Message } from './l1_to_l2_seeding.js';
20
22
  import { getBalances, getPrivateBalance, isStandardTokenContract } from './utils.js';
21
23
  const MINT_BALANCE = 1e12;
22
24
  const MIN_BALANCE = 1e3;
25
+ const FEE_JUICE_TOP_UP_THRESHOLD = 100n * 10n ** 18n;
23
26
  export class BotFactory {
24
27
  config;
25
28
  wallet;
26
29
  store;
27
30
  aztecNode;
28
31
  aztecNodeAdmin;
32
+ syncChainTip;
29
33
  log;
30
- constructor(config, wallet, store, aztecNode, aztecNodeAdmin){
34
+ constructor(config, wallet, store, aztecNode, aztecNodeAdmin, syncChainTip){
31
35
  this.config = config;
32
36
  this.wallet = wallet;
33
37
  this.store = store;
34
38
  this.aztecNode = aztecNode;
35
39
  this.aztecNodeAdmin = aztecNodeAdmin;
40
+ this.syncChainTip = syncChainTip;
36
41
  this.log = createLogger('bot');
42
+ // Set fee padding on the wallet so that all transactions during setup
43
+ // (token deploy, minting, etc.) use the configured padding, not the default.
44
+ this.wallet.setMinFeePadding(config.minFeePadding);
37
45
  }
38
46
  /**
39
47
  * Initializes a new bot by setting up the sender account, registering the recipient,
40
48
  * deploying the token contract, and minting tokens if necessary.
41
49
  */ async setup() {
42
50
  const defaultAccountAddress = await this.setupAccount();
43
- const recipient = (await this.wallet.createAccount()).address;
51
+ const recipient = (await this.wallet.createSchnorrAccount(Fr.random(), Fr.random())).address;
52
+ await this.ensureFeeJuiceBalance(defaultAccountAddress);
44
53
  const token = await this.setupToken(defaultAccountAddress);
45
54
  await this.mintTokens(token, defaultAccountAddress);
46
55
  return {
@@ -53,6 +62,7 @@ export class BotFactory {
53
62
  }
54
63
  async setupAmm() {
55
64
  const defaultAccountAddress = await this.setupAccount();
65
+ await this.ensureFeeJuiceBalance(defaultAccountAddress);
56
66
  const token0 = await this.setupTokenContract(defaultAccountAddress, this.config.tokenSalt, 'BotToken0', 'BOT0');
57
67
  const token1 = await this.setupTokenContract(defaultAccountAddress, this.config.tokenSalt, 'BotToken1', 'BOT1');
58
68
  const liquidityToken = await this.setupTokenContract(defaultAccountAddress, this.config.tokenSalt, 'BotLPToken', 'BOTLP');
@@ -69,6 +79,68 @@ export class BotFactory {
69
79
  };
70
80
  }
71
81
  /**
82
+ * Initializes the cross-chain bot by deploying TestContract, creating an L1 client,
83
+ * seeding initial L1→L2 messages, and waiting for the first to be ready.
84
+ */ async setupCrossChain() {
85
+ const defaultAccountAddress = await this.setupAccount();
86
+ await this.ensureFeeJuiceBalance(defaultAccountAddress);
87
+ // Create L1 client (same pattern as bridgeL1FeeJuice)
88
+ const l1RpcUrls = this.config.l1RpcUrls;
89
+ if (!l1RpcUrls?.length) {
90
+ throw new Error('L1 RPC URLs required for cross-chain bot');
91
+ }
92
+ const mnemonicOrPrivateKey = this.config.l1PrivateKey?.getValue() ?? this.config.l1Mnemonic?.getValue();
93
+ if (!mnemonicOrPrivateKey) {
94
+ throw new Error('L1 mnemonic or private key required for cross-chain bot');
95
+ }
96
+ const { l1ChainId, l1ContractAddresses } = await this.aztecNode.getNodeInfo();
97
+ const chain = createEthereumChain(l1RpcUrls, l1ChainId);
98
+ const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
99
+ // Fetch Rollup version (needed for Inbox L2Actor struct)
100
+ const rollupContract = new RollupContract(l1Client, l1ContractAddresses.rollupAddress.toString());
101
+ const rollupVersion = await rollupContract.getVersion();
102
+ // Deploy TestContract (pays from the standing balance funded above).
103
+ const contract = await this.setupTestContract(defaultAccountAddress);
104
+ // Recover any pending messages from store (clean up stale ones first)
105
+ await this.store.cleanupOldPendingMessages();
106
+ const pendingMessages = await this.store.getUnconsumedL1ToL2Messages();
107
+ // Seed initial L1→L2 messages if pipeline is empty
108
+ const seedCount = Math.max(0, this.config.l1ToL2SeedCount - pendingMessages.length);
109
+ for(let i = 0; i < seedCount; i++){
110
+ await seedL1ToL2Message(l1Client, EthAddress.fromString(l1ContractAddresses.inboxAddress.toString()), contract.address, rollupVersion, this.store, this.log);
111
+ }
112
+ // Block until at least one message is ready
113
+ const allMessages = await this.store.getUnconsumedL1ToL2Messages();
114
+ if (allMessages.length > 0) {
115
+ this.log.info(`Waiting for first L1→L2 message to be ready...`);
116
+ const firstMsg = allMessages[0];
117
+ await waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(firstMsg.msgHash), {
118
+ timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
119
+ chainTip: this.syncChainTip
120
+ });
121
+ this.log.info(`First L1→L2 message is ready`);
122
+ }
123
+ return {
124
+ wallet: this.wallet,
125
+ defaultAccountAddress,
126
+ contract,
127
+ node: this.aztecNode,
128
+ l1Client,
129
+ rollupVersion
130
+ };
131
+ }
132
+ async setupTestContract(deployer) {
133
+ const deployOpts = {
134
+ from: deployer
135
+ };
136
+ const deploy = TestContract.deploy(this.wallet, {
137
+ salt: this.config.tokenSalt,
138
+ universalDeploy: true
139
+ });
140
+ const instance = await this.registerOrDeployContract('TestContract', deploy, deployOpts);
141
+ return TestContract.at(instance.address, this.wallet);
142
+ }
143
+ /**
72
144
  * Checks if the sender account contract is initialized, and initializes it if necessary.
73
145
  * @returns The sender wallet.
74
146
  */ async setupAccount() {
@@ -81,133 +153,103 @@ export class BotFactory {
81
153
  return await this.setupTestAccount();
82
154
  }
83
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
+ }
84
167
  async setupAccountWithPrivateKey(secret) {
85
168
  const salt = this.config.senderSalt ?? Fr.ONE;
86
169
  const signingKey = deriveSigningKey(secret);
87
- const accountData = {
88
- secret,
89
- salt,
90
- contract: new SchnorrAccountContract(signingKey)
91
- };
92
- const accountManager = await this.wallet.createAccount(accountData);
93
- const metadata = await this.wallet.getContractMetadata(accountManager.address);
94
- if (metadata.isContractInitialized) {
95
- this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
96
- const timer = new Timer();
97
- const address = accountManager.address;
98
- this.log.info(`Account at ${address} registered. duration=${timer.ms()}`);
99
- await this.store.deleteBridgeClaim(address);
100
- return address;
101
- } else {
102
- const address = accountManager.address;
103
- this.log.info(`Deploying account at ${address}`);
104
- const claim = await this.getOrCreateBridgeClaim(address);
105
- const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
106
- const deployMethod = await accountManager.getDeployMethod();
107
- const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
108
- const gasSettings = GasSettings.default({
109
- maxFeesPerGas
110
- });
111
- const sentTx = deployMethod.send({
112
- from: AztecAddress.ZERO,
113
- fee: {
114
- gasSettings,
115
- paymentMethod
116
- }
117
- });
118
- const txHash = await sentTx.getTxHash();
119
- this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`);
120
- await this.withNoMinTxsPerBlock(()=>sentTx.wait({
121
- timeout: this.config.txMinedWaitSeconds
122
- }));
123
- this.log.info(`Account deployed at ${address}`);
124
- // Clean up the consumed bridge claim
125
- await this.store.deleteBridgeClaim(address);
126
- return accountManager.address;
127
- }
128
- }
129
- async setupTestAccount() {
130
- const [initialAccountData] = await getInitialTestAccountsData();
131
- const accountData = {
132
- secret: initialAccountData.secret,
133
- salt: initialAccountData.salt,
134
- contract: new SchnorrAccountContract(initialAccountData.signingKey)
135
- };
136
- const accountManager = await this.wallet.createAccount(accountData);
170
+ const accountManager = await this.wallet.createSchnorrInitializerlessAccount(secret, salt, signingKey);
137
171
  return accountManager.address;
138
172
  }
139
173
  /**
140
174
  * Checks if the token contract is deployed and deploys it if necessary.
141
- * @param wallet - Wallet to deploy the token contract from.
142
- * @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.
143
179
  */ async setupToken(sender) {
144
180
  let deploy;
145
- let tokenInstance;
181
+ const salt = this.config.tokenSalt;
146
182
  const deployOpts = {
147
- from: sender,
148
- contractAddressSalt: this.config.tokenSalt,
149
- universalDeploy: true
183
+ from: sender
150
184
  };
185
+ let token;
151
186
  if (this.config.contract === SupportedTokenContracts.TokenContract) {
152
- deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18);
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);
153
193
  } else if (this.config.contract === SupportedTokenContracts.PrivateTokenContract) {
154
194
  // Generate keys for the contract since PrivateToken uses SinglePrivateMutable which requires keys
155
195
  const tokenSecretKey = Fr.random();
156
196
  const tokenPublicKeys = (await deriveKeys(tokenSecretKey)).publicKeys;
157
- 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
+ });
158
202
  deployOpts.skipInstancePublication = true;
159
203
  deployOpts.skipClassPublication = true;
160
204
  deployOpts.skipInitialization = false;
161
205
  // Register the contract with the secret key before deployment
162
- tokenInstance = await deploy.getInstance(deployOpts);
206
+ const tokenInstance = await deploy.getInstance();
207
+ token = PrivateTokenContract.at(tokenInstance.address, this.wallet);
163
208
  await this.wallet.registerContract(tokenInstance, PrivateTokenContract.artifact, tokenSecretKey);
209
+ // The contract constructor initializes private storage vars that need the contract's own nullifier key.
210
+ deployOpts.additionalScopes = [
211
+ tokenInstance.address
212
+ ];
164
213
  } else {
165
214
  throw new Error(`Unsupported token contract type: ${this.config.contract}`);
166
215
  }
167
- const address = tokenInstance?.address ?? (await deploy.getInstance(deployOpts)).address;
168
- const metadata = await this.wallet.getContractMetadata(address);
169
- if (metadata.isContractPublished) {
170
- this.log.info(`Token at ${address.toString()} already deployed`);
171
- return deploy.register();
172
- } else {
173
- this.log.info(`Deploying token contract at ${address.toString()}`);
174
- const sentTx = deploy.send(deployOpts);
175
- const txHash = await sentTx.getTxHash();
176
- this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`);
177
- return this.withNoMinTxsPerBlock(()=>sentTx.deployed({
178
- timeout: this.config.txMinedWaitSeconds
179
- }));
180
- }
216
+ await this.registerOrDeployContract('token', deploy, deployOpts);
217
+ return token;
181
218
  }
182
219
  /**
183
220
  * Checks if the token contract is deployed and deploys it if necessary.
184
221
  * @param wallet - Wallet to deploy the token contract from.
185
222
  * @returns The TokenContract instance.
186
- */ setupTokenContract(deployer, contractAddressSalt, name, ticker, decimals = 18) {
223
+ */ async setupTokenContract(deployer, salt, name, ticker, decimals = 18) {
187
224
  const deployOpts = {
188
- from: deployer,
189
- contractAddressSalt,
190
- universalDeploy: true
225
+ from: deployer
191
226
  };
192
- const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals);
193
- return this.registerOrDeployContract('Token - ' + name, deploy, deployOpts);
227
+ const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals, {
228
+ salt,
229
+ universalDeploy: true
230
+ });
231
+ const instance = await this.registerOrDeployContract('Token - ' + name, deploy, deployOpts);
232
+ return TokenContract.at(instance.address, this.wallet);
194
233
  }
195
- async setupAmmContract(deployer, contractAddressSalt, token0, token1, lpToken) {
234
+ async setupAmmContract(deployer, salt, token0, token1, lpToken) {
196
235
  const deployOpts = {
197
- from: deployer,
198
- contractAddressSalt,
199
- universalDeploy: true
200
- };
201
- const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address);
202
- const amm = await this.registerOrDeployContract('AMM', deploy, deployOpts);
203
- this.log.info(`AMM deployed at ${amm.address}`);
204
- const minterTx = lpToken.methods.set_minter(amm.address, true).send({
205
236
  from: deployer
237
+ };
238
+ const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address, {
239
+ salt,
240
+ universalDeploy: true
206
241
  });
207
- this.log.info(`Set LP token minter to AMM txHash=${(await minterTx.getTxHash()).toString()}`);
208
- await minterTx.wait({
209
- timeout: this.config.txMinedWaitSeconds
242
+ const instance = await this.registerOrDeployContract('AMM', deploy, deployOpts);
243
+ const amm = AMMContract.at(instance.address, this.wallet);
244
+ this.log.info(`AMM deployed at ${amm.address}`);
245
+ const setMinterInteraction = lpToken.methods.set_minter(amm.address, true);
246
+ const { receipt: minterReceipt } = await setMinterInteraction.send({
247
+ from: deployer,
248
+ wait: {
249
+ timeout: this.config.txMinedWaitSeconds
250
+ }
210
251
  });
252
+ this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}`);
211
253
  this.log.info(`Liquidity token initialized`);
212
254
  return amm;
213
255
  }
@@ -215,13 +257,13 @@ export class BotFactory {
215
257
  const getPrivateBalances = ()=>Promise.all([
216
258
  token0.methods.balance_of_private(liquidityProvider).simulate({
217
259
  from: liquidityProvider
218
- }),
260
+ }).then((r)=>r.result),
219
261
  token1.methods.balance_of_private(liquidityProvider).simulate({
220
262
  from: liquidityProvider
221
- }),
263
+ }).then((r)=>r.result),
222
264
  lpToken.methods.balance_of_private(liquidityProvider).simulate({
223
265
  from: liquidityProvider
224
- })
266
+ }).then((r)=>r.result)
225
267
  ]);
226
268
  const authwitNonce = Fr.random();
227
269
  // keep some tokens for swapping
@@ -240,51 +282,103 @@ export class BotFactory {
240
282
  caller: amm.address,
241
283
  call: await token1.methods.transfer_to_public_and_prepare_private_balance_increase(liquidityProvider, amm.address, amount1Max, authwitNonce).getFunctionCall()
242
284
  });
243
- const mintTx = new BatchCall(this.wallet, [
285
+ const mintBatch = new BatchCall(this.wallet, [
244
286
  token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
245
287
  token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE)
246
- ]).send({
247
- from: liquidityProvider
248
- });
249
- this.log.info(`Sent mint tx: ${(await mintTx.getTxHash()).toString()}`);
250
- await mintTx.wait({
251
- timeout: this.config.txMinedWaitSeconds
288
+ ]);
289
+ const { receipt: mintReceipt } = await mintBatch.send({
290
+ from: liquidityProvider,
291
+ wait: {
292
+ timeout: this.config.txMinedWaitSeconds
293
+ }
252
294
  });
253
- const addLiquidityTx = amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce).send({
295
+ this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}`);
296
+ const addLiquidityInteraction = amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce);
297
+ const { receipt: addLiquidityReceipt } = await addLiquidityInteraction.send({
254
298
  from: liquidityProvider,
255
299
  authWitnesses: [
256
300
  token0Authwit,
257
301
  token1Authwit
258
- ]
259
- });
260
- this.log.info(`Sent tx to add liquidity to the AMM: ${(await addLiquidityTx.getTxHash()).toString()}`);
261
- await addLiquidityTx.wait({
262
- timeout: this.config.txMinedWaitSeconds
302
+ ],
303
+ wait: {
304
+ timeout: this.config.txMinedWaitSeconds
305
+ }
263
306
  });
307
+ this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}`);
264
308
  this.log.info(`Liquidity added`);
265
309
  const [newT0Bal, newT1Bal, newLPBal] = await getPrivateBalances();
266
310
  this.log.info(`Updated private balances of ${defaultAccountAddress} after minting and funding AMM: token0=${newT0Bal}, token1=${newT1Bal}, lp=${newLPBal}`);
267
311
  }
268
312
  async registerOrDeployContract(name, deploy, deployOpts) {
269
- const address = (await deploy.getInstance(deployOpts)).address;
313
+ const instance = await deploy.getInstance();
314
+ const address = instance.address;
270
315
  const metadata = await this.wallet.getContractMetadata(address);
271
316
  if (metadata.isContractPublished) {
272
317
  this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
273
- return deploy.register();
274
- } else {
275
- this.log.info(`Deploying contract ${name} at ${address.toString()}`);
276
- const sentTx = deploy.send(deployOpts);
277
- const txHash = await sentTx.getTxHash();
278
- this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
279
- return this.withNoMinTxsPerBlock(()=>sentTx.deployed({
280
- timeout: this.config.txMinedWaitSeconds
281
- }));
318
+ await deploy.register();
319
+ return instance;
282
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;
283
340
  }
284
341
  /**
285
- * Mints private and public tokens for the sender if their balance is below the minimum.
286
- * @param token - Token contract.
287
- */ async mintTokens(token, minter) {
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);
364
+ await this.withNoMinTxsPerBlock(async ()=>{
365
+ const executionPayload = await paymentMethod.getExecutionPayload();
366
+ const { txHash } = await this.wallet.sendTx(executionPayload, {
367
+ from: account,
368
+ wait: NO_WAIT
369
+ });
370
+ this.log.info(`Sent fee juice top-up tx ${txHash.toString()}`);
371
+ return waitForTx(this.aztecNode, txHash, {
372
+ timeout: this.config.txMinedWaitSeconds
373
+ });
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}`);
378
+ }
379
+ this.log.info(`Fee juice top-up complete for ${account.toString()}`);
380
+ }
381
+ async mintTokens(token, minter) {
288
382
  const isStandardToken = isStandardTokenContract(token);
289
383
  let privateBalance = 0n;
290
384
  let publicBalance = 0n;
@@ -306,30 +400,36 @@ export class BotFactory {
306
400
  this.log.info(`Skipping minting as ${minter.toString()} has enough tokens`);
307
401
  return;
308
402
  }
309
- const sentTx = new BatchCall(token.wallet, calls).send({
310
- from: minter
311
- });
312
- const txHash = await sentTx.getTxHash();
313
- this.log.info(`Sent token mint tx with hash ${txHash.toString()}`);
314
- await this.withNoMinTxsPerBlock(()=>sentTx.wait({
403
+ // PrivateToken's mint accesses contract-level private storage vars (admin, total_supply).
404
+ const additionalScopes = isStandardToken ? undefined : [
405
+ token.address
406
+ ];
407
+ const mintBatch = new BatchCall(token.wallet, calls);
408
+ await this.withNoMinTxsPerBlock(async ()=>{
409
+ const { txHash } = await mintBatch.send({
410
+ from: minter,
411
+ additionalScopes,
412
+ wait: NO_WAIT
413
+ });
414
+ this.log.info(`Sent token mint tx with hash ${txHash.toString()}`);
415
+ return waitForTx(this.aztecNode, txHash, {
315
416
  timeout: this.config.txMinedWaitSeconds
316
- }));
417
+ });
418
+ });
317
419
  }
318
420
  /**
319
- * Gets or creates a bridge claim for the recipient.
320
- * Checks if a claim already exists in the store and reuses it if valid.
321
- * 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.
322
424
  */ async getOrCreateBridgeClaim(recipient) {
323
- // Check if we have an existing claim in the store
324
425
  const existingClaim = await this.store.getBridgeClaim(recipient);
325
426
  if (existingClaim) {
326
427
  this.log.info(`Found existing bridge claim for ${recipient.toString()}, checking validity...`);
327
- // Check if the message is ready on L2
328
428
  try {
329
429
  const messageHash = Fr.fromHexString(existingClaim.claim.messageHash);
330
430
  await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.aztecNode, messageHash, {
331
431
  timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
332
- forPublicConsumption: false
432
+ chainTip: this.syncChainTip
333
433
  }));
334
434
  return existingClaim.claim;
335
435
  } catch (err) {
@@ -358,7 +458,7 @@ export class BotFactory {
358
458
  const claim = await portal.bridgeTokensPublic(recipient, mintAmount, true);
359
459
  await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(claim.messageHash), {
360
460
  timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
361
- forPublicConsumption: false
461
+ chainTip: this.syncChainTip
362
462
  }));
363
463
  this.log.info(`Created a claim for ${mintAmount} L1 fee juice to ${recipient}.`, claim);
364
464
  return claim;
package/dest/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { Bot } from './bot.js';
2
2
  export { AmmBot } from './amm_bot.js';
3
+ export { CrossChainBot } from './cross_chain_bot.js';
3
4
  export { BotRunner } from './runner.js';
4
5
  export { BotStore } from './store/bot_store.js';
5
6
  export { type BotConfig, getBotConfigFromEnv, getBotDefaultConfig, botConfigMappings, SupportedTokenContracts, } from './config.js';
6
7
  export { getBotRunnerApiHandler } from './rpc.js';
7
8
  export * from './interface.js';
8
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsR0FBRyxFQUFFLE1BQU0sVUFBVSxDQUFDO0FBQy9CLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDdEMsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUN4QyxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDaEQsT0FBTyxFQUNMLEtBQUssU0FBUyxFQUNkLG1CQUFtQixFQUNuQixtQkFBbUIsRUFDbkIsaUJBQWlCLEVBQ2pCLHVCQUF1QixHQUN4QixNQUFNLGFBQWEsQ0FBQztBQUNyQixPQUFPLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSxVQUFVLENBQUM7QUFDbEQsY0FBYyxnQkFBZ0IsQ0FBQyJ9
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsR0FBRyxFQUFFLE1BQU0sVUFBVSxDQUFDO0FBQy9CLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDdEMsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3JELE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDeEMsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ2hELE9BQU8sRUFDTCxLQUFLLFNBQVMsRUFDZCxtQkFBbUIsRUFDbkIsbUJBQW1CLEVBQ25CLGlCQUFpQixFQUNqQix1QkFBdUIsR0FDeEIsTUFBTSxhQUFhLENBQUM7QUFDckIsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sVUFBVSxDQUFDO0FBQ2xELGNBQWMsZ0JBQWdCLENBQUMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACL,KAAK,SAAS,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACL,KAAK,SAAS,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,cAAc,gBAAgB,CAAC"}
package/dest/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { Bot } from './bot.js';
2
2
  export { AmmBot } from './amm_bot.js';
3
+ export { CrossChainBot } from './cross_chain_bot.js';
3
4
  export { BotRunner } from './runner.js';
4
5
  export { BotStore } from './store/bot_store.js';
5
6
  export { getBotConfigFromEnv, getBotDefaultConfig, botConfigMappings, SupportedTokenContracts } from './config.js';
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUUxRCxPQUFPLEVBQUUsQ0FBQyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBRXhCLE9BQU8sRUFBRSxLQUFLLFNBQVMsRUFBbUIsTUFBTSxhQUFhLENBQUM7QUFFOUQsZUFBTyxNQUFNLGFBQWE7Ozs7OztFQUV4QixDQUFDO0FBRUgsTUFBTSxNQUFNLE9BQU8sR0FBRyxDQUFDLENBQUMsS0FBSyxDQUFDLE9BQU8sYUFBYSxDQUFDLENBQUM7QUFFcEQsTUFBTSxXQUFXLFlBQVk7SUFDM0IsS0FBSyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN2QixJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3RCLEdBQUcsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDckIsS0FBSyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN2QixTQUFTLElBQUksT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQ2hDLE9BQU8sSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDNUIsTUFBTSxDQUFDLE1BQU0sRUFBRSxTQUFTLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0NBQzFDO0FBRUQsZUFBTyxNQUFNLGtCQUFrQixFQUFFLFlBQVksQ0FBQyxZQUFZLENBUXpELENBQUMifQ==
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUUxRCxPQUFPLEVBQUUsQ0FBQyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBRXhCLE9BQU8sRUFBRSxLQUFLLFNBQVMsRUFBbUIsTUFBTSxhQUFhLENBQUM7QUFFOUQsZUFBTyxNQUFNLGFBQWE7O2lCQUV4QixDQUFDO0FBRUgsTUFBTSxNQUFNLE9BQU8sR0FBRyxDQUFDLENBQUMsS0FBSyxDQUFDLE9BQU8sYUFBYSxDQUFDLENBQUM7QUFFcEQsTUFBTSxXQUFXLFlBQVk7SUFDM0IsS0FBSyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN2QixJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3RCLEdBQUcsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDckIsS0FBSyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN2QixTQUFTLElBQUksT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQ2hDLE9BQU8sSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDNUIsTUFBTSxDQUFDLE1BQU0sRUFBRSxTQUFTLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0NBQzFDO0FBRUQsZUFBTyxNQUFNLGtCQUFrQixFQUFFLFlBQVksQ0FBQyxZQUFZLENBUXpELENBQUMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,aAAa;;;;;;EAExB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,MAAM,WAAW,YAAY;IAC3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,SAAS,IAAI,OAAO,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"}
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,aAAa;;iBAExB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,MAAM,WAAW,YAAY;IAC3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,SAAS,IAAI,OAAO,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
  };
@@ -0,0 +1,8 @@
1
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
2
+ import { EthAddress } from '@aztec/foundation/eth-address';
3
+ import type { Logger } from '@aztec/foundation/log';
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import type { BotStore, PendingL1ToL2Message } from './store/index.js';
6
+ /** Sends an L1→L2 message via the Inbox contract and stores it. */
7
+ export declare function seedL1ToL2Message(l1Client: ExtendedViemWalletClient, inboxAddress: EthAddress, l2Recipient: AztecAddress, rollupVersion: bigint, store: BotStore, log: Logger): Promise<PendingL1ToL2Message>;
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDFfdG9fbDJfc2VlZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2wxX3RvX2wyX3NlZWRpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUd0RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDM0QsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFcEQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFJaEUsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLG9CQUFvQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFdkUscUVBQW1FO0FBQ25FLHdCQUFzQixpQkFBaUIsQ0FDckMsUUFBUSxFQUFFLHdCQUF3QixFQUNsQyxZQUFZLEVBQUUsVUFBVSxFQUN4QixXQUFXLEVBQUUsWUFBWSxFQUN6QixhQUFhLEVBQUUsTUFBTSxFQUNyQixLQUFLLEVBQUUsUUFBUSxFQUNmLEdBQUcsRUFBRSxNQUFNLEdBQ1YsT0FBTyxDQUFDLG9CQUFvQixDQUFDLENBeUQvQiJ9