@aztec/bot 0.85.0-alpha-testnet.2 → 0.85.0-alpha-testnet.3

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.
@@ -1,11 +1,22 @@
1
+ import { AztecAddress } from '@aztec/aztec.js';
1
2
  import type { ApiSchemaFor } from '@aztec/stdlib/schemas';
3
+ import { z } from 'zod';
2
4
  import { type BotConfig } from './config.js';
5
+ export declare const BotInfoSchema: z.ZodObject<{
6
+ botAddress: import("@aztec/stdlib/schemas").ZodFor<AztecAddress>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ botAddress: AztecAddress;
9
+ }, {
10
+ botAddress?: any;
11
+ }>;
12
+ export type BotInfo = z.infer<typeof BotInfoSchema>;
3
13
  export interface BotRunnerApi {
4
14
  start(): Promise<void>;
5
15
  stop(): Promise<void>;
6
16
  run(): Promise<void>;
7
17
  setup(): Promise<void>;
8
18
  getConfig(): Promise<BotConfig>;
19
+ getInfo(): Promise<BotInfo>;
9
20
  update(config: BotConfig): Promise<void>;
10
21
  }
11
22
  export declare const BotRunnerApiSchema: ApiSchemaFor<BotRunnerApi>;
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,aAAa,CAAC;AAE9D,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,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,YAAY,CAOzD,CAAC"}
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,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;;;;;;EAExB,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
@@ -1,10 +1,15 @@
1
+ import { AztecAddress } from '@aztec/aztec.js';
1
2
  import { z } from 'zod';
2
3
  import { BotConfigSchema } from './config.js';
4
+ export const BotInfoSchema = z.object({
5
+ botAddress: AztecAddress.schema
6
+ });
3
7
  export const BotRunnerApiSchema = {
4
8
  start: z.function().args().returns(z.void()),
5
9
  stop: z.function().args().returns(z.void()),
6
10
  run: z.function().args().returns(z.void()),
7
11
  setup: z.function().args().returns(z.void()),
12
+ getInfo: z.function().args().returns(BotInfoSchema),
8
13
  getConfig: z.function().args().returns(BotConfigSchema),
9
14
  update: z.function().args(BotConfigSchema).returns(z.void())
10
15
  };
