@aztec/bot 2.0.0-rc.8 → 2.0.2-rc.2
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/config.js +1 -1
- package/dest/factory.d.ts +0 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +5 -12
- package/package.json +11 -11
- package/src/config.ts +1 -1
- package/src/factory.ts +7 -14
package/dest/config.js
CHANGED
|
@@ -85,7 +85,7 @@ export const botConfigMappings = {
|
|
|
85
85
|
l1ToL2MessageTimeoutSeconds: {
|
|
86
86
|
env: 'BOT_L1_TO_L2_TIMEOUT_SECONDS',
|
|
87
87
|
description: 'How long to wait for L1 to L2 messages to become available on L2',
|
|
88
|
-
...numberConfigHelper(
|
|
88
|
+
...numberConfigHelper(3600)
|
|
89
89
|
},
|
|
90
90
|
senderPrivateKey: {
|
|
91
91
|
env: 'BOT_PRIVATE_KEY',
|
package/dest/factory.d.ts
CHANGED
package/dest/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,YAAY,EAQZ,KAAK,GAAG,EAIT,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAIjF,OAAO,EAAE,KAAK,SAAS,EAAwC,MAAM,aAAa,CAAC;AAMnF,qBAAa,UAAU;IAOnB,OAAO,CAAC,QAAQ,CAAC,MAAM;IANzB,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,IAAI,CAAC,CAAY;IACzB,OAAO,CAAC,SAAS,CAAC,C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,EAAE,cAAc,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAA;KAAE;IA4B3E;;;OAGG;IACU,KAAK;;;;;;;IASL,QAAQ;;;;;;;;IAuCrB;;;OAGG;YACW,YAAY;YASZ,0BAA0B;YA8B1B,gBAAgB;IAc9B;;OAEG;YACW,iBAAiB;IAK/B;;;;OAIG;YACW,UAAU;IA+BxB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;YAaZ,gBAAgB;YAqBhB,OAAO;YA0EP,wBAAwB;IAkBtC;;;OAGG;YACW,UAAU;YAmCV,gBAAgB;YAgChB,oBAAoB;CAYnC"}
|
package/dest/factory.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { getDeployedTestAccountsWallets, getInitialTestAccounts } from '@aztec/accounts/testing';
|
|
3
|
-
import { BatchCall, FeeJuicePaymentMethodWithClaim, L1FeeJuicePortalManager, createLogger, createPXEClient,
|
|
3
|
+
import { BatchCall, FeeJuicePaymentMethodWithClaim, L1FeeJuicePortalManager, createLogger, createPXEClient, waitForL1ToL2MessageReady } from '@aztec/aztec.js';
|
|
4
4
|
import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
|
|
5
5
|
import { Fr } from '@aztec/foundation/fields';
|
|
6
6
|
import { Timer } from '@aztec/foundation/timer';
|
|
@@ -328,12 +328,11 @@ export class BotFactory {
|
|
|
328
328
|
const portal = await L1FeeJuicePortalManager.new(this.pxe, extendedClient, this.log);
|
|
329
329
|
const mintAmount = await portal.getTokenManager().getMintAmount();
|
|
330
330
|
const claim = await portal.bridgeTokensPublic(recipient, mintAmount, true);
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
await this.withNoMinTxsPerBlock(()=>waitForL1ToL2MessageReady(this.pxe, Fr.fromHexString(claim.messageHash), {
|
|
332
|
+
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
|
|
333
|
+
forPublicConsumption: false
|
|
334
|
+
}));
|
|
333
335
|
this.log.info(`Created a claim for ${mintAmount} L1 fee juice to ${recipient}.`, claim);
|
|
334
|
-
// Progress by 2 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
335
|
-
await this.advanceL2Block();
|
|
336
|
-
await this.advanceL2Block();
|
|
337
336
|
return claim;
|
|
338
337
|
}
|
|
339
338
|
async withNoMinTxsPerBlock(fn) {
|
|
@@ -352,10 +351,4 @@ export class BotFactory {
|
|
|
352
351
|
});
|
|
353
352
|
}
|
|
354
353
|
}
|
|
355
|
-
async advanceL2Block() {
|
|
356
|
-
await this.withNoMinTxsPerBlock(async ()=>{
|
|
357
|
-
const initialBlockNumber = await this.node.getBlockNumber();
|
|
358
|
-
await retryUntil(async ()=>await this.node.getBlockNumber() >= initialBlockNumber + 1);
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
354
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/bot",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2-rc.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@aztec/accounts": "2.0.
|
|
58
|
-
"@aztec/aztec.js": "2.0.
|
|
59
|
-
"@aztec/entrypoints": "2.0.
|
|
60
|
-
"@aztec/ethereum": "2.0.
|
|
61
|
-
"@aztec/foundation": "2.0.
|
|
62
|
-
"@aztec/noir-contracts.js": "2.0.
|
|
63
|
-
"@aztec/noir-protocol-circuits-types": "2.0.
|
|
64
|
-
"@aztec/protocol-contracts": "2.0.
|
|
65
|
-
"@aztec/stdlib": "2.0.
|
|
66
|
-
"@aztec/telemetry-client": "2.0.
|
|
57
|
+
"@aztec/accounts": "2.0.2-rc.2",
|
|
58
|
+
"@aztec/aztec.js": "2.0.2-rc.2",
|
|
59
|
+
"@aztec/entrypoints": "2.0.2-rc.2",
|
|
60
|
+
"@aztec/ethereum": "2.0.2-rc.2",
|
|
61
|
+
"@aztec/foundation": "2.0.2-rc.2",
|
|
62
|
+
"@aztec/noir-contracts.js": "2.0.2-rc.2",
|
|
63
|
+
"@aztec/noir-protocol-circuits-types": "2.0.2-rc.2",
|
|
64
|
+
"@aztec/protocol-contracts": "2.0.2-rc.2",
|
|
65
|
+
"@aztec/stdlib": "2.0.2-rc.2",
|
|
66
|
+
"@aztec/telemetry-client": "2.0.2-rc.2",
|
|
67
67
|
"source-map-support": "^0.5.21",
|
|
68
68
|
"tslib": "^2.4.0",
|
|
69
69
|
"zod": "^3.23.8"
|
package/src/config.ts
CHANGED
|
@@ -154,7 +154,7 @@ export const botConfigMappings: ConfigMappingsType<BotConfig> = {
|
|
|
154
154
|
l1ToL2MessageTimeoutSeconds: {
|
|
155
155
|
env: 'BOT_L1_TO_L2_TIMEOUT_SECONDS',
|
|
156
156
|
description: 'How long to wait for L1 to L2 messages to become available on L2',
|
|
157
|
-
...numberConfigHelper(
|
|
157
|
+
...numberConfigHelper(3600),
|
|
158
158
|
},
|
|
159
159
|
senderPrivateKey: {
|
|
160
160
|
env: 'BOT_PRIVATE_KEY',
|
package/src/factory.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
type PXE,
|
|
14
14
|
createLogger,
|
|
15
15
|
createPXEClient,
|
|
16
|
-
|
|
16
|
+
waitForL1ToL2MessageReady,
|
|
17
17
|
} from '@aztec/aztec.js';
|
|
18
18
|
import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
|
|
19
19
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -410,15 +410,15 @@ export class BotFactory {
|
|
|
410
410
|
const mintAmount = await portal.getTokenManager().getMintAmount();
|
|
411
411
|
const claim = await portal.bridgeTokensPublic(recipient, mintAmount, true /* mint */);
|
|
412
412
|
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
await this.withNoMinTxsPerBlock(() =>
|
|
414
|
+
waitForL1ToL2MessageReady(this.pxe, Fr.fromHexString(claim.messageHash), {
|
|
415
|
+
timeoutSeconds: this.config.l1ToL2MessageTimeoutSeconds,
|
|
416
|
+
forPublicConsumption: false,
|
|
417
|
+
}),
|
|
418
|
+
);
|
|
415
419
|
|
|
416
420
|
this.log.info(`Created a claim for ${mintAmount} L1 fee juice to ${recipient}.`, claim);
|
|
417
421
|
|
|
418
|
-
// Progress by 2 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
419
|
-
await this.advanceL2Block();
|
|
420
|
-
await this.advanceL2Block();
|
|
421
|
-
|
|
422
422
|
return claim;
|
|
423
423
|
}
|
|
424
424
|
|
|
@@ -434,11 +434,4 @@ export class BotFactory {
|
|
|
434
434
|
await this.nodeAdmin.setConfig({ minTxsPerBlock });
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
|
|
438
|
-
private async advanceL2Block() {
|
|
439
|
-
await this.withNoMinTxsPerBlock(async () => {
|
|
440
|
-
const initialBlockNumber = await this.node!.getBlockNumber();
|
|
441
|
-
await retryUntil(async () => (await this.node!.getBlockNumber()) >= initialBlockNumber + 1);
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
437
|
}
|