@feelyourprotocol/util 8141.0.0
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/LICENSE +373 -0
- package/README.md +297 -0
- package/dist/cjs/account.d.ts +165 -0
- package/dist/cjs/account.d.ts.map +1 -0
- package/dist/cjs/account.js +530 -0
- package/dist/cjs/account.js.map +1 -0
- package/dist/cjs/address.d.ts +67 -0
- package/dist/cjs/address.d.ts.map +1 -0
- package/dist/cjs/address.js +136 -0
- package/dist/cjs/address.js.map +1 -0
- package/dist/cjs/authorization.d.ts +41 -0
- package/dist/cjs/authorization.d.ts.map +1 -0
- package/dist/cjs/authorization.js +135 -0
- package/dist/cjs/authorization.js.map +1 -0
- package/dist/cjs/bal.d.ts +129 -0
- package/dist/cjs/bal.d.ts.map +1 -0
- package/dist/cjs/bal.js +529 -0
- package/dist/cjs/bal.js.map +1 -0
- package/dist/cjs/binaryTree.d.ts +148 -0
- package/dist/cjs/binaryTree.d.ts.map +1 -0
- package/dist/cjs/binaryTree.js +240 -0
- package/dist/cjs/binaryTree.js.map +1 -0
- package/dist/cjs/blobs.d.ts +76 -0
- package/dist/cjs/blobs.d.ts.map +1 -0
- package/dist/cjs/blobs.js +175 -0
- package/dist/cjs/blobs.js.map +1 -0
- package/dist/cjs/bytes.d.ts +291 -0
- package/dist/cjs/bytes.d.ts.map +1 -0
- package/dist/cjs/bytes.js +606 -0
- package/dist/cjs/bytes.js.map +1 -0
- package/dist/cjs/constants.d.ts +91 -0
- package/dist/cjs/constants.d.ts.map +1 -0
- package/dist/cjs/constants.js +97 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/db.d.ts +65 -0
- package/dist/cjs/db.d.ts.map +1 -0
- package/dist/cjs/db.js +14 -0
- package/dist/cjs/db.js.map +1 -0
- package/dist/cjs/env.d.ts +9 -0
- package/dist/cjs/env.d.ts.map +1 -0
- package/dist/cjs/env.js +13 -0
- package/dist/cjs/env.js.map +1 -0
- package/dist/cjs/errors.d.ts +3 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +19 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/helpers.d.ts +21 -0
- package/dist/cjs/helpers.d.ts.map +1 -0
- package/dist/cjs/helpers.js +50 -0
- package/dist/cjs/helpers.js.map +1 -0
- package/dist/cjs/index.d.ts +67 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +93 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internal.d.ts +72 -0
- package/dist/cjs/internal.d.ts.map +1 -0
- package/dist/cjs/internal.js +182 -0
- package/dist/cjs/internal.js.map +1 -0
- package/dist/cjs/kzg.d.ts +14 -0
- package/dist/cjs/kzg.d.ts.map +1 -0
- package/dist/cjs/kzg.js +3 -0
- package/dist/cjs/kzg.js.map +1 -0
- package/dist/cjs/lock.d.ts +15 -0
- package/dist/cjs/lock.d.ts.map +1 -0
- package/dist/cjs/lock.js +45 -0
- package/dist/cjs/lock.js.map +1 -0
- package/dist/cjs/mapDB.d.ts +17 -0
- package/dist/cjs/mapDB.d.ts.map +1 -0
- package/dist/cjs/mapDB.js +46 -0
- package/dist/cjs/mapDB.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/provider.d.ts +46 -0
- package/dist/cjs/provider.d.ts.map +1 -0
- package/dist/cjs/provider.js +84 -0
- package/dist/cjs/provider.js.map +1 -0
- package/dist/cjs/request.d.ts +20 -0
- package/dist/cjs/request.d.ts.map +1 -0
- package/dist/cjs/request.js +35 -0
- package/dist/cjs/request.js.map +1 -0
- package/dist/cjs/signature.d.ts +47 -0
- package/dist/cjs/signature.d.ts.map +1 -0
- package/dist/cjs/signature.js +147 -0
- package/dist/cjs/signature.js.map +1 -0
- package/dist/cjs/tasks.d.ts +32 -0
- package/dist/cjs/tasks.d.ts.map +1 -0
- package/dist/cjs/tasks.js +51 -0
- package/dist/cjs/tasks.js.map +1 -0
- package/dist/cjs/types.d.ts +64 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +78 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/units.d.ts +22 -0
- package/dist/cjs/units.d.ts.map +1 -0
- package/dist/cjs/units.js +51 -0
- package/dist/cjs/units.js.map +1 -0
- package/dist/cjs/withdrawal.d.ts +72 -0
- package/dist/cjs/withdrawal.d.ts.map +1 -0
- package/dist/cjs/withdrawal.js +93 -0
- package/dist/cjs/withdrawal.js.map +1 -0
- package/dist/esm/account.d.ts +165 -0
- package/dist/esm/account.d.ts.map +1 -0
- package/dist/esm/account.js +505 -0
- package/dist/esm/account.js.map +1 -0
- package/dist/esm/address.d.ts +67 -0
- package/dist/esm/address.d.ts.map +1 -0
- package/dist/esm/address.js +125 -0
- package/dist/esm/address.js.map +1 -0
- package/dist/esm/authorization.d.ts +41 -0
- package/dist/esm/authorization.d.ts.map +1 -0
- package/dist/esm/authorization.js +126 -0
- package/dist/esm/authorization.js.map +1 -0
- package/dist/esm/bal.d.ts +129 -0
- package/dist/esm/bal.d.ts.map +1 -0
- package/dist/esm/bal.js +522 -0
- package/dist/esm/bal.js.map +1 -0
- package/dist/esm/binaryTree.d.ts +148 -0
- package/dist/esm/binaryTree.d.ts.map +1 -0
- package/dist/esm/binaryTree.js +226 -0
- package/dist/esm/binaryTree.js.map +1 -0
- package/dist/esm/blobs.d.ts +76 -0
- package/dist/esm/blobs.d.ts.map +1 -0
- package/dist/esm/blobs.js +163 -0
- package/dist/esm/blobs.js.map +1 -0
- package/dist/esm/bytes.d.ts +291 -0
- package/dist/esm/bytes.d.ts.map +1 -0
- package/dist/esm/bytes.js +562 -0
- package/dist/esm/bytes.js.map +1 -0
- package/dist/esm/constants.d.ts +91 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +94 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/db.d.ts +65 -0
- package/dist/esm/db.d.ts.map +1 -0
- package/dist/esm/db.js +11 -0
- package/dist/esm/db.js.map +1 -0
- package/dist/esm/env.d.ts +9 -0
- package/dist/esm/env.d.ts.map +1 -0
- package/dist/esm/env.js +9 -0
- package/dist/esm/env.js.map +1 -0
- package/dist/esm/errors.d.ts +3 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +14 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/helpers.d.ts +21 -0
- package/dist/esm/helpers.d.ts.map +1 -0
- package/dist/esm/helpers.js +43 -0
- package/dist/esm/helpers.js.map +1 -0
- package/dist/esm/index.d.ts +67 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +67 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal.d.ts +72 -0
- package/dist/esm/internal.d.ts.map +1 -0
- package/dist/esm/internal.js +170 -0
- package/dist/esm/internal.js.map +1 -0
- package/dist/esm/kzg.d.ts +14 -0
- package/dist/esm/kzg.d.ts.map +1 -0
- package/dist/esm/kzg.js +2 -0
- package/dist/esm/kzg.js.map +1 -0
- package/dist/esm/lock.d.ts +15 -0
- package/dist/esm/lock.d.ts.map +1 -0
- package/dist/esm/lock.js +41 -0
- package/dist/esm/lock.js.map +1 -0
- package/dist/esm/mapDB.d.ts +17 -0
- package/dist/esm/mapDB.d.ts.map +1 -0
- package/dist/esm/mapDB.js +42 -0
- package/dist/esm/mapDB.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/provider.d.ts +46 -0
- package/dist/esm/provider.d.ts.map +1 -0
- package/dist/esm/provider.js +79 -0
- package/dist/esm/provider.js.map +1 -0
- package/dist/esm/request.d.ts +20 -0
- package/dist/esm/request.d.ts.map +1 -0
- package/dist/esm/request.js +30 -0
- package/dist/esm/request.js.map +1 -0
- package/dist/esm/signature.d.ts +47 -0
- package/dist/esm/signature.d.ts.map +1 -0
- package/dist/esm/signature.js +137 -0
- package/dist/esm/signature.js.map +1 -0
- package/dist/esm/tasks.d.ts +32 -0
- package/dist/esm/tasks.d.ts.map +1 -0
- package/dist/esm/tasks.js +47 -0
- package/dist/esm/tasks.js.map +1 -0
- package/dist/esm/types.d.ts +64 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +71 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/units.d.ts +22 -0
- package/dist/esm/units.d.ts.map +1 -0
- package/dist/esm/units.js +46 -0
- package/dist/esm/units.js.map +1 -0
- package/dist/esm/withdrawal.d.ts +72 -0
- package/dist/esm/withdrawal.d.ts.map +1 -0
- package/dist/esm/withdrawal.js +86 -0
- package/dist/esm/withdrawal.js.map +1 -0
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.prod.esm.tsbuildinfo +1 -0
- package/package.json +116 -0
- package/src/account.ts +630 -0
- package/src/address.ts +158 -0
- package/src/authorization.ts +180 -0
- package/src/bal.ts +761 -0
- package/src/binaryTree.ts +353 -0
- package/src/blobs.ts +209 -0
- package/src/bytes.ts +659 -0
- package/src/constants.ts +125 -0
- package/src/db.ts +86 -0
- package/src/env.ts +9 -0
- package/src/errors.ts +28 -0
- package/src/helpers.ts +46 -0
- package/src/index.ts +88 -0
- package/src/internal.ts +212 -0
- package/src/kzg.ts +24 -0
- package/src/lock.ts +42 -0
- package/src/mapDB.ts +57 -0
- package/src/provider.ts +109 -0
- package/src/request.ts +48 -0
- package/src/signature.ts +202 -0
- package/src/tasks.ts +59 -0
- package/src/types.ts +177 -0
- package/src/units.ts +56 -0
- package/src/withdrawal.ts +133 -0
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.utf8ToBytes = exports.concatBytes = exports.randomBytes = exports.compareBytes = exports.intToUnpaddedBytes = exports.bigIntToAddressBytes = exports.bigIntToUnpaddedBytes = exports.bigIntMin = exports.bigIntMax = exports.bigIntToHex = exports.validateNoLeadingZeroes = exports.short = exports.addHexPrefix = exports.toUnsigned = exports.fromSigned = exports.toBytes = exports.unpadHex = exports.unpadArray = exports.unpadBytes = exports.setLengthRight = exports.setLengthLeft = exports.bigIntToBytes = exports.intToBytes = exports.intToHex = exports.bytesToInt = exports.bytesToBigInt = exports.bytesToHex = exports.unprefixedHexToBytes = exports.hexToBytes = exports.bytesToUnprefixedHex = void 0;
|
|
4
|
+
exports.bytesToInt32 = bytesToInt32;
|
|
5
|
+
exports.bytesToBigInt64 = bytesToBigInt64;
|
|
6
|
+
exports.int32ToBytes = int32ToBytes;
|
|
7
|
+
exports.bigInt64ToBytes = bigInt64ToBytes;
|
|
8
|
+
exports.bytesToUtf8 = bytesToUtf8;
|
|
9
|
+
exports.equalsBytes = equalsBytes;
|
|
10
|
+
exports.hexToBigInt = hexToBigInt;
|
|
11
|
+
exports.bytesToBits = bytesToBits;
|
|
12
|
+
exports.bitsToBytes = bitsToBytes;
|
|
13
|
+
exports.matchingBytesLength = matchingBytesLength;
|
|
14
|
+
exports.matchingBitsLength = matchingBitsLength;
|
|
15
|
+
exports.equalsBits = equalsBits;
|
|
16
|
+
const utils_js_1 = require("@noble/hashes/utils.js");
|
|
17
|
+
const errors_ts_1 = require("./errors.js");
|
|
18
|
+
const helpers_ts_1 = require("./helpers.js");
|
|
19
|
+
const internal_ts_1 = require("./internal.js");
|
|
20
|
+
const BIGINT_0 = BigInt(0);
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated
|
|
23
|
+
*/
|
|
24
|
+
exports.bytesToUnprefixedHex = utils_js_1.bytesToHex;
|
|
25
|
+
/**
|
|
26
|
+
* Converts a {@link PrefixedHexString} to a {@link Uint8Array}
|
|
27
|
+
* @param {PrefixedHexString} hex The 0x-prefixed hex string to convert
|
|
28
|
+
* @returns {Uint8Array} The converted bytes
|
|
29
|
+
* @throws If the input is not a valid 0x-prefixed hex string
|
|
30
|
+
*/
|
|
31
|
+
const hexToBytes = (hex) => {
|
|
32
|
+
if (!hex.startsWith('0x'))
|
|
33
|
+
throw (0, errors_ts_1.EthereumJSErrorWithoutCode)('input string must be 0x prefixed');
|
|
34
|
+
return (0, utils_js_1.hexToBytes)((0, internal_ts_1.padToEven)((0, internal_ts_1.stripHexPrefix)(hex)));
|
|
35
|
+
};
|
|
36
|
+
exports.hexToBytes = hexToBytes;
|
|
37
|
+
const unprefixedHexToBytes = (hex) => {
|
|
38
|
+
if (hex.startsWith('0x'))
|
|
39
|
+
throw (0, errors_ts_1.EthereumJSErrorWithoutCode)('input string cannot be 0x prefixed');
|
|
40
|
+
return (0, utils_js_1.hexToBytes)((0, internal_ts_1.padToEven)(hex));
|
|
41
|
+
};
|
|
42
|
+
exports.unprefixedHexToBytes = unprefixedHexToBytes;
|
|
43
|
+
/**
|
|
44
|
+
* Converts a {@link Uint8Array} to a {@link PrefixedHexString}
|
|
45
|
+
* @param {Uint8Array} bytes the bytes to convert
|
|
46
|
+
* @returns {PrefixedHexString} the hex string
|
|
47
|
+
* @dev Returns `0x` if provided an empty Uint8Array
|
|
48
|
+
*/
|
|
49
|
+
const bytesToHex = (bytes) => {
|
|
50
|
+
// Using deprecated bytesToUnprefixedHex for performance: bytesToHex is a wrapper that adds the 0x prefix.
|
|
51
|
+
// Using bytesToUnprefixedHex directly avoids creating an intermediate prefixed string and then stripping it.
|
|
52
|
+
const unprefixedHex = (0, exports.bytesToUnprefixedHex)(bytes);
|
|
53
|
+
return `0x${unprefixedHex}`;
|
|
54
|
+
};
|
|
55
|
+
exports.bytesToHex = bytesToHex;
|
|
56
|
+
// BigInt cache for the numbers 0 - 256*256-1 (two-byte bytes)
|
|
57
|
+
const BIGINT_CACHE = [];
|
|
58
|
+
for (let i = 0; i <= 256 * 256 - 1; i++) {
|
|
59
|
+
BIGINT_CACHE[i] = BigInt(i);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Converts a {@link Uint8Array} to a {@link bigint}
|
|
63
|
+
* @param {Uint8Array} bytes the bytes to convert
|
|
64
|
+
* @returns {bigint}
|
|
65
|
+
*/
|
|
66
|
+
const bytesToBigInt = (bytes, littleEndian = false) => {
|
|
67
|
+
(0, helpers_ts_1.assertIsBytes)(bytes);
|
|
68
|
+
if (littleEndian) {
|
|
69
|
+
bytes = bytes.slice().reverse();
|
|
70
|
+
}
|
|
71
|
+
const hex = (0, exports.bytesToHex)(bytes);
|
|
72
|
+
if (hex === '0x') {
|
|
73
|
+
return BIGINT_0;
|
|
74
|
+
}
|
|
75
|
+
if (hex.length === 4) {
|
|
76
|
+
// If the byte length is 1 (this is faster than checking `bytes.length === 1`)
|
|
77
|
+
return BIGINT_CACHE[bytes[0]];
|
|
78
|
+
}
|
|
79
|
+
if (hex.length === 6) {
|
|
80
|
+
return BIGINT_CACHE[bytes[0] * 256 + bytes[1]];
|
|
81
|
+
}
|
|
82
|
+
return BigInt(hex);
|
|
83
|
+
};
|
|
84
|
+
exports.bytesToBigInt = bytesToBigInt;
|
|
85
|
+
/**
|
|
86
|
+
* Converts a {@link Uint8Array} to a {@link number}.
|
|
87
|
+
* @param {Uint8Array} bytes the bytes to convert
|
|
88
|
+
* @return {number}
|
|
89
|
+
* @throws If the input number exceeds 53 bits.
|
|
90
|
+
*/
|
|
91
|
+
const bytesToInt = (bytes) => {
|
|
92
|
+
const res = Number((0, exports.bytesToBigInt)(bytes));
|
|
93
|
+
if (!Number.isSafeInteger(res))
|
|
94
|
+
throw (0, errors_ts_1.EthereumJSErrorWithoutCode)('Number exceeds 53 bits');
|
|
95
|
+
return res;
|
|
96
|
+
};
|
|
97
|
+
exports.bytesToInt = bytesToInt;
|
|
98
|
+
/******************************************/
|
|
99
|
+
/**
|
|
100
|
+
* Converts a {@link number} into a {@link PrefixedHexString}
|
|
101
|
+
* @param {number} i
|
|
102
|
+
* @return {PrefixedHexString}
|
|
103
|
+
*/
|
|
104
|
+
const intToHex = (i) => {
|
|
105
|
+
if (!Number.isSafeInteger(i) || i < 0) {
|
|
106
|
+
throw (0, errors_ts_1.EthereumJSErrorWithoutCode)(`Received an invalid integer type: ${i}`);
|
|
107
|
+
}
|
|
108
|
+
return `0x${i.toString(16)}`;
|
|
109
|
+
};
|
|
110
|
+
exports.intToHex = intToHex;
|
|
111
|
+
/**
|
|
112
|
+
* Converts an {@link number} to a {@link Uint8Array}
|
|
113
|
+
* @param {Number} i
|
|
114
|
+
* @return {Uint8Array}
|
|
115
|
+
*/
|
|
116
|
+
const intToBytes = (i) => {
|
|
117
|
+
const hex = (0, exports.intToHex)(i);
|
|
118
|
+
return (0, exports.hexToBytes)(hex);
|
|
119
|
+
};
|
|
120
|
+
exports.intToBytes = intToBytes;
|
|
121
|
+
/**
|
|
122
|
+
* Converts a {@link bigint} to a {@link Uint8Array}
|
|
123
|
+
* * @param {bigint} num the bigint to convert
|
|
124
|
+
* @returns {Uint8Array}
|
|
125
|
+
*/
|
|
126
|
+
const bigIntToBytes = (num, littleEndian = false) => {
|
|
127
|
+
const bytes = (0, exports.hexToBytes)(`0x${(0, internal_ts_1.padToEven)(num.toString(16))}`);
|
|
128
|
+
return littleEndian ? bytes.reverse() : bytes;
|
|
129
|
+
};
|
|
130
|
+
exports.bigIntToBytes = bigIntToBytes;
|
|
131
|
+
/**
|
|
132
|
+
* Pads a `Uint8Array` with zeros till it has `length` bytes.
|
|
133
|
+
* Throws if input length exceeds target length, unless allowTruncate is true.
|
|
134
|
+
* @param {Uint8Array} msg the value to pad
|
|
135
|
+
* @param {number} length the number of bytes the output should be
|
|
136
|
+
* @param {boolean} right whether to start padding from the left or right
|
|
137
|
+
* @param {boolean} allowTruncate whether to allow truncation if msg exceeds length
|
|
138
|
+
* @return {Uint8Array}
|
|
139
|
+
*/
|
|
140
|
+
const setLength = (msg, length, right, allowTruncate) => {
|
|
141
|
+
if (msg.length > length) {
|
|
142
|
+
if (!allowTruncate) {
|
|
143
|
+
throw (0, errors_ts_1.EthereumJSErrorWithoutCode)(`Input length ${msg.length} exceeds target length ${length}. Use allowTruncate option to truncate.`);
|
|
144
|
+
}
|
|
145
|
+
return right ? msg.subarray(0, length) : msg.subarray(-length);
|
|
146
|
+
}
|
|
147
|
+
if (msg.length < length) {
|
|
148
|
+
return right
|
|
149
|
+
? new Uint8Array([...msg, ...new Uint8Array(length - msg.length)])
|
|
150
|
+
: new Uint8Array([...new Uint8Array(length - msg.length), ...msg]);
|
|
151
|
+
}
|
|
152
|
+
return msg;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Left Pads a `Uint8Array` with leading zeros till it has `length` bytes.
|
|
156
|
+
* Throws if input length exceeds target length, unless allowTruncate option is true.
|
|
157
|
+
* @param {Uint8Array} msg the value to pad
|
|
158
|
+
* @param {number} length the number of bytes the output should be
|
|
159
|
+
* @param {SetLengthOpts} opts options object with allowTruncate flag
|
|
160
|
+
* @return {Uint8Array}
|
|
161
|
+
*/
|
|
162
|
+
const setLengthLeft = (msg, length, opts = {}) => {
|
|
163
|
+
(0, helpers_ts_1.assertIsBytes)(msg);
|
|
164
|
+
return setLength(msg, length, false, opts.allowTruncate ?? false);
|
|
165
|
+
};
|
|
166
|
+
exports.setLengthLeft = setLengthLeft;
|
|
167
|
+
/**
|
|
168
|
+
* Right Pads a `Uint8Array` with trailing zeros till it has `length` bytes.
|
|
169
|
+
* Throws if input length exceeds target length, unless allowTruncate option is true.
|
|
170
|
+
* @param {Uint8Array} msg the value to pad
|
|
171
|
+
* @param {number} length the number of bytes the output should be
|
|
172
|
+
* @param {SetLengthOpts} opts options object with allowTruncate flag
|
|
173
|
+
* @return {Uint8Array}
|
|
174
|
+
*/
|
|
175
|
+
const setLengthRight = (msg, length, opts = {}) => {
|
|
176
|
+
(0, helpers_ts_1.assertIsBytes)(msg);
|
|
177
|
+
return setLength(msg, length, true, opts.allowTruncate ?? false);
|
|
178
|
+
};
|
|
179
|
+
exports.setLengthRight = setLengthRight;
|
|
180
|
+
/**
|
|
181
|
+
* Trims leading zeros from a `Uint8Array`, `number[]` or `string`.
|
|
182
|
+
* @param {Uint8Array|number[]|string} a
|
|
183
|
+
* @return {Uint8Array|number[]|string}
|
|
184
|
+
*/
|
|
185
|
+
const stripZeros = (a) => {
|
|
186
|
+
let first = a[0];
|
|
187
|
+
while (a.length > 0 && first.toString() === '0') {
|
|
188
|
+
a = a.slice(1);
|
|
189
|
+
first = a[0];
|
|
190
|
+
}
|
|
191
|
+
return a;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Trims leading zeros from a `Uint8Array`.
|
|
195
|
+
* @param {Uint8Array} a
|
|
196
|
+
* @return {Uint8Array}
|
|
197
|
+
*/
|
|
198
|
+
const unpadBytes = (a) => {
|
|
199
|
+
(0, helpers_ts_1.assertIsBytes)(a);
|
|
200
|
+
return stripZeros(a);
|
|
201
|
+
};
|
|
202
|
+
exports.unpadBytes = unpadBytes;
|
|
203
|
+
/**
|
|
204
|
+
* Trims leading zeros from an `Array` (of numbers).
|
|
205
|
+
* @param {number[]} a
|
|
206
|
+
* @return {number[]}
|
|
207
|
+
*/
|
|
208
|
+
const unpadArray = (a) => {
|
|
209
|
+
(0, helpers_ts_1.assertIsArray)(a);
|
|
210
|
+
return stripZeros(a);
|
|
211
|
+
};
|
|
212
|
+
exports.unpadArray = unpadArray;
|
|
213
|
+
/**
|
|
214
|
+
* Trims leading zeros from a `PrefixedHexString`.
|
|
215
|
+
* @param {PrefixedHexString} a
|
|
216
|
+
* @return {PrefixedHexString}
|
|
217
|
+
*/
|
|
218
|
+
const unpadHex = (a) => {
|
|
219
|
+
(0, helpers_ts_1.assertIsHexString)(a);
|
|
220
|
+
return `0x${stripZeros((0, internal_ts_1.stripHexPrefix)(a))}`;
|
|
221
|
+
};
|
|
222
|
+
exports.unpadHex = unpadHex;
|
|
223
|
+
/**
|
|
224
|
+
* Attempts to turn a value into a `Uint8Array`.
|
|
225
|
+
* Inputs supported: `Buffer`, `Uint8Array`, `String` (hex-prefixed), `Number`, null/undefined, `BigInt` and other objects
|
|
226
|
+
* with a `toArray()` or `toBytes()` method.
|
|
227
|
+
* @param {ToBytesInputTypes} v the value
|
|
228
|
+
* @return {Uint8Array}
|
|
229
|
+
*/
|
|
230
|
+
const toBytes = (v) => {
|
|
231
|
+
if (v === null || v === undefined) {
|
|
232
|
+
return new Uint8Array();
|
|
233
|
+
}
|
|
234
|
+
if (Array.isArray(v) || v instanceof Uint8Array) {
|
|
235
|
+
return Uint8Array.from(v);
|
|
236
|
+
}
|
|
237
|
+
if (typeof v === 'string') {
|
|
238
|
+
if (!(0, internal_ts_1.isHexString)(v)) {
|
|
239
|
+
throw (0, errors_ts_1.EthereumJSErrorWithoutCode)(`Cannot convert string to Uint8Array. toBytes only supports 0x-prefixed hex strings and this string was given: ${v}`);
|
|
240
|
+
}
|
|
241
|
+
return (0, exports.hexToBytes)(v);
|
|
242
|
+
}
|
|
243
|
+
if (typeof v === 'number') {
|
|
244
|
+
return (0, exports.intToBytes)(v);
|
|
245
|
+
}
|
|
246
|
+
if (typeof v === 'bigint') {
|
|
247
|
+
if (v < BIGINT_0) {
|
|
248
|
+
throw (0, errors_ts_1.EthereumJSErrorWithoutCode)(`Cannot convert negative bigint to Uint8Array. Given: ${v}`);
|
|
249
|
+
}
|
|
250
|
+
let n = v.toString(16);
|
|
251
|
+
if (n.length % 2)
|
|
252
|
+
n = '0' + n;
|
|
253
|
+
return (0, exports.unprefixedHexToBytes)(n);
|
|
254
|
+
}
|
|
255
|
+
if (v.toBytes !== undefined) {
|
|
256
|
+
// converts a `TransformableToBytes` object to a Uint8Array
|
|
257
|
+
return v.toBytes();
|
|
258
|
+
}
|
|
259
|
+
throw (0, errors_ts_1.EthereumJSErrorWithoutCode)('invalid type');
|
|
260
|
+
};
|
|
261
|
+
exports.toBytes = toBytes;
|
|
262
|
+
/**
|
|
263
|
+
* Interprets a `Uint8Array` as a signed integer and returns a `BigInt`. Assumes 256-bit numbers.
|
|
264
|
+
* @param {Uint8Array} num Signed integer value
|
|
265
|
+
* @returns {bigint}
|
|
266
|
+
*/
|
|
267
|
+
const fromSigned = (num) => {
|
|
268
|
+
return BigInt.asIntN(256, (0, exports.bytesToBigInt)(num));
|
|
269
|
+
};
|
|
270
|
+
exports.fromSigned = fromSigned;
|
|
271
|
+
/**
|
|
272
|
+
* Converts a `BigInt` to an unsigned integer and returns it as a `Uint8Array`. Assumes 256-bit numbers.
|
|
273
|
+
* @param {bigint} num
|
|
274
|
+
* @returns {Uint8Array}
|
|
275
|
+
*/
|
|
276
|
+
const toUnsigned = (num) => {
|
|
277
|
+
return (0, exports.bigIntToBytes)(BigInt.asUintN(256, num));
|
|
278
|
+
};
|
|
279
|
+
exports.toUnsigned = toUnsigned;
|
|
280
|
+
/**
|
|
281
|
+
* Adds "0x" to a given `string` if it does not already start with "0x".
|
|
282
|
+
* @param {string} str
|
|
283
|
+
* @return {PrefixedHexString}
|
|
284
|
+
*/
|
|
285
|
+
const addHexPrefix = (str) => {
|
|
286
|
+
if (typeof str !== 'string') {
|
|
287
|
+
return str;
|
|
288
|
+
}
|
|
289
|
+
return (0, internal_ts_1.isHexString)(str) ? str : `0x${str}`;
|
|
290
|
+
};
|
|
291
|
+
exports.addHexPrefix = addHexPrefix;
|
|
292
|
+
/**
|
|
293
|
+
* Shortens a string or Uint8Array's hex string representation to maxLength (default 50).
|
|
294
|
+
*
|
|
295
|
+
* Examples:
|
|
296
|
+
*
|
|
297
|
+
* Input: '657468657265756d000000000000000000000000000000000000000000000000'
|
|
298
|
+
* Output: '657468657265756d0000000000000000000000000000000000…'
|
|
299
|
+
* @param {Uint8Array | string} bytes
|
|
300
|
+
* @param {number} maxLength
|
|
301
|
+
* @return {string}
|
|
302
|
+
*/
|
|
303
|
+
const short = (bytes, maxLength = 50) => {
|
|
304
|
+
const byteStr = bytes instanceof Uint8Array ? (0, exports.bytesToHex)(bytes) : bytes;
|
|
305
|
+
const len = byteStr.slice(0, 2) === '0x' ? maxLength + 2 : maxLength;
|
|
306
|
+
if (byteStr.length <= len) {
|
|
307
|
+
return byteStr;
|
|
308
|
+
}
|
|
309
|
+
return byteStr.slice(0, len) + '…';
|
|
310
|
+
};
|
|
311
|
+
exports.short = short;
|
|
312
|
+
/**
|
|
313
|
+
* Checks provided Uint8Array for leading zeroes and throws if found.
|
|
314
|
+
*
|
|
315
|
+
* Examples:
|
|
316
|
+
*
|
|
317
|
+
* Valid values: 0x1, 0x, 0x01, 0x1234
|
|
318
|
+
* Invalid values: 0x0, 0x00, 0x001, 0x0001
|
|
319
|
+
*
|
|
320
|
+
* Note: This method is useful for validating that RLP encoded integers comply with the rule that all
|
|
321
|
+
* integer values encoded to RLP must be in the most compact form and contain no leading zero bytes
|
|
322
|
+
* @param values An object containing string keys and Uint8Array values
|
|
323
|
+
* @throws if any provided value is found to have leading zero bytes
|
|
324
|
+
*/
|
|
325
|
+
const validateNoLeadingZeroes = (values) => {
|
|
326
|
+
for (const [k, v] of Object.entries(values)) {
|
|
327
|
+
if (v !== undefined && v.length > 0 && v[0] === 0) {
|
|
328
|
+
throw (0, errors_ts_1.EthereumJSErrorWithoutCode)(`${k} cannot have leading zeroes, received: ${(0, exports.bytesToHex)(v)}`);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
exports.validateNoLeadingZeroes = validateNoLeadingZeroes;
|
|
333
|
+
/**
|
|
334
|
+
* Converts a {@link bigint} to a `0x` prefixed hex string
|
|
335
|
+
* @param {bigint} num the bigint to convert
|
|
336
|
+
* @returns {PrefixedHexString}
|
|
337
|
+
*/
|
|
338
|
+
const bigIntToHex = (num) => {
|
|
339
|
+
return `0x${num.toString(16)}`;
|
|
340
|
+
};
|
|
341
|
+
exports.bigIntToHex = bigIntToHex;
|
|
342
|
+
/**
|
|
343
|
+
* Calculates max bigint from an array of bigints
|
|
344
|
+
* @param args array of bigints
|
|
345
|
+
*/
|
|
346
|
+
const bigIntMax = (...args) => args.reduce((m, e) => (e > m ? e : m));
|
|
347
|
+
exports.bigIntMax = bigIntMax;
|
|
348
|
+
/**
|
|
349
|
+
* Calculates min BigInt from an array of BigInts
|
|
350
|
+
* @param args array of bigints
|
|
351
|
+
*/
|
|
352
|
+
const bigIntMin = (...args) => args.reduce((m, e) => (e < m ? e : m));
|
|
353
|
+
exports.bigIntMin = bigIntMin;
|
|
354
|
+
/**
|
|
355
|
+
* Convert value from bigint to an unpadded Uint8Array
|
|
356
|
+
* (useful for RLP transport)
|
|
357
|
+
* @param {bigint} value the bigint to convert
|
|
358
|
+
* @returns {Uint8Array}
|
|
359
|
+
*/
|
|
360
|
+
const bigIntToUnpaddedBytes = (value) => {
|
|
361
|
+
return (0, exports.unpadBytes)((0, exports.bigIntToBytes)(value));
|
|
362
|
+
};
|
|
363
|
+
exports.bigIntToUnpaddedBytes = bigIntToUnpaddedBytes;
|
|
364
|
+
const bigIntToAddressBytes = (value, strict = true) => {
|
|
365
|
+
const addressBytes = (0, exports.bigIntToBytes)(value);
|
|
366
|
+
if (strict && addressBytes.length > 20) {
|
|
367
|
+
throw Error(`Invalid address bytes length=${addressBytes.length} strict=${strict}`);
|
|
368
|
+
}
|
|
369
|
+
// When not strict, allow truncation of values larger than 20 bytes
|
|
370
|
+
return (0, exports.setLengthLeft)(addressBytes, 20, { allowTruncate: !strict });
|
|
371
|
+
};
|
|
372
|
+
exports.bigIntToAddressBytes = bigIntToAddressBytes;
|
|
373
|
+
/**
|
|
374
|
+
* Convert value from number to an unpadded Uint8Array
|
|
375
|
+
* (useful for RLP transport)
|
|
376
|
+
* @param {number} value the bigint to convert
|
|
377
|
+
* @returns {Uint8Array}
|
|
378
|
+
*/
|
|
379
|
+
const intToUnpaddedBytes = (value) => {
|
|
380
|
+
return (0, exports.unpadBytes)((0, exports.intToBytes)(value));
|
|
381
|
+
};
|
|
382
|
+
exports.intToUnpaddedBytes = intToUnpaddedBytes;
|
|
383
|
+
/**
|
|
384
|
+
* Compares two Uint8Arrays and returns a number indicating their order in a sorted array.
|
|
385
|
+
*
|
|
386
|
+
* @param {Uint8Array} value1 - The first Uint8Array to compare.
|
|
387
|
+
* @param {Uint8Array} value2 - The second Uint8Array to compare.
|
|
388
|
+
* @returns {number} A positive number if value1 is larger than value2,
|
|
389
|
+
* A negative number if value1 is smaller than value2,
|
|
390
|
+
* or 0 if value1 and value2 are equal.
|
|
391
|
+
*/
|
|
392
|
+
const compareBytes = (value1, value2) => {
|
|
393
|
+
const bigIntValue1 = (0, exports.bytesToBigInt)(value1);
|
|
394
|
+
const bigIntValue2 = (0, exports.bytesToBigInt)(value2);
|
|
395
|
+
return bigIntValue1 > bigIntValue2 ? 1 : bigIntValue1 < bigIntValue2 ? -1 : 0;
|
|
396
|
+
};
|
|
397
|
+
exports.compareBytes = compareBytes;
|
|
398
|
+
/**
|
|
399
|
+
* Generates a Uint8Array of random bytes of specified length.
|
|
400
|
+
*
|
|
401
|
+
* @param {number} length - The length of the Uint8Array.
|
|
402
|
+
* @returns {Uint8Array} A Uint8Array of random bytes of specified length.
|
|
403
|
+
*/
|
|
404
|
+
const randomBytes = (length) => {
|
|
405
|
+
return (0, utils_js_1.randomBytes)(length);
|
|
406
|
+
};
|
|
407
|
+
exports.randomBytes = randomBytes;
|
|
408
|
+
/**
|
|
409
|
+
* This mirrors the functionality of the `ethereum-cryptography` export except
|
|
410
|
+
* it skips the check to validate that every element of `arrays` is indeed a `uint8Array`
|
|
411
|
+
* Can give small performance gains on large arrays
|
|
412
|
+
* @param {Uint8Array[]} arrays an array of Uint8Arrays
|
|
413
|
+
* @returns {Uint8Array} one Uint8Array with all the elements of the original set
|
|
414
|
+
* works like `Buffer.concat`
|
|
415
|
+
*/
|
|
416
|
+
const concatBytes = (...arrays) => {
|
|
417
|
+
if (arrays.length === 1)
|
|
418
|
+
return arrays[0];
|
|
419
|
+
const length = arrays.reduce((a, arr) => a + arr.length, 0);
|
|
420
|
+
const result = new Uint8Array(length);
|
|
421
|
+
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
422
|
+
const arr = arrays[i];
|
|
423
|
+
result.set(arr, pad);
|
|
424
|
+
pad += arr.length;
|
|
425
|
+
}
|
|
426
|
+
return result;
|
|
427
|
+
};
|
|
428
|
+
exports.concatBytes = concatBytes;
|
|
429
|
+
/**
|
|
430
|
+
* @notice Convert a Uint8Array to a 32-bit integer
|
|
431
|
+
* @param {Uint8Array} bytes The input Uint8Array from which to read the 32-bit integer.
|
|
432
|
+
* @param {boolean} littleEndian True for little-endian, undefined or false for big-endian.
|
|
433
|
+
* @return {number} The 32-bit integer read from the input Uint8Array.
|
|
434
|
+
*/
|
|
435
|
+
function bytesToInt32(bytes, littleEndian = false) {
|
|
436
|
+
if (bytes.length < 4) {
|
|
437
|
+
bytes = setLength(bytes, 4, littleEndian, false);
|
|
438
|
+
}
|
|
439
|
+
const dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
440
|
+
return dataView.getUint32(0, littleEndian);
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* @notice Convert a Uint8Array to a 64-bit bigint
|
|
444
|
+
* @param {Uint8Array} bytes The input Uint8Array from which to read the 64-bit bigint.
|
|
445
|
+
* @param {boolean} littleEndian True for little-endian, undefined or false for big-endian.
|
|
446
|
+
* @return {bigint} The 64-bit bigint read from the input Uint8Array.
|
|
447
|
+
*/
|
|
448
|
+
function bytesToBigInt64(bytes, littleEndian = false) {
|
|
449
|
+
if (bytes.length < 8) {
|
|
450
|
+
bytes = setLength(bytes, 8, littleEndian, false);
|
|
451
|
+
}
|
|
452
|
+
const dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
453
|
+
return dataView.getBigUint64(0, littleEndian);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* @notice Convert a 32-bit integer to a Uint8Array.
|
|
457
|
+
* @param {number} value The 32-bit integer to convert.
|
|
458
|
+
* @param {boolean} littleEndian True for little-endian, undefined or false for big-endian.
|
|
459
|
+
* @return {Uint8Array} A Uint8Array of length 4 containing the integer.
|
|
460
|
+
*/
|
|
461
|
+
function int32ToBytes(value, littleEndian = false) {
|
|
462
|
+
const buffer = new ArrayBuffer(4);
|
|
463
|
+
const dataView = new DataView(buffer);
|
|
464
|
+
dataView.setUint32(0, value, littleEndian);
|
|
465
|
+
return new Uint8Array(buffer);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* @notice Convert a 64-bit bigint to a Uint8Array.
|
|
469
|
+
* @param {bigint} value The 64-bit bigint to convert.
|
|
470
|
+
* @param {boolean} littleEndian True for little-endian, undefined or false for big-endian.
|
|
471
|
+
* @return {Uint8Array} A Uint8Array of length 8 containing the bigint.
|
|
472
|
+
*/
|
|
473
|
+
function bigInt64ToBytes(value, littleEndian = false) {
|
|
474
|
+
const buffer = new ArrayBuffer(8);
|
|
475
|
+
const dataView = new DataView(buffer);
|
|
476
|
+
dataView.setBigUint64(0, value, littleEndian);
|
|
477
|
+
return new Uint8Array(buffer);
|
|
478
|
+
}
|
|
479
|
+
var utils_js_2 = require("@noble/hashes/utils.js");
|
|
480
|
+
Object.defineProperty(exports, "utf8ToBytes", { enumerable: true, get: function () { return utils_js_2.utf8ToBytes; } });
|
|
481
|
+
/**
|
|
482
|
+
* @notice Converts a Uint8Array to a UTF-8 string.
|
|
483
|
+
* Implementation copied from ethereum-cryptography https://github.com/ethereum/js-ethereum-cryptography/blob/31f980b2847545d33268f2510ba38a3836202a44/src/utils.ts#L22-L27
|
|
484
|
+
* @param {Uint8Array} bytes - The input Uint8Array to convert.
|
|
485
|
+
* @returns {string} The UTF-8 string.
|
|
486
|
+
* @throws {TypeError} If the input is not a Uint8Array.
|
|
487
|
+
*
|
|
488
|
+
*/
|
|
489
|
+
function bytesToUtf8(bytes) {
|
|
490
|
+
if (!(bytes instanceof Uint8Array)) {
|
|
491
|
+
throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof bytes}`);
|
|
492
|
+
}
|
|
493
|
+
return new TextDecoder().decode(bytes);
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* @notice Compares two Uint8Arrays and returns true if they are equal.
|
|
497
|
+
* Implementation copied from ethereum-cryptography https://github.com/ethereum/js-ethereum-cryptography/blob/main/src/utils.ts#L35-L45
|
|
498
|
+
* @param {Uint8Array} a - The first Uint8Array to compare.
|
|
499
|
+
* @param {Uint8Array} b - The second Uint8Array to compare.
|
|
500
|
+
* @returns {boolean} True if the Uint8Arrays are equal, false otherwise.
|
|
501
|
+
*/
|
|
502
|
+
function equalsBytes(a, b) {
|
|
503
|
+
if (a.length !== b.length) {
|
|
504
|
+
return false;
|
|
505
|
+
}
|
|
506
|
+
for (let i = 0; i < a.length; i++) {
|
|
507
|
+
if (a[i] !== b[i]) {
|
|
508
|
+
return false;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return true;
|
|
512
|
+
}
|
|
513
|
+
function hexToBigInt(input) {
|
|
514
|
+
return (0, exports.bytesToBigInt)((0, exports.hexToBytes)((0, internal_ts_1.isHexString)(input) ? input : `0x${input}`));
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Converts a Uint8Array of bytes into an array of bits.
|
|
518
|
+
* @param {Uint8Array} bytes - The input byte array.
|
|
519
|
+
* @param {number} bitLength - The number of bits to extract from the input bytes.
|
|
520
|
+
* @returns {number[]} An array of bits (each 0 or 1) corresponding to the input bytes.
|
|
521
|
+
*/
|
|
522
|
+
function bytesToBits(bytes, bitLength) {
|
|
523
|
+
const bits = [];
|
|
524
|
+
for (let i = 0; i < (bitLength ?? bytes.length * 8); i++) {
|
|
525
|
+
const byteIndex = Math.floor(i / 8);
|
|
526
|
+
const bitIndex = 7 - (i % 8);
|
|
527
|
+
bits.push((bytes[byteIndex] >> bitIndex) & 1);
|
|
528
|
+
}
|
|
529
|
+
return bits;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Converts an array of bits into a Uint8Array.
|
|
533
|
+
* The input bits are grouped into sets of 8, with the first bit in each group being the most significant.
|
|
534
|
+
* @param {number[]} bits - The input array of bits (each should be 0 or 1). Its length should be a multiple of 8.
|
|
535
|
+
* @returns {Uint8Array} A Uint8Array constructed from the input bits.
|
|
536
|
+
*/
|
|
537
|
+
function bitsToBytes(bits) {
|
|
538
|
+
const numBytes = Math.ceil(bits.length / 8); // Ensure partial byte storage
|
|
539
|
+
const byteData = new Uint8Array(numBytes);
|
|
540
|
+
for (let i = 0; i < bits.length; i++) {
|
|
541
|
+
const byteIndex = Math.floor(i / 8);
|
|
542
|
+
const bitIndex = 7 - (i % 8);
|
|
543
|
+
byteData[byteIndex] |= bits[i] << bitIndex;
|
|
544
|
+
}
|
|
545
|
+
return byteData;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Compares two byte arrays and returns the count of consecutively matching items from the start.
|
|
549
|
+
* @param {Uint8Array} bytes1 - The first Uint8Array to compare.
|
|
550
|
+
* @param {Uint8Array} bytes2 - The second Uint8Array to compare.
|
|
551
|
+
* @returns {number} The count of consecutively matching items from the start.
|
|
552
|
+
*/
|
|
553
|
+
function matchingBytesLength(bytes1, bytes2) {
|
|
554
|
+
let count = 0;
|
|
555
|
+
const minLength = Math.min(bytes1.length, bytes2.length);
|
|
556
|
+
for (let i = 0; i < minLength; i++) {
|
|
557
|
+
if (bytes1[i] === bytes2[i]) {
|
|
558
|
+
count++;
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
// Break early if a mismatch is found
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return count;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Compares two arrays of bits (0 or 1) and returns the count of consecutively matching bits from the start.
|
|
569
|
+
* @param {number[]} bits1 - The first array of bits, in bytes or bits.
|
|
570
|
+
* @param {number[]} bits2 - The second array of bits, in bytes or bits.
|
|
571
|
+
* @returns {number} The count of consecutively matching bits from the start.
|
|
572
|
+
*/
|
|
573
|
+
function matchingBitsLength(bits1, bits2) {
|
|
574
|
+
let count = 0;
|
|
575
|
+
const minLength = Math.min(bits1.length, bits2.length);
|
|
576
|
+
for (let i = 0; i < minLength; i++) {
|
|
577
|
+
if (bits1[i] === bits2[i]) {
|
|
578
|
+
count++;
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
return count;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return count;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Checks whether two arrays of bits are equal.
|
|
588
|
+
*
|
|
589
|
+
* Two arrays are considered equal if they have the same length and each corresponding element is identical.
|
|
590
|
+
*
|
|
591
|
+
* @param {number[]} bits1 - The first bits array.
|
|
592
|
+
* @param {number[]} bits2 - The second bits array.
|
|
593
|
+
* @returns {boolean} True if the arrays are equal; otherwise, false.
|
|
594
|
+
*/
|
|
595
|
+
function equalsBits(bits1, bits2) {
|
|
596
|
+
if (bits1.length !== bits2.length) {
|
|
597
|
+
return false;
|
|
598
|
+
}
|
|
599
|
+
for (let i = 0; i < bits1.length; i++) {
|
|
600
|
+
if (bits1[i] !== bits2[i]) {
|
|
601
|
+
return false;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return true;
|
|
605
|
+
}
|
|
606
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../src/bytes.ts"],"names":[],"mappings":";;;AA0dA,oCAMC;AAQD,0CAMC;AAQD,oCAKC;AAQD,0CAKC;AAYD,kCAKC;AASD,kCAUC;AAED,kCAEC;AAQD,kCAUC;AAQD,kCAWC;AAQD,kDAaC;AAQD,gDAWC;AAWD,gCAUC;AAlpBD,qDAI+B;AAE/B,2CAAwD;AACxD,6CAA8E;AAC9E,+CAAsE;AAItE,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;AAE1B;;GAEG;AACU,QAAA,oBAAoB,GAAG,qBAAyB,CAAA;AAE7D;;;;;GAKG;AACI,MAAM,UAAU,GAAG,CAAC,GAAsB,EAAc,EAAE;IAC/D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,MAAM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