@aztec/bot 0.0.1-commit.f504929 → 0.0.1-commit.f5a9928

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/src/interface.ts CHANGED
@@ -22,11 +22,11 @@ export interface BotRunnerApi {
22
22
  }
23
23
 
24
24
  export const BotRunnerApiSchema: ApiSchemaFor<BotRunnerApi> = {
25
- start: z.function().args().returns(z.void()),
26
- stop: z.function().args().returns(z.void()),
27
- run: z.function().args().returns(z.void()),
28
- setup: z.function().args().returns(z.void()),
29
- getInfo: z.function().args().returns(BotInfoSchema),
30
- getConfig: z.function().args().returns(BotConfigSchema),
31
- update: z.function().args(BotConfigSchema).returns(z.void()),
25
+ start: z.function({ input: z.tuple([]), output: z.void() }),
26
+ stop: z.function({ input: z.tuple([]), output: z.void() }),
27
+ run: z.function({ input: z.tuple([]), output: z.void() }),
28
+ setup: z.function({ input: z.tuple([]), output: z.void() }),
29
+ getInfo: z.function({ input: z.tuple([]), output: BotInfoSchema }),
30
+ getConfig: z.function({ input: z.tuple([]), output: BotConfigSchema }),
31
+ update: z.function({ input: z.tuple([BotConfigSchema]), output: z.void() }),
32
32
  };
package/src/runner.ts CHANGED
@@ -2,6 +2,7 @@ import { createLogger } from '@aztec/aztec.js/log';
2
2
  import type { AztecNode } from '@aztec/aztec.js/node';
3
3
  import { omit } from '@aztec/foundation/collection';
4
4
  import { RunningPromise } from '@aztec/foundation/running-promise';
5
+ import type { BlockTag } from '@aztec/stdlib/block';
5
6
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
6
7
  import { type TelemetryClient, type Traceable, type Tracer, trackSpan } from '@aztec/telemetry-client';
7
8
  import type { EmbeddedWallet } from '@aztec/wallets/embedded';
@@ -30,6 +31,7 @@ export class BotRunner implements BotRunnerApi, Traceable {
30
31
  private readonly telemetry: TelemetryClient,
31
32
  private readonly aztecNodeAdmin: AztecNodeAdmin | undefined,
32
33
  private readonly store: BotStore,
34
+ private readonly syncChainTip?: BlockTag,
33
35
  ) {
34
36
  this.tracer = telemetry.getTracer('Bot');
35
37
 
@@ -149,13 +151,34 @@ export class BotRunner implements BotRunnerApi, Traceable {
149
151
  try {
150
152
  switch (this.config.botMode) {
151
153
  case 'crosschain':
152
- this.bot = CrossChainBot.create(this.config, this.wallet, this.aztecNode, this.aztecNodeAdmin, this.store);
154
+ this.bot = CrossChainBot.create(
155
+ this.config,
156
+ this.wallet,
157
+ this.aztecNode,
158
+ this.aztecNodeAdmin,
159
+ this.store,
160
+ this.syncChainTip,
161
+ );
153
162
  break;
154
163
  case 'amm':
155
- this.bot = AmmBot.create(this.config, this.wallet, this.aztecNode, this.aztecNodeAdmin, this.store);
164
+ this.bot = AmmBot.create(
165
+ this.config,
166
+ this.wallet,
167
+ this.aztecNode,
168
+ this.aztecNodeAdmin,
169
+ this.store,
170
+ this.syncChainTip,
171
+ );
156
172
  break;
157
173
  case 'transfer':
158
- this.bot = Bot.create(this.config, this.wallet, this.aztecNode, this.aztecNodeAdmin, this.store);
174
+ this.bot = Bot.create(
175
+ this.config,
176
+ this.wallet,
177
+ this.aztecNode,
178
+ this.aztecNodeAdmin,
179
+ this.store,
180
+ this.syncChainTip,
181
+ );
159
182
  break;
160
183
  default: {
161
184
  const _exhaustive: never = this.config.botMode;