How to use the @chainsafe/ssz-type-schema.parseType function in @chainsafe/ssz-type-schema

To help you get started, we’ve selected a few @chainsafe/ssz-type-schema 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 / src / core / clone.ts View on Github external
export function clone(value: any, type: AnySSZType): any {
  const _type = parseType(type);
  _assertValidValue(value, _type);
  return _clone(value, _type);
}
github ChainSafe / lodestar / packages / eth2.0-utils / src / converters / json.ts View on Github external
export function fromJson(value: object, type: AnySSZType): T {
  value = objectToCamelCase(value);
  return expandJsonValue(value, parseType(type));
}
github ChainSafe / lodestar / packages / ssz / src / core / serialize.ts View on Github external
export function serialize(value: any, type: AnySSZType): Buffer {
  const _type = parseType(type);
  _assertValidValue(value, _type);
  const buf = Buffer.alloc(size(value, _type));
  _serialize(value, _type, buf, 0);
  return buf;
}
github ChainSafe / lodestar / packages / ssz / src / core / defaultValue.ts View on Github external
export function defaultValue(type: AnySSZType): T {
  return _defaultValue(parseType(type)) as T;
}
github ChainSafe / lodestar / packages / ssz / src / core / createValue.ts View on Github external
export function createValue(type: AnySSZType, value: any = null): T {
  return _createValue(parseType(type), value) as T;
}
github ChainSafe / lodestar / packages / ssz / src / core / equals.ts View on Github external
export function equals(value1: any, value2: any, type: AnySSZType): boolean {
  const _type = parseType(type);
  _assertValidValue(value1, _type);
  _assertValidValue(value2, _type);
  return _equals(value1, value2, _type);
}