@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/dest/amm_bot.d.ts +4 -3
- package/dest/amm_bot.d.ts.map +1 -1
- package/dest/amm_bot.js +3 -3
- package/dest/base_bot.d.ts +4 -4
- package/dest/base_bot.d.ts.map +1 -1
- package/dest/base_bot.js +12 -22
- package/dest/bot.d.ts +3 -2
- package/dest/bot.d.ts.map +1 -1
- package/dest/bot.js +3 -7
- package/dest/config.d.ts +31 -82
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +6 -7
- package/dest/cross_chain_bot.d.ts +6 -4
- package/dest/cross_chain_bot.d.ts.map +1 -1
- package/dest/cross_chain_bot.js +14 -17
- package/dest/factory.d.ts +17 -7
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +232 -177
- package/dest/interface.d.ts +2 -6
- package/dest/interface.d.ts.map +1 -1
- package/dest/interface.js +30 -7
- package/dest/runner.d.ts +3 -2
- package/dest/runner.d.ts.map +1 -1
- package/dest/runner.js +6 -4
- package/package.json +16 -16
- package/src/amm_bot.ts +5 -2
- package/src/base_bot.ts +10 -17
- package/src/bot.ts +4 -4
- package/src/config.ts +8 -8
- package/src/cross_chain_bot.ts +12 -14
- package/src/factory.ts +233 -195
- package/src/interface.ts +7 -7
- package/src/runner.ts +26 -3
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(
|
|
26
|
-
stop: z.function(
|
|
27
|
-
run: z.function(
|
|
28
|
-
setup: z.function(
|
|
29
|
-
getInfo: z.function(
|
|
30
|
-
getConfig: z.function(
|
|
31
|
-
update: z.function(
|
|
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(
|
|
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(
|
|
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(
|
|
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;
|