package/dest/runner.d.ts CHANGED
@@ -2,7 +2,7 @@ import { type AztecNode, type PXE } from '@aztec/aztec.js';
2
2
  import { type AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
3
3
  import { type TelemetryClient, type Traceable, type Tracer } from '@aztec/telemetry-client';
4
4
  import { type BotConfig } from './config.js';
5
- import type { BotRunnerApi } from './interface.js';
5
+ import type { BotInfo, BotRunnerApi } from './interface.js';
6
6
  export declare class BotRunner implements BotRunnerApi, Traceable {
7
7
  #private;
8
8
  private config;
@@ -48,5 +48,7 @@ export declare class BotRunner implements BotRunnerApi, Traceable {
48
48
  run(): Promise<void>;
49
49
  /** Returns the current configuration for the bot. */
50
50
  getConfig(): Promise<BotConfig>;
51
+ /** Returns the bot sender address. */
52
+ getInfo(): Promise<BotInfo>;
51
53
  }
52
54
  //# sourceMappingURL=runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAuC,MAAM,iBAAiB,CAAC;AAEhG,OAAO,EAAE,KAAK,cAAc,EAA8B,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,EAA8B,MAAM,yBAAyB,CAAC;AAKxH,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,qBAAa,SAAU,YAAW,YAAY,EAAE,SAAS;;IAarD,OAAO,CAAC,MAAM;IAZhB,OAAO,CAAC,GAAG,CAAuB;IAClC,OAAO,CAAC,GAAG,CAAC,CAAmB;IA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AmB;IAC/B,OAAO,CAAC,GAAG,CAAC,CAAM;IAClB,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,SAAS,CAAC,CAAiB;IACnC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,OAAO,CAAQ;IAEvB,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAGrB,MAAM,EAAE,SAAS,EACzB,YAAY,EAAE;QAAE,GAAG,CAAC,EAAE,GAAG,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE,cAAc,CAAC;QAAC,SAAS,EAAE,eAAe,CAAA;KAAE;IAgBvG,6EAA6E;IAChE,KAAK;YAOJ,OAAO;IAMrB;;;OAGG;IACU,KAAK;IAQlB;;OAEG;IACU,IAAI;IAQV,SAAS;IAIhB,0CAA0C;IACnC,SAAS;IAIhB;;;OAGG;IACU,MAAM,CAAC,MAAM,EAAE,SAAS;IAerC;;;OAGG;IACU,GAAG;IAwBhB,qDAAqD;IAC9C,SAAS;IAKhB,sCAAsC;IACzB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;CA6CzC"}
package/dest/runner.js CHANGED
@@ -5,6 +5,7 @@ function _ts_decorate(decorators, target, key, desc) {
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  }
7
7
  import { createAztecNodeClient, createLogger } from '@aztec/aztec.js';
8
+ import { omit } from '@aztec/foundation/collection';
8
9
  import { RunningPromise } from '@aztec/foundation/running-promise';
9
10
  import { createAztecNodeAdminClient } from '@aztec/stdlib/interfaces/client';
10
11
  import { makeTracedFetch, trackSpan } from '@aztec/telemetry-client';
@@ -122,7 +123,17 @@ export class BotRunner {
122
123
  }
123
124
  }
124
125
  /** Returns the current configuration for the bot. */ getConfig() {
125
- return Promise.resolve(this.config);
126
+ const redacted = omit(this.config, 'l1Mnemonic', 'l1PrivateKey', 'senderPrivateKey');
127
+ return Promise.resolve(redacted);
128
+ }
129
+ /** Returns the bot sender address. */ async getInfo() {
130
+ if (!this.bot) {
131
+ throw new Error(`Bot is not initialized`);
132
+ }
133
+ const botAddress = await this.bot.then((b)=>b.wallet.getAddress());
134
+ return {
135
+ botAddress
136
+ };
126
137
  }
127
138
  async #createBot() {
128
139
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/bot",
3
- "version": "0.85.0-alpha-testnet.2",
3
+ "version": "0.85.0-alpha-testnet.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -52,16 +52,16 @@
52
52
  ]
53
53
  },
