@lodestar/utils 1.37.0-dev.983ef10850 → 1.37.0-dev.c2cf1aac27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/ChainSafe/lodestar/issues"
13
13
  },
14
- "version": "1.37.0-dev.983ef10850",
14
+ "version": "1.37.0-dev.c2cf1aac27",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
@@ -22,7 +22,6 @@
22
22
  },
23
23
  "imports": {
24
24
  "#bytes": {
25
- "bun": "./src/bytes/bun.ts",
26
25
  "browser": "./lib/bytes/browser.js",
27
26
  "default": "./lib/bytes/nodejs.js"
28
27
  }
@@ -48,7 +47,6 @@
48
47
  "types": "lib/index.d.ts",
49
48
  "dependencies": {
50
49
  "@chainsafe/as-sha256": "^1.2.0",
51
- "@lodestar/bun": "git+https://github.com/ChainSafe/lodestar-bun.git",
52
50
  "any-signal": "^4.1.1",
53
51
  "bigint-buffer": "^1.1.5",
54
52
  "case": "^1.6.3",
@@ -65,5 +63,5 @@
65
63
  "beacon",
66
64
  "blockchain"
67
65
  ],
68
- "gitHead": "94bffb19fdf6b61a6af3d58701740b1d5b08f9fb"
66
+ "gitHead": "1cb6e876183d71522e8fba497b7bb7a1bbb5e03b"
69
67
  }
