@aztec/bot 0.0.1-commit.d3ec352c → 0.0.1-commit.e6bd8901

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/runner.js CHANGED
@@ -1,15 +1,383 @@
1
- function _ts_decorate(decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ function applyDecs2203RFactory() {
2
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
3
+ return function addInitializer(initializer) {
4
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
5
+ assertCallable(initializer, "An initializer");
6
+ initializers.push(initializer);
7
+ };
8
+ }
9
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
10
+ var kindStr;
11
+ switch(kind){
12
+ case 1:
13
+ kindStr = "accessor";
14
+ break;
15
+ case 2:
16
+ kindStr = "method";
17
+ break;
18
+ case 3:
19
+ kindStr = "getter";
20
+ break;
21
+ case 4:
22
+ kindStr = "setter";
23
+ break;
24
+ default:
25
+ kindStr = "field";
26
+ }
27
+ var ctx = {
28
+ kind: kindStr,
29
+ name: isPrivate ? "#" + name : name,
30
+ static: isStatic,
31
+ private: isPrivate,
32
+ metadata: metadata
33
+ };
34
+ var decoratorFinishedRef = {
35
+ v: false
36
+ };
37
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
38
+ var get, set;
39
+ if (kind === 0) {
40
+ if (isPrivate) {
41
+ get = desc.get;
42
+ set = desc.set;
43
+ } else {
44
+ get = function() {
45
+ return this[name];
46
+ };
47
+ set = function(v) {
48
+ this[name] = v;
49
+ };
50
+ }
51
+ } else if (kind === 2) {
52
+ get = function() {
53
+ return desc.value;
54
+ };
55
+ } else {
56
+ if (kind === 1 || kind === 3) {
57
+ get = function() {
58
+ return desc.get.call(this);
59
+ };
60
+ }
61
+ if (kind === 1 || kind === 4) {
62
+ set = function(v) {
63
+ desc.set.call(this, v);
64
+ };
65
+ }
66
+ }
67
+ ctx.access = get && set ? {
68
+ get: get,
69
+ set: set
70
+ } : get ? {
71
+ get: get
72
+ } : {
73
+ set: set
74
+ };
75
+ try {
76
+ return dec(value, ctx);
77
+ } finally{
78
+ decoratorFinishedRef.v = true;
79
+ }
80
+ }
81
+ function assertNotFinished(decoratorFinishedRef, fnName) {
82
+ if (decoratorFinishedRef.v) {
83
+ throw new Error("attempted to call " + fnName + " after decoration was finished");
84
+ }
85
+ }
86
+ function assertCallable(fn, hint) {
87
+ if (typeof fn !== "function") {
88
+ throw new TypeError(hint + " must be a function");
89
+ }
90
+ }
91
+ function assertValidReturnValue(kind, value) {
92
+ var type = typeof value;
93
+ if (kind === 1) {
94
+ if (type !== "object" || value === null) {
95
+ throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
96
+ }
97
+ if (value.get !== undefined) {
98
+ assertCallable(value.get, "accessor.get");
99
+ }
100
+ if (value.set !== undefined) {
101
+ assertCallable(value.set, "accessor.set");
102
+ }
103
+ if (value.init !== undefined) {
104
+ assertCallable(value.init, "accessor.init");
105
+ }
106
+ } else if (type !== "function") {
107
+ var hint;
108
+ if (kind === 0) {
109
+ hint = "field";
110
+ } else if (kind === 10) {
111
+ hint = "class";
112
+ } else {
113
+ hint = "method";
114
+ }
115
+ throw new TypeError(hint + " decorators must return a function or void 0");
116
+ }
117
+ }
118
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
119
+ var decs = decInfo[0];
120
+ var desc, init, value;
121
+ if (isPrivate) {
122
+ if (kind === 0 || kind === 1) {
123
+ desc = {
124
+ get: decInfo[3],
125
+ set: decInfo[4]
126
+ };
127
+ } else if (kind === 3) {
128
+ desc = {
129
+ get: decInfo[3]
130
+ };
131
+ } else if (kind === 4) {
132
+ desc = {
133
+ set: decInfo[3]
134
+ };
135
+ } else {
136
+ desc = {
137
+ value: decInfo[3]
138
+ };
139
+ }
140
+ } else if (kind !== 0) {
141
+ desc = Object.getOwnPropertyDescriptor(base, name);
142
+ }
143
+ if (kind === 1) {
144
+ value = {
145
+ get: desc.get,
146
+ set: desc.set
147
+ };
148
+ } else if (kind === 2) {
149
+ value = desc.value;
150
+ } else if (kind === 3) {
151
+ value = desc.get;
152
+ } else if (kind === 4) {
153
+ value = desc.set;
154
+ }
155
+ var newValue, get, set;
156
+ if (typeof decs === "function") {
157
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
158
+ if (newValue !== void 0) {
159
+ assertValidReturnValue(kind, newValue);
160
+ if (kind === 0) {
161
+ init = newValue;
162
+ } else if (kind === 1) {
163
+ init = newValue.init;
164
+ get = newValue.get || value.get;
165
+ set = newValue.set || value.set;
166
+ value = {
167
+ get: get,
168
+ set: set
169
+ };
170
+ } else {
171
+ value = newValue;
172
+ }
173
+ }
174
+ } else {
175
+ for(var i = decs.length - 1; i >= 0; i--){
176
+ var dec = decs[i];
177
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
178
+ if (newValue !== void 0) {
179
+ assertValidReturnValue(kind, newValue);
180
+ var newInit;
181
+ if (kind === 0) {
182
+ newInit = newValue;
183
+ } else if (kind === 1) {
184
+ newInit = newValue.init;
185
+ get = newValue.get || value.get;
186
+ set = newValue.set || value.set;
187
+ value = {
188
+ get: get,
189
+ set: set
190
+ };
191
+ } else {
192
+ value = newValue;
193
+ }
194
+ if (newInit !== void 0) {
195
+ if (init === void 0) {
196
+ init = newInit;
197
+ } else if (typeof init === "function") {
198
+ init = [
199
+ init,
200
+ newInit
201
+ ];
202
+ } else {
203
+ init.push(newInit);
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+ if (kind === 0 || kind === 1) {
210
+ if (init === void 0) {
211
+ init = function(instance, init) {
212
+ return init;
213
+ };
214
+ } else if (typeof init !== "function") {
215
+ var ownInitializers = init;
216
+ init = function(instance, init) {
217
+ var value = init;
218
+ for(var i = 0; i < ownInitializers.length; i++){
219
+ value = ownInitializers[i].call(instance, value);
220
+ }
221
+ return value;
222
+ };
223
+ } else {
224
+ var originalInitializer = init;
225
+ init = function(instance, init) {
226
+ return originalInitializer.call(instance, init);
227
+ };
228
+ }
229
+ ret.push(init);
230
+ }
231
+ if (kind !== 0) {
232
+ if (kind === 1) {
233
+ desc.get = value.get;
234
+ desc.set = value.set;
235
+ } else if (kind === 2) {
236
+ desc.value = value;
237
+ } else if (kind === 3) {
238
+ desc.get = value;
239
+ } else if (kind === 4) {
240
+ desc.set = value;
241
+ }
242
+ if (isPrivate) {
243
+ if (kind === 1) {
244
+ ret.push(function(instance, args) {
245
+ return value.get.call(instance, args);
246
+ });
247
+ ret.push(function(instance, args) {
248
+ return value.set.call(instance, args);
249
+ });
250
+ } else if (kind === 2) {
251
+ ret.push(value);
252
+ } else {
253
+ ret.push(function(instance, args) {
254
+ return value.call(instance, args);
255
+ });
256
+ }
257
+ } else {
258
+ Object.defineProperty(base, name, desc);
259
+ }
260
+ }
261
+ }
262
+ function applyMemberDecs(Class, decInfos, metadata) {
263
+ var ret = [];
264
+ var protoInitializers;
265
+ var staticInitializers;
266
+ var existingProtoNonFields = new Map();
267
+ var existingStaticNonFields = new Map();
268
+ for(var i = 0; i < decInfos.length; i++){
269
+ var decInfo = decInfos[i];
270
+ if (!Array.isArray(decInfo)) continue;
271
+ var kind = decInfo[1];
272
+ var name = decInfo[2];
273
+ var isPrivate = decInfo.length > 3;
274
+ var isStatic = kind >= 5;
275
+ var base;
276
+ var initializers;
277
+ if (isStatic) {
278
+ base = Class;
279
+ kind = kind - 5;
280
+ staticInitializers = staticInitializers || [];
281
+ initializers = staticInitializers;
282
+ } else {
283
+ base = Class.prototype;
284
+ protoInitializers = protoInitializers || [];
285
+ initializers = protoInitializers;
286
+ }
287
+ if (kind !== 0 && !isPrivate) {
288
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
289
+ var existingKind = existingNonFields.get(name) || 0;
290
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
291
+ throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
292
+ } else if (!existingKind && kind > 2) {
293
+ existingNonFields.set(name, kind);
294
+ } else {
295
+ existingNonFields.set(name, true);
296
+ }
297
+ }
298
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
299
+ }
300
+ pushInitializers(ret, protoInitializers);
301
+ pushInitializers(ret, staticInitializers);
302
+ return ret;
303
+ }
304
+ function pushInitializers(ret, initializers) {
305
+ if (initializers) {
306
+ ret.push(function(instance) {
307
+ for(var i = 0; i < initializers.length; i++){
308
+ initializers[i].call(instance);
309
+ }
310
+ return instance;
311
+ });
312
+ }
313
+ }
314
+ function applyClassDecs(targetClass, classDecs, metadata) {
315
+ if (classDecs.length > 0) {
316
+ var initializers = [];
317
+ var newClass = targetClass;
318
+ var name = targetClass.name;
319
+ for(var i = classDecs.length - 1; i >= 0; i--){
320
+ var decoratorFinishedRef = {
321
+ v: false
322
+ };
323
+ try {
324
+ var nextNewClass = classDecs[i](newClass, {
325
+ kind: "class",
326
+ name: name,
327
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
328
+ metadata
329
+ });
330
+ } finally{
331
+ decoratorFinishedRef.v = true;
332
+ }
333
+ if (nextNewClass !== undefined) {
334
+ assertValidReturnValue(10, nextNewClass);
335
+ newClass = nextNewClass;
336
+ }
337
+ }
338
+ return [
339
+ defineMetadata(newClass, metadata),
340
+ function() {
341
+ for(var i = 0; i < initializers.length; i++){
342
+ initializers[i].call(newClass);
343
+ }
344
+ }
345
+ ];
346
+ }
347
+ }
348
+ function defineMetadata(Class, metadata) {
349
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
350
+ configurable: true,
351
+ enumerable: true,
352
+ value: metadata
353
+ });
354
+ }
355
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
356
+ if (parentClass !== void 0) {
357
+ var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
358
+ }
359
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
360
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
361
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
362
+ return {
363
+ e: e,
364
+ get c () {
365
+ return applyClassDecs(targetClass, classDecs, metadata);
366
+ }
367
+ };
368
+ };
369
+ }
370
+ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
371
+ return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
6
372
  }
