UNPKG

@lodestar/types

Version:

Typescript types required for lodestar

49 lines 1.32 kB
import { BasicType } from "@chainsafe/ssz"; export class StringType extends BasicType { typeName = "string"; byteLength = 0; fixedSize = 0; minSize = 0; maxSize = 0; defaultValue() { return ""; } // Serialization + deserialization value_serializeToBytes() { throw Error("Not supported in String type"); } value_deserializeFromBytes() { throw Error("Not supported in String type"); } tree_serializeToBytes() { throw Error("Not supported in String type"); } tree_deserializeFromBytes() { throw Error("Not supported in String type"); } // Fast tree opts tree_getFromNode() { throw Error("Not supported in String type"); } tree_setToNode() { throw Error("Not supported in String type"); } tree_getFromPackedNode() { throw Error("Not supported in String type"); } tree_setToPackedNode() { throw Error("Not supported in String type"); } // JSON fromJson(json) { if (typeof json !== "string") { throw Error(`JSON invalid type ${typeof json} expected string`); } return json; } toJson(value) { return value; } } export const stringType = new StringType(); //# sourceMappingURL=stringType.js.map