🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@chainsafe/eth2.0-types

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chainsafe/eth2.0-types

Typescript types required for eth2.0

latest
Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
79
-13.19%
Maintainers
3
Weekly downloads
 
Created
Source

eth2.0-types

npm License

Typescript and SSZ types for Eth2 datastructures

Usage

Using the typescript types

import {BeaconState} from "@chainsafe/eth2.0-types";

const b: BeaconState = {
  slot: 5,
  ...
};

Using the ssz types

// mainnet and minimal types pre-generated under non-default export
import {types as mainnetTypes} from "@chainsafe/eth2.0-types/lib/ssz/presets/mainnet";
import {types as minimaltTypes} from "@chainsafe/eth2.0-types/lib/ssz/presets/mainnet";

import {defaultValue} from "@chainsafe/ssz";

defaultValue(mainnetTypes.BeaconState);
defaultValue(minimalTypes.BeaconState);

...

// create your own IBeaconSSZTypes object from an IBeaconParams
import {createIBeaconSSZTypes} from "@chainsafe/eth2.0-types";
import {IBeaconParams} from "@chainsafe/eth2.0-params";
const testnetParams: IBeaconParams = {
  ...
};

const testnetTypes = createIBeaconSSZTypes(testnetParams);

defaultValue(testnetTypes.BeaconState);

License

Apache-2.0

Keywords

beacon

FAQs

Package last updated on 18 Feb 2020

Did you know?

Socket

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