@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.
Files changed (223) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +297 -0
  3. package/dist/cjs/account.d.ts +165 -0
  4. package/dist/cjs/account.d.ts.map +1 -0
  5. package/dist/cjs/account.js +530 -0
  6. package/dist/cjs/account.js.map +1 -0
  7. package/dist/cjs/address.d.ts +67 -0
  8. package/dist/cjs/address.d.ts.map +1 -0
  9. package/dist/cjs/address.js +136 -0
  10. package/dist/cjs/address.js.map +1 -0
  11. package/dist/cjs/authorization.d.ts +41 -0
  12. package/dist/cjs/authorization.d.ts.map +1 -0
  13. package/dist/cjs/authorization.js +135 -0
  14. package/dist/cjs/authorization.js.map +1 -0
  15. package/dist/cjs/bal.d.ts +129 -0
  16. package/dist/cjs/bal.d.ts.map +1 -0
  17. package/dist/cjs/bal.js +529 -0
  18. package/dist/cjs/bal.js.map +1 -0
  19. package/dist/cjs/binaryTree.d.ts +148 -0
  20. package/dist/cjs/binaryTree.d.ts.map +1 -0
  21. package/dist/cjs/binaryTree.js +240 -0
  22. package/dist/cjs/binaryTree.js.map +1 -0
  23. package/dist/cjs/blobs.d.ts +76 -0
  24. package/dist/cjs/blobs.d.ts.map +1 -0
  25. package/dist/cjs/blobs.js +175 -0
  26. package/dist/cjs/blobs.js.map +1 -0
  27. package/dist/cjs/bytes.d.ts +291 -0
  28. package/dist/cjs/bytes.d.ts.map +1 -0
  29. package/dist/cjs/bytes.js +606 -0
  30. package/dist/cjs/bytes.js.map +1 -0
  31. package/dist/cjs/constants.d.ts +91 -0
  32. package/dist/cjs/constants.d.ts.map +1 -0
  33. package/dist/cjs/constants.js +97 -0
  34. package/dist/cjs/constants.js.map +1 -0
  35. package/dist/cjs/db.d.ts +65 -0
  36. package/dist/cjs/db.d.ts.map +1 -0
  37. package/dist/cjs/db.js +14 -0
  38. package/dist/cjs/db.js.map +1 -0
  39. package/dist/cjs/env.d.ts +9 -0
  40. package/dist/cjs/env.d.ts.map +1 -0
  41. package/dist/cjs/env.js +13 -0
  42. package/dist/cjs/env.js.map +1 -0
  43. package/dist/cjs/errors.d.ts +3 -0
  44. package/dist/cjs/errors.d.ts.map +1 -0
  45. package/dist/cjs/errors.js +19 -0
  46. package/dist/cjs/errors.js.map +1 -0
  47. package/dist/cjs/helpers.d.ts +21 -0
  48. package/dist/cjs/helpers.d.ts.map +1 -0
  49. package/dist/cjs/helpers.js +50 -0
  50. package/dist/cjs/helpers.js.map +1 -0
  51. package/dist/cjs/index.d.ts +67 -0
  52. package/dist/cjs/index.d.ts.map +1 -0
  53. package/dist/cjs/index.js +93 -0
  54. package/dist/cjs/index.js.map +1 -0
  55. package/dist/cjs/internal.d.ts +72 -0
  56. package/dist/cjs/internal.d.ts.map +1 -0
  57. package/dist/cjs/internal.js +182 -0
  58. package/dist/cjs/internal.js.map +1 -0
  59. package/dist/cjs/kzg.d.ts +14 -0
  60. package/dist/cjs/kzg.d.ts.map +1 -0
  61. package/dist/cjs/kzg.js +3 -0
  62. package/dist/cjs/kzg.js.map +1 -0
  63. package/dist/cjs/lock.d.ts +15 -0
  64. package/dist/cjs/lock.d.ts.map +1 -0
  65. package/dist/cjs/lock.js +45 -0
  66. package/dist/cjs/lock.js.map +1 -0
  67. package/dist/cjs/mapDB.d.ts +17 -0
  68. package/dist/cjs/mapDB.d.ts.map +1 -0
  69. package/dist/cjs/mapDB.js +46 -0
  70. package/dist/cjs/mapDB.js.map +1 -0
  71. package/dist/cjs/package.json +3 -0
  72. package/dist/cjs/provider.d.ts +46 -0
  73. package/dist/cjs/provider.d.ts.map +1 -0
  74. package/dist/cjs/provider.js +84 -0
  75. package/dist/cjs/provider.js.map +1 -0
  76. package/dist/cjs/request.d.ts +20 -0
  77. package/dist/cjs/request.d.ts.map +1 -0
  78. package/dist/cjs/request.js +35 -0
  79. package/dist/cjs/request.js.map +1 -0
  80. package/dist/cjs/signature.d.ts +47 -0
  81. package/dist/cjs/signature.d.ts.map +1 -0
  82. package/dist/cjs/signature.js +147 -0
  83. package/dist/cjs/signature.js.map +1 -0
  84. package/dist/cjs/tasks.d.ts +32 -0
  85. package/dist/cjs/tasks.d.ts.map +1 -0
  86. package/dist/cjs/tasks.js +51 -0
  87. package/dist/cjs/tasks.js.map +1 -0
  88. package/dist/cjs/types.d.ts +64 -0
  89. package/dist/cjs/types.d.ts.map +1 -0
  90. package/dist/cjs/types.js +78 -0
  91. package/dist/cjs/types.js.map +1 -0
  92. package/dist/cjs/units.d.ts +22 -0
  93. package/dist/cjs/units.d.ts.map +1 -0
  94. package/dist/cjs/units.js +51 -0
  95. package/dist/cjs/units.js.map +1 -0
  96. package/dist/cjs/withdrawal.d.ts +72 -0
  97. package/dist/cjs/withdrawal.d.ts.map +1 -0
  98. package/dist/cjs/withdrawal.js +93 -0
  99. package/dist/cjs/withdrawal.js.map +1 -0
  100. package/dist/esm/account.d.ts +165 -0
  101. package/dist/esm/account.d.ts.map +1 -0
  102. package/dist/esm/account.js +505 -0
  103. package/dist/esm/account.js.map +1 -0
  104. package/dist/esm/address.d.ts +67 -0
  105. package/dist/esm/address.d.ts.map +1 -0
  106. package/dist/esm/address.js +125 -0
  107. package/dist/esm/address.js.map +1 -0
  108. package/dist/esm/authorization.d.ts +41 -0
  109. package/dist/esm/authorization.d.ts.map +1 -0
  110. package/dist/esm/authorization.js +126 -0
  111. package/dist/esm/authorization.js.map +1 -0
  112. package/dist/esm/bal.d.ts +129 -0
  113. package/dist/esm/bal.d.ts.map +1 -0
  114. package/dist/esm/bal.js +522 -0
  115. package/dist/esm/bal.js.map +1 -0
  116. package/dist/esm/binaryTree.d.ts +148 -0
  117. package/dist/esm/binaryTree.d.ts.map +1 -0
  118. package/dist/esm/binaryTree.js +226 -0
  119. package/dist/esm/binaryTree.js.map +1 -0
  120. package/dist/esm/blobs.d.ts +76 -0
  121. package/dist/esm/blobs.d.ts.map +1 -0
  122. package/dist/esm/blobs.js +163 -0
  123. package/dist/esm/blobs.js.map +1 -0
  124. package/dist/esm/bytes.d.ts +291 -0
  125. package/dist/esm/bytes.d.ts.map +1 -0
  126. package/dist/esm/bytes.js +562 -0
  127. package/dist/esm/bytes.js.map +1 -0
  128. package/dist/esm/constants.d.ts +91 -0
  129. package/dist/esm/constants.d.ts.map +1 -0
  130. package/dist/esm/constants.js +94 -0
  131. package/dist/esm/constants.js.map +1 -0
  132. package/dist/esm/db.d.ts +65 -0
  133. package/dist/esm/db.d.ts.map +1 -0
  134. package/dist/esm/db.js +11 -0
  135. package/dist/esm/db.js.map +1 -0
  136. package/dist/esm/env.d.ts +9 -0
  137. package/dist/esm/env.d.ts.map +1 -0
  138. package/dist/esm/env.js +9 -0
  139. package/dist/esm/env.js.map +1 -0
  140. package/dist/esm/errors.d.ts +3 -0
  141. package/dist/esm/errors.d.ts.map +1 -0
  142. package/dist/esm/errors.js +14 -0
  143. package/dist/esm/errors.js.map +1 -0
  144. package/dist/esm/helpers.d.ts +21 -0
  145. package/dist/esm/helpers.d.ts.map +1 -0
  146. package/dist/esm/helpers.js +43 -0
  147. package/dist/esm/helpers.js.map +1 -0
  148. package/dist/esm/index.d.ts +67 -0
  149. package/dist/esm/index.d.ts.map +1 -0
  150. package/dist/esm/index.js +67 -0
  151. package/dist/esm/index.js.map +1 -0
  152. package/dist/esm/internal.d.ts +72 -0
  153. package/dist/esm/internal.d.ts.map +1 -0
  154. package/dist/esm/internal.js +170 -0
  155. package/dist/esm/internal.js.map +1 -0
  156. package/dist/esm/kzg.d.ts +14 -0
  157. package/dist/esm/kzg.d.ts.map +1 -0
  158. package/dist/esm/kzg.js +2 -0
  159. package/dist/esm/kzg.js.map +1 -0
  160. package/dist/esm/lock.d.ts +15 -0
  161. package/dist/esm/lock.d.ts.map +1 -0
  162. package/dist/esm/lock.js +41 -0
  163. package/dist/esm/lock.js.map +1 -0
  164. package/dist/esm/mapDB.d.ts +17 -0
  165. package/dist/esm/mapDB.d.ts.map +1 -0
  166. package/dist/esm/mapDB.js +42 -0
  167. package/dist/esm/mapDB.js.map +1 -0
  168. package/dist/esm/package.json +3 -0
  169. package/dist/esm/provider.d.ts +46 -0
  170. package/dist/esm/provider.d.ts.map +1 -0
  171. package/dist/esm/provider.js +79 -0
  172. package/dist/esm/provider.js.map +1 -0
  173. package/dist/esm/request.d.ts +20 -0
  174. package/dist/esm/request.d.ts.map +1 -0
  175. package/dist/esm/request.js +30 -0
  176. package/dist/esm/request.js.map +1 -0
  177. package/dist/esm/signature.d.ts +47 -0
  178. package/dist/esm/signature.d.ts.map +1 -0
  179. package/dist/esm/signature.js +137 -0
  180. package/dist/esm/signature.js.map +1 -0
  181. package/dist/esm/tasks.d.ts +32 -0
  182. package/dist/esm/tasks.d.ts.map +1 -0
  183. package/dist/esm/tasks.js +47 -0
  184. package/dist/esm/tasks.js.map +1 -0
  185. package/dist/esm/types.d.ts +64 -0
  186. package/dist/esm/types.d.ts.map +1 -0
  187. package/dist/esm/types.js +71 -0
  188. package/dist/esm/types.js.map +1 -0
  189. package/dist/esm/units.d.ts +22 -0
  190. package/dist/esm/units.d.ts.map +1 -0
  191. package/dist/esm/units.js +46 -0
  192. package/dist/esm/units.js.map +1 -0
  193. package/dist/esm/withdrawal.d.ts +72 -0
  194. package/dist/esm/withdrawal.d.ts.map +1 -0
  195. package/dist/esm/withdrawal.js +86 -0
  196. package/dist/esm/withdrawal.js.map +1 -0
  197. package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -0
  198. package/dist/tsconfig.prod.esm.tsbuildinfo +1 -0
  199. package/package.json +116 -0
  200. package/src/account.ts +630 -0
  201. package/src/address.ts +158 -0
  202. package/src/authorization.ts +180 -0
  203. package/src/bal.ts +761 -0
  204. package/src/binaryTree.ts +353 -0
  205. package/src/blobs.ts +209 -0
  206. package/src/bytes.ts +659 -0
  207. package/src/constants.ts +125 -0
  208. package/src/db.ts +86 -0
  209. package/src/env.ts +9 -0
  210. package/src/errors.ts +28 -0
  211. package/src/helpers.ts +46 -0
  212. package/src/index.ts +88 -0
  213. package/src/internal.ts +212 -0
  214. package/src/kzg.ts +24 -0
  215. package/src/lock.ts +42 -0
  216. package/src/mapDB.ts +57 -0
  217. package/src/provider.ts +109 -0
  218. package/src/request.ts +48 -0
  219. package/src/signature.ts +202 -0
  220. package/src/tasks.ts +59 -0
  221. package/src/types.ts +177 -0
  222. package/src/units.ts +56 -0
  223. package/src/withdrawal.ts +133 -0
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.blobsToCellProofs = exports.blobsToCellsAndProofs = exports.blobsToCells = exports.commitmentsToVersionedHashes = exports.computeVersionedHash = exports.blobsToProofs = exports.blobsToCommitments = exports.getBlobs = exports.CELLS_PER_EXT_BLOB = void 0;
4
+ exports.getBlob = getBlob;
5
+ const sha2_js_1 = require("@noble/hashes/sha2.js");
6
+ const bytes_ts_1 = require("./bytes.js");
7
+ /**
8
+ * These utilities for constructing blobs are borrowed from https://github.com/Inphi/eip4844-interop.git
9
+ */
10
+ const BYTES_PER_FIELD_ELEMENT = 32; // EIP-4844
11
+ const FIELD_ELEMENTS_PER_BLOB = 4096; // EIP-4844
12
+ const BLOB_SIZE = BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB;
13
+ const MAX_BLOBS_PER_TX = 6; // EIP-7691: Blob throughput increase, Pectra HF
14
+ const MAX_BLOB_BYTES_PER_TX = BLOB_SIZE * MAX_BLOBS_PER_TX - 1;
15
+ exports.CELLS_PER_EXT_BLOB = 128; // EIP-4844, Consensus Spec, 2 * FIELD_ELEMENTS_PER_BLOB // 64 (FIELD_ELEMENTS_PER_CELL)
16
+ /**
17
+ * Pads input data to blob boundaries with 0x80 marker and zeros.
18
+ * @param data Input data to pad
19
+ * @param blobs_len Number of blobs the data should span
20
+ * @returns Padded data aligned to blob boundaries
21
+ */
22
+ function getPadded(data, blobs_len) {
23
+ const pData = new Uint8Array(blobs_len * BLOB_SIZE);
24
+ pData.set(data);
25
+ pData[data.byteLength] = 0x80;
26
+ return pData;
27
+ }
28
+ /**
29
+ * Converts arbitrary byte data into EIP-4844 blob format.
30
+ * Splits data into 4096 field elements of 32 bytes each, with proper alignment.
31
+ * @param data Input data (must be exactly BLOB_SIZE bytes)
32
+ * @returns Hex-prefixed blob string
33
+ */
34
+ function getBlob(data) {
35
+ const blob = new Uint8Array(BLOB_SIZE);
36
+ for (let i = 0; i < FIELD_ELEMENTS_PER_BLOB; i++) {
37
+ const chunk = new Uint8Array(32);
38
+ chunk.set(data.subarray(i * 31, (i + 1) * 31), 0);
39
+ blob.set(chunk, i * 32);
40
+ }
41
+ return (0, bytes_ts_1.bytesToHex)(blob);
42
+ }
43
+ /**
44
+ * EIP-4844: Converts UTF-8 string(s) into EIP-4844 blob format.
45
+ *
46
+ * Each input string is converted to UTF-8 bytes, padded with 0x80 followed by zeros
47
+ * to align with blob boundaries, and encoded as one or more blobs depending on size.
48
+ * Multiple inputs are processed sequentially, with each input contributing its own blob(s).
49
+ *
50
+ * @param input Single UTF-8 string or array of UTF-8 strings to encode
51
+ * @throws Error with message 'invalid blob data' if any input string is empty
52
+ * @throws Error with message 'blob data is too large' if any single input exceeds MAX_USEFUL_BYTES_PER_TX
53
+ * @returns Array of hex-prefixed blob strings (0x...), one blob per 131,071 useful bytes per input
54
+ */
55
+ const getBlobs = (input) => {
56
+ const inputArray = Array.isArray(input) ? input : [input];
57
+ const blobs = [];
58
+ for (const input of inputArray) {
59
+ const data = (0, bytes_ts_1.utf8ToBytes)(input);
60
+ const len = data.byteLength;
61
+ if (len === 0) {
62
+ throw Error('invalid blob data (0 bytes)');
63
+ }
64
+ if (len > MAX_BLOB_BYTES_PER_TX) {
65
+ throw Error(`blob data is too large (${len} bytes > ${MAX_BLOB_BYTES_PER_TX} bytes)`);
66
+ }
67
+ const blobs_len = Math.ceil(len / BLOB_SIZE);
68
+ const pData = getPadded(data, blobs_len);
69
+ for (let i = 0; i < blobs_len; i++) {
70
+ const chunk = pData.subarray(i * BLOB_SIZE, (i + 1) * BLOB_SIZE);
71
+ const blob = getBlob(chunk);
72
+ blobs.push(blob);
73
+ }
74
+ }
75
+ return blobs;
76
+ };
77
+ exports.getBlobs = getBlobs;
78
+ /**
79
+ * EIP-4844: Computes KZG commitments for a set of blobs.
80
+ * @param kzg KZG implementation used to compute commitments
81
+ * @param blobs Array of blob data as hex-prefixed strings
82
+ * @returns Array of lowercase hex-prefixed KZG commitments (one per blob)
83
+ */
84
+ const blobsToCommitments = (kzg, blobs) => {
85
+ const commitments = [];
86
+ for (const blob of blobs) {
87
+ commitments.push(kzg.blobToKzgCommitment(blob).toLowerCase());
88
+ }
89
+ return commitments;
90
+ };
91
+ exports.blobsToCommitments = blobsToCommitments;
92
+ /**
93
+ * EIP-4844: Computes KZG proofs for each blob/commitment pair.
94
+ * @param kzg KZG implementation used to compute proofs
95
+ * @param blobs Array of blob data as hex-prefixed strings
96
+ * @param commitments Array of corresponding blob commitments
97
+ * @returns Array of lowercase hex-prefixed proofs (aligned with input order)
98
+ */
99
+ const blobsToProofs = (kzg, blobs, commitments) => {
100
+ const proofs = blobs.map((blob, ctx) => kzg.computeBlobProof(blob, commitments[ctx]).toLowerCase());
101
+ return proofs;
102
+ };
103
+ exports.blobsToProofs = blobsToProofs;
104
+ /**
105
+ * EIP-4844: Converts a vector commitment for a given data blob to its versioned hash. For 4844, this version
106
+ * number will be 0x01 for KZG vector commitments but could be different if future vector commitment
107
+ * types are introduced
108
+ * @param commitment a vector commitment to a blob
109
+ * @param blobCommitmentVersion the version number corresponding to the type of vector commitment
110
+ * @returns a versioned hash corresponding to a given blob vector commitment
111
+ */
112
+ const computeVersionedHash = (commitment, blobCommitmentVersion) => {
113
+ const computedVersionedHash = new Uint8Array(32);
114
+ computedVersionedHash.set([blobCommitmentVersion], 0);
115
+ computedVersionedHash.set((0, sha2_js_1.sha256)((0, bytes_ts_1.hexToBytes)(commitment)).subarray(1), 1);
116
+ return (0, bytes_ts_1.bytesToHex)(computedVersionedHash);
117
+ };
118
+ exports.computeVersionedHash = computeVersionedHash;
119
+ /**
120
+ * EIP-4844: Generate an array of versioned hashes from corresponding kzg commitments
121
+ * @param commitments array of kzg commitments
122
+ * @returns array of versioned hashes
123
+ * Note: assumes KZG commitments (version 1 version hashes)
124
+ */
125
+ const commitmentsToVersionedHashes = (commitments) => {
126
+ const hashes = [];
127
+ for (const commitment of commitments) {
128
+ hashes.push((0, exports.computeVersionedHash)(commitment, 0x01));
129
+ }
130
+ return hashes;
131
+ };
132
+ exports.commitmentsToVersionedHashes = commitmentsToVersionedHashes;
133
+ /**
134
+ * EIP-7594: Expands blobs into their extended cells using the provided KZG implementation.
135
+ * @param kzg KZG implementation capable of computing cells
136
+ * @param blobs Array of blob data as hex-prefixed strings
137
+ * @returns Tuple of [cells, indices], where cells are hex strings and indices are 0..127
138
+ */
139
+ const blobsToCells = (kzg, blobs) => {
140
+ const cells = blobs.reduce((acc, elem) => {
141
+ return [...acc, ...kzg.computeCells(elem)];
142
+ }, []);
143
+ const indices = Array.from({ length: exports.CELLS_PER_EXT_BLOB }, (_, i) => i);
144
+ return [cells, indices];
145
+ };
146
+ exports.blobsToCells = blobsToCells;
147
+ /**
148
+ * EIP-7594: Computes extended cells and corresponding proofs for the given blobs.
149
+ * @param kzg KZG implementation capable of computing cells and proofs
150
+ * @param blobs Array of blob data as hex-prefixed strings
151
+ * @returns Tuple of [cells, proofs, indices]; indices are 0..127
152
+ */
153
+ const blobsToCellsAndProofs = (kzg, blobs) => {
154
+ const blobsAndCells = blobs.reduce(([cellsAcc, proofsAcc], elem) => {
155
+ const blobCellsAndProofs = kzg.computeCellsAndProofs(elem);
156
+ return [
157
+ [...cellsAcc, ...blobCellsAndProofs[0]],
158
+ [...proofsAcc, ...blobCellsAndProofs[1]],
159
+ ];
160
+ }, [[], []]);
161
+ const indices = Array.from({ length: exports.CELLS_PER_EXT_BLOB }, (_, i) => i);
162
+ return [...blobsAndCells, indices];
163
+ };
164
+ exports.blobsToCellsAndProofs = blobsToCellsAndProofs;
165
+ /**
166
+ * EIP-7594: Computes cell proofs for the given blobs.
167
+ * @param kzg KZG implementation capable of computing cell proofs
168
+ * @param blobs Array of blob data as hex-prefixed strings
169
+ * @returns Array of lowercase hex-prefixed cell proofs (aligned with input order)
170
+ */
171
+ const blobsToCellProofs = (kzg, blobs) => {
172
+ return (0, exports.blobsToCellsAndProofs)(kzg, blobs)[1];
173
+ };
174
+ exports.blobsToCellProofs = blobsToCellProofs;
175
+ //# sourceMappingURL=blobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blobs.js","sourceRoot":"","sources":["../../src/blobs.ts"],"names":[],"mappings":";;;AAsCA,0BASC;AA/CD,mDAA8C;AAE9C,yCAAgE;AAKhE;;GAEG;AACH,MAAM,uBAAuB,GAAG,EAAE,CAAA,CAAC,WAAW;AAC9C,MAAM,uBAAuB,GAAG,IAAI,CAAA,CAAC,WAAW;AAChD,MAAM,SAAS,GAAG,uBAAuB,GAAG,uBAAuB,CAAA;AAEnE,MAAM,gBAAgB,GAAG,CAAC,CAAA,CAAC,gDAAgD;AAC3E,MAAM,qBAAqB,GAAG,SAAS,GAAG,gBAAgB,GAAG,CAAC,CAAA;AAEjD,QAAA,kBAAkB,GAAG,GAAG,CAAA,CAAC,wFAAwF;AAE9H;;;;;GAKG;AACH,SAAS,SAAS,CAAC,IAAgB,EAAE,SAAiB;IACpD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC,CAAA;IACnD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACf,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAA;IAC7B,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,IAAgB;IACtC,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,CAAA;IACtC,KAAK,IAAI,CAAC,GAAG,CAA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aAAa,GAAG,KAAK,CAAC,MAAM,CAChC,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE;QAC9B,MAAM,kBAAkB,GAAG,GAAG,CAAC,qBAAqB,CAAC,IAAI,CAGxD,CAAA;QACD,OAAO;YACL,CAAC,GAAG,QAAQ,EAAE,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;YACvC,CAAC,GAAG,SAAS,EAAE,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;SACzC,CAAA;IACH,CAAC,EACD,CAAC,EAAyB,EAAE,EAAyB,CAAC,CACvD,CAAA;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,0BAAkB,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IACvE,OAAO,CAAC,GAAG,aAAa,EAAE,OAAO,CAAyD,CAAA;AAC5F,CAAC,CAAA;AApBY,QAAA,qBAAqB,yBAoBjC;AAED;;;;;GAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,GAAQ,EAAE,KAA0B,EAAuB,EAAE;IAC7F,OAAO,IAAA,6BAAqB,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAwB,CAAA;AACpE,CAAC,CAAA;AAFY,QAAA,iBAAiB,qBAE7B"}
@@ -0,0 +1,291 @@
1
+ import { bytesToHex as bytesToUnprefixedHexNoble } from '@noble/hashes/utils.js';
2
+ import type { PrefixedHexString, TransformableToBytes } from './types.ts';
3
+ /**
4
+ * @deprecated
5
+ */
6
+ export declare const bytesToUnprefixedHex: typeof bytesToUnprefixedHexNoble;
7
+ /**
8
+ * Converts a {@link PrefixedHexString} to a {@link Uint8Array}
9
+ * @param {PrefixedHexString} hex The 0x-prefixed hex string to convert
10
+ * @returns {Uint8Array} The converted bytes
11
+ * @throws If the input is not a valid 0x-prefixed hex string
12
+ */
13
+ export declare const hexToBytes: (hex: PrefixedHexString) => Uint8Array;
14
+ export declare const unprefixedHexToBytes: (hex: string) => Uint8Array;
15
+ /**
16
+ * Converts a {@link Uint8Array} to a {@link PrefixedHexString}
17
+ * @param {Uint8Array} bytes the bytes to convert
18
+ * @returns {PrefixedHexString} the hex string
19
+ * @dev Returns `0x` if provided an empty Uint8Array
20
+ */
21
+ export declare const bytesToHex: (bytes: Uint8Array) => PrefixedHexString;
22
+ /**
23
+ * Converts a {@link Uint8Array} to a {@link bigint}
24
+ * @param {Uint8Array} bytes the bytes to convert
25
+ * @returns {bigint}
26
+ */
27
+ export declare const bytesToBigInt: (bytes: Uint8Array, littleEndian?: boolean) => bigint;
28
+ /**
29
+ * Converts a {@link Uint8Array} to a {@link number}.
30
+ * @param {Uint8Array} bytes the bytes to convert
31
+ * @return {number}
32
+ * @throws If the input number exceeds 53 bits.
33
+ */
34
+ export declare const bytesToInt: (bytes: Uint8Array) => number;
35
+ /******************************************/
36
+ /**
37
+ * Converts a {@link number} into a {@link PrefixedHexString}
38
+ * @param {number} i
39
+ * @return {PrefixedHexString}
40
+ */
41
+ export declare const intToHex: (i: number) => PrefixedHexString;
42
+ /**
43
+ * Converts an {@link number} to a {@link Uint8Array}
44
+ * @param {Number} i
45
+ * @return {Uint8Array}
46
+ */
47
+ export declare const intToBytes: (i: number) => Uint8Array;
48
+ /**
49
+ * Converts a {@link bigint} to a {@link Uint8Array}
50
+ * * @param {bigint} num the bigint to convert
51
+ * @returns {Uint8Array}
52
+ */
53
+ export declare const bigIntToBytes: (num: bigint, littleEndian?: boolean) => Uint8Array;
54
+ export interface SetLengthOpts {
55
+ /** Allow truncation if msg exceeds length. Default: false */
56
+ allowTruncate?: boolean;
57
+ }
58
+ /**
59
+ * Left Pads a `Uint8Array` with leading zeros till it has `length` bytes.
60
+ * Throws if input length exceeds target length, unless allowTruncate option is true.
61
+ * @param {Uint8Array} msg the value to pad
62
+ * @param {number} length the number of bytes the output should be
63
+ * @param {SetLengthOpts} opts options object with allowTruncate flag
64
+ * @return {Uint8Array}
65
+ */
66
+ export declare const setLengthLeft: (msg: Uint8Array, length: number, opts?: SetLengthOpts) => Uint8Array;
67
+ /**
68
+ * Right Pads a `Uint8Array` with trailing zeros till it has `length` bytes.
69
+ * Throws if input length exceeds target length, unless allowTruncate option is true.
70
+ * @param {Uint8Array} msg the value to pad
71
+ * @param {number} length the number of bytes the output should be
72
+ * @param {SetLengthOpts} opts options object with allowTruncate flag
73
+ * @return {Uint8Array}
74
+ */
75
+ export declare const setLengthRight: (msg: Uint8Array, length: number, opts?: SetLengthOpts) => Uint8Array;
76
+ /**
77
+ * Trims leading zeros from a `Uint8Array`.
78
+ * @param {Uint8Array} a
79
+ * @return {Uint8Array}
80
+ */
81
+ export declare const unpadBytes: (a: Uint8Array) => Uint8Array;
82
+ /**
83
+ * Trims leading zeros from an `Array` (of numbers).
84
+ * @param {number[]} a
85
+ * @return {number[]}
86
+ */
87
+ export declare const unpadArray: (a: number[]) => number[];
88
+ /**
89
+ * Trims leading zeros from a `PrefixedHexString`.
90
+ * @param {PrefixedHexString} a
91
+ * @return {PrefixedHexString}
92
+ */
93
+ export declare const unpadHex: (a: PrefixedHexString) => PrefixedHexString;
94
+ export type ToBytesInputTypes = PrefixedHexString | number | bigint | Uint8Array | number[] | TransformableToBytes | null | undefined;
95
+ /**
96
+ * Attempts to turn a value into a `Uint8Array`.
97
+ * Inputs supported: `Buffer`, `Uint8Array`, `String` (hex-prefixed), `Number`, null/undefined, `BigInt` and other objects
98
+ * with a `toArray()` or `toBytes()` method.
99
+ * @param {ToBytesInputTypes} v the value
100
+ * @return {Uint8Array}
101
+ */
102
+ export declare const toBytes: (v: ToBytesInputTypes) => Uint8Array;
103
+ /**
104
+ * Interprets a `Uint8Array` as a signed integer and returns a `BigInt`. Assumes 256-bit numbers.
105
+ * @param {Uint8Array} num Signed integer value
106
+ * @returns {bigint}
107
+ */
108
+ export declare const fromSigned: (num: Uint8Array) => bigint;
109
+ /**
110
+ * Converts a `BigInt` to an unsigned integer and returns it as a `Uint8Array`. Assumes 256-bit numbers.
111
+ * @param {bigint} num
112
+ * @returns {Uint8Array}
113
+ */
114
+ export declare const toUnsigned: (num: bigint) => Uint8Array;
115
+ /**
116
+ * Adds "0x" to a given `string` if it does not already start with "0x".
117
+ * @param {string} str
118
+ * @return {PrefixedHexString}
119
+ */
120
+ export declare const addHexPrefix: (str: string) => PrefixedHexString;
121
+ /**
122
+ * Shortens a string or Uint8Array's hex string representation to maxLength (default 50).
123
+ *
124
+ * Examples:
125
+ *
126
+ * Input: '657468657265756d000000000000000000000000000000000000000000000000'
127
+ * Output: '657468657265756d0000000000000000000000000000000000…'
128
+ * @param {Uint8Array | string} bytes
129
+ * @param {number} maxLength
130
+ * @return {string}
131
+ */
132
+ export declare const short: (bytes: Uint8Array | string, maxLength?: number) => string;
133
+ /**
134
+ * Checks provided Uint8Array for leading zeroes and throws if found.
135
+ *
136
+ * Examples:
137
+ *
138
+ * Valid values: 0x1, 0x, 0x01, 0x1234
139
+ * Invalid values: 0x0, 0x00, 0x001, 0x0001
140
+ *
141
+ * Note: This method is useful for validating that RLP encoded integers comply with the rule that all
142
+ * integer values encoded to RLP must be in the most compact form and contain no leading zero bytes
143
+ * @param values An object containing string keys and Uint8Array values
144
+ * @throws if any provided value is found to have leading zero bytes
145
+ */
146
+ export declare const validateNoLeadingZeroes: (values: {
147
+ [key: string]: Uint8Array | undefined;
148
+ }) => void;
149
+ /**
150
+ * Converts a {@link bigint} to a `0x` prefixed hex string
151
+ * @param {bigint} num the bigint to convert
152
+ * @returns {PrefixedHexString}
153
+ */
154
+ export declare const bigIntToHex: (num: bigint) => PrefixedHexString;
155
+ /**
156
+ * Calculates max bigint from an array of bigints
157
+ * @param args array of bigints
158
+ */
159
+ export declare const bigIntMax: (...args: bigint[]) => bigint;
160
+ /**
161
+ * Calculates min BigInt from an array of BigInts
162
+ * @param args array of bigints
163
+ */
164
+ export declare const bigIntMin: (...args: bigint[]) => bigint;
165
+ /**
166
+ * Convert value from bigint to an unpadded Uint8Array
167
+ * (useful for RLP transport)
168
+ * @param {bigint} value the bigint to convert
169
+ * @returns {Uint8Array}
170
+ */
171
+ export declare const bigIntToUnpaddedBytes: (value: bigint) => Uint8Array;
172
+ export declare const bigIntToAddressBytes: (value: bigint, strict?: boolean) => Uint8Array;
173
+ /**
174
+ * Convert value from number to an unpadded Uint8Array
175
+ * (useful for RLP transport)
176
+ * @param {number} value the bigint to convert
177
+ * @returns {Uint8Array}
178
+ */
179
+ export declare const intToUnpaddedBytes: (value: number) => Uint8Array;
180
+ /**
181
+ * Compares two Uint8Arrays and returns a number indicating their order in a sorted array.
182
+ *
183
+ * @param {Uint8Array} value1 - The first Uint8Array to compare.
184
+ * @param {Uint8Array} value2 - The second Uint8Array to compare.
185
+ * @returns {number} A positive number if value1 is larger than value2,
186
+ * A negative number if value1 is smaller than value2,
187
+ * or 0 if value1 and value2 are equal.
188
+ */
189
+ export declare const compareBytes: (value1: Uint8Array, value2: Uint8Array) => number;
190
+ /**
191
+ * Generates a Uint8Array of random bytes of specified length.
192
+ *
193
+ * @param {number} length - The length of the Uint8Array.
194
+ * @returns {Uint8Array} A Uint8Array of random bytes of specified length.
195
+ */
196
+ export declare const randomBytes: (length: number) => Uint8Array;
197
+ /**
198
+ * This mirrors the functionality of the `ethereum-cryptography` export except
199
+ * it skips the check to validate that every element of `arrays` is indeed a `uint8Array`
200
+ * Can give small performance gains on large arrays
201
+ * @param {Uint8Array[]} arrays an array of Uint8Arrays
202
+ * @returns {Uint8Array} one Uint8Array with all the elements of the original set
203
+ * works like `Buffer.concat`
204
+ */
205
+ export declare const concatBytes: (...arrays: Uint8Array[]) => Uint8Array<ArrayBuffer>;
206
+ /**
207
+ * @notice Convert a Uint8Array to a 32-bit integer
208
+ * @param {Uint8Array} bytes The input Uint8Array from which to read the 32-bit integer.
209
+ * @param {boolean} littleEndian True for little-endian, undefined or false for big-endian.
210
+ * @return {number} The 32-bit integer read from the input Uint8Array.
211
+ */
212
+ export declare function bytesToInt32(bytes: Uint8Array, littleEndian?: boolean): number;
213
+ /**
214
+ * @notice Convert a Uint8Array to a 64-bit bigint
215
+ * @param {Uint8Array} bytes The input Uint8Array from which to read the 64-bit bigint.
216
+ * @param {boolean} littleEndian True for little-endian, undefined or false for big-endian.
217
+ * @return {bigint} The 64-bit bigint read from the input Uint8Array.
218
+ */
219
+ export declare function bytesToBigInt64(bytes: Uint8Array, littleEndian?: boolean): bigint;
220
+ /**
221
+ * @notice Convert a 32-bit integer to a Uint8Array.
222
+ * @param {number} value The 32-bit integer to convert.
223
+ * @param {boolean} littleEndian True for little-endian, undefined or false for big-endian.
224
+ * @return {Uint8Array} A Uint8Array of length 4 containing the integer.
225
+ */
226
+ export declare function int32ToBytes(value: number, littleEndian?: boolean): Uint8Array;
227
+ /**
228
+ * @notice Convert a 64-bit bigint to a Uint8Array.
229
+ * @param {bigint} value The 64-bit bigint to convert.
230
+ * @param {boolean} littleEndian True for little-endian, undefined or false for big-endian.
231
+ * @return {Uint8Array} A Uint8Array of length 8 containing the bigint.
232
+ */
233
+ export declare function bigInt64ToBytes(value: bigint, littleEndian?: boolean): Uint8Array;
234
+ export { utf8ToBytes } from '@noble/hashes/utils.js';
235
+ /**
236
+ * @notice Converts a Uint8Array to a UTF-8 string.
237
+ * Implementation copied from ethereum-cryptography https://github.com/ethereum/js-ethereum-cryptography/blob/31f980b2847545d33268f2510ba38a3836202a44/src/utils.ts#L22-L27
238
+ * @param {Uint8Array} bytes - The input Uint8Array to convert.
239
+ * @returns {string} The UTF-8 string.
240
+ * @throws {TypeError} If the input is not a Uint8Array.
241
+ *
242
+ */
243
+ export declare function bytesToUtf8(bytes: Uint8Array): string;
244
+ /**
245
+ * @notice Compares two Uint8Arrays and returns true if they are equal.
246
+ * Implementation copied from ethereum-cryptography https://github.com/ethereum/js-ethereum-cryptography/blob/main/src/utils.ts#L35-L45
247
+ * @param {Uint8Array} a - The first Uint8Array to compare.
248
+ * @param {Uint8Array} b - The second Uint8Array to compare.
249
+ * @returns {boolean} True if the Uint8Arrays are equal, false otherwise.
250
+ */
251
+ export declare function equalsBytes(a: Uint8Array, b: Uint8Array): boolean;
252
+ export declare function hexToBigInt(input: PrefixedHexString): bigint;
253
+ /**
254
+ * Converts a Uint8Array of bytes into an array of bits.
255
+ * @param {Uint8Array} bytes - The input byte array.
256
+ * @param {number} bitLength - The number of bits to extract from the input bytes.
257
+ * @returns {number[]} An array of bits (each 0 or 1) corresponding to the input bytes.
258
+ */
259
+ export declare function bytesToBits(bytes: Uint8Array, bitLength?: number): number[];
260
+ /**
261
+ * Converts an array of bits into a Uint8Array.
262
+ * The input bits are grouped into sets of 8, with the first bit in each group being the most significant.
263
+ * @param {number[]} bits - The input array of bits (each should be 0 or 1). Its length should be a multiple of 8.
264
+ * @returns {Uint8Array} A Uint8Array constructed from the input bits.
265
+ */
266
+ export declare function bitsToBytes(bits: number[]): Uint8Array;
267
+ /**
268
+ * Compares two byte arrays and returns the count of consecutively matching items from the start.
269
+ * @param {Uint8Array} bytes1 - The first Uint8Array to compare.
270
+ * @param {Uint8Array} bytes2 - The second Uint8Array to compare.
271
+ * @returns {number} The count of consecutively matching items from the start.
272
+ */
273
+ export declare function matchingBytesLength(bytes1: Uint8Array, bytes2: Uint8Array): number;
274
+ /**
275
+ * Compares two arrays of bits (0 or 1) and returns the count of consecutively matching bits from the start.
276
+ * @param {number[]} bits1 - The first array of bits, in bytes or bits.
277
+ * @param {number[]} bits2 - The second array of bits, in bytes or bits.
278
+ * @returns {number} The count of consecutively matching bits from the start.
279
+ */
280
+ export declare function matchingBitsLength(bits1: number[], bits2: number[]): number;
281
+ /**
282
+ * Checks whether two arrays of bits are equal.
283
+ *
284
+ * Two arrays are considered equal if they have the same length and each corresponding element is identical.
285
+ *
286
+ * @param {number[]} bits1 - The first bits array.
287
+ * @param {number[]} bits2 - The second bits array.
288
+ * @returns {boolean} True if the arrays are equal; otherwise, false.
289
+ */
290
+ export declare function equalsBits(bits1: number[], bits2: number[]): boolean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