11import { type BotConfig , BotRunner , botConfigMappings , getBotRunnerApiHandler } from '@aztec/bot' ;
22import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server' ;
33import type { LogFn } from '@aztec/foundation/log' ;
4- import type { AztecNode , PXE } from '@aztec/stdlib/interfaces/client' ;
4+ import { type AztecNode , type PXE , createAztecNodeClient } from '@aztec/stdlib/interfaces/client' ;
55import type { TelemetryClient } from '@aztec/telemetry-client' ;
6- import { getConfigEnvVars as getTelemetryClientConfig , initTelemetryClient } from '@aztec/telemetry-client' ;
6+ import {
7+ getConfigEnvVars as getTelemetryClientConfig ,
8+ initTelemetryClient ,
9+ makeTracedFetch ,
10+ } from '@aztec/telemetry-client' ;
711
812import { extractRelevantOptions } from '../util.js' ;
13+ import { getVersions } from '../versioning.js' ;
914
1015export async function startBot (
1116 options : any ,
@@ -20,15 +25,19 @@ export async function startBot(
2025 ) ;
2126 process . exit ( 1 ) ;
2227 }
28+
29+ const fetch = makeTracedFetch ( [ 1 , 2 , 3 ] , true ) ;
30+ const node = createAztecNodeClient ( options . nodeUrl , getVersions ( ) , fetch ) ;
31+
2332 // Start a PXE client that is used by the bot if required
2433 let pxe : PXE | undefined ;
2534 if ( options . pxe ) {
2635 const { addPXE } = await import ( './start_pxe.js' ) ;
27- ( { pxe } = await addPXE ( options , signalHandlers , services , userLog ) ) ;
36+ ( { pxe } = await addPXE ( options , signalHandlers , services , userLog , { node } ) ) ;
2837 }
2938
3039 const telemetry = initTelemetryClient ( getTelemetryClientConfig ( ) ) ;
31- await addBot ( options , signalHandlers , services , { pxe, telemetry } ) ;
40+ await addBot ( options , signalHandlers , services , { pxe, telemetry, node } ) ;
3241}
3342
3443export function addBot (
0 commit comments