JSPM

@chainsafe/eth2.0-types

0.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q27106F
  • License Apache-2.0

Typescript types required for eth2.0

Package Exports

  • @chainsafe/eth2.0-types/lib/ssz/presets/mainnet
  • @chainsafe/eth2.0-types/lib/ssz/presets/minimal

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@chainsafe/eth2.0-types) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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