From 481757e019729ce3790c5cd07cb89c5d7ded7cf4 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 13 Jul 2023 01:42:54 -0400 Subject: [PATCH] fix: pass client to prover after creating client in factory. don't try to parse thr messages --- src/node/index.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/node/index.ts b/src/node/index.ts index a82ca35..0bd14e7 100644 --- a/src/node/index.ts +++ b/src/node/index.ts @@ -5,18 +5,22 @@ import * as capella from "@lodestar/types/capella"; import { consensusClient } from "#util.js"; function createDefaultClient(beaconUrl: string): Client { - return new Client({ + const options = { store: new Store(), prover: new Prover(async (args) => { - const res = await consensusClient.get( - `/eth/v1/beacon/light_client/updates?start_period=${args.start}&count=${args.count}`, - ); - return res.data.map((u: any) => - capella.ssz.LightClientUpdate.fromJson(u.data), - ); + return ( + await consensusClient.get( + `/eth/v1/beacon/light_client/updates?start_period=${args.start}&count=${args.count}`, + ) + ).data; }), beaconUrl, - }); + }; + + const client = new Client(options); + options.prover.client = client; + + return client; } export { Client, Prover, Store, createDefaultClient };