How to use @chainsafe/lodestar - 3 common examples

To help you get started, we’ve selected a few @chainsafe/lodestar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ChainSafe / lodestar / packages / ssz-cli / src / hashTreeRoot.ts View on Github external
demand: true,
      type: "string",
    },
  }).argv;
  try {
    // process input
    let input = await readInput(argv.i);
    // parse input
    const inputParser = "yaml";
    const parsedInput = inputParsers[inputParser].parse(input);
    // process config
    const config = presets[argv.config];
    // process type
    const type = config[argv.t];
    // perform action
    const output = hashTreeRoot(expandYamlValue(parsedInput,type), type);
    // parse output
    const outputParser = "hex";
    const parsedOutput = outputParsers[outputParser].dump(output);
    // write output
    await writeOutput(parsedOutput, argv.o);
  } catch (e) {
    console.error(e.message);
  }
})();
github ChainSafe / lodestar / packages / ssz-cli / src / serialize.ts View on Github external
demand: true,
      type: "string",
    },
  }).argv;
  try {
    // process input
    const input = await readInput(argv.i);
    // parse input
    const inputParser = "yaml";
    const parsedInput = inputParsers[inputParser].parse(input);
    // process config
    const config = presets[argv.config];
    // process type
    const type = config[argv.t];
    // perform action
    const output = serialize(expandYamlValue(parsedInput,type), type);
    // parse output
    const outputParser = "hex";
    const parsedOutput = outputParsers[outputParser].dump(output);
    // write output
    await writeOutput(parsedOutput, argv.o);
  } catch (e) {
    console.error(e.message);
  }
})();
github ChainSafe / lodestar / packages / eth2.0-state-transition / src / util / domain.ts View on Github external
export function computeDomain(domainType: DomainType, forkVersion: Version = Buffer.alloc(4)): Domain {
  return Buffer.concat([
    intToBytes(domainType, 4),
    forkVersion,
  ]);
}

@chainsafe/lodestar

Command line interface for lodestar

LGPL-3.0
Latest version published 30 days ago

Package Health Score

78 / 100
Full package analysis

Popular JavaScript code snippets

Find secure code to use in your application or website