@chainsafe/lodestar-api
Advanced tools
Comparing version 0.39.0-dev.f8f74664e5 to 0.39.0-dev.fda5613cd2
import { Epoch, phase0, Slot, RootHex, altair, UintNum64 } from "@chainsafe/lodestar-types"; | ||
import { Type } from "@chainsafe/ssz"; | ||
import { RouteDef } from "../../utils/index.js"; | ||
export declare type LightclientHeaderUpdate = { | ||
export declare type LightclientOptimisticHeaderUpdate = { | ||
syncAggregate: altair.SyncAggregate; | ||
@@ -32,6 +32,6 @@ attestedHeader: phase0.BeaconBlockHeader; | ||
chainReorg = "chain_reorg", | ||
/** New or better header update available */ | ||
lightclientHeaderUpdate = "lightclient_header_update", | ||
/** New or better optimistic header update available */ | ||
lightclientOptimisticUpdate = "light_client_optimistic_update", | ||
/** New or better finalized update available */ | ||
lightclientFinalizedUpdate = "lightclient_finalized_update" | ||
lightclientFinalizedUpdate = "light_client_finalized_update" | ||
} | ||
@@ -67,3 +67,3 @@ export declare type EventData = { | ||
}; | ||
[EventType.lightclientHeaderUpdate]: LightclientHeaderUpdate; | ||
[EventType.lightclientOptimisticUpdate]: LightclientOptimisticHeaderUpdate; | ||
[EventType.lightclientFinalizedUpdate]: LightclientFinalizedUpdate; | ||
@@ -70,0 +70,0 @@ }; |
@@ -23,6 +23,6 @@ import { ssz, StringType } from "@chainsafe/lodestar-types"; | ||
EventType["chainReorg"] = "chain_reorg"; | ||
/** New or better header update available */ | ||
EventType["lightclientHeaderUpdate"] = "lightclient_header_update"; | ||
/** New or better optimistic header update available */ | ||
EventType["lightclientOptimisticUpdate"] = "light_client_optimistic_update"; | ||
/** New or better finalized update available */ | ||
EventType["lightclientFinalizedUpdate"] = "lightclient_finalized_update"; | ||
EventType["lightclientFinalizedUpdate"] = "light_client_finalized_update"; | ||
})(EventType || (EventType = {})); | ||
@@ -65,3 +65,3 @@ export const routesData = { | ||
}, { jsonCase: "eth2" }), | ||
[EventType.lightclientHeaderUpdate]: new ContainerType({ | ||
[EventType.lightclientOptimisticUpdate]: new ContainerType({ | ||
syncAggregate: ssz.altair.SyncAggregate, | ||
@@ -68,0 +68,0 @@ attestedHeader: ssz.phase0.BeaconBlockHeader, |
@@ -5,4 +5,4 @@ import { JsonPath } from "@chainsafe/ssz"; | ||
import { ReturnTypes, RoutesData, ReqSerializers, ReqEmpty } from "../../utils/index.js"; | ||
import { LightclientHeaderUpdate, LightclientFinalizedUpdate } from "./events.js"; | ||
export { LightclientHeaderUpdate, LightclientFinalizedUpdate }; | ||
import { LightclientOptimisticHeaderUpdate, LightclientFinalizedUpdate } from "./events.js"; | ||
export { LightclientOptimisticHeaderUpdate, LightclientFinalizedUpdate }; | ||
export declare type LightclientSnapshotWithProof = { | ||
@@ -23,3 +23,3 @@ header: phase0.BeaconBlockHeader; | ||
/** | ||
* Returns an array of best updates in the requested periods within the inclusive range `from` - `to`. | ||
* Returns an array of best updates given a `startPeriod` and `count` number of sync committee period to return. | ||
* Best is defined by (in order of priority): | ||
@@ -30,21 +30,21 @@ * - Is finalized update | ||
*/ | ||
getCommitteeUpdates(from: SyncPeriod, to: SyncPeriod): Promise<{ | ||
getUpdates(startPeriod: SyncPeriod, count: number): Promise<{ | ||
data: altair.LightClientUpdate[]; | ||
}>; | ||
/** | ||
* Returns the latest best head update available. Clients should use the SSE type `lightclient_header_update` | ||
* Returns the latest optimistic head update available. Clients should use the SSE type `light_client_optimistic_update` | ||
* unless to get the very first head update after syncing, or if SSE are not supported by the server. | ||
*/ | ||
getLatestHeadUpdate(): Promise<{ | ||
data: LightclientHeaderUpdate; | ||
getOptimisticUpdate(): Promise<{ | ||
data: LightclientOptimisticHeaderUpdate; | ||
}>; | ||
getLatestFinalizedHeadUpdate(): Promise<{ | ||
getFinalityUpdate(): Promise<{ | ||
data: LightclientFinalizedUpdate; | ||
}>; | ||
/** | ||
* Fetch a snapshot with a proof to a trusted block root. | ||
* Fetch a bootstrapping state with a proof to a trusted block root. | ||
* The trusted block root should be fetched with similar means to a weak subjectivity checkpoint. | ||
* Only block roots for checkpoints are guaranteed to be available. | ||
*/ | ||
getSnapshot(blockRoot: string): Promise<{ | ||
getBootstrap(blockRoot: string): Promise<{ | ||
data: LightclientSnapshotWithProof; | ||
@@ -66,11 +66,11 @@ }>; | ||
}; | ||
getCommitteeUpdates: { | ||
getUpdates: { | ||
query: { | ||
from: number; | ||
to: number; | ||
start_period: number; | ||
count: number; | ||
}; | ||
}; | ||
getLatestHeadUpdate: ReqEmpty; | ||
getLatestFinalizedHeadUpdate: ReqEmpty; | ||
getSnapshot: { | ||
getOptimisticUpdate: ReqEmpty; | ||
getFinalityUpdate: ReqEmpty; | ||
getBootstrap: { | ||
params: { | ||
@@ -77,0 +77,0 @@ blockRoot: string; |
@@ -10,7 +10,7 @@ import { ContainerType, VectorCompositeType } from "@chainsafe/ssz"; | ||
export const routesData = { | ||
getStateProof: { url: "/eth/v1/lightclient/proof/:stateId", method: "GET" }, | ||
getCommitteeUpdates: { url: "/eth/v1/lightclient/committee_updates", method: "GET" }, | ||
getLatestHeadUpdate: { url: "/eth/v1/lightclient/latest_head_update/", method: "GET" }, | ||
getLatestFinalizedHeadUpdate: { url: "/eth/v1/lightclient/latest_finalized_head_update/", method: "GET" }, | ||
getSnapshot: { url: "/eth/v1/lightclient/snapshot/:blockRoot", method: "GET" }, | ||
getStateProof: { url: "/eth/v1/light_client/proof/:stateId", method: "GET" }, | ||
getUpdates: { url: "/eth/v1/light_client/updates", method: "GET" }, | ||
getOptimisticUpdate: { url: "/eth/v1/light_client/optimistic_update/", method: "GET" }, | ||
getFinalityUpdate: { url: "/eth/v1/light_client/finality_update/", method: "GET" }, | ||
getBootstrap: { url: "/eth/v1/light_client/bootstrap/:blockRoot", method: "GET" }, | ||
}; | ||
@@ -24,10 +24,10 @@ export function getReqSerializers() { | ||
}, | ||
getCommitteeUpdates: { | ||
writeReq: (from, to) => ({ query: { from, to } }), | ||
parseReq: ({ query }) => [query.from, query.to], | ||
schema: { query: { from: Schema.UintRequired, to: Schema.UintRequired } }, | ||
getUpdates: { | ||
writeReq: (start_period, count) => ({ query: { start_period, count } }), | ||
parseReq: ({ query }) => [query.start_period, query.count], | ||
schema: { query: { start_period: Schema.UintRequired, count: Schema.UintRequired } }, | ||
}, | ||
getLatestHeadUpdate: reqEmpty, | ||
getLatestFinalizedHeadUpdate: reqEmpty, | ||
getSnapshot: { | ||
getOptimisticUpdate: reqEmpty, | ||
getFinalityUpdate: reqEmpty, | ||
getBootstrap: { | ||
writeReq: (blockRoot) => ({ params: { blockRoot } }), | ||
@@ -58,8 +58,8 @@ parseReq: ({ params }) => [params.blockRoot], | ||
getStateProof: sameType(), | ||
getCommitteeUpdates: ContainerData(ArrayOf(ssz.altair.LightClientUpdate)), | ||
getLatestHeadUpdate: ContainerData(lightclientHeaderUpdate), | ||
getLatestFinalizedHeadUpdate: ContainerData(lightclientFinalizedUpdate), | ||
getSnapshot: ContainerData(lightclientSnapshotWithProofType), | ||
getUpdates: ContainerData(ArrayOf(ssz.altair.LightClientUpdate)), | ||
getOptimisticUpdate: ContainerData(lightclientHeaderUpdate), | ||
getFinalityUpdate: ContainerData(lightclientFinalizedUpdate), | ||
getBootstrap: ContainerData(lightclientSnapshotWithProofType), | ||
}; | ||
} | ||
//# sourceMappingURL=lightclient.js.map |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "0.39.0-dev.f8f74664e5", | ||
"version": "0.39.0-dev.fda5613cd2", | ||
"type": "module", | ||
@@ -73,6 +73,6 @@ "exports": { | ||
"dependencies": { | ||
"@chainsafe/lodestar-config": "0.39.0-dev.f8f74664e5", | ||
"@chainsafe/lodestar-params": "0.39.0-dev.f8f74664e5", | ||
"@chainsafe/lodestar-types": "0.39.0-dev.f8f74664e5", | ||
"@chainsafe/lodestar-utils": "0.39.0-dev.f8f74664e5", | ||
"@chainsafe/lodestar-config": "0.39.0-dev.fda5613cd2", | ||
"@chainsafe/lodestar-params": "0.39.0-dev.fda5613cd2", | ||
"@chainsafe/lodestar-types": "0.39.0-dev.fda5613cd2", | ||
"@chainsafe/lodestar-utils": "0.39.0-dev.fda5613cd2", | ||
"@chainsafe/persistent-merkle-tree": "^0.4.2", | ||
@@ -99,3 +99,3 @@ "@chainsafe/ssz": "^0.9.2", | ||
], | ||
"gitHead": "9c8f1f427b15ac2404dc1dc0d9b9e6b8216e1a08" | ||
"gitHead": "f8698d672a18347d3e61c2f4a9d076a697c3a53e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
261776
+ Added@chainsafe/lodestar-config@0.39.0-dev.fda5613cd2(transitive)
+ Added@chainsafe/lodestar-params@0.39.0-dev.fda5613cd2(transitive)
+ Added@chainsafe/lodestar-types@0.39.0-dev.fda5613cd2(transitive)
+ Added@chainsafe/lodestar-utils@0.39.0-dev.fda5613cd2(transitive)
- Removed@chainsafe/lodestar-config@0.39.0-dev.f8f74664e5(transitive)
- Removed@chainsafe/lodestar-params@0.39.0-dev.f8f74664e5(transitive)
- Removed@chainsafe/lodestar-types@0.39.0-dev.f8f74664e5(transitive)
- Removed@chainsafe/lodestar-utils@0.39.0-dev.f8f74664e5(transitive)