54
54
  "dependencies": {
55
- "@aztec/accounts": "0.85.0-alpha-testnet.2",
56
- "@aztec/aztec.js": "0.85.0-alpha-testnet.2",
57
- "@aztec/entrypoints": "0.85.0-alpha-testnet.2",
58
- "@aztec/ethereum": "0.85.0-alpha-testnet.2",
59
- "@aztec/foundation": "0.85.0-alpha-testnet.2",
60
- "@aztec/noir-contracts.js": "0.85.0-alpha-testnet.2",
61
- "@aztec/noir-protocol-circuits-types": "0.85.0-alpha-testnet.2",
62
- "@aztec/protocol-contracts": "0.85.0-alpha-testnet.2",
63
- "@aztec/stdlib": "0.85.0-alpha-testnet.2",
64
- "@aztec/telemetry-client": "0.85.0-alpha-testnet.2",
55
+ "@aztec/accounts": "0.85.0-alpha-testnet.3",
56
+ "@aztec/aztec.js": "0.85.0-alpha-testnet.3",
57
+ "@aztec/entrypoints": "0.85.0-alpha-testnet.3",
58
+ "@aztec/ethereum": "0.85.0-alpha-testnet.3",
59
+ "@aztec/foundation": "0.85.0-alpha-testnet.3",
60
+ "@aztec/noir-contracts.js": "0.85.0-alpha-testnet.3",
61
+ "@aztec/noir-protocol-circuits-types": "0.85.0-alpha-testnet.3",
62
+ "@aztec/protocol-contracts": "0.85.0-alpha-testnet.3",
63
+ "@aztec/stdlib": "0.85.0-alpha-testnet.3",
64
+ "@aztec/telemetry-client": "0.85.0-alpha-testnet.3",
65
65
  "source-map-support": "^0.5.21",
66
66
  "tslib": "^2.4.0",
67
67
  "zod": "^3.23.8"
package/src/interface.ts CHANGED
@@ -1,15 +1,23 @@
1
+ import { AztecAddress } from '@aztec/aztec.js';
1
2
  import type { ApiSchemaFor } from '@aztec/stdlib/schemas';
2
3
 
3
4
  import { z } from 'zod';
4
5
 
5
6
  import { type BotConfig, BotConfigSchema } from './config.js';
6
7
 
8
+ export const BotInfoSchema = z.object({
9
+ botAddress: AztecAddress.schema,
10
+ });
11
+
12
+ export type BotInfo = z.infer<typeof BotInfoSchema>;
13
+
7
14
  export interface BotRunnerApi {
8
15
  start(): Promise<void>;
9
16
  stop(): Promise<void>;
10
17
  run(): Promise<void>;
11
18
  setup(): Promise<void>;
12
19
  getConfig(): Promise<BotConfig>;
20
+ getInfo(): Promise<BotInfo>;
13
21
  update(config: BotConfig): Promise<void>;
14
22
  }
15
23
 
@@ -18,6 +26,7 @@ export const BotRunnerApiSchema: ApiSchemaFor<BotRunnerApi> = {
18
26
  stop: z.function().args().returns(z.void()),
19
27
  run: z.function().args().returns(z.void()),
20
28
  setup: z.function().args().returns(z.void()),
29
+ getInfo: z.function().args().returns(BotInfoSchema),
21
30
  getConfig: z.function().args().returns(BotConfigSchema),
22
31
  update: z.function().args(BotConfigSchema).returns(z.void()),
23
32
  };
package/src/runner.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type AztecNode, type PXE, createAztecNodeClient, createLogger } from '@aztec/aztec.js';
2
+ import { omit } from '@aztec/foundation/collection';
2
3
  import { RunningPromise } from '@aztec/foundation/running-promise';
3
4
  import { type AztecNodeAdmin, createAztecNodeAdminClient } from '@aztec/stdlib/interfaces/client';
4
5
  import { type TelemetryClient, type Traceable, type Tracer, makeTracedFetch, trackSpan } from '@aztec/telemetry-client';
@@ -7,7 +8,7 @@ import { AmmBot } from './amm_bot.js';
7
8
  import type { BaseBot } from './base_bot.js';
8
9
  import { Bot } from './bot.js';
9
10
  import { type BotConfig, getVersions } from './config.js';
10
- import type { BotRunnerApi } from './interface.js';
11
+ import type { BotInfo, BotRunnerApi } from './interface.js';
11
12
 
12
13
  export class BotRunner implements BotRunnerApi, Traceable {
13
14
  private log = createLogger('bot');
@@ -134,7 +135,17 @@ export class BotRunner implements BotRunnerApi, Traceable {
134
135
 
135
136
  /** Returns the current configuration for the bot. */
136
137
  public getConfig() {
137
- return Promise.resolve(this.config);
138
+ const redacted = omit(this.config, 'l1Mnemonic', 'l1PrivateKey', 'senderPrivateKey');
139
+ return Promise.resolve(redacted as BotConfig);
140
+ }
141
+
142
+ /** Returns the bot sender address. */
143
+ public async getInfo(): Promise<BotInfo> {
144
+ if (!this.bot) {
145
+ throw new Error(`Bot is not initialized`);
146
+ }
147
+ const botAddress = await this.bot.then(b => b.wallet.getAddress());
148
+ return { botAddress };
138
149
  }
139
150
 
140
151
  async #createBot() {