@gardenfi/utils 2.1.1 → 2.1.2-beta.1

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 (208) hide show
  1. package/dist/index100.cjs +1 -1
  2. package/dist/index100.js +105 -3
  3. package/dist/index101.cjs +1 -1
  4. package/dist/index101.js +16 -10
  5. package/dist/index102.cjs +1 -1
  6. package/dist/index102.js +77 -18
  7. package/dist/index103.cjs +1 -1
  8. package/dist/index103.js +18 -8
  9. package/dist/index104.cjs +1 -1
  10. package/dist/index104.js +1 -1
  11. package/dist/index105.cjs +1 -1
  12. package/dist/index105.js +33 -638
  13. package/dist/index106.cjs +1 -1
  14. package/dist/index106.js +5 -173
  15. package/dist/index107.cjs +1 -1
  16. package/dist/index107.js +10 -18
  17. package/dist/index108.cjs +1 -1
  18. package/dist/index108.js +2 -128
  19. package/dist/index109.cjs +1 -1
  20. package/dist/index109.js +128 -2
  21. package/dist/index110.cjs +1 -1
  22. package/dist/index110.js +7 -2
  23. package/dist/index111.cjs +1 -1
  24. package/dist/index111.js +2 -38
  25. package/dist/index112.cjs +1 -1
  26. package/dist/index112.js +33 -34
  27. package/dist/index113.cjs +1 -2
  28. package/dist/index113.js +21 -3
  29. package/dist/index114.cjs +1 -1
  30. package/dist/index114.js +5 -5
  31. package/dist/index115.cjs +2 -1
  32. package/dist/index115.js +3 -11
  33. package/dist/index116.cjs +1 -1
  34. package/dist/index116.js +18 -6
  35. package/dist/index117.cjs +1 -1
  36. package/dist/index117.js +638 -15
  37. package/dist/index118.cjs +1 -1
  38. package/dist/index118.js +173 -5
  39. package/dist/index15.cjs +1 -1
  40. package/dist/index15.js +2 -2
  41. package/dist/index18.cjs +1 -1
  42. package/dist/index18.js +11 -11
  43. package/dist/index19.cjs +1 -1
  44. package/dist/index19.js +9 -9
  45. package/dist/index20.cjs +1 -1
  46. package/dist/index20.js +17 -18
  47. package/dist/index21.cjs +1 -16
  48. package/dist/index21.js +30 -112
  49. package/dist/index22.cjs +16 -1
  50. package/dist/index22.js +113 -30
  51. package/dist/index23.cjs +1 -1
  52. package/dist/index23.js +17 -41
  53. package/dist/index24.cjs +1 -1
  54. package/dist/index24.js +6 -44
  55. package/dist/index25.cjs +1 -1
  56. package/dist/index25.js +44 -24
  57. package/dist/index26.cjs +1 -1
  58. package/dist/index26.js +21 -6
  59. package/dist/index27.cjs +1 -1
  60. package/dist/index27.js +8 -13
  61. package/dist/index28.cjs +1 -1
  62. package/dist/index28.js +31 -15
  63. package/dist/index29.cjs +1 -1
  64. package/dist/index29.js +26 -5
  65. package/dist/index30.cjs +2 -1
  66. package/dist/index30.js +65 -13
  67. package/dist/index31.cjs +1 -1
  68. package/dist/index31.js +51 -10
  69. package/dist/index32.cjs +1 -1
  70. package/dist/index32.js +12 -12
  71. package/dist/index33.cjs +1 -1
  72. package/dist/index33.js +24 -11
  73. package/dist/index34.cjs +1 -1
  74. package/dist/index34.js +75 -13
  75. package/dist/index35.cjs +1 -1
  76. package/dist/index35.js +1 -1
  77. package/dist/index36.cjs +1 -1
  78. package/dist/index36.js +7 -55
  79. package/dist/index37.cjs +1 -1
  80. package/dist/index37.js +32 -16
  81. package/dist/index38.cjs +1 -1
  82. package/dist/index38.js +15 -5
  83. package/dist/index39.cjs +1 -1
  84. package/dist/index39.js +2 -9
  85. package/dist/index4.cjs +1 -1
  86. package/dist/index4.js +27 -24
  87. package/dist/index40.cjs +1 -1
  88. package/dist/index40.js +8 -171
  89. package/dist/index41.cjs +1 -1
  90. package/dist/index41.js +19 -102
  91. package/dist/index42.cjs +1 -1
  92. package/dist/index42.js +41 -21
  93. package/dist/index43.cjs +1 -1
  94. package/dist/index43.js +25 -17
  95. package/dist/index44.cjs +1 -1
  96. package/dist/index44.js +6 -7
  97. package/dist/index45.cjs +1 -1
  98. package/dist/index45.js +12 -20
  99. package/dist/index46.cjs +1 -1
  100. package/dist/index46.js +15 -8
  101. package/dist/index47.cjs +1 -1
  102. package/dist/index47.js +5 -31
  103. package/dist/index48.cjs +1 -1
  104. package/dist/index48.js +13 -26
  105. package/dist/index49.cjs +1 -2
  106. package/dist/index49.js +10 -65
  107. package/dist/index50.cjs +1 -1
  108. package/dist/index50.js +12 -51
  109. package/dist/index51.cjs +1 -1
  110. package/dist/index51.js +11 -12
  111. package/dist/index52.cjs +1 -1
  112. package/dist/index52.js +13 -24
  113. package/dist/index53.cjs +1 -1
  114. package/dist/index53.js +55 -75
  115. package/dist/index54.cjs +1 -1
  116. package/dist/index54.js +16 -7
  117. package/dist/index55.cjs +1 -1
  118. package/dist/index55.js +5 -32
  119. package/dist/index56.cjs +1 -1
  120. package/dist/index56.js +8 -15
  121. package/dist/index57.cjs +1 -1
  122. package/dist/index57.js +172 -2
  123. package/dist/index58.cjs +1 -1
  124. package/dist/index58.js +102 -7
  125. package/dist/index59.cjs +1 -1
  126. package/dist/index59.js +21 -20
  127. package/dist/index60.cjs +1 -1
  128. package/dist/index60.js +1 -1
  129. package/dist/index62.cjs +1 -1
  130. package/dist/index62.js +6 -112
  131. package/dist/index63.cjs +2 -1
  132. package/dist/index63.js +58 -15
  133. package/dist/index64.cjs +1 -1
  134. package/dist/index64.js +2 -224
  135. package/dist/index65.cjs +1 -2
  136. package/dist/index65.js +5 -58
  137. package/dist/index66.cjs +1 -1
  138. package/dist/index66.js +4 -21
  139. package/dist/index67.cjs +1 -1
  140. package/dist/index67.js +11 -40
  141. package/dist/index68.cjs +5 -1
  142. package/dist/index68.js +51 -29
  143. package/dist/index69.cjs +2 -1
  144. package/dist/index69.js +31 -66
  145. package/dist/index70.cjs +1 -1
  146. package/dist/index70.js +5 -67
  147. package/dist/index71.cjs +1 -1
  148. package/dist/index71.js +4 -2
  149. package/dist/index72.cjs +1 -1
  150. package/dist/index72.js +18 -228
  151. package/dist/index73.cjs +1 -1
  152. package/dist/index73.js +8 -18
  153. package/dist/index74.cjs +1 -1
  154. package/dist/index74.js +10 -42
  155. package/dist/index75.cjs +1 -1
  156. package/dist/index75.js +11 -4
  157. package/dist/index76.cjs +1 -1
  158. package/dist/index76.js +6 -3
  159. package/dist/index77.cjs +1 -1
  160. package/dist/index77.js +13 -8
  161. package/dist/index78.cjs +1 -1
  162. package/dist/index78.js +30 -102
  163. package/dist/index79.cjs +1 -1
  164. package/dist/index79.js +14 -17
  165. package/dist/index80.cjs +1 -1
  166. package/dist/index80.js +64 -8
  167. package/dist/index81.cjs +1 -1
  168. package/dist/index81.js +26 -9
  169. package/dist/index82.cjs +1 -1
  170. package/dist/index82.js +3 -12
  171. package/dist/index83.cjs +1 -1
  172. package/dist/index83.js +3 -13
  173. package/dist/index84.cjs +1 -1
  174. package/dist/index84.js +8 -6
  175. package/dist/index85.cjs +1 -1
  176. package/dist/index85.js +185 -72
  177. package/dist/index86.cjs +1 -1
  178. package/dist/index86.js +18 -14
  179. package/dist/index87.cjs +1 -1
  180. package/dist/index87.js +8 -18
  181. package/dist/index88.cjs +1 -1
  182. package/dist/index88.js +9 -189
  183. package/dist/index89.cjs +1 -1
  184. package/dist/index89.js +18 -63
  185. package/dist/index9.cjs +1 -1
  186. package/dist/index9.js +51 -43
  187. package/dist/index90.cjs +1 -1
  188. package/dist/index90.js +41 -2
  189. package/dist/index91.cjs +1 -1
  190. package/dist/index91.js +34 -6
  191. package/dist/index92.cjs +1 -1
  192. package/dist/index92.js +69 -11
  193. package/dist/index93.cjs +1 -5
  194. package/dist/index93.js +106 -50
  195. package/dist/index94.cjs +1 -2
  196. package/dist/index94.js +65 -32
  197. package/dist/index95.cjs +1 -1
  198. package/dist/index95.js +2 -6
  199. package/dist/index96.cjs +1 -1
  200. package/dist/index96.js +16 -3
  201. package/dist/index97.cjs +1 -1
  202. package/dist/index97.js +223 -6
  203. package/dist/index98.cjs +1 -1
  204. package/dist/index98.js +229 -30
  205. package/dist/index99.cjs +1 -1
  206. package/dist/index99.js +40 -25
  207. package/dist/src/lib/utils.d.ts +1 -1
  208. package/package.json +1 -1