373
+ var _dec, _dec1, _call_work, _initProto;
7
374
  import { createLogger } from '@aztec/aztec.js/log';
8
375
  import { omit } from '@aztec/foundation/collection';
9
376
  import { RunningPromise } from '@aztec/foundation/running-promise';
10
377
  import { trackSpan } from '@aztec/telemetry-client';
11
378
  import { AmmBot } from './amm_bot.js';
12
379
  import { Bot } from './bot.js';
380
+ _dec = trackSpan('Bot.setup'), _dec1 = trackSpan('Bot.work');
13
381
  export class BotRunner {
14
382
  config;
15
383
  wallet;
@@ -17,6 +385,42 @@ export class BotRunner {
17
385
  telemetry;
18
386
  aztecNodeAdmin;
19
387
  store;
388
+ static{
389
+ ({ e: [_call_work, _initProto] } = _apply_decs_2203_r(this, [
390
+ [
391
+ _dec,
392
+ 2,
393
+ "doSetup"
394
+ ],
395
+ [
396
+ _dec1,
397
+ 2,
398
+ "work",
399
+ async function() {
400
+ if (this.config.maxPendingTxs > 0) {
401
+ const pendingTxCount = await this.aztecNode.getPendingTxCount();
402
+ if (pendingTxCount >= this.config.maxPendingTxs) {
403
+ this.log.verbose(`Not sending bot tx since node has ${pendingTxCount} pending txs`);
404
+ return;
405
+ }
406
+ }
407
+ try {
408
+ await this.run();
409
+ } catch {
410
+ // Already logged in run()
411
+ if (this.config.maxConsecutiveErrors > 0 && this.consecutiveErrors >= this.config.maxConsecutiveErrors) {
412
+ this.log.error(`Too many errors bot is unhealthy`);
413
+ this.healthy = false;
414
+ }
415
+ }
416
+ if (!this.healthy && this.config.stopWhenUnhealthy) {
417
+ this.log.fatal(`Stopping bot due to errors`);
418
+ process.exit(1); // workaround docker not restarting the container if its unhealthy. We have to exit instead
419
+ }
420
+ }
421
+ ]
422
+ ], []));
423
+ }
20
424
  log;
21
425
  bot;
22
426
  runningPromise;
@@ -30,7 +434,7 @@ export class BotRunner {
30
434
  this.telemetry = telemetry;
31
435
  this.aztecNodeAdmin = aztecNodeAdmin;
32
436
  this.store = store;
33
- this.log = createLogger('bot');
437
+ this.log = (_initProto(this), createLogger('bot'));
34
438
  this.consecutiveErrors = 0;
35
439
  this.healthy = true;
36
440
  this.tracer = telemetry.getTracer('Bot');
@@ -138,29 +542,7 @@ export class BotRunner {
138
542
  throw err;
139
543
  }
140
544
  }
141
- async #work() {
142
- if (this.config.maxPendingTxs > 0) {
143
- const pendingTxCount = await this.aztecNode.getPendingTxCount();
144
- if (pendingTxCount >= this.config.maxPendingTxs) {
145
- this.log.verbose(`Not sending bot tx since node has ${pendingTxCount} pending txs`);
146
- return;
147
- }
148
- }
149
- try {
150
- await this.run();
151
- } catch {
152
- // Already logged in run()
153
- if (this.config.maxConsecutiveErrors > 0 && this.consecutiveErrors >= this.config.maxConsecutiveErrors) {
154
- this.log.error(`Too many errors bot is unhealthy`);
155
- this.healthy = false;
156
- }
157
- }
158
- if (!this.healthy && this.config.stopWhenUnhealthy) {
159
- this.log.fatal(`Stopping bot due to errors`);
160
- process.exit(1); // workaround docker not restarting the container if its unhealthy. We have to exit instead
161
- }
545
+ get #work() {
546
+ return _call_work;
162
547
  }
163
548
  }
