Socket
Socket
Sign inDemoInstall

@chainsafe/lodestar-api

Package Overview
Dependencies
128
Maintainers
3
Versions
819
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.39.0 to 0.40.0-dev.138225fed4

10

lib/beacon/routes/beacon/block.d.ts
import { ForkName } from "@chainsafe/lodestar-params";
import { IChainForkConfig } from "@chainsafe/lodestar-config";
import { phase0, allForks, Slot, Root } from "@chainsafe/lodestar-types";
import { phase0, allForks, Slot, Root, bellatrix } from "@chainsafe/lodestar-types";
import { RoutesData, ReturnTypes, ReqSerializers } from "../../../utils/index.js";

@@ -85,2 +85,7 @@ export declare type BlockId = "head" | "genesis" | "finalized" | string | number;

publishBlock(block: allForks.SignedBeaconBlock): Promise<void>;
/**
* Publish a signed blinded block by submitting it to the mev relay and patching in the block
* transactions beacon node gets in response.
*/
publishBlindedBlock(block: bellatrix.SignedBlindedBeaconBlock): Promise<void>;
};

@@ -111,2 +116,5 @@ /**

};
publishBlindedBlock: {
body: unknown;
};
};

@@ -113,0 +121,0 @@ export declare function getReqSerializers(config: IChainForkConfig): ReqSerializers<Api, ReqTypes>;

@@ -15,2 +15,3 @@ import { ContainerType } from "@chainsafe/ssz";

publishBlock: { url: "/eth/v1/beacon/blocks", method: "POST" },
publishBlindedBlock: { url: "/eth/v1/beacon/blinded_blocks", method: "POST" },
};

@@ -41,2 +42,3 @@ export function getReqSerializers(config) {

publishBlock: reqOnlyBody(AllForksSignedBeaconBlock, Schema.Object),
publishBlindedBlock: reqOnlyBody(ssz.bellatrix.SignedBlindedBeaconBlock, Schema.Object),
};

@@ -43,0 +45,0 @@ }

@@ -358,2 +358,133 @@ import { IChainForkConfig } from "@chainsafe/lodestar-config";

}>;
publishBlindedBlock: import("../../../utils/types.js").ReqSerializer<(block: import("@chainsafe/ssz/lib/view/container").ValueOfFields<{
message: import("@chainsafe/ssz").ContainerType<{
slot: import("@chainsafe/ssz").UintNumberType;
proposerIndex: import("@chainsafe/ssz").UintNumberType;
parentRoot: import("@chainsafe/ssz").ByteVectorType;
stateRoot: import("@chainsafe/ssz").ByteVectorType;
body: import("@chainsafe/ssz").ContainerType<{
executionPayloadHeader: import("@chainsafe/ssz").ContainerType<{
transactionsRoot: import("@chainsafe/ssz").ByteVectorType;
parentHash: import("@chainsafe/ssz").ByteVectorType;
feeRecipient: import("@chainsafe/ssz").ByteVectorType;
stateRoot: import("@chainsafe/ssz").ByteVectorType;
receiptsRoot: import("@chainsafe/ssz").ByteVectorType;
logsBloom: import("@chainsafe/ssz").ByteVectorType;
prevRandao: import("@chainsafe/ssz").ByteVectorType;
blockNumber: import("@chainsafe/ssz").UintNumberType;
gasLimit: import("@chainsafe/ssz").UintNumberType;
gasUsed: import("@chainsafe/ssz").UintNumberType;
timestamp: import("@chainsafe/ssz").UintNumberType;
extraData: import("@chainsafe/ssz").ByteListType;
baseFeePerGas: import("@chainsafe/ssz").UintBigintType;
blockHash: import("@chainsafe/ssz").ByteVectorType;
}>;
syncAggregate: import("@chainsafe/ssz").ContainerType<{
syncCommitteeBits: import("@chainsafe/ssz").BitVectorType;
syncCommitteeSignature: import("@chainsafe/ssz").ByteVectorType;
}>;
randaoReveal: import("@chainsafe/ssz").ByteVectorType;
eth1Data: import("@chainsafe/ssz").ContainerType<{
depositRoot: import("@chainsafe/ssz").ByteVectorType;
depositCount: import("@chainsafe/ssz").UintNumberType;
blockHash: import("@chainsafe/ssz").ByteVectorType;
}>;
graffiti: import("@chainsafe/ssz").ByteVectorType;
proposerSlashings: import("@chainsafe/ssz").ListCompositeType<import("@chainsafe/ssz").ContainerType<{
signedHeader1: import("@chainsafe/ssz").ContainerType<{
message: import("@chainsafe/ssz").ContainerType<{
slot: import("@chainsafe/ssz").UintBigintType;
proposerIndex: import("@chainsafe/ssz").UintNumberType;
parentRoot: import("@chainsafe/ssz").ByteVectorType;
stateRoot: import("@chainsafe/ssz").ByteVectorType;
bodyRoot: import("@chainsafe/ssz").ByteVectorType;
}>;
signature: import("@chainsafe/ssz").ByteVectorType;
}>;
signedHeader2: import("@chainsafe/ssz").ContainerType<{
message: import("@chainsafe/ssz").ContainerType<{
slot: import("@chainsafe/ssz").UintBigintType;
proposerIndex: import("@chainsafe/ssz").UintNumberType;
parentRoot: import("@chainsafe/ssz").ByteVectorType;
stateRoot: import("@chainsafe/ssz").ByteVectorType;
bodyRoot: import("@chainsafe/ssz").ByteVectorType;
}>;
signature: import("@chainsafe/ssz").ByteVectorType;
}>;
}>>;
attesterSlashings: import("@chainsafe/ssz").ListCompositeType<import("@chainsafe/ssz").ContainerType<{
attestation1: import("@chainsafe/ssz").ContainerType<{
attestingIndices: import("@chainsafe/ssz").ListBasicType<import("@chainsafe/ssz").UintNumberType>;
data: import("@chainsafe/ssz").ContainerType<{
slot: import("@chainsafe/ssz").UintBigintType;
index: import("@chainsafe/ssz").UintBigintType;
beaconBlockRoot: import("@chainsafe/ssz").ByteVectorType;
source: import("@chainsafe/ssz").ContainerType<{
epoch: import("@chainsafe/ssz").UintBigintType;
root: import("@chainsafe/ssz").ByteVectorType;
}>;
target: import("@chainsafe/ssz").ContainerType<{
epoch: import("@chainsafe/ssz").UintBigintType;
root: import("@chainsafe/ssz").ByteVectorType;
}>;
}>;
signature: import("@chainsafe/ssz").ByteVectorType;
}>;
attestation2: import("@chainsafe/ssz").ContainerType<{
attestingIndices: import("@chainsafe/ssz").ListBasicType<import("@chainsafe/ssz").UintNumberType>;
data: import("@chainsafe/ssz").ContainerType<{
slot: import("@chainsafe/ssz").UintBigintType;
index: import("@chainsafe/ssz").UintBigintType;
beaconBlockRoot: import("@chainsafe/ssz").ByteVectorType;
source: import("@chainsafe/ssz").ContainerType<{
epoch: import("@chainsafe/ssz").UintBigintType;
root: import("@chainsafe/ssz").ByteVectorType;
}>;
target: import("@chainsafe/ssz").ContainerType<{
epoch: import("@chainsafe/ssz").UintBigintType;
root: import("@chainsafe/ssz").ByteVectorType;
}>;
}>;
signature: import("@chainsafe/ssz").ByteVectorType;
}>;
}>>;
attestations: import("@chainsafe/ssz").ListCompositeType<import("@chainsafe/ssz").ContainerType<{
aggregationBits: import("@chainsafe/ssz").BitListType;
data: import("@chainsafe/ssz").ContainerType<{
slot: import("@chainsafe/ssz").UintNumberType;
index: import("@chainsafe/ssz").UintNumberType;
beaconBlockRoot: import("@chainsafe/ssz").ByteVectorType;
source: import("@chainsafe/ssz").ContainerType<{
epoch: import("@chainsafe/ssz").UintNumberType;
root: import("@chainsafe/ssz").ByteVectorType;
}>;
target: import("@chainsafe/ssz").ContainerType<{
epoch: import("@chainsafe/ssz").UintNumberType;
root: import("@chainsafe/ssz").ByteVectorType;
}>;
}>;
signature: import("@chainsafe/ssz").ByteVectorType;
}>>;
deposits: import("@chainsafe/ssz").ListCompositeType<import("@chainsafe/ssz").ContainerType<{
proof: import("@chainsafe/ssz").VectorCompositeType<import("@chainsafe/ssz").ByteVectorType>;
data: import("@chainsafe/ssz").ContainerType<{
pubkey: import("@chainsafe/ssz").ByteVectorType;
withdrawalCredentials: import("@chainsafe/ssz").ByteVectorType;
amount: import("@chainsafe/ssz").UintNumberType;
signature: import("@chainsafe/ssz").ByteVectorType;
}>;
}>>;
voluntaryExits: import("@chainsafe/ssz").ListCompositeType<import("@chainsafe/ssz").ContainerType<{
message: import("@chainsafe/ssz").ContainerType<{
epoch: import("@chainsafe/ssz").UintNumberType;
validatorIndex: import("@chainsafe/ssz").UintNumberType;
}>;
signature: import("@chainsafe/ssz").ByteVectorType;
}>>;
}>;
}>;
signature: import("@chainsafe/ssz").ByteVectorType;
}>) => Promise<void>, {
body: unknown;
}>;
getGenesis: import("../../../utils/types.js").ReqSerializer<() => void, import("../../../utils/types.js").ReqGeneric>;

@@ -360,0 +491,0 @@ };

10

lib/beacon/routes/events.d.ts
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
import { ForkName } from "@chainsafe/lodestar-params";
import { allForks, altair, BLSPubkey, BLSSignature, CommitteeIndex, Epoch, phase0, Root, Slot, UintNum64, ValidatorIndex } from "@chainsafe/lodestar-types";
import { allForks, altair, BLSPubkey, BLSSignature, CommitteeIndex, Epoch, phase0, bellatrix, Root, Slot, UintNum64, ValidatorIndex } from "@chainsafe/lodestar-types";
import { RoutesData, ReturnTypes, ReqSerializers } from "../../utils/index.js";

@@ -51,2 +51,7 @@ export declare type BeaconCommitteeSubscription = {

};
export declare type LivenessResponseData = {
index: ValidatorIndex;
epoch: Epoch;
isLive: boolean;
};
export declare type Api = {

@@ -115,2 +120,6 @@ /**

}>;
produceBlindedBlock(slot: Slot, randaoReveal: BLSSignature, graffiti: string): Promise<{
data: bellatrix.BlindedBeaconBlock;
version: ForkName;
}>;
/**

@@ -169,2 +178,7 @@ * Produce an attestation data

prepareBeaconProposer(proposers: ProposerPreparationData[]): Promise<void>;
/** Returns validator indices that have been observed to be active on the network */
getLiveness(indices: ValidatorIndex[], epoch: Epoch): Promise<{
data: LivenessResponseData[];
}>;
registerValidator(registrations: bellatrix.SignedValidatorRegistrationV1[]): Promise<void>;
};

