Socket
Socket
Sign inDemoInstall

@lodestar/api

Package Overview
Dependencies
36
Maintainers
5
Versions
1396
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @lodestar/api

A Typescript implementation of the Ethereum Consensus light client


Version published
Weekly downloads
1.3K
decreased by-31.46%
Maintainers
5
Install size
9.86 MB
Created
Weekly downloads
 

Readme

Source

Lodestar Eth Consensus API

Discord ETH Beacon APIs Spec v2.1.0 ES Version Node Version

This package is part of ChainSafe's Lodestar project

Typescript REST client for the Ethereum Consensus API spec

Usage

We use more typesafe approach for the API client, where all the errors are returned not thrown. This approach is more easy to document and better to handle all possible error cases.

import {getClient, HttpError} from "@lodestar/api";
import {config} from "@lodestar/config/default";

const api = getClient({baseUrl: "http://localhost:9596"}, {config});

api.beacon
  .getStateValidator(
    "head",
    "0x933ad9491b62059dd065b560d256d8957a8c402cc6e8d8ee7290ae11e8f7329267a8811c397529dac52ae1342ba58c95"
  )
  .then((res) => {
    if (res.ok) {
      console.log("Your balance is:", res.response.data.balance, res.ok, res.status);
    } else {
      console.error(res.status, res.error.code, res.error.message);
    }
  });

Prerequisites

  • NodeJS (LTS)
  • Yarn

What you need

You will need to go over the specification.

Getting started

Contributors

Read our contributors document, submit an issue or talk to us on our discord!

License

Apache-2.0 ChainSafe Systems

Keywords

FAQs

Last updated on 11 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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