@@ -1,12 +0,0 @@
1
- export declare function toHex(data: Uint8Array): string;
2
- export declare function toRootHex(root: Uint8Array): string;
3
- export declare function toPubkeyHex(pubkey: Uint8Array): string;
4
- export declare function fromHex(hex: string): Uint8Array;
5
- export declare function fromHexInto(hex: string, buffer: Uint8Array): void;
6
- export declare const toHexString: typeof toHex;
7
- export declare function intToBytes(value: number | bigint, byteLength: number, endianness?: "be" | "le"): Uint8Array;
8
- export declare function bytesToInt(buf: Uint8Array, endianness?: "be" | "le"): number;
9
- export declare const bigIntToBytes: typeof intToBytes;
10
- export declare function bytesToBigInt(buf: Uint8Array, endianness?: "be" | "le"): bigint;
11
- export { xor } from "./browser.ts";
12
- //# sourceMappingURL=bun.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/bytes/bun.ts"],"names":[],"mappings":"AAEA,wBAAgB,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAE9C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAKlD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAKtD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAU/C;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAUjE;AAED,eAAO,MAAM,WAAW,cAAQ,CAAC;AAIjC,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAE,IAAI,GAAG,IAAW,GAAG,UAAU,CAKjH;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,GAAE,IAAI,GAAG,IAAW,GAAG,MAAM,CAKlF;AAED,eAAO,MAAM,aAAa,mBAAa,CAAC;AAExC,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,GAAE,IAAI,GAAG,IAAW,GAAG,MAAM,CAKrF;AAED,OAAO,EAAC,GAAG,EAAC,MAAM,cAAc,CAAC"}
package/lib/bytes/bun.js DELETED
@@ -1,57 +0,0 @@
1
- import { bytes } from "@lodestar/bun";
2
- export function toHex(data) {
3
- return `0x${data.toHex()}`;
4
- }
5
- export function toRootHex(root) {
6
- if (root.length !== 32) {
7
- throw Error(`Expect root to be 32 bytes, got ${root.length}`);
8
- }
9
- return `0x${root.toHex()}`;
10
- }
11
- export function toPubkeyHex(pubkey) {
12
- if (pubkey.length !== 48) {
13
- throw Error(`Expect pubkey to be 48 bytes, got ${pubkey.length}`);
14
- }
15
- return `0x${pubkey.toHex()}`;
16
- }
17
- export function fromHex(hex) {
18
- if (hex.startsWith("0x")) {
19
- hex = hex.slice(2);
20
- }
21
- if (hex.length % 2 !== 0) {
22
- throw new Error(`hex string length ${hex.length} must be multiple of 2`);
23
- }
24
- return Uint8Array.fromHex(hex);
25
- }
26
- export function fromHexInto(hex, buffer) {
27
- if (hex.startsWith("0x")) {
28
- hex = hex.slice(2);
29
- }
30
- if (hex.length !== buffer.length * 2) {
31
- throw new Error(`hex string length ${hex.length} must be exactly double the buffer length ${buffer.length}`);
32
- }
33
- buffer.setFromHex(hex);
34
- }
35
- export const toHexString = toHex;
36
- import { bytesToBigInt as bBytesToBigInt, bytesToInt as bBytesToInt, intToBytes as bIntToBytes } from "./browser.js";
37
- export function intToBytes(value, byteLength, endianness = "le") {
38
- if (byteLength > 8) {
39
- return bIntToBytes(value, byteLength, endianness);
40
- }
41
- return bytes.intToBytes(value, byteLength, endianness);
42
- }
43
- export function bytesToInt(buf, endianness = "le") {
44
- if (buf.length > 8) {
45
- return bBytesToInt(buf, endianness);
46
- }
47
- return bytes.bytesToInt(buf, endianness);
48
- }
49
- export const bigIntToBytes = intToBytes;
50
- export function bytesToBigInt(buf, endianness = "le") {
51
- if (buf.length > 8) {
52
- return bBytesToBigInt(buf, endianness);
53
- }
54
- return bytes.bytesToBigint(buf, endianness);
55
- }
56
- export { xor } from "./browser.js";
57
- //# sourceMappingURL=bun.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bun.js","sourceRoot":"","sources":["../../src/bytes/bun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAEpC,MAAM,UAAU,KAAK,CAAC,IAAgB;IACpC,OAAO,KAAK,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAgB;IACxC,IAAI,IAAI,CAA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AC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;AAEjC,OAAO,EAAC,aAAa,IAAI,cAAc,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAC,MAAM,cAAc,CAAC;AAEnH,MAAM,UAAU,UAAU,CAAC,KAAsB,EAAE,UAAkB,EAAE,aAA0B,IAAI;IACnG,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAe,EAAE,aAA0B,IAAI;IACxE,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,WAAW,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;AAExC,MAAM,UAAU,aAAa,CAAC,GAAe,EAAE,aAA0B,IAAI;IAC3E,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,cAAc,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAC9C,CAAC;AAED,OAAO,EAAC,GAAG,EAAC,MAAM,cAAc,CAAC"}
package/src/bytes/bun.ts DELETED
@@ -1,72 +0,0 @@
1
- import {bytes} from "@lodestar/bun";
2
-
3
- export function toHex(data: Uint8Array): string {
4
- return `0x${data.toHex()}`;
5
- }
6
-
7
- export function toRootHex(root: Uint8Array): string {
8
- if (root.length !== 32) {
9
- throw Error(`Expect root to be 32 bytes, got ${root.length}`);
10
- }
11
- return `0x${root.toHex()}`;
12
- }
13
-
14
- export function toPubkeyHex(pubkey: Uint8Array): string {
15
- if (pubkey.length !== 48) {
16
- throw Error(`Expect pubkey to be 48 bytes, got ${pubkey.length}`);
17
- }
18
- return `0x${pubkey.toHex()}`;
19
- }
20
-
21
- export function fromHex(hex: string): Uint8Array {
22
- if (hex.startsWith("0x")) {
23
- hex = hex.slice(2);
24
- }
25
-
26
- if (hex.length % 2 !== 0) {
27
- throw new Error(`hex string length ${hex.length} must be multiple of 2`);
28
- }
29
-
30
- return Uint8Array.fromHex(hex);
31
- }
32
-
33
- export function fromHexInto(hex: string, buffer: Uint8Array): void {
34
- if (hex.startsWith("0x")) {
35
- hex = hex.slice(2);
36
- }
37
-
38
- if (hex.length !== buffer.length * 2) {
39
- throw new Error(`hex string length ${hex.length} must be exactly double the buffer length ${buffer.length}`);
40
- }
41
-
42
- buffer.setFromHex(hex);
43
- }
44
-
45
- export const toHexString = toHex;
46
-
47
- import {bytesToBigInt as bBytesToBigInt, bytesToInt as bBytesToInt, intToBytes as bIntToBytes} from "./browser.ts";
48
-
49
- export function intToBytes(value: number | bigint, byteLength: number, endianness: "be" | "le" = "le"): Uint8Array {
50
- if (byteLength > 8) {
51
- return bIntToBytes(value, byteLength, endianness);
52
- }
53
- return bytes.intToBytes(value, byteLength, endianness);
54
- }
55
-
56
- export function bytesToInt(buf: Uint8Array, endianness: "be" | "le" = "le"): number {
57
- if (buf.length > 8) {
58
- return bBytesToInt(buf, endianness);
59
- }
60
- return bytes.bytesToInt(buf, endianness);
61
- }
62
-
63
- export const bigIntToBytes = intToBytes;
64
-
65
- export function bytesToBigInt(buf: Uint8Array, endianness: "be" | "le" = "le"): bigint {
66
- if (buf.length > 8) {
67
- return bBytesToBigInt(buf, endianness);
68
- }
69
- return bytes.bytesToBigint(buf, endianness);
70
- }
71
-
72
- export {xor} from "./browser.ts";