@@ -211,2 +225,11 @@ /**

};
produceBlindedBlock: {
params: {
slot: number;
};
query: {
randao_reveal: string;
grafitti: string;
};
};
produceAttestationData: {

@@ -246,2 +269,11 @@ query: {

};
getLiveness: {
query: {
indices: ValidatorIndex[];
epoch: Epoch;
};
};
registerValidator: {
body: unknown;
};
};

@@ -248,0 +280,0 @@ export declare function getReqSerializers(): ReqSerializers<Api, ReqTypes>;

@@ -13,2 +13,3 @@ import { ContainerType, fromHexString, toHexString } from "@chainsafe/ssz";

produceBlockV2: { url: "/eth/v2/validator/blocks/:slot", method: "GET" },
produceBlindedBlock: { url: "/eth/v2/validator/blinded_blocks/:slot", method: "GET" },
produceAttestationData: { url: "/eth/v1/validator/attestation_data", method: "GET" },

@@ -22,2 +23,4 @@ produceSyncCommitteeContribution: { url: "/eth/v1/validator/sync_committee_contribution", method: "GET" },

prepareBeaconProposer: { url: "/eth/v1/validator/prepare_beacon_proposer", method: "POST" },
getLiveness: { url: "/eth/v1/validator/liveness", method: "GET" },
registerValidator: { url: "/eth/v1/validator/register_validator", method: "POST" },
};

@@ -74,2 +77,3 @@ export function getReqSerializers() {

produceBlockV2: produceBlock,
produceBlindedBlock: produceBlock,
produceAttestationData: {

@@ -113,2 +117,8 @@ writeReq: (index, slot) => ({ query: { slot, committee_index: index } }),

},
getLiveness: {
writeReq: (indices, epoch) => ({ query: { indices, epoch } }),
parseReq: ({ query }) => [query.indices, query.epoch],
schema: { query: { indices: Schema.UintArray, epoch: Schema.Uint } },
},
registerValidator: reqOnlyBody(ArrayOf(ssz.bellatrix.SignedValidatorRegistrationV1), Schema.ObjectArray),
};

@@ -144,7 +154,9 @@ }

produceBlockV2: WithVersion((fork) => ssz[fork].BeaconBlock),
produceBlindedBlock: WithVersion((_fork) => ssz.bellatrix.BlindedBeaconBlock),
produceAttestationData: ContainerData(ssz.phase0.AttestationData),
produceSyncCommitteeContribution: ContainerData(ssz.altair.SyncCommitteeContribution),
getAggregatedAttestation: ContainerData(ssz.phase0.Attestation),
getLiveness: jsonType("camel"),
};
}
//# sourceMappingURL=validator.js.map

@@ -0,4 +1,12 @@

import { bellatrix, Slot, Root, BLSPubkey } from "@chainsafe/lodestar-types";
import { ReturnTypes, RoutesData, ReqSerializers, ReqEmpty } from "../utils/index.js";
export declare type Api = {
checkStatus(): Promise<void>;
registerValidator(registrations: bellatrix.SignedValidatorRegistrationV1[]): Promise<void>;
getPayloadHeader(slot: Slot, parentHash: Root, proposerPubKey: BLSPubkey): Promise<{
data: bellatrix.SignedBuilderBid;
}>;
submitSignedBlindedBlock(signedBlock: bellatrix.SignedBlindedBeaconBlock): Promise<{
data: bellatrix.ExecutionPayload;
}>;
};

@@ -11,2 +19,15 @@ /**

checkStatus: ReqEmpty;
registerValidator: {
body: unknown;
};
getPayloadHeader: {
params: {
slot: Slot;
parent_hash: string;
pubkey: string;
};
};
submitSignedBlindedBlock: {
body: unknown;
};
};

@@ -13,0 +34,0 @@ export declare function getReqSerializers(): ReqSerializers<Api, ReqTypes>;

@@ -1,2 +0,4 @@

import { reqEmpty } from "../utils/index.js";
import { ssz } from "@chainsafe/lodestar-types";
import { fromHexString, toHexString } from "@chainsafe/ssz";
import { Schema, reqOnlyBody, ContainerData, reqEmpty, ArrayOf, } from "../utils/index.js";
/**

@@ -7,2 +9,5 @@ * Define javascript values for each route

checkStatus: { url: "/eth/v1/builder/status", method: "GET" },
registerValidator: { url: "/eth/v1/builder/validators", method: "POST" },
getPayloadHeader: { url: "/eth/v1/builder/header/:slot/:parent_hash/:pubkey", method: "GET" },
submitSignedBlindedBlock: { url: "/eth/v1/builder/blinded_blocks", method: "POST" },
};

@@ -12,7 +17,21 @@ export function getReqSerializers() {

checkStatus: reqEmpty,
registerValidator: reqOnlyBody(ArrayOf(ssz.bellatrix.SignedValidatorRegistrationV1), Schema.ObjectArray),
getPayloadHeader: {
writeReq: (slot, parentHash, proposerPubKey) => ({
params: { slot, parent_hash: toHexString(parentHash), pubkey: toHexString(proposerPubKey) },
}),
parseReq: ({ params }) => [params.slot, fromHexString(params.parent_hash), fromHexString(params.pubkey)],
schema: {
params: { slot: Schema.UintRequired, parent_hash: Schema.StringRequired, pubkey: Schema.StringRequired },
},
},
submitSignedBlindedBlock: reqOnlyBody(ssz.bellatrix.SignedBlindedBeaconBlock, Schema.Object),
};
}
export function getReturnTypes() {
return {};
return {
getPayloadHeader: ContainerData(ssz.bellatrix.SignedBuilderBid),
submitSignedBlindedBlock: ContainerData(ssz.bellatrix.ExecutionPayload),
};
}
//# sourceMappingURL=routes.js.map
import { IChainForkConfig } from "@chainsafe/lodestar-config";
import { IHttpClient, HttpClientModules, HttpClientOptions } from "../utils/client/index.js";
import { Api } from "./routes.js";
export { ImportStatus, DeletionStatus, KeystoreStr, SlashingProtectionData, PubkeyHex, Api } from "./routes.js";
export { ImportStatus, DeletionStatus, ImportRemoteKeyStatus, DeleteRemoteKeyStatus, ResponseStatus, SignerDefinition, KeystoreStr, SlashingProtectionData, PubkeyHex, Api, } from "./routes.js";
declare type ClientModules = HttpClientModules & {

@@ -6,0 +6,0 @@ config: IChainForkConfig;

import { HttpClient } from "../utils/client/index.js";
import * as keymanager from "./client.js";
// NOTE: Don't export server here so it's not bundled to all consumers
export { ImportStatus, DeletionStatus } from "./routes.js";
export { ImportStatus, DeletionStatus, ImportRemoteKeyStatus, DeleteRemoteKeyStatus, } from "./routes.js";
/**

@@ -6,0 +6,0 @@ * REST HTTP client for all keymanager routes

@@ -20,2 +20,36 @@ import { ReturnTypes, RoutesData, ReqSerializers, ReqEmpty } from "../utils/index.js";

}
export declare enum ImportRemoteKeyStatus {
/** Remote key successfully imported to validator client permanent storage */
imported = "imported",
/** Remote key's pubkey is already known to the validator client */
duplicate = "duplicate",
/** Any other status different to the above: I/O errors, etc. */
error = "error"
}
export declare enum DeleteRemoteKeyStatus {
/** key was active and removed */
deleted = "deleted",
/** key was not found to be removed */
not_found = "not_found",
/**
* unexpected condition meant the key could not be removed (the key was actually found,
* but we couldn't stop using it) - this would be a sign that making it active elsewhere would
* almost certainly cause you headaches / slashing conditions etc.
*/
error = "error"
}
export declare type ResponseStatus<Status> = {
status: Status;
message?: string;
};
export declare type SignerDefinition = {
pubkey: PubkeyHex;
/**
* URL to API implementing EIP-3030: BLS Remote Signer HTTP API
* `"https://remote.signer"`
*/
url: string;
/** The signer associated with this pubkey cannot be deleted from the API */
readonly: boolean;
};
/**

@@ -42,18 +76,2 @@ * JSON serialized representation of a single keystore in EIP-2335: BLS12-381 Keystore format.

export declare type PubkeyHex = string;
declare type Statuses<Status> = {
status: Status;
message?: string;
}[];
declare type ImportKeystoresReq = {
keystores: KeystoreStr[];
passwords: string[];
slashingProtection: SlashingProtectionData;
};
declare type ListKeysResponse = {
validatingPubkey: PubkeyHex;
/** The derivation path (if present in the imported keystore) */
derivationPath?: string;
/** The key associated with this pubkey cannot be deleted from the API */
readonly?: boolean;
};
export declare type Api = {

@@ -66,3 +84,9 @@ /**

listKeys(): Promise<{
data: ListKeysResponse[];
data: {
validatingPubkey: PubkeyHex;
/** The derivation path (if present in the imported keystore) */
derivationPath?: string;
/** The key associated with this pubkey cannot be deleted from the API */
readonly?: boolean;
}[];
}>;

