Socket
Socket
Sign inDemoInstall

@chainsafe/lodestar-api

Package Overview
Dependencies
Maintainers
3
Versions
819
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chainsafe/lodestar-api - npm Package Compare versions

Comparing version 0.39.0-dev.7c5aa21877 to 0.39.0-dev.7decce4fec

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 @@ };

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

@@ -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, {

12

package.json

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

},
"version": "0.39.0-dev.7c5aa21877",
"version": "0.39.0-dev.7decce4fec",
"type": "module",

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

"dependencies": {
"@chainsafe/lodestar-config": "0.39.0-dev.7c5aa21877",
"@chainsafe/lodestar-params": "0.39.0-dev.7c5aa21877",
"@chainsafe/lodestar-types": "0.39.0-dev.7c5aa21877",
"@chainsafe/lodestar-utils": "0.39.0-dev.7c5aa21877",
"@chainsafe/lodestar-config": "0.39.0-dev.7decce4fec",
"@chainsafe/lodestar-params": "0.39.0-dev.7decce4fec",
"@chainsafe/lodestar-types": "0.39.0-dev.7decce4fec",
"@chainsafe/lodestar-utils": "0.39.0-dev.7decce4fec",
"@chainsafe/persistent-merkle-tree": "^0.4.2",

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

],
"gitHead": "f1029fbc34958b8a29d8fe3c47a4fcfe23e74d59"
"gitHead": "5cf02811e46c2faba93f775ce48bfa732ee96686"
}

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc