@aztec/bot 0.0.1-commit.b655e406 → 0.0.1-commit.b6e433891
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/amm_bot.d.ts +6 -7
- package/dest/amm_bot.d.ts.map +1 -1
- package/dest/amm_bot.js +27 -16
- package/dest/base_bot.d.ts +6 -6
- package/dest/base_bot.d.ts.map +1 -1
- package/dest/base_bot.js +14 -15
- package/dest/bot.d.ts +6 -6
- package/dest/bot.d.ts.map +1 -1
- package/dest/bot.js +8 -4
- package/dest/config.d.ts +73 -58
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +44 -17
- package/dest/cross_chain_bot.d.ts +54 -0
- package/dest/cross_chain_bot.d.ts.map +1 -0
- package/dest/cross_chain_bot.js +134 -0
- package/dest/factory.d.ts +18 -26
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +261 -79
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/interface.d.ts +1 -1
- package/dest/l1_to_l2_seeding.d.ts +8 -0
- package/dest/l1_to_l2_seeding.d.ts.map +1 -0
- package/dest/l1_to_l2_seeding.js +63 -0
- package/dest/rpc.d.ts +1 -1
- package/dest/runner.d.ts +3 -3
- package/dest/runner.d.ts.map +1 -1
- package/dest/runner.js +429 -31
- package/dest/store/bot_store.d.ts +30 -5
- package/dest/store/bot_store.d.ts.map +1 -1
- package/dest/store/bot_store.js +38 -7
- package/dest/store/index.d.ts +2 -2
- package/dest/store/index.d.ts.map +1 -1
- package/dest/utils.d.ts +1 -1
- package/dest/utils.js +3 -3
- package/package.json +19 -15
- package/src/amm_bot.ts +26 -21
- package/src/base_bot.ts +13 -27
- package/src/bot.ts +10 -8
- package/src/config.ts +90 -60
- package/src/cross_chain_bot.ts +203 -0
- package/src/factory.ts +264 -75
- package/src/index.ts +1 -0
- package/src/l1_to_l2_seeding.ts +79 -0
- package/src/runner.ts +18 -5
- package/src/store/bot_store.ts +61 -6
- package/src/store/index.ts +1 -1
- package/src/utils.ts +3 -3
package/dest/factory.js
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
3
2
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
-
import { BatchCall } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { BatchCall, NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
5
4
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
6
5
|
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
6
|
+
import { deriveKeys } from '@aztec/aztec.js/keys';
|
|
7
7
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
8
8
|
import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
10
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
11
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
12
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
13
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
14
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
15
|
import { Timer } from '@aztec/foundation/timer';
|
|
12
16
|
import { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
13
17
|
import { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
14
18
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
15
|
-
import {
|
|
19
|
+
import { TestContract } from '@aztec/noir-test-contracts.js/Test';
|
|
20
|
+
import { GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
16
21
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
17
22
|
import { SupportedTokenContracts } from './config.js';
|
|
23
|
+
import { seedL1ToL2Message } from './l1_to_l2_seeding.js';
|
|
18
24
|
import { getBalances, getPrivateBalance, isStandardTokenContract } from './utils.js';
|
|
19
25
|
const MINT_BALANCE = 1e12;
|
|
20
26
|
const MIN_BALANCE = 1e3;
|
|
@@ -32,13 +38,16 @@ export class BotFactory {
|
|
|
32
38
|
this.aztecNode = aztecNode;
|
|
33
39
|
this.aztecNodeAdmin = aztecNodeAdmin;
|
|
34
40
|
this.log = createLogger('bot');
|
|
41
|
+
// Set fee padding on the wallet so that all transactions during setup
|
|
42
|
+
// (token deploy, minting, etc.) use the configured padding, not the default.
|
|
43
|
+
this.wallet.setMinFeePadding(config.minFeePadding);
|
|
35
44
|
}
|
|
36
45
|
/**
|
|
37
46
|
* Initializes a new bot by setting up the sender account, registering the recipient,
|
|
38
47
|
* deploying the token contract, and minting tokens if necessary.
|
|
39
48
|
*/ async setup() {
|
|
40
|
-
const recipient = (await this.wallet.createAccount()).address;
|
|
41
49
|
const defaultAccountAddress = await this.setupAccount();
|
|
50
|
+
const recipient = (await this.wallet.createSchnorrAccount(Fr.random(), Fr.random())).address;
|
|
42
51
|
const token = await this.setupToken(defaultAccountAddress);
|
|
43
52
|
await this.mintTokens(token, defaultAccountAddress);
|
|
44
53
|
return {
|
|
@@ -67,6 +76,65 @@ export class BotFactory {
|
|
|
67
76
|
};
|
|
68
77
|
}
|
|
69
78
|
/**
|
|
79
|
+
* Initializes the cross-chain bot by deploying TestContract, creating an L1 client,
|
|
80
|
+
* seeding initial L1→L2 messages, and waiting for the first to be ready.
|
|
81
|
+
*/ async setupCrossChain() {
|
|
82
|
+
const defaultAccountAddress = await this.setupAccount();
|
|
83
|
+
// Create L1 client (same pattern as bridgeL1FeeJuice)
|
|
84
|
+
const l1RpcUrls = this.config.l1RpcUrls;
|
|
85
|
+
if (!l1RpcUrls?.length) {
|
|
86
|
+
throw new Error('L1 RPC URLs required for cross-chain bot');
|
|
87
|
+
}
|
|
88
|
+
const mnemonicOrPrivateKey = this.config.l1PrivateKey?.getValue() ?? this.config.l1Mnemonic?.getValue();
|
|
89
|
+
if (!mnemonicOrPrivateKey) {
|
|
90
|
+
throw new Error('L1 mnemonic or private key required for cross-chain bot');
|
|
91
|
+
}
|
|
92
|
+
const { l1ChainId, l1ContractAddresses } = await this.aztecNode.getNodeInfo();
|
|
93
|
+
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
|
|
94
|
+
const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
|
|
95
|
+
// Fetch Rollup version (needed for Inbox L2Actor struct)
|
|
96
|
+
const rollupContract = new RollupContract(l1Client, l1ContractAddresses.rollupAddress.toString());
|
|
97
|
+
const rollupVersion = await rollupContract.getVersion();
|
|
98
|
+
// Deploy TestContract
|
|
99
|
+
const contract = await this.setupTestContract(defaultAccountAddress);
|
|
100
|
+
// Recover any pending messages from store (clean up stale ones first)
|
|
101
|
+
await this.store.cleanupOldPendingMessages();
|
|
102
|
+
const pendingMessages = await this.store.getUnconsumedL1ToL2Messages();
|
|
103
|
+
// Seed initial L1→L2 messages if pipeline is empty
|
|
104
|
+
const seedCount = Math.max(0, this.config.l1ToL2SeedCount - pendingMessages.length);
|
|
105
|
+
for(let i = 0; i < seedCount; i++){
|
|
106
|
+
await seedL1ToL2Message(l1Client, EthAddress.fromString(l1ContractAddresses.inboxAddress.toString()), contract.address, rollupVersion, this.store, this.log);
|
|
107
|
+
}
|
|
108
|
+
// Block until at least one message is ready
|
|
109
|
+
const allMessages = await this.store.getUnconsumedL1ToL2Messages();
|
|
110
|
+
if (allMessages.length > 0) {
|
|
111
|
+
this.log.info(`Waiting for first L1→L2 message to be ready...`);
|
|
112
|
+
const firstMsg = allMessages[0];
|
|
113
|
+
await waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(firstMsg.msgHash), {
|
|
114
|
+
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
115
|
+
});
|
|
116
|
+
this.log.info(`First L1→L2 message is ready`);
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
wallet: this.wallet,
|
|
120
|
+
defaultAccountAddress,
|
|
121
|
+
contract,
|
|
122
|
+
node: this.aztecNode,
|
|
123
|
+
l1Client,
|
|
124
|
+
rollupVersion
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
async setupTestContract(deployer) {
|
|
128
|
+
const deployOpts = {
|
|
129
|
+
from: deployer,
|
|
130
|
+
contractAddressSalt: this.config.tokenSalt,
|
|
131
|
+
universalDeploy: true
|
|
132
|
+
};
|
|
133
|
+
const deploy = TestContract.deploy(this.wallet);
|
|
134
|
+
const instance = await this.registerOrDeployContract('TestContract', deploy, deployOpts);
|
|
135
|
+
return TestContract.at(instance.address, this.wallet);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
70
138
|
* Checks if the sender account contract is initialized, and initializes it if necessary.
|
|
71
139
|
* @returns The sender wallet.
|
|
72
140
|
*/ async setupAccount() {
|
|
@@ -82,14 +150,9 @@ export class BotFactory {
|
|
|
82
150
|
async setupAccountWithPrivateKey(secret) {
|
|
83
151
|
const salt = this.config.senderSalt ?? Fr.ONE;
|
|
84
152
|
const signingKey = deriveSigningKey(secret);
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
contract: new SchnorrAccountContract(signingKey)
|
|
89
|
-
};
|
|
90
|
-
const accountManager = await this.wallet.createAccount(accountData);
|
|
91
|
-
const isInit = (await this.wallet.getContractMetadata(accountManager.address)).isContractInitialized;
|
|
92
|
-
if (isInit) {
|
|
153
|
+
const accountManager = await this.wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
154
|
+
const metadata = await this.wallet.getContractMetadata(accountManager.address);
|
|
155
|
+
if (metadata.isContractInitialized) {
|
|
93
156
|
this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
|
|
94
157
|
const timer = new Timer();
|
|
95
158
|
const address = accountManager.address;
|
|
@@ -102,22 +165,35 @@ export class BotFactory {
|
|
|
102
165
|
const claim = await this.getOrCreateBridgeClaim(address);
|
|
103
166
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
|
|
104
167
|
const deployMethod = await accountManager.getDeployMethod();
|
|
105
|
-
const maxFeesPerGas = (await this.aztecNode.
|
|
106
|
-
const
|
|
107
|
-
maxFeesPerGas
|
|
108
|
-
});
|
|
109
|
-
const sentTx = deployMethod.send({
|
|
168
|
+
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
|
|
169
|
+
const { estimatedGas } = await deployMethod.simulate({
|
|
110
170
|
from: AztecAddress.ZERO,
|
|
111
171
|
fee: {
|
|
112
|
-
|
|
172
|
+
estimateGas: true,
|
|
113
173
|
paymentMethod
|
|
114
174
|
}
|
|
115
175
|
});
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
176
|
+
const gasSettings = GasSettings.from({
|
|
177
|
+
...estimatedGas,
|
|
178
|
+
maxFeesPerGas,
|
|
179
|
+
maxPriorityFeesPerGas: GasFees.empty()
|
|
180
|
+
});
|
|
181
|
+
await this.withNoMinTxsPerBlock(async ()=>{
|
|
182
|
+
const { txHash } = await deployMethod.send({
|
|
183
|
+
from: AztecAddress.ZERO,
|
|
184
|
+
fee: {
|
|
185
|
+
gasSettings,
|
|
186
|
+
paymentMethod
|
|
187
|
+
},
|
|
188
|
+
wait: NO_WAIT
|
|
189
|
+
});
|
|
190
|
+
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`, {
|
|
191
|
+
gasSettings
|
|
192
|
+
});
|
|
193
|
+
return waitForTx(this.aztecNode, txHash, {
|
|
119
194
|
timeout: this.config.txMinedWaitSeconds
|
|
120
|
-
})
|
|
195
|
+
});
|
|
196
|
+
});
|
|
121
197
|
this.log.info(`Account deployed at ${address}`);
|
|
122
198
|
// Clean up the consumed bridge claim
|
|
123
199
|
await this.store.deleteBridgeClaim(address);
|
|
@@ -126,12 +202,7 @@ export class BotFactory {
|
|
|
126
202
|
}
|
|
127
203
|
async setupTestAccount() {
|
|
128
204
|
const [initialAccountData] = await getInitialTestAccountsData();
|
|
129
|
-
const
|
|
130
|
-
secret: initialAccountData.secret,
|
|
131
|
-
salt: initialAccountData.salt,
|
|
132
|
-
contract: new SchnorrAccountContract(initialAccountData.signingKey)
|
|
133
|
-
};
|
|
134
|
-
const accountManager = await this.wallet.createAccount(accountData);
|
|
205
|
+
const accountManager = await this.wallet.createSchnorrAccount(initialAccountData.secret, initialAccountData.salt, initialAccountData.signingKey);
|
|
135
206
|
return accountManager.address;
|
|
136
207
|
}
|
|
137
208
|
/**
|
|
@@ -140,47 +211,81 @@ export class BotFactory {
|
|
|
140
211
|
* @returns The TokenContract instance.
|
|
141
212
|
*/ async setupToken(sender) {
|
|
142
213
|
let deploy;
|
|
214
|
+
let tokenInstance;
|
|
143
215
|
const deployOpts = {
|
|
144
216
|
from: sender,
|
|
145
217
|
contractAddressSalt: this.config.tokenSalt,
|
|
146
218
|
universalDeploy: true
|
|
147
219
|
};
|
|
220
|
+
let token;
|
|
148
221
|
if (this.config.contract === SupportedTokenContracts.TokenContract) {
|
|
149
222
|
deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18);
|
|
223
|
+
tokenInstance = await deploy.getInstance(deployOpts);
|
|
224
|
+
token = TokenContract.at(tokenInstance.address, this.wallet);
|
|
150
225
|
} else if (this.config.contract === SupportedTokenContracts.PrivateTokenContract) {
|
|
151
|
-
|
|
226
|
+
// Generate keys for the contract since PrivateToken uses SinglePrivateMutable which requires keys
|
|
227
|
+
const tokenSecretKey = Fr.random();
|
|
228
|
+
const tokenPublicKeys = (await deriveKeys(tokenSecretKey)).publicKeys;
|
|
229
|
+
deploy = PrivateTokenContract.deployWithPublicKeys(tokenPublicKeys, this.wallet, MINT_BALANCE, sender);
|
|
152
230
|
deployOpts.skipInstancePublication = true;
|
|
153
231
|
deployOpts.skipClassPublication = true;
|
|
154
232
|
deployOpts.skipInitialization = false;
|
|
233
|
+
// Register the contract with the secret key before deployment
|
|
234
|
+
tokenInstance = await deploy.getInstance(deployOpts);
|
|
235
|
+
token = PrivateTokenContract.at(tokenInstance.address, this.wallet);
|
|
236
|
+
await this.wallet.registerContract(tokenInstance, PrivateTokenContract.artifact, tokenSecretKey);
|
|
237
|
+
// The contract constructor initializes private storage vars that need the contract's own nullifier key.
|
|
238
|
+
deployOpts.additionalScopes = [
|
|
239
|
+
tokenInstance.address
|
|
240
|
+
];
|
|
155
241
|
} else {
|
|
156
242
|
throw new Error(`Unsupported token contract type: ${this.config.contract}`);
|
|
157
243
|
}
|
|
158
|
-
const address = (await deploy.getInstance(deployOpts)).address;
|
|
159
|
-
|
|
244
|
+
const address = tokenInstance?.address ?? (await deploy.getInstance(deployOpts)).address;
|
|
245
|
+
const metadata = await this.wallet.getContractMetadata(address);
|
|
246
|
+
if (metadata.isContractPublished) {
|
|
160
247
|
this.log.info(`Token at ${address.toString()} already deployed`);
|
|
161
|
-
|
|
248
|
+
await deploy.register();
|
|
162
249
|
} else {
|
|
163
250
|
this.log.info(`Deploying token contract at ${address.toString()}`);
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
251
|
+
const { estimatedGas } = await deploy.simulate({
|
|
252
|
+
...deployOpts,
|
|
253
|
+
fee: {
|
|
254
|
+
estimateGas: true
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
const { txHash } = await deploy.send({
|
|
258
|
+
...deployOpts,
|
|
259
|
+
fee: {
|
|
260
|
+
gasSettings: estimatedGas
|
|
261
|
+
},
|
|
262
|
+
wait: NO_WAIT
|
|
263
|
+
});
|
|
264
|
+
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`, {
|
|
265
|
+
estimatedGas
|
|
266
|
+
});
|
|
267
|
+
await this.withNoMinTxsPerBlock(async ()=>{
|
|
268
|
+
await waitForTx(this.aztecNode, txHash, {
|
|
168
269
|
timeout: this.config.txMinedWaitSeconds
|
|
169
|
-
})
|
|
270
|
+
});
|
|
271
|
+
return token;
|
|
272
|
+
});
|
|
170
273
|
}
|
|
274
|
+
return token;
|
|
171
275
|
}
|
|
172
276
|
/**
|
|
173
277
|
* Checks if the token contract is deployed and deploys it if necessary.
|
|
174
278
|
* @param wallet - Wallet to deploy the token contract from.
|
|
175
279
|
* @returns The TokenContract instance.
|
|
176
|
-
*/ setupTokenContract(deployer, contractAddressSalt, name, ticker, decimals = 18) {
|
|
280
|
+
*/ async setupTokenContract(deployer, contractAddressSalt, name, ticker, decimals = 18) {
|
|
177
281
|
const deployOpts = {
|
|
178
282
|
from: deployer,
|
|
179
283
|
contractAddressSalt,
|
|
180
284
|
universalDeploy: true
|
|
181
285
|
};
|
|
182
286
|
const deploy = TokenContract.deploy(this.wallet, deployer, name, ticker, decimals);
|
|
183
|
-
|
|
287
|
+
const instance = await this.registerOrDeployContract('Token - ' + name, deploy, deployOpts);
|
|
288
|
+
return TokenContract.at(instance.address, this.wallet);
|
|
184
289
|
}
|
|
185
290
|
async setupAmmContract(deployer, contractAddressSalt, token0, token1, lpToken) {
|
|
186
291
|
const deployOpts = {
|
|
@@ -189,14 +294,27 @@ export class BotFactory {
|
|
|
189
294
|
universalDeploy: true
|
|
190
295
|
};
|
|
191
296
|
const deploy = AMMContract.deploy(this.wallet, token0.address, token1.address, lpToken.address);
|
|
192
|
-
const
|
|
297
|
+
const instance = await this.registerOrDeployContract('AMM', deploy, deployOpts);
|
|
298
|
+
const amm = AMMContract.at(instance.address, this.wallet);
|
|
193
299
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
194
|
-
const
|
|
195
|
-
|
|
300
|
+
const setMinterInteraction = lpToken.methods.set_minter(amm.address, true);
|
|
301
|
+
const { estimatedGas: setMinterGas } = await setMinterInteraction.simulate({
|
|
302
|
+
from: deployer,
|
|
303
|
+
fee: {
|
|
304
|
+
estimateGas: true
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
const { receipt: minterReceipt } = await setMinterInteraction.send({
|
|
308
|
+
from: deployer,
|
|
309
|
+
fee: {
|
|
310
|
+
gasSettings: setMinterGas
|
|
311
|
+
},
|
|
312
|
+
wait: {
|
|
313
|
+
timeout: this.config.txMinedWaitSeconds
|
|
314
|
+
}
|
|
196
315
|
});
|
|
197
|
-
this.log.info(`Set LP token minter to AMM txHash=${
|
|
198
|
-
|
|
199
|
-
timeout: this.config.txMinedWaitSeconds
|
|
316
|
+
this.log.info(`Set LP token minter to AMM txHash=${minterReceipt.txHash.toString()}`, {
|
|
317
|
+
estimatedGas: setMinterGas
|
|
200
318
|
});
|
|
201
319
|
this.log.info(`Liquidity token initialized`);
|
|
202
320
|
return amm;
|
|
@@ -205,13 +323,13 @@ export class BotFactory {
|
|
|
205
323
|
const getPrivateBalances = ()=>Promise.all([
|
|
206
324
|
token0.methods.balance_of_private(liquidityProvider).simulate({
|
|
207
325
|
from: liquidityProvider
|
|
208
|
-
}),
|
|
326
|
+
}).then((r)=>r.result),
|
|
209
327
|
token1.methods.balance_of_private(liquidityProvider).simulate({
|
|
210
328
|
from: liquidityProvider
|
|
211
|
-
}),
|
|
329
|
+
}).then((r)=>r.result),
|
|
212
330
|
lpToken.methods.balance_of_private(liquidityProvider).simulate({
|
|
213
331
|
from: liquidityProvider
|
|
214
|
-
})
|
|
332
|
+
}).then((r)=>r.result)
|
|
215
333
|
]);
|
|
216
334
|
const authwitNonce = Fr.random();
|
|
217
335
|
// keep some tokens for swapping
|
|
@@ -230,45 +348,91 @@ export class BotFactory {
|
|
|
230
348
|
caller: amm.address,
|
|
231
349
|
call: await token1.methods.transfer_to_public_and_prepare_private_balance_increase(liquidityProvider, amm.address, amount1Max, authwitNonce).getFunctionCall()
|
|
232
350
|
});
|
|
233
|
-
const
|
|
351
|
+
const mintBatch = new BatchCall(this.wallet, [
|
|
234
352
|
token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
235
353
|
token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE)
|
|
236
|
-
])
|
|
237
|
-
|
|
354
|
+
]);
|
|
355
|
+
const { estimatedGas: mintGas } = await mintBatch.simulate({
|
|
356
|
+
from: liquidityProvider,
|
|
357
|
+
fee: {
|
|
358
|
+
estimateGas: true
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
const { receipt: mintReceipt } = await mintBatch.send({
|
|
362
|
+
from: liquidityProvider,
|
|
363
|
+
fee: {
|
|
364
|
+
gasSettings: mintGas
|
|
365
|
+
},
|
|
366
|
+
wait: {
|
|
367
|
+
timeout: this.config.txMinedWaitSeconds
|
|
368
|
+
}
|
|
238
369
|
});
|
|
239
|
-
this.log.info(`Sent mint tx: ${
|
|
240
|
-
|
|
241
|
-
timeout: this.config.txMinedWaitSeconds
|
|
370
|
+
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}`, {
|
|
371
|
+
estimatedGas: mintGas
|
|
242
372
|
});
|
|
243
|
-
const
|
|
373
|
+
const addLiquidityInteraction = amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce);
|
|
374
|
+
const { estimatedGas: addLiquidityGas } = await addLiquidityInteraction.simulate({
|
|
244
375
|
from: liquidityProvider,
|
|
376
|
+
fee: {
|
|
377
|
+
estimateGas: true
|
|
378
|
+
},
|
|
245
379
|
authWitnesses: [
|
|
246
380
|
token0Authwit,
|
|
247
381
|
token1Authwit
|
|
248
382
|
]
|
|
249
383
|
});
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
384
|
+
const { receipt: addLiquidityReceipt } = await addLiquidityInteraction.send({
|
|
385
|
+
from: liquidityProvider,
|
|
386
|
+
fee: {
|
|
387
|
+
gasSettings: addLiquidityGas
|
|
388
|
+
},
|
|
389
|
+
authWitnesses: [
|
|
390
|
+
token0Authwit,
|
|
391
|
+
token1Authwit
|
|
392
|
+
],
|
|
393
|
+
wait: {
|
|
394
|
+
timeout: this.config.txMinedWaitSeconds
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
this.log.info(`Sent tx to add liquidity to the AMM: ${addLiquidityReceipt.txHash.toString()}`, {
|
|
398
|
+
estimatedGas: addLiquidityGas
|
|
253
399
|
});
|
|
254
400
|
this.log.info(`Liquidity added`);
|
|
255
401
|
const [newT0Bal, newT1Bal, newLPBal] = await getPrivateBalances();
|
|
256
402
|
this.log.info(`Updated private balances of ${defaultAccountAddress} after minting and funding AMM: token0=${newT0Bal}, token1=${newT1Bal}, lp=${newLPBal}`);
|
|
257
403
|
}
|
|
258
404
|
async registerOrDeployContract(name, deploy, deployOpts) {
|
|
259
|
-
const
|
|
260
|
-
|
|
405
|
+
const instance = await deploy.getInstance(deployOpts);
|
|
406
|
+
const address = instance.address;
|
|
407
|
+
const metadata = await this.wallet.getContractMetadata(address);
|
|
408
|
+
if (metadata.isContractPublished) {
|
|
261
409
|
this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
|
|
262
|
-
|
|
410
|
+
await deploy.register();
|
|
263
411
|
} else {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
412
|
+
const { estimatedGas } = await deploy.simulate({
|
|
413
|
+
...deployOpts,
|
|
414
|
+
fee: {
|
|
415
|
+
estimateGas: true
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
this.log.info(`Deploying contract ${name} at ${address.toString()}`, {
|
|
419
|
+
estimatedGas
|
|
420
|
+
});
|
|
421
|
+
await this.withNoMinTxsPerBlock(async ()=>{
|
|
422
|
+
const { txHash } = await deploy.send({
|
|
423
|
+
...deployOpts,
|
|
424
|
+
fee: {
|
|
425
|
+
gasSettings: estimatedGas
|
|
426
|
+
},
|
|
427
|
+
wait: NO_WAIT
|
|
428
|
+
});
|
|
429
|
+
this.log.info(`Sent contract ${name} setup tx with hash ${txHash.toString()}`);
|
|
430
|
+
return waitForTx(this.aztecNode, txHash, {
|
|
269
431
|
timeout: this.config.txMinedWaitSeconds
|
|
270
|
-
})
|
|
432
|
+
});
|
|
433
|
+
});
|
|
271
434
|
}
|
|
435
|
+
return instance;
|
|
272
436
|
}
|
|
273
437
|
/**
|
|
274
438
|
* Mints private and public tokens for the sender if their balance is below the minimum.
|
|
@@ -295,14 +459,34 @@ export class BotFactory {
|
|
|
295
459
|
this.log.info(`Skipping minting as ${minter.toString()} has enough tokens`);
|
|
296
460
|
return;
|
|
297
461
|
}
|
|
298
|
-
|
|
299
|
-
|
|
462
|
+
// PrivateToken's mint accesses contract-level private storage vars (admin, total_supply).
|
|
463
|
+
const additionalScopes = isStandardToken ? undefined : [
|
|
464
|
+
token.address
|
|
465
|
+
];
|
|
466
|
+
const mintBatch = new BatchCall(token.wallet, calls);
|
|
467
|
+
const { estimatedGas } = await mintBatch.simulate({
|
|
468
|
+
from: minter,
|
|
469
|
+
fee: {
|
|
470
|
+
estimateGas: true
|
|
471
|
+
},
|
|
472
|
+
additionalScopes
|
|
300
473
|
});
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
474
|
+
await this.withNoMinTxsPerBlock(async ()=>{
|
|
475
|
+
const { txHash } = await mintBatch.send({
|
|
476
|
+
from: minter,
|
|
477
|
+
additionalScopes,
|
|
478
|
+
fee: {
|
|
479
|
+
gasSettings: estimatedGas
|
|
480
|
+
},
|
|
481
|
+
wait: NO_WAIT
|
|
482
|
+
});
|
|
483
|
+
this.log.info(`Sent token mint tx with hash ${txHash.toString()}`, {
|
|
484
|
+
estimatedGas
|
|
485
|
+
});
|
|
486
|
+
return waitForTx(this.aztecNode, txHash, {
|
|
304
487
|
timeout: this.config.txMinedWaitSeconds
|
|
305
|
-
})
|
|
488
|
+
});
|
|
489
|
+
});
|
|
306
490
|
}
|
|
307
491
|
/**
|
|
308
492
|
* Gets or creates a bridge claim for the recipient.
|
|
@@ -317,8 +501,7 @@ export class BotFactory {
|
|
|
317
501
|
try {
|
|
318
502
|
const messageHash = Fr.fromHexString(existingClaim.claim.messageHash);
|
|
319
503
|
await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.aztecNode, messageHash, {
|
|
320
|
-
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
321
|
-
forPublicConsumption: false
|
|
504
|
+
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
322
505
|
}));
|
|
323
506
|
return existingClaim.claim;
|
|
324
507
|
} catch (err) {
|
|
@@ -346,8 +529,7 @@ export class BotFactory {
|
|
|
346
529
|
const mintAmount = await portal.getTokenManager().getMintAmount();
|
|
347
530
|
const claim = await portal.bridgeTokensPublic(recipient, mintAmount, true);
|
|
348
531
|
await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(claim.messageHash), {
|
|
349
|
-
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
350
|
-
forPublicConsumption: false
|
|
532
|
+
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds
|
|
351
533
|
}));
|
|
352
534
|
this.log.info(`Created a claim for ${mintAmount} L1 fee juice to ${recipient}.`, claim);
|
|
353
535
|
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=
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsR0FBRyxFQUFFLE1BQU0sVUFBVSxDQUFDO0FBQy9CLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDdEMsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3JELE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDeEMsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ2hELE9BQU8sRUFDTCxLQUFLLFNBQVMsRUFDZCxtQkFBbUIsRUFDbkIsbUJBQW1CLEVBQ25CLGlCQUFpQixFQUNqQix1QkFBdUIsR0FDeEIsTUFBTSxhQUFhLENBQUM7QUFDckIsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sVUFBVSxDQUFDO0FBQ2xELGNBQWMsZ0JBQWdCLENBQUMifQ==
|
package/dest/index.d.ts.map
CHANGED
|
@@ -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';
|
package/dest/interface.d.ts
CHANGED
|
@@ -20,4 +20,4 @@ export interface BotRunnerApi {
|
|
|
20
20
|
update(config: BotConfig): Promise<void>;
|
|
21
21
|
}
|
|
22
22
|
export declare const BotRunnerApiSchema: ApiSchemaFor<BotRunnerApi>;
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUUxRCxPQUFPLEVBQUUsQ0FBQyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBRXhCLE9BQU8sRUFBRSxLQUFLLFNBQVMsRUFBbUIsTUFBTSxhQUFhLENBQUM7QUFFOUQsZUFBTyxNQUFNLGFBQWE7Ozs7OztFQUV4QixDQUFDO0FBRUgsTUFBTSxNQUFNLE9BQU8sR0FBRyxDQUFDLENBQUMsS0FBSyxDQUFDLE9BQU8sYUFBYSxDQUFDLENBQUM7QUFFcEQsTUFBTSxXQUFXLFlBQVk7SUFDM0IsS0FBSyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN2QixJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3RCLEdBQUcsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDckIsS0FBSyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN2QixTQUFTLElBQUksT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQ2hDLE9BQU8sSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDNUIsTUFBTSxDQUFDLE1BQU0sRUFBRSxTQUFTLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0NBQzFDO0FBRUQsZUFBTyxNQUFNLGtCQUFrQixFQUFFLFlBQVksQ0FBQyxZQUFZLENBUXpELENBQUMifQ==
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"l1_to_l2_seeding.d.ts","sourceRoot":"","sources":["../src/l1_to_l2_seeding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAGtE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAIhE,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,qEAAmE;AACnE,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,wBAAwB,EAClC,YAAY,EAAE,UAAU,EACxB,WAAW,EAAE,YAAY,EACzB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,QAAQ,EACf,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,oBAAoB,CAAC,CAyD/B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { generateClaimSecret } from '@aztec/aztec.js/ethereum';
|
|
2
|
+
import { compactArray } from '@aztec/foundation/collection';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { InboxAbi } from '@aztec/l1-artifacts';
|
|
5
|
+
import { decodeEventLog, getContract } from 'viem';
|
|
6
|
+
/** Sends an L1→L2 message via the Inbox contract and stores it. */ export async function seedL1ToL2Message(l1Client, inboxAddress, l2Recipient, rollupVersion, store, log) {
|
|
7
|
+
log.info('Seeding L1→L2 message');
|
|
8
|
+
const [secret, secretHash] = await generateClaimSecret(log);
|
|
9
|
+
const content = Fr.random();
|
|
10
|
+
const inbox = getContract({
|
|
11
|
+
address: inboxAddress.toString(),
|
|
12
|
+
abi: InboxAbi,
|
|
13
|
+
client: l1Client
|
|
14
|
+
});
|
|
15
|
+
const txHash = await inbox.write.sendL2Message([
|
|
16
|
+
{
|
|
17
|
+
actor: l2Recipient.toString(),
|
|
18
|
+
version: rollupVersion
|
|
19
|
+
},
|
|
20
|
+
content.toString(),
|
|
21
|
+
secretHash.toString()
|
|
22
|
+
], {
|
|
23
|
+
gas: 1_000_000n
|
|
24
|
+
});
|
|
25
|
+
log.info(`L1→L2 message sent in tx ${txHash}`);
|
|
26
|
+
const txReceipt = await l1Client.waitForTransactionReceipt({
|
|
27
|
+
hash: txHash
|
|
28
|
+
});
|
|
29
|
+
if (txReceipt.status !== 'success') {
|
|
30
|
+
throw new Error(`L1→L2 message tx failed: ${txHash}`);
|
|
31
|
+
}
|
|
32
|
+
// Extract MessageSent event
|
|
33
|
+
const messageSentLogs = compactArray(txReceipt.logs.filter((l)=>l.address.toLowerCase() === inboxAddress.toString().toLowerCase()).map((l)=>{
|
|
34
|
+
try {
|
|
35
|
+
return decodeEventLog({
|
|
36
|
+
abi: InboxAbi,
|
|
37
|
+
eventName: 'MessageSent',
|
|
38
|
+
data: l.data,
|
|
39
|
+
topics: l.topics
|
|
40
|
+
});
|
|
41
|
+
} catch {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
if (messageSentLogs.length !== 1) {
|
|
46
|
+
throw new Error(`Expected 1 MessageSent event, got ${messageSentLogs.length}`);
|
|
47
|
+
}
|
|
48
|
+
const event = messageSentLogs[0];
|
|
49
|
+
const msgHash = event.args.hash;
|
|
50
|
+
const globalLeafIndex = event.args.index;
|
|
51
|
+
const msg = {
|
|
52
|
+
content: content.toString(),
|
|
53
|
+
secret: secret.toString(),
|
|
54
|
+
secretHash: secretHash.toString(),
|
|
55
|
+
msgHash,
|
|
56
|
+
sender: l1Client.account.address,
|
|
57
|
+
globalLeafIndex: globalLeafIndex.toString(),
|
|
58
|
+
timestamp: Date.now()
|
|
59
|
+
};
|
|
60
|
+
await store.savePendingL1ToL2Message(msg);
|
|
61
|
+
log.info(`Seeded L1→L2 message msgHash=${msg.msgHash}`);
|
|
62
|
+
return msg;
|
|
63
|
+
}
|
package/dest/rpc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ApiHandler } from '@aztec/foundation/json-rpc/server';
|
|
2
2
|
import type { BotRunner } from './runner.js';
|
|
3
3
|
export declare function getBotRunnerApiHandler(botRunner: BotRunner): ApiHandler;
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnBjLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcnBjLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBR3BFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUU3Qyx3QkFBZ0Isc0JBQXNCLENBQUMsU0FBUyxFQUFFLFNBQVMsR0FBRyxVQUFVLENBRXZFIn0=
|
package/dest/runner.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
2
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
3
3
|
import { type TelemetryClient, type Traceable, type Tracer } from '@aztec/telemetry-client';
|
|
4
|
-
import type {
|
|
4
|
+
import type { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
5
5
|
import type { BotConfig } from './config.js';
|
|
6
6
|
import type { BotInfo, BotRunnerApi } from './interface.js';
|
|
7
7
|
import { BotStore } from './store/index.js';
|
|
@@ -19,7 +19,7 @@ export declare class BotRunner implements BotRunnerApi, Traceable {
|
|
|
19
19
|
private consecutiveErrors;
|
|
20
20
|
private healthy;
|
|
21
21
|
readonly tracer: Tracer;
|
|
22
|
-
constructor(config: BotConfig, wallet:
|
|
22
|
+
constructor(config: BotConfig, wallet: EmbeddedWallet, aztecNode: AztecNode, telemetry: TelemetryClient, aztecNodeAdmin: AztecNodeAdmin | undefined, store: BotStore);
|
|
23
23
|
/** Initializes the bot if needed. Blocks until the bot setup is finished. */
|
|
24
24
|
setup(): Promise<void>;
|
|
25
25
|
private doSetup;
|
|
@@ -50,4 +50,4 @@ export declare class BotRunner implements BotRunnerApi, Traceable {
|
|
|
50
50
|
/** Returns the bot sender address. */
|
|
51
51
|
getInfo(): Promise<BotInfo>;
|
|
52
52
|
}
|
|
53
|
-
//# sourceMappingURL=
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVubmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcnVubmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBR3RELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ3RFLE9BQU8sRUFBRSxLQUFLLGVBQWUsRUFBRSxLQUFLLFNBQVMsRUFBRSxLQUFLLE1BQU0sRUFBYSxNQUFNLHlCQUF5QixDQUFDO0FBQ3ZHLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBSzlELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUU3QyxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDNUQsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRTVDLHFCQUFhLFNBQVUsWUFBVyxZQUFZLEVBQUUsU0FBUzs7SUFVckQsT0FBTyxDQUFDLE1BQU07SUFDZCxPQUFPLENBQUMsUUFBUSxDQUFDLE1BQU07SUFDdkIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxTQUFTO0lBQzFCLE9BQU8sQ0FBQyxRQUFRLENBQUMsU0FBUztJQUMxQixPQUFPLENBQUMsUUFBUSxDQUFDLGNBQWM7SUFDL0IsT0FBTyxDQUFDLFFBQVEsQ0FBQyxLQUFLO0lBZHhCLE9BQU8sQ0FBQyxHQUFHLENBQXVCO0lBQ2xDLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBbUI7SUFDL0IsT0FBTyxDQUFDLGNBQWMsQ0FBaUI7SUFDdkMsT0FBTyxDQUFDLGlCQUFpQixDQUFLO0lBQzlCLE9BQU8sQ0FBQyxPQUFPLENBQVE7SUFFdkIsU0FBZ0IsTUFBTSxFQUFFLE1BQU0sQ0FBQztJQUUvQixZQUNVLE1BQU0sRUFBRSxTQUFTLEVBQ1IsTUFBTSxFQUFFLGNBQWMsRUFDdEIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsU0FBUyxFQUFFLGVBQWUsRUFDMUIsY0FBYyxFQUFFLGNBQWMsR0FBRyxTQUFTLEVBQzFDLEtBQUssRUFBRSxRQUFRLEVBS2pDO0lBRUQsNkVBQTZFO0lBQ2hFLEtBQUssa0JBSWpCO1lBR2EsT0FBTztJQU1yQjs7O09BR0c7SUFDVSxLQUFLLGtCQU1qQjtJQUVEOztPQUVHO0lBQ1UsSUFBSSxrQkFPaEI7SUFFTSxTQUFTLFlBRWY7SUFFRCwwQ0FBMEM7SUFDbkMsU0FBUyxZQUVmO0lBRUQ7OztPQUdHO0lBQ1UsTUFBTSxDQUFDLE1BQU0sRUFBRSxTQUFTLGlCQWFwQztJQUVEOzs7T0FHRztJQUNVLEdBQUcsa0JBc0JmO0lBRUQscURBQXFEO0lBQzlDLFNBQVMsdUJBR2Y7SUFFRCxzQ0FBc0M7SUFDekIsT0FBTyxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FNdkM7Q0FtREYifQ==
|