@@ -83,3 +107,3 @@ /**

importKeystores(keystoresStr: KeystoreStr[], passwords: string[], slashingProtectionStr: SlashingProtectionData): Promise<{
data: Statuses<ImportStatus>;
data: ResponseStatus<ImportStatus>[];
}>;

@@ -108,5 +132,20 @@ /**

deleteKeystores(pubkeysHex: string[]): Promise<{
data: Statuses<DeletionStatus>;
data: ResponseStatus<DeletionStatus>[];
slashingProtection: SlashingProtectionData;
}>;
/**
* List all remote validating pubkeys known to this validator client binary
*/
listRemoteKeys(): Promise<{
data: SignerDefinition[];
}>;
/**
* Import remote keys for the validator client to request duties for
*/
importRemoteKeys(remoteSigners: Pick<SignerDefinition, "pubkey" | "url">[]): Promise<{
data: ResponseStatus<ImportRemoteKeyStatus>[];
}>;
deleteRemoteKeys(pubkeys: PubkeyHex[]): Promise<{
data: ResponseStatus<DeleteRemoteKeyStatus>[];
}>;
};

@@ -117,3 +156,7 @@ export declare const routesData: RoutesData<Api>;

importKeystores: {
body: ImportKeystoresReq;
body: {
keystores: KeystoreStr[];
passwords: string[];
slashingProtection: SlashingProtectionData;
};
};

