mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-10 08:08:16 -05:00
* Refactor REST API definitions
* Simplify REST testing
* Bump to fastify 3.x.x
* Return {} in fastify handler to trigger send
* Move REST server to lodestar-api
* Improve REST tests
* Add eventstream test
* Clean up
* Bump versions
* Fix query string format
* Add extra debug routes
* Consume lodestar-api package
* Fix tests
* Revert package.json change
* Add HttpClient test
* Destroy all active requests immediately on close
* Fastify hook handlers must resolve
* Fix fastify hook config args
* Fix parsing of ValidatorId
* Remove e2e script test
* Add docs
* Simplify req declarations
* Review PR
* Update license
14 lines
598 B
TypeScript
14 lines
598 B
TypeScript
import {IBeaconConfig} from "@chainsafe/lodestar-config";
|
|
import {IHttpClient, generateGenericJsonClient} from "./utils";
|
|
import {Api, ReqTypes, routesData, getReqSerializers, getReturnTypes} from "../routes/node";
|
|
|
|
/**
|
|
* REST HTTP client for beacon routes
|
|
*/
|
|
export function getClient(config: IBeaconConfig, httpClient: IHttpClient): Api {
|
|
const reqSerializers = getReqSerializers();
|
|
const returnTypes = getReturnTypes(config);
|
|
// All routes return JSON, use a client auto-generator
|
|
return generateGenericJsonClient<Api, ReqTypes>(routesData, reqSerializers, returnTypes, httpClient);
|
|
}
|