fix: pass client to prover after creating client in factory. don't try to parse thr messages

This commit is contained in:
Derrick Hammer 2023-07-13 01:42:54 -04:00
parent 816bd93e80
commit 481757e019
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 12 additions and 8 deletions

View File

@ -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(
return (
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),
);
)
).data;
}),
beaconUrl,
});
};
const client = new Client(options);
options.prover.client = client;
return client;
}
export { Client, Prover, Store, createDefaultClient };