@@ -125,6 +168,16 @@ deleteKeystores: {

};
listRemoteKeys: ReqEmpty;
importRemoteKeys: {
body: {
remoteKeys: Pick<SignerDefinition, "pubkey" | "url">[];
};
};
deleteRemoteKeys: {
body: {
pubkeys: string[];
};
};
};
export declare function getReqSerializers(): ReqSerializers<Api, ReqTypes>;
export declare function getReturnTypes(): ReturnTypes<Api>;
export {};
//# sourceMappingURL=routes.d.ts.map

@@ -22,2 +22,24 @@ import { Schema, reqEmpty, jsonType } from "../utils/index.js";

})(DeletionStatus || (DeletionStatus = {}));
export var ImportRemoteKeyStatus;
(function (ImportRemoteKeyStatus) {
/** Remote key successfully imported to validator client permanent storage */
ImportRemoteKeyStatus["imported"] = "imported";
/** Remote key's pubkey is already known to the validator client */
ImportRemoteKeyStatus["duplicate"] = "duplicate";
/** Any other status different to the above: I/O errors, etc. */
ImportRemoteKeyStatus["error"] = "error";
})(ImportRemoteKeyStatus || (ImportRemoteKeyStatus = {}));
export var DeleteRemoteKeyStatus;
(function (DeleteRemoteKeyStatus) {
/** key was active and removed */
DeleteRemoteKeyStatus["deleted"] = "deleted";
/** key was not found to be removed */
DeleteRemoteKeyStatus["not_found"] = "not_found";
/**
* unexpected condition meant the key could not be removed (the key was actually found,
* but we couldn't stop using it) - this would be a sign that making it active elsewhere would
* almost certainly cause you headaches / slashing conditions etc.
*/
DeleteRemoteKeyStatus["error"] = "error";
})(DeleteRemoteKeyStatus || (DeleteRemoteKeyStatus = {}));
export const routesData = {

@@ -27,2 +49,5 @@ listKeys: { url: "/eth/v1/keystores", method: "GET" },

deleteKeystores: { url: "/eth/v1/keystores", method: "DELETE" },
listRemoteKeys: { url: "/eth/v1/remotekeys", method: "GET" },
importRemoteKeys: { url: "/eth/v1/remotekeys", method: "POST" },
deleteRemoteKeys: { url: "/eth/v1/remotekeys", method: "DELETE" },
};

