How to use the @chainsafe/ssz-type-schema.UintImpl.bigint 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 / defaultValue.ts View on Github external
export function _defaultValue(type: FullSSZType): any {
  switch (type.type) {
    case Type.bool:
      return false;
    case Type.uint:
      switch (type.use) {
        case UintImpl.bn:
          return new BN(0);
        case UintImpl.bigint:
          return BigInt(0);
        case UintImpl.number:
          return 0;
      }
      break;
    case Type.bitList:
      return BitList.fromBitfield(Buffer.alloc(0), 0);
    case Type.bitVector:
      return BitVector.fromBitfield(
        Buffer.alloc(Math.max(1, Math.ceil(type.length / 8))),
        type.length);
    case Type.byteList:
      return Buffer.alloc(0);
    case Type.byteVector:
      return Buffer.alloc(type.length);
    case Type.list: