@aztec/bot 0.0.1-commit.a072138 → 0.0.1-commit.a4600f49
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 -5
- package/dest/amm_bot.d.ts.map +1 -1
- package/dest/amm_bot.js +26 -19
- package/dest/base_bot.d.ts +7 -7
- package/dest/base_bot.d.ts.map +1 -1
- package/dest/base_bot.js +21 -32
- package/dest/bot.d.ts +5 -4
- package/dest/bot.d.ts.map +1 -1
- package/dest/bot.js +7 -10
- package/dest/config.d.ts +47 -82
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +42 -15
- package/dest/cross_chain_bot.d.ts +56 -0
- package/dest/cross_chain_bot.d.ts.map +1 -0
- package/dest/cross_chain_bot.js +138 -0
- package/dest/factory.d.ts +25 -6
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +201 -124
- 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 +2 -6
- package/dest/interface.d.ts.map +1 -1
- package/dest/interface.js +30 -7
- 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/runner.d.ts +4 -3
- package/dest/runner.d.ts.map +1 -1
- package/dest/runner.js +20 -2
- 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 +37 -6
- package/dest/store/index.d.ts +2 -2
- package/dest/store/index.d.ts.map +1 -1
- package/dest/utils.js +3 -3
- package/package.json +17 -14
- package/src/amm_bot.ts +28 -20
- package/src/base_bot.ts +16 -33
- package/src/bot.ts +11 -10
- package/src/config.ts +47 -18
- package/src/cross_chain_bot.ts +208 -0
- package/src/factory.ts +254 -129
- package/src/index.ts +1 -0
- package/src/interface.ts +7 -7
- package/src/l1_to_l2_seeding.ts +79 -0
- package/src/runner.ts +41 -5
- package/src/store/bot_store.ts +60 -5
- package/src/store/index.ts +1 -1
- package/src/utils.ts +3 -3
package/dest/factory.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
3
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
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';
|
|
@@ -8,40 +6,50 @@ 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';
|
|
10
8
|
import { waitForTx } from '@aztec/aztec.js/node';
|
|
9
|
+
import { getFeeJuiceBalance } from '@aztec/aztec.js/utils';
|
|
11
10
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
12
11
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
12
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
13
13
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
14
|
-
import {
|
|
14
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
15
15
|
import { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
16
16
|
import { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
17
17
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
18
|
-
import {
|
|
18
|
+
import { TestContract } from '@aztec/noir-test-contracts.js/Test';
|
|
19
19
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
20
20
|
import { SupportedTokenContracts } from './config.js';
|
|
21
|
+
import { seedL1ToL2Message } from './l1_to_l2_seeding.js';
|
|
21
22
|
import { getBalances, getPrivateBalance, isStandardTokenContract } from './utils.js';
|
|
22
23
|
const MINT_BALANCE = 1e12;
|
|
23
24
|
const MIN_BALANCE = 1e3;
|
|
25
|
+
const FEE_JUICE_TOP_UP_THRESHOLD = 100n * 10n ** 18n;
|
|
24
26
|
export class BotFactory {
|
|
25
27
|
config;
|
|
26
28
|
wallet;
|
|
27
29
|
store;
|
|
28
30
|
aztecNode;
|
|
29
31
|
aztecNodeAdmin;
|
|
32
|
+
syncChainTip;
|
|
30
33
|
log;
|
|
31
|
-
constructor(config, wallet, store, aztecNode, aztecNodeAdmin){
|
|
34
|
+
constructor(config, wallet, store, aztecNode, aztecNodeAdmin, syncChainTip){
|
|
32
35
|
this.config = config;
|
|
33
36
|
this.wallet = wallet;
|
|
34
37
|
this.store = store;
|
|
35
38
|
this.aztecNode = aztecNode;
|
|
36
39
|
this.aztecNodeAdmin = aztecNodeAdmin;
|
|
40
|
+
this.syncChainTip = syncChainTip;
|
|
37
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);
|
|
38
45
|
}
|
|
39
46
|
/**
|
|
40
47
|
* Initializes a new bot by setting up the sender account, registering the recipient,
|
|
41
48
|
* deploying the token contract, and minting tokens if necessary.
|
|
42
49
|
*/ async setup() {
|
|
43
50
|
const defaultAccountAddress = await this.setupAccount();
|
|
44
|
-
const recipient = (await this.wallet.
|
|
51
|
+
const recipient = (await this.wallet.createSchnorrAccount(Fr.random(), Fr.random())).address;
|
|
52
|
+
await this.ensureFeeJuiceBalance(defaultAccountAddress);
|
|
45
53
|
const token = await this.setupToken(defaultAccountAddress);
|
|
46
54
|
await this.mintTokens(token, defaultAccountAddress);
|
|
47
55
|
return {
|
|
@@ -54,6 +62,7 @@ export class BotFactory {
|
|
|
54
62
|
}
|
|
55
63
|
async setupAmm() {
|
|
56
64
|
const defaultAccountAddress = await this.setupAccount();
|
|
65
|
+
await this.ensureFeeJuiceBalance(defaultAccountAddress);
|
|
57
66
|
const token0 = await this.setupTokenContract(defaultAccountAddress, this.config.tokenSalt, 'BotToken0', 'BOT0');
|
|
58
67
|
const token1 = await this.setupTokenContract(defaultAccountAddress, this.config.tokenSalt, 'BotToken1', 'BOT1');
|
|
59
68
|
const liquidityToken = await this.setupTokenContract(defaultAccountAddress, this.config.tokenSalt, 'BotLPToken', 'BOTLP');
|
|
@@ -70,6 +79,68 @@ export class BotFactory {
|
|
|
70
79
|
};
|
|
71
80
|
}
|
|
72
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
|
+
/**
|
|
73
144
|
* Checks if the sender account contract is initialized, and initializes it if necessary.
|
|
74
145
|
* @returns The sender wallet.
|
|
75
146
|
*/ async setupAccount() {
|
|
@@ -82,141 +153,97 @@ export class BotFactory {
|
|
|
82
153
|
return await this.setupTestAccount();
|
|
83
154
|
}
|
|
84
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
|
+
}
|
|
85
167
|
async setupAccountWithPrivateKey(secret) {
|
|
86
168
|
const salt = this.config.senderSalt ?? Fr.ONE;
|
|
87
169
|
const signingKey = deriveSigningKey(secret);
|
|
88
|
-
const
|
|
89
|
-
secret,
|
|
90
|
-
salt,
|
|
91
|
-
contract: new SchnorrAccountContract(signingKey)
|
|
92
|
-
};
|
|
93
|
-
const accountManager = await this.wallet.createAccount(accountData);
|
|
94
|
-
const metadata = await this.wallet.getContractMetadata(accountManager.address);
|
|
95
|
-
if (metadata.isContractInitialized) {
|
|
96
|
-
this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
|
|
97
|
-
const timer = new Timer();
|
|
98
|
-
const address = accountManager.address;
|
|
99
|
-
this.log.info(`Account at ${address} registered. duration=${timer.ms()}`);
|
|
100
|
-
await this.store.deleteBridgeClaim(address);
|
|
101
|
-
return address;
|
|
102
|
-
} else {
|
|
103
|
-
const address = accountManager.address;
|
|
104
|
-
this.log.info(`Deploying account at ${address}`);
|
|
105
|
-
const claim = await this.getOrCreateBridgeClaim(address);
|
|
106
|
-
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
|
|
107
|
-
const deployMethod = await accountManager.getDeployMethod();
|
|
108
|
-
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1 + this.config.minFeePadding);
|
|
109
|
-
const gasSettings = GasSettings.default({
|
|
110
|
-
maxFeesPerGas
|
|
111
|
-
});
|
|
112
|
-
await this.withNoMinTxsPerBlock(async ()=>{
|
|
113
|
-
const txHash = await deployMethod.send({
|
|
114
|
-
from: AztecAddress.ZERO,
|
|
115
|
-
fee: {
|
|
116
|
-
gasSettings,
|
|
117
|
-
paymentMethod
|
|
118
|
-
},
|
|
119
|
-
wait: NO_WAIT
|
|
120
|
-
});
|
|
121
|
-
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`);
|
|
122
|
-
return waitForTx(this.aztecNode, txHash, {
|
|
123
|
-
timeout: this.config.txMinedWaitSeconds
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
this.log.info(`Account deployed at ${address}`);
|
|
127
|
-
// Clean up the consumed bridge claim
|
|
128
|
-
await this.store.deleteBridgeClaim(address);
|
|
129
|
-
return accountManager.address;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
async setupTestAccount() {
|
|
133
|
-
const [initialAccountData] = await getInitialTestAccountsData();
|
|
134
|
-
const accountData = {
|
|
135
|
-
secret: initialAccountData.secret,
|
|
136
|
-
salt: initialAccountData.salt,
|
|
137
|
-
contract: new SchnorrAccountContract(initialAccountData.signingKey)
|
|
138
|
-
};
|
|
139
|
-
const accountManager = await this.wallet.createAccount(accountData);
|
|
170
|
+
const accountManager = await this.wallet.createSchnorrInitializerlessAccount(secret, salt, signingKey);
|
|
140
171
|
return accountManager.address;
|
|
141
172
|
}
|
|
142
173
|
/**
|
|
143
174
|
* Checks if the token contract is deployed and deploys it if necessary.
|
|
144
|
-
*
|
|
145
|
-
* @
|
|
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.
|
|
146
179
|
*/ async setupToken(sender) {
|
|
147
180
|
let deploy;
|
|
148
|
-
|
|
181
|
+
const salt = this.config.tokenSalt;
|
|
149
182
|
const deployOpts = {
|
|
150
|
-
from: sender
|
|
151
|
-
contractAddressSalt: this.config.tokenSalt,
|
|
152
|
-
universalDeploy: true
|
|
183
|
+
from: sender
|
|
153
184
|
};
|
|
154
185
|
let token;
|
|
155
186
|
if (this.config.contract === SupportedTokenContracts.TokenContract) {
|
|
156
|
-
deploy = TokenContract.deploy(this.wallet, sender, 'BotToken', 'BOT', 18
|
|
157
|
-
|
|
158
|
-
|
|
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);
|
|
159
193
|
} else if (this.config.contract === SupportedTokenContracts.PrivateTokenContract) {
|
|
160
194
|
// Generate keys for the contract since PrivateToken uses SinglePrivateMutable which requires keys
|
|
161
195
|
const tokenSecretKey = Fr.random();
|
|
162
196
|
const tokenPublicKeys = (await deriveKeys(tokenSecretKey)).publicKeys;
|
|
163
|
-
deploy = PrivateTokenContract.
|
|
197
|
+
deploy = PrivateTokenContract.deploy(this.wallet, MINT_BALANCE, sender, {
|
|
198
|
+
salt,
|
|
199
|
+
universalDeploy: true,
|
|
200
|
+
publicKeys: tokenPublicKeys
|
|
201
|
+
});
|
|
164
202
|
deployOpts.skipInstancePublication = true;
|
|
165
203
|
deployOpts.skipClassPublication = true;
|
|
166
204
|
deployOpts.skipInitialization = false;
|
|
167
205
|
// Register the contract with the secret key before deployment
|
|
168
|
-
tokenInstance = await deploy.getInstance(
|
|
206
|
+
const tokenInstance = await deploy.getInstance();
|
|
169
207
|
token = PrivateTokenContract.at(tokenInstance.address, this.wallet);
|
|
170
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
|
+
];
|
|
171
213
|
} else {
|
|
172
214
|
throw new Error(`Unsupported token contract type: ${this.config.contract}`);
|
|
173
215
|
}
|
|
174
|
-
|
|
175
|
-
const metadata = await this.wallet.getContractMetadata(address);
|
|
176
|
-
if (metadata.isContractPublished) {
|
|
177
|
-
this.log.info(`Token at ${address.toString()} already deployed`);
|
|
178
|
-
await deploy.register();
|
|
179
|
-
} else {
|
|
180
|
-
this.log.info(`Deploying token contract at ${address.toString()}`);
|
|
181
|
-
const txHash = await deploy.send({
|
|
182
|
-
...deployOpts,
|
|
183
|
-
wait: NO_WAIT
|
|
184
|
-
});
|
|
185
|
-
this.log.info(`Sent tx for token setup with hash ${txHash.toString()}`);
|
|
186
|
-
await this.withNoMinTxsPerBlock(async ()=>{
|
|
187
|
-
await waitForTx(this.aztecNode, txHash, {
|
|
188
|
-
timeout: this.config.txMinedWaitSeconds
|
|
189
|
-
});
|
|
190
|
-
return token;
|
|
191
|
-
});
|
|
192
|
-
}
|
|
216
|
+
await this.registerOrDeployContract('token', deploy, deployOpts);
|
|
193
217
|
return token;
|
|
194
218
|
}
|
|
195
219
|
/**
|
|
196
220
|
* Checks if the token contract is deployed and deploys it if necessary.
|
|
197
221
|
* @param wallet - Wallet to deploy the token contract from.
|
|
198
222
|
* @returns The TokenContract instance.
|
|
199
|
-
*/ async setupTokenContract(deployer,
|
|
223
|
+
*/ async setupTokenContract(deployer, salt, name, ticker, decimals = 18) {
|
|
200
224
|
const deployOpts = {
|
|
201
|
-
from: deployer
|
|
202
|
-
contractAddressSalt,
|
|
203
|
-
universalDeploy: true
|
|
225
|
+
from: deployer
|
|
204
226
|
};
|
|
205
|
-
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
|
+
});
|
|
206
231
|
const instance = await this.registerOrDeployContract('Token - ' + name, deploy, deployOpts);
|
|
207
232
|
return TokenContract.at(instance.address, this.wallet);
|
|
208
233
|
}
|
|
209
|
-
async setupAmmContract(deployer,
|
|
234
|
+
async setupAmmContract(deployer, salt, token0, token1, lpToken) {
|
|
210
235
|
const deployOpts = {
|
|
211
|
-
from: deployer
|
|
212
|
-
contractAddressSalt,
|
|
213
|
-
universalDeploy: true
|
|
236
|
+
from: deployer
|
|
214
237
|
};
|
|
215
|
-
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
|
+
});
|
|
216
242
|
const instance = await this.registerOrDeployContract('AMM', deploy, deployOpts);
|
|
217
243
|
const amm = AMMContract.at(instance.address, this.wallet);
|
|
218
244
|
this.log.info(`AMM deployed at ${amm.address}`);
|
|
219
|
-
const
|
|
245
|
+
const setMinterInteraction = lpToken.methods.set_minter(amm.address, true);
|
|
246
|
+
const { receipt: minterReceipt } = await setMinterInteraction.send({
|
|
220
247
|
from: deployer,
|
|
221
248
|
wait: {
|
|
222
249
|
timeout: this.config.txMinedWaitSeconds
|
|
@@ -230,13 +257,13 @@ export class BotFactory {
|
|
|
230
257
|
const getPrivateBalances = ()=>Promise.all([
|
|
231
258
|
token0.methods.balance_of_private(liquidityProvider).simulate({
|
|
232
259
|
from: liquidityProvider
|
|
233
|
-
}),
|
|
260
|
+
}).then((r)=>r.result),
|
|
234
261
|
token1.methods.balance_of_private(liquidityProvider).simulate({
|
|
235
262
|
from: liquidityProvider
|
|
236
|
-
}),
|
|
263
|
+
}).then((r)=>r.result),
|
|
237
264
|
lpToken.methods.balance_of_private(liquidityProvider).simulate({
|
|
238
265
|
from: liquidityProvider
|
|
239
|
-
})
|
|
266
|
+
}).then((r)=>r.result)
|
|
240
267
|
]);
|
|
241
268
|
const authwitNonce = Fr.random();
|
|
242
269
|
// keep some tokens for swapping
|
|
@@ -255,17 +282,19 @@ export class BotFactory {
|
|
|
255
282
|
caller: amm.address,
|
|
256
283
|
call: await token1.methods.transfer_to_public_and_prepare_private_balance_increase(liquidityProvider, amm.address, amount1Max, authwitNonce).getFunctionCall()
|
|
257
284
|
});
|
|
258
|
-
const
|
|
285
|
+
const mintBatch = new BatchCall(this.wallet, [
|
|
259
286
|
token0.methods.mint_to_private(liquidityProvider, MINT_BALANCE),
|
|
260
287
|
token1.methods.mint_to_private(liquidityProvider, MINT_BALANCE)
|
|
261
|
-
])
|
|
288
|
+
]);
|
|
289
|
+
const { receipt: mintReceipt } = await mintBatch.send({
|
|
262
290
|
from: liquidityProvider,
|
|
263
291
|
wait: {
|
|
264
292
|
timeout: this.config.txMinedWaitSeconds
|
|
265
293
|
}
|
|
266
294
|
});
|
|
267
295
|
this.log.info(`Sent mint tx: ${mintReceipt.txHash.toString()}`);
|
|
268
|
-
const
|
|
296
|
+
const addLiquidityInteraction = amm.methods.add_liquidity(amount0Max, amount1Max, amount0Min, amount1Min, authwitNonce);
|
|
297
|
+
const { receipt: addLiquidityReceipt } = await addLiquidityInteraction.send({
|
|
269
298
|
from: liquidityProvider,
|
|
270
299
|
authWitnesses: [
|
|
271
300
|
token0Authwit,
|
|
@@ -281,31 +310,75 @@ export class BotFactory {
|
|
|
281
310
|
this.log.info(`Updated private balances of ${defaultAccountAddress} after minting and funding AMM: token0=${newT0Bal}, token1=${newT1Bal}, lp=${newLPBal}`);
|
|
282
311
|
}
|
|
283
312
|
async registerOrDeployContract(name, deploy, deployOpts) {
|
|
284
|
-
const instance = await deploy.getInstance(
|
|
313
|
+
const instance = await deploy.getInstance();
|
|
285
314
|
const address = instance.address;
|
|
286
315
|
const metadata = await this.wallet.getContractMetadata(address);
|
|
287
316
|
if (metadata.isContractPublished) {
|
|
288
317
|
this.log.info(`Contract ${name} at ${address.toString()} already deployed`);
|
|
289
318
|
await deploy.register();
|
|
290
|
-
|
|
291
|
-
|
|
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);
|
|
292
364
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
293
|
-
const
|
|
294
|
-
|
|
365
|
+
const executionPayload = await paymentMethod.getExecutionPayload();
|
|
366
|
+
const { txHash } = await this.wallet.sendTx(executionPayload, {
|
|
367
|
+
from: account,
|
|
295
368
|
wait: NO_WAIT
|
|
296
369
|
});
|
|
297
|
-
this.log.info(`Sent
|
|
370
|
+
this.log.info(`Sent fee juice top-up tx ${txHash.toString()}`);
|
|
298
371
|
return waitForTx(this.aztecNode, txHash, {
|
|
299
372
|
timeout: this.config.txMinedWaitSeconds
|
|
300
373
|
});
|
|
301
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}`);
|
|
302
378
|
}
|
|
303
|
-
|
|
379
|
+
this.log.info(`Fee juice top-up complete for ${account.toString()}`);
|
|
304
380
|
}
|
|
305
|
-
|
|
306
|
-
* Mints private and public tokens for the sender if their balance is below the minimum.
|
|
307
|
-
* @param token - Token contract.
|
|
308
|
-
*/ async mintTokens(token, minter) {
|
|
381
|
+
async mintTokens(token, minter) {
|
|
309
382
|
const isStandardToken = isStandardTokenContract(token);
|
|
310
383
|
let privateBalance = 0n;
|
|
311
384
|
let publicBalance = 0n;
|
|
@@ -327,9 +400,15 @@ export class BotFactory {
|
|
|
327
400
|
this.log.info(`Skipping minting as ${minter.toString()} has enough tokens`);
|
|
328
401
|
return;
|
|
329
402
|
}
|
|
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);
|
|
330
408
|
await this.withNoMinTxsPerBlock(async ()=>{
|
|
331
|
-
const txHash = await
|
|
409
|
+
const { txHash } = await mintBatch.send({
|
|
332
410
|
from: minter,
|
|
411
|
+
additionalScopes,
|
|
333
412
|
wait: NO_WAIT
|
|
334
413
|
});
|
|
335
414
|
this.log.info(`Sent token mint tx with hash ${txHash.toString()}`);
|
|
@@ -339,20 +418,18 @@ export class BotFactory {
|
|
|
339
418
|
});
|
|
340
419
|
}
|
|
341
420
|
/**
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
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.
|
|
345
424
|
*/ async getOrCreateBridgeClaim(recipient) {
|
|
346
|
-
// Check if we have an existing claim in the store
|
|
347
425
|
const existingClaim = await this.store.getBridgeClaim(recipient);
|
|
348
426
|
if (existingClaim) {
|
|
349
427
|
this.log.info(`Found existing bridge claim for ${recipient.toString()}, checking validity...`);
|
|
350
|
-
// Check if the message is ready on L2
|
|
351
428
|
try {
|
|
352
429
|
const messageHash = Fr.fromHexString(existingClaim.claim.messageHash);
|
|
353
430
|
await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.aztecNode, messageHash, {
|
|
354
431
|
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
|
|
355
|
-
|
|
432
|
+
chainTip: this.syncChainTip
|
|
356
433
|
}));
|
|
357
434
|
return existingClaim.claim;
|
|
358
435
|
} catch (err) {
|
|
@@ -381,7 +458,7 @@ export class BotFactory {
|
|
|
381
458
|
const claim = await portal.bridgeTokensPublic(recipient, mintAmount, true);
|
|
382
459
|
await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.aztecNode, Fr.fromHexString(claim.messageHash), {
|
|
383
460
|
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
|
|
384
|
-
|
|
461
|
+
chainTip: this.syncChainTip
|
|
385
462
|
}));
|
|
386
463
|
this.log.info(`Created a claim for ${mintAmount} L1 fee juice to ${recipient}.`, claim);
|
|
387
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,
|
|
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
|
@@ -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
|
-
},
|
|
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,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUUxRCxPQUFPLEVBQUUsQ0FBQyxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBRXhCLE9BQU8sRUFBRSxLQUFLLFNBQVMsRUFBbUIsTUFBTSxhQUFhLENBQUM7QUFFOUQsZUFBTyxNQUFNLGFBQWE7O2lCQUV4QixDQUFDO0FBRUgsTUFBTSxNQUFNLE9BQU8sR0FBRyxDQUFDLENBQUMsS0FBSyxDQUFDLE9BQU8sYUFBYSxDQUFDLENBQUM7QUFFcEQsTUFBTSxXQUFXLFlBQVk7SUFDM0IsS0FBSyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN2QixJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3RCLEdBQUcsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDckIsS0FBSyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN2QixTQUFTLElBQUksT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQ2hDLE9BQU8sSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDNUIsTUFBTSxDQUFDLE1BQU0sRUFBRSxTQUFTLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0NBQzFDO0FBRUQsZUFBTyxNQUFNLGtCQUFrQixFQUFFLFlBQVksQ0FBQyxZQUFZLENBUXpELENBQUMifQ==
|
package/dest/interface.d.ts.map
CHANGED
|
@@ -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
|
|
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(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
@@ -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"}
|