@@ -42,2 +67,13 @@ export function getReqSerializers() {

},
listRemoteKeys: reqEmpty,
importRemoteKeys: {
writeReq: (remoteKeys) => ({ body: { remoteKeys } }),
parseReq: ({ body: { remoteKeys } }) => [remoteKeys],
schema: { body: Schema.Object },
},
deleteRemoteKeys: {
writeReq: (pubkeys) => ({ body: { pubkeys } }),
parseReq: ({ body: { pubkeys } }) => [pubkeys],
schema: { body: Schema.Object },
},
};

@@ -51,4 +87,7 @@ }

deleteKeystores: jsonType("camel"),
listRemoteKeys: jsonType("camel"),
importRemoteKeys: jsonType("camel"),
deleteRemoteKeys: jsonType("camel"),
};
}
//# sourceMappingURL=routes.js.map

@@ -28,2 +28,3 @@ import { fetch } from "cross-fetch";

timeoutMs?: number;
bearerToken?: string;
/** Return an AbortSignal to be attached to all requests */

@@ -41,2 +42,3 @@ getAbortSignal?: () => AbortSignal | undefined;

private readonly timeoutMs;
private readonly bearerToken?;
private readonly getAbortSignal?;

@@ -43,0 +45,0 @@ private readonly fetch;

