@lodestar/api
Version:
A Typescript REST client for the Ethereum Consensus API
48 lines • 1.59 kB
JavaScript
import { ContainerType } from "@chainsafe/ssz";
import { ssz } from "@lodestar/types";
import { ArrayOf, EmptyMetaCodec, EmptyRequestCodec, JsonOnlyResp, } from "../../utils/codecs.js";
export const DepositContractType = new ContainerType({
chainId: ssz.UintNum64,
address: ssz.ExecutionAddress,
}, { jsonCase: "eth2" });
export const ForkListType = ArrayOf(ssz.phase0.Fork);
export function getDefinitions(_config) {
return {
getDepositContract: {
url: "/eth/v1/config/deposit_contract",
method: "GET",
req: EmptyRequestCodec,
resp: {
data: DepositContractType,
meta: EmptyMetaCodec,
},
},
getForkSchedule: {
url: "/eth/v1/config/fork_schedule",
method: "GET",
req: EmptyRequestCodec,
resp: {
data: ForkListType,
meta: EmptyMetaCodec,
},
},
getSpec: {
url: "/eth/v1/config/spec",
method: "GET",
req: EmptyRequestCodec,
resp: JsonOnlyResp({
data: {
toJson: (data) => data,
fromJson: (data) => {
if (typeof data !== "object" || data === null) {
throw Error("JSON must be of type object");
}
return data;
},
},
meta: EmptyMetaCodec,
}),
},
};
}
//# sourceMappingURL=config.js.map