package/dist/index98.js CHANGED
@@ -1,35 +1,234 @@
1
- import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index118.js";
2
- import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index111.js";
3
- import { createCursor as B } from "./index108.js";
4
- import { size as u } from "./index75.js";
5
- import { hexToBytes as x } from "./index36.js";
6
- import { bytesToHex as d } from "./index24.js";
7
- function S(e) {
8
- const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
9
- if (!o)
10
- throw new c();
11
- if (o > y)
12
- throw new h({
13
- maxSize: y,
14
- size: o
15
- });
16
- const s = [];
17
- let n = !0, r = 0;
18
- for (; n; ) {
19
- const t = B(new Uint8Array(a));
20
- let l = 0;
21
- for (; l < f; ) {
22
- const b = i.slice(r, r + (p - 1));
23
- if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
24
- t.pushByte(128), n = !1;
25
- break;
26
- }
27
- l++, r += 31;
1
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
+ const d = /* @__PURE__ */ BigInt(0), y = /* @__PURE__ */ BigInt(1), I = /* @__PURE__ */ BigInt(2);
3
+ function h(t) {
4
+ return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
5
+ }
6
+ function b(t) {
7
+ if (!h(t))
8
+ throw new Error("Uint8Array expected");
9
+ }
10
+ function O(t, n) {
11
+ if (typeof n != "boolean")
12
+ throw new Error(t + " boolean expected, got " + n);
13
+ }
14
+ const T = /* @__PURE__ */ Array.from({ length: 256 }, (t, n) => n.toString(16).padStart(2, "0"));
15
+ function B(t) {
16
+ b(t);
17
+ let n = "";
18
+ for (let r = 0; r < t.length; r++)
19
+ n += T[t[r]];
20
+ return n;
21
+ }
22
+ function S(t) {
23
+ const n = t.toString(16);
24
+ return n.length & 1 ? "0" + n : n;
25
+ }
26
+ function U(t) {
27
+ if (typeof t != "string")
28
+ throw new Error("hex string expected, got " + typeof t);
29
+ return t === "" ? d : BigInt("0x" + t);
30
+ }
31
+ const s = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
32
+ function E(t) {
33
+ if (t >= s._0 && t <= s._9)
34
+ return t - s._0;
35
+ if (t >= s.A && t <= s.F)
36
+ return t - (s.A - 10);
37
+ if (t >= s.a && t <= s.f)
38
+ return t - (s.a - 10);
39
+ }
40
+ function m(t) {
41
+ if (typeof t != "string")
42
+ throw new Error("hex string expected, got " + typeof t);
43
+ const n = t.length, r = n / 2;
44
+ if (n % 2)
45
+ throw new Error("hex string expected, got unpadded hex of length " + n);
46
+ const e = new Uint8Array(r);
47
+ for (let o = 0, i = 0; o < r; o++, i += 2) {
48
+ const a = E(t.charCodeAt(i)), f = E(t.charCodeAt(i + 1));
49
+ if (a === void 0 || f === void 0) {
50
+ const c = t[i] + t[i + 1];
51
+ throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + i);
52
+ }
53
+ e[o] = a * 16 + f;
54
+ }
55
+ return e;
56
+ }
57
+ function V(t) {
58
+ return U(B(t));
59
+ }
60
+ function H(t) {
61
+ return b(t), U(B(Uint8Array.from(t).reverse()));
62
+ }
63
+ function v(t, n) {
64
+ return m(t.toString(16).padStart(n * 2, "0"));
65
+ }
66
+ function C(t, n) {
67
+ return v(t, n).reverse();
68
+ }
69
+ function M(t) {
70
+ return m(S(t));
71
+ }
72
+ function R(t, n, r) {
73
+ let e;
74
+ if (typeof n == "string")
75
+ try {
76
+ e = m(n);
77
+ } catch (i) {
78
+ throw new Error(t + " must be hex string or Uint8Array, cause: " + i);
28
79
  }
29
- s.push(t);
80
+ else if (h(n))
81
+ e = Uint8Array.from(n);
82
+ else
83
+ throw new Error(t + " must be hex string or Uint8Array");
84
+ const o = e.length;
85
+ if (typeof r == "number" && o !== r)
86
+ throw new Error(t + " of length " + r + " expected, got " + o);
87
+ return e;
88
+ }
89
+ function _(...t) {
90
+ let n = 0;
91
+ for (let e = 0; e < t.length; e++) {
92
+ const o = t[e];
93
+ b(o), n += o.length;
94
+ }
95
+ const r = new Uint8Array(n);
96
+ for (let e = 0, o = 0; e < t.length; e++) {
97
+ const i = t[e];
98
+ r.set(i, o), o += i.length;
30
99
  }
31
- return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
100
+ return r;
101
+ }
102
+ function j(t, n) {
103
+ if (t.length !== n.length)
104
+ return !1;
105
+ let r = 0;
106
+ for (let e = 0; e < t.length; e++)
107
+ r |= t[e] ^ n[e];
108
+ return r === 0;
109
+ }
110
+ function z(t) {
111
+ if (typeof t != "string")
112
+ throw new Error("string expected");
113
+ return new Uint8Array(new TextEncoder().encode(t));
114
+ }
115
+ const w = (t) => typeof t == "bigint" && d <= t;
116
+ function N(t, n, r) {
117
+ return w(t) && w(n) && w(r) && n <= t && t < r;
118
+ }
119
+ function D(t, n, r, e) {
120
+ if (!N(n, r, e))
121
+ throw new Error("expected valid " + t + ": " + r + " <= n < " + e + ", got " + n);
122
+ }
123
+ function G(t) {
124
+ let n;
125
+ for (n = 0; t > d; t >>= y, n += 1)
126
+ ;
127
+ return n;
128
+ }
129
+ function P(t, n) {
130
+ return t >> BigInt(n) & y;
131
+ }
132
+ function W(t, n, r) {
133
+ return t | (r ? y : d) << BigInt(n);
134
+ }
135
+ const q = (t) => (I << BigInt(t - 1)) - y, p = (t) => new Uint8Array(t), A = (t) => Uint8Array.from(t);
136
+ function J(t, n, r) {
137
+ if (typeof t != "number" || t < 2)
138
+ throw new Error("hashLen must be a number");
139
+ if (typeof n != "number" || n < 2)
140
+ throw new Error("qByteLen must be a number");
141
+ if (typeof r != "function")
142
+ throw new Error("hmacFn must be a function");
143
+ let e = p(t), o = p(t), i = 0;
144
+ const a = () => {
145
+ e.fill(1), o.fill(0), i = 0;
146
+ }, f = (...u) => r(o, e, ...u), c = (u = p()) => {
147
+ o = f(A([0]), u), e = f(), u.length !== 0 && (o = f(A([1]), u), e = f());
148
+ }, x = () => {
149
+ if (i++ >= 1e3)
150
+ throw new Error("drbg: tried 1000 values");
151
+ let u = 0;
152
+ const l = [];
153
+ for (; u < n; ) {
154
+ e = f();
155
+ const g = e.slice();
156
+ l.push(g), u += e.length;
157
+ }
158
+ return _(...l);
159
+ };
160
+ return (u, l) => {
161
+ a(), c(u);
162
+ let g;
163
+ for (; !(g = l(x())); )
164
+ c();
165
+ return a(), g;
166
+ };
167
+ }
168
+ const k = {
169
+ bigint: (t) => typeof t == "bigint",
170
+ function: (t) => typeof t == "function",
171
+ boolean: (t) => typeof t == "boolean",
172
+ string: (t) => typeof t == "string",
173
+ stringOrUint8Array: (t) => typeof t == "string" || h(t),
174
+ isSafeInteger: (t) => Number.isSafeInteger(t),
175
+ array: (t) => Array.isArray(t),
176
+ field: (t, n) => n.Fp.isValid(t),
177
+ hash: (t) => typeof t == "function" && Number.isSafeInteger(t.outputLen)
178
+ };
179
+ function K(t, n, r = {}) {
180
+ const e = (o, i, a) => {
181
+ const f = k[i];
182
+ if (typeof f != "function")
183
+ throw new Error("invalid validator function");
184
+ const c = t[o];
185
+ if (!(a && c === void 0) && !f(c, t))
186
+ throw new Error("param " + String(o) + " is invalid. Expected " + i + ", got " + c);
187
+ };
188
+ for (const [o, i] of Object.entries(n))
189
+ e(o, i, !1);
190
+ for (const [o, i] of Object.entries(r))
191
+ e(o, i, !0);
192
+ return t;
193
+ }
194
+ const Q = () => {
195
+ throw new Error("not implemented");
196
+ };
197
+ function X(t) {
198
+ const n = /* @__PURE__ */ new WeakMap();
199
+ return (r, ...e) => {
200
+ const o = n.get(r);
201
+ if (o !== void 0)
202
+ return o;
203
+ const i = t(r, ...e);
204
+ return n.set(r, i), i;
205
+ };
32
206
  }
33
207
  export {
34
- S as toBlobs
208
+ D as aInRange,
209
+ O as abool,
210
+ b as abytes,
211
+ P as bitGet,
212
+ G as bitLen,
213
+ q as bitMask,
214
+ W as bitSet,
215
+ B as bytesToHex,
216
+ V as bytesToNumberBE,
217
+ H as bytesToNumberLE,
218
+ _ as concatBytes,
219
+ J as createHmacDrbg,
220
+ R as ensureBytes,
221
+ j as equalBytes,
222
+ m as hexToBytes,
223
+ U as hexToNumber,
224
+ N as inRange,
225
+ h as isBytes,
226
+ X as memoized,
227
+ Q as notImplemented,
228
+ v as numberToBytesBE,
229
+ C as numberToBytesLE,
230
+ S as numberToHexUnpadded,
231
+ M as numberToVarBytesBE,
232
+ z as utf8ToBytes,
233
+ K as validateObject
35
234
  };
package/dist/index99.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index57.cjs"),e=require("./index65.cjs");class i extends e.BaseError{constructor({domain:r}){super(`Invalid domain "${s.stringify(r)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class o extends e.BaseError{constructor({primaryType:r,types:a}){super(`Invalid primary type \`${r}\` must be one of \`${JSON.stringify(Object.keys(a))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class n extends e.BaseError{constructor({type:r}){super(`Struct type "${r}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}exports.InvalidDomainError=i;exports.InvalidPrimaryTypeError=o;exports.InvalidStructTypeError=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index63.cjs"),u=require("./index109.cjs"),f=require("./index53.cjs"),g=require("./index25.cjs");function c(n,e="hex"){const i=o(n),s=u.createCursor(new Uint8Array(i.length));return i.encode(s),e==="hex"?g.bytesToHex(s.bytes):s.bytes}function o(n){return Array.isArray(n)?p(n.map(e=>o(e))):y(n)}function p(n){const e=n.reduce((t,h)=>t+h.length,0),i=l(e);return{length:e<=55?1+e:1+i+e,encode(t){e<=55?t.pushByte(192+e):(t.pushByte(247+i),i===1?t.pushUint8(e):i===2?t.pushUint16(e):i===3?t.pushUint24(e):t.pushUint32(e));for(const{encode:h}of n)h(t)}}}function y(n){const e=typeof n=="string"?f.hexToBytes(n):n,i=l(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+i+e.length,encode(t){e.length===1&&e[0]<128?t.pushBytes(e):e.length<=55?(t.pushByte(128+e.length),t.pushBytes(e)):(t.pushByte(183+i),i===1?t.pushUint8(e.length):i===2?t.pushUint16(e.length):i===3?t.pushUint24(e.length):t.pushUint32(e.length),t.pushBytes(e))}}}function l(n){if(n<2**8)return 1;if(n<2**16)return 2;if(n<2**24)return 3;if(n<2**32)return 4;throw new r.BaseError("Length is too large.")}exports.toRlp=c;
package/dist/index99.js CHANGED
@@ -1,30 +1,45 @@
1
- import { stringify as a } from "./index57.js";
2
- import { BaseError as t } from "./index65.js";
3
- class n extends t {
4
- constructor({ domain: r }) {
5
- super(`Invalid domain "${a(r)}".`, {
6
- metaMessages: ["Must be a valid EIP-712 domain."]
7
- });
8
- }
1
+ import { BaseError as l } from "./index63.js";
2
+ import { createCursor as r } from "./index109.js";
3
+ import { hexToBytes as g } from "./index53.js";
4
+ import { bytesToHex as u } from "./index25.js";
5
+ function m(n, e = "hex") {
6
+ const i = s(n), h = r(new Uint8Array(i.length));
7
+ return i.encode(h), e === "hex" ? u(h.bytes) : h.bytes;
9
8
  }
10
- class p extends t {
11
- constructor({ primaryType: r, types: s }) {
12
- super(`Invalid primary type \`${r}\` must be one of \`${JSON.stringify(Object.keys(s))}\`.`, {
13
- docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
14
- metaMessages: ["Check that the primary type is a key in `types`."]
15
- });
16
- }
9
+ function s(n) {
10
+ return Array.isArray(n) ? p(n.map((e) => s(e))) : y(n);
17
11
  }
18
- class y extends t {
19
- constructor({ type: r }) {
20
- super(`Struct type "${r}" is invalid.`, {
21
- metaMessages: ["Struct type must not be a Solidity type."],
22
- name: "InvalidStructTypeError"
23
- });
24
- }
12
+ function p(n) {
13
+ const e = n.reduce((t, f) => t + f.length, 0), i = o(e);
14
+ return {
15
+ length: e <= 55 ? 1 + e : 1 + i + e,
16
+ encode(t) {
17
+ e <= 55 ? t.pushByte(192 + e) : (t.pushByte(247 + i), i === 1 ? t.pushUint8(e) : i === 2 ? t.pushUint16(e) : i === 3 ? t.pushUint24(e) : t.pushUint32(e));
18
+ for (const { encode: f } of n)
19
+ f(t);
20
+ }
21
+ };
22
+ }
23
+ function y(n) {
24
+ const e = typeof n == "string" ? g(n) : n, i = o(e.length);
25
+ return {
26
+ length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + i + e.length,
27
+ encode(t) {
28
+ e.length === 1 && e[0] < 128 ? t.pushBytes(e) : e.length <= 55 ? (t.pushByte(128 + e.length), t.pushBytes(e)) : (t.pushByte(183 + i), i === 1 ? t.pushUint8(e.length) : i === 2 ? t.pushUint16(e.length) : i === 3 ? t.pushUint24(e.length) : t.pushUint32(e.length), t.pushBytes(e));
29
+ }
30
+ };
31
+ }
32
+ function o(n) {
33
+ if (n < 2 ** 8)
34
+ return 1;
35
+ if (n < 2 ** 16)
36
+ return 2;
37
+ if (n < 2 ** 24)
38
+ return 3;
39
+ if (n < 2 ** 32)
40
+ return 4;
41
+ throw new l("Length is too large.");
25
42
  }
26
43
  export {
27
- n as InvalidDomainError,
28
- p as InvalidPrimaryTypeError,
29
- y as InvalidStructTypeError
44
+ m as toRlp
30
45
  };
@@ -1,7 +1,7 @@
1
1
  export declare const with0x: (str: string) => `0x${string}`;
2
2
  /**
3
3
  * Includes `Bearer ` in the Authorization header
4
- * @param authToken authToken
4
+ * @param authToken
5
5
  * @returns Authorization header
6
6
  */
7
7
  export declare const Authorization: (authToken: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/utils",
3
- "version": "2.1.1",
3
+ "version": "2.1.2-beta.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",