164
- _ts_decorate([
165
- trackSpan('Bot.setup')
166
- ], BotRunner.prototype, "doSetup", null);
@@ -13,7 +13,7 @@ export interface BridgeClaimData {
13
13
  export declare class BotStore {
14
14
  private readonly store;
15
15
  private readonly log;
16
- static readonly SCHEMA_VERSION: number;
16
+ static readonly SCHEMA_VERSION = 1;
17
17
  private readonly bridgeClaims;
18
18
  constructor(store: AztecAsyncKVStore, log?: Logger);
19
19
  /**
@@ -41,4 +41,4 @@ export declare class BotStore {
41
41
  */
42
42
  close(): Promise<void>;
43
43
  }
44
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm90X3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RvcmUvYm90X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxhQUFhLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUU5RCxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQWlCLE1BQU0saUJBQWlCLENBQUM7QUFFeEUsTUFBTSxXQUFXLGVBQWU7SUFDOUIsS0FBSyxFQUFFLGFBQWEsQ0FBQztJQUNyQixTQUFTLEVBQUUsTUFBTSxDQUFDO0lBQ2xCLFNBQVMsRUFBRSxNQUFNLENBQUM7Q0FDbkI7QUFFRDs7R0FFRztBQUNILHFCQUFhLFFBQVE7SUFLakIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxLQUFLO0lBQ3RCLE9BQU8sQ0FBQyxRQUFRLENBQUMsR0FBRztJQUx0QixnQkFBdUIsY0FBYyxTQUFLO0lBQzFDLE9BQU8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lC;CACF"}
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { createLogger } from '@aztec/foundation/log';
3
3
  /**
4
4
  * Simple data store for the bot to persist L1 bridge claims.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/bot",
3
- "version": "0.0.1-commit.d3ec352c",
3
+ "version": "0.0.1-commit.e6bd8901",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -54,18 +54,18 @@
54
54
  ]
55
55
  },
56
56
  "dependencies": {
57
- "@aztec/accounts": "0.0.1-commit.d3ec352c",
58
- "@aztec/aztec.js": "0.0.1-commit.d3ec352c",
59
- "@aztec/entrypoints": "0.0.1-commit.d3ec352c",
60
- "@aztec/ethereum": "0.0.1-commit.d3ec352c",
61
- "@aztec/foundation": "0.0.1-commit.d3ec352c",
62
- "@aztec/kv-store": "0.0.1-commit.d3ec352c",
63
- "@aztec/noir-contracts.js": "0.0.1-commit.d3ec352c",
64
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.d3ec352c",
65
- "@aztec/protocol-contracts": "0.0.1-commit.d3ec352c",
66
- "@aztec/stdlib": "0.0.1-commit.d3ec352c",
67
- "@aztec/telemetry-client": "0.0.1-commit.d3ec352c",
68
- "@aztec/test-wallet": "0.0.1-commit.d3ec352c",
57
+ "@aztec/accounts": "0.0.1-commit.e6bd8901",
58
+ "@aztec/aztec.js": "0.0.1-commit.e6bd8901",
59
+ "@aztec/entrypoints": "0.0.1-commit.e6bd8901",
60
+ "@aztec/ethereum": "0.0.1-commit.e6bd8901",
61
+ "@aztec/foundation": "0.0.1-commit.e6bd8901",
62
+ "@aztec/kv-store": "0.0.1-commit.e6bd8901",
63
+ "@aztec/noir-contracts.js": "0.0.1-commit.e6bd8901",
64
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.e6bd8901",
65
+ "@aztec/protocol-contracts": "0.0.1-commit.e6bd8901",
66
+ "@aztec/stdlib": "0.0.1-commit.e6bd8901",
67
+ "@aztec/telemetry-client": "0.0.1-commit.e6bd8901",
68
+ "@aztec/test-wallet": "0.0.1-commit.e6bd8901",
69
69
  "source-map-support": "^0.5.21",
70
70
  "tslib": "^2.4.0",
71
71
  "zod": "^3.23.8"
@@ -75,7 +75,7 @@
75
75
  "@types/jest": "^30.0.0",
76
76
  "@types/node": "^22.15.17",
77
77
  "@types/source-map-support": "^0.5.10",
78
- "@typescript/native-preview": "7.0.0-dev.20251126.1",
78
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
79
79
  "jest": "^30.0.0",
80
80
  "jest-mock-extended": "^4.0.0",
81
81
  "ts-node": "^10.9.1",
package/src/amm_bot.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AztecAddress } from '@aztec/aztec.js/addresses';
2
- import { SentTx } from '@aztec/aztec.js/contracts';
2
+ import { NO_WAIT } from '@aztec/aztec.js/contracts';
3
3
  import { Fr } from '@aztec/aztec.js/fields';
4
- import { TxReceipt } from '@aztec/aztec.js/tx';
4
+ import { TxHash, TxReceipt } from '@aztec/aztec.js/tx';
5
5
  import { jsonStringify } from '@aztec/foundation/json-rpc';
6
6
  import type { AMMContract } from '@aztec/noir-contracts.js/AMM';
7
7
  import type { TokenContract } from '@aztec/noir-contracts.js/Token';
@@ -48,7 +48,7 @@ export class AmmBot extends BaseBot {
48
48
  return new AmmBot(aztecNode, wallet, defaultAccountAddress, amm, token0, token1, config);
49
49
  }
50
50
 
51
- protected async createAndSendTx(logCtx: object): Promise<SentTx> {
51
+ protected async createAndSendTx(logCtx: object): Promise<TxHash> {
52
52
  const { feePaymentMethod } = this.config;
53
53
  const { wallet, amm, token0, token1 } = this;
54
54
 
@@ -89,7 +89,7 @@ export class AmmBot extends BaseBot {
89
89
 
90
90
  this.log.verbose(`Sending transaction`, logCtx);
91
91
  this.log.info(`Tx. Balances: ${jsonStringify(balances)}`, { ...logCtx, balances });
92
- return swapExactTokensInteraction.send(opts);
92
+ return swapExactTokensInteraction.send({ ...opts, wait: NO_WAIT });
93
93
  }
94
94
 
95
95
  protected override async onTxMined(receipt: TxReceipt, logCtx: object): Promise<void> {
package/src/base_bot.ts CHANGED
@@ -3,10 +3,10 @@ import {
3
3
  BatchCall,
4
4
  ContractFunctionInteraction,
5
5
  type SendInteractionOptions,
6
- SentTx,
7
6
  waitForProven,
8
7
  } from '@aztec/aztec.js/contracts';
9
8
  import { createLogger } from '@aztec/aztec.js/log';
9
+ import { waitForTx } from '@aztec/aztec.js/node';
10
10
  import { TxHash, TxReceipt } from '@aztec/aztec.js/tx';
11
11
  import { Gas } from '@aztec/stdlib/gas';
12
12
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
@@ -33,9 +33,7 @@ export abstract class BaseBot {
33
33
  const { followChain, txMinedWaitSeconds } = this.config;
34
34
 
35
35
  this.log.verbose(`Creating tx`, logCtx);
36
- const tx = await this.createAndSendTx(logCtx);
37
-
38
- const txHash = await tx.getTxHash();
36
+ const txHash = await this.createAndSendTx(logCtx);
39
37
 
40
38
  if (followChain === 'NONE') {
41
39
  this.log.info(`Transaction ${txHash.toString()} sent, not waiting for it to be mined`);
@@ -46,9 +44,7 @@ export abstract class BaseBot {
46
44
  `Awaiting tx ${txHash.toString()} to be on the ${followChain} chain (timeout ${txMinedWaitSeconds}s)`,
47
45
  logCtx,
48
46
  );
49
- const receipt = await tx.wait({
50
- timeout: txMinedWaitSeconds,
51
- });
47
+ const receipt = await waitForTx(this.node, txHash, { timeout: txMinedWaitSeconds });
52
48
  if (followChain === 'PROVEN') {
53
49
  await waitForProven(this.node, receipt, { provenTimeout: txMinedWaitSeconds });
54
50
  }
@@ -63,7 +59,7 @@ export abstract class BaseBot {
63
59
  return receipt;
64
60
  }
65
61
 
66
- protected abstract createAndSendTx(logCtx: object): Promise<SentTx>;
62
+ protected abstract createAndSendTx(logCtx: object): Promise<TxHash>;
67
63
 
68
64
  protected onTxMined(_receipt: TxReceipt, _logCtx: object): Promise<void> {
69
65
  // no-op
@@ -73,9 +69,9 @@ export abstract class BaseBot {
73
69
  protected async getSendMethodOpts(
74
70
  interaction: ContractFunctionInteraction | BatchCall,
75
71
  ): Promise<SendInteractionOptions> {
76
- const { l2GasLimit, daGasLimit, baseFeePadding } = this.config;
72
+ const { l2GasLimit, daGasLimit, minFeePadding } = this.config;
77
73
 
78
- this.wallet.setBaseFeePadding(baseFeePadding);
74
+ this.wallet.setMinFeePadding(minFeePadding);
79
75
 
80
76
  let gasSettings;
81
77
  if (l2GasLimit !== undefined && l2GasLimit > 0 && daGasLimit !== undefined && daGasLimit > 0) {
package/src/bot.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { AztecAddress } from '@aztec/aztec.js/addresses';
2
- import { BatchCall, SentTx } from '@aztec/aztec.js/contracts';
2
+ import { BatchCall, NO_WAIT } from '@aztec/aztec.js/contracts';
3
+ import { TxHash } from '@aztec/aztec.js/tx';
3
4
  import { times } from '@aztec/foundation/collection';
4
5
  import type { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
5
6
  import type { TokenContract } from '@aztec/noir-contracts.js/Token';
@@ -48,7 +49,7 @@ export class Bot extends BaseBot {
48
49
  this.config = { ...this.config, ...config };
49
50
  }
50
51
 
51
- protected async createAndSendTx(logCtx: object): Promise<SentTx> {
52
+ protected async createAndSendTx(logCtx: object): Promise<TxHash> {
52
53
  const { privateTransfersPerTx, publicTransfersPerTx, feePaymentMethod } = this.config;
53
54
  const { token, recipient, wallet } = this;
54
55
 
@@ -75,7 +76,7 @@ export class Bot extends BaseBot {
75
76
  await batch.simulate({ from: this.defaultAccountAddress });
76
77
 
77
78
  this.log.verbose(`Sending transaction`, logCtx);
78
- return batch.send(opts);
79
+ return batch.send({ ...opts, wait: NO_WAIT });
79
80
  }
80
81
 
81
82
  public async getBalances() {