@@ -20,2 +20,3 @@ import { fetch } from "cross-fetch";

this.timeoutMs = (_a = opts.timeoutMs) !== null && _a !== void 0 ? _a : 60000;
this.bearerToken = opts.bearerToken;
this.getAbortSignal = opts.getAbortSignal;

@@ -49,4 +50,8 @@ this.fetch = (_b = opts.fetch) !== null && _b !== void 0 ? _b : fetch;

const headers = opts.headers || {};
if (opts.body)
if (opts.body && headers["Content-Type"] === undefined) {
headers["Content-Type"] = "application/json";
}
if (this.bearerToken && headers["Authorization"] === undefined) {
headers["Authorization"] = `Bearer ${this.bearerToken}`;
}
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.debug("HttpClient request", { routeId });

@@ -53,0 +58,0 @@ const res = await this.fetch(url, {

@@ -14,3 +14,3 @@ {

},
"version": "0.39.0",
"version": "0.40.0-dev.138225fed4",
"type": "module",

@@ -73,6 +73,6 @@ "exports": {

"dependencies": {
"@chainsafe/lodestar-config": "^0.39.0",
"@chainsafe/lodestar-params": "^0.39.0",
"@chainsafe/lodestar-types": "^0.39.0",
"@chainsafe/lodestar-utils": "^0.39.0",
"@chainsafe/lodestar-config": "0.40.0-dev.138225fed4",
"@chainsafe/lodestar-params": "0.40.0-dev.138225fed4",
"@chainsafe/lodestar-types": "0.40.0-dev.138225fed4",
"@chainsafe/lodestar-utils": "0.40.0-dev.138225fed4",
"@chainsafe/persistent-merkle-tree": "^0.4.2",

@@ -99,3 +99,3 @@ "@chainsafe/ssz": "^0.9.2",

],
"gitHead": "55e7ca2d544bd786fe287a1254b95a0d784d553e"
"gitHead": "635b0e025be917bbd0595ef8b336018b6cb15179"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc