@coinbase/cdp-hooks 0.0.95 → 0.0.97

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 (293) hide show
  1. package/dist/esm/index100.js +35 -42
  2. package/dist/esm/index101.js +9 -88
  3. package/dist/esm/index102.js +31 -40
  4. package/dist/esm/index103.js +35 -7
  5. package/dist/esm/index104.js +7 -4
  6. package/dist/esm/index105.js +29 -16
  7. package/dist/esm/index106.js +46 -8
  8. package/dist/esm/index107.js +69 -13
  9. package/dist/esm/index108.js +40 -7
  10. package/dist/esm/index109.js +75 -9
  11. package/dist/esm/index110.js +30 -15
  12. package/dist/esm/index111.js +6 -46
  13. package/dist/esm/index112.js +16 -13
  14. package/dist/esm/index113.js +8 -16
  15. package/dist/esm/index114.js +13 -13
  16. package/dist/esm/index115.js +6 -5
  17. package/dist/esm/index116.js +9 -35
  18. package/dist/esm/index117.js +15 -8
  19. package/dist/esm/index118.js +11 -7
  20. package/dist/esm/index119.js +45 -24
  21. package/dist/esm/index120.js +13 -10
  22. package/dist/esm/index121.js +15 -13
  23. package/dist/esm/index122.js +13 -11
  24. package/dist/esm/index123.js +6 -116
  25. package/dist/esm/index124.js +34 -32
  26. package/dist/esm/index125.js +9 -79
  27. package/dist/esm/index126.js +8 -177
  28. package/dist/esm/index127.js +27 -43
  29. package/dist/esm/index128.js +10 -6
  30. package/dist/esm/index129.js +13 -12
  31. package/dist/esm/index130.js +11 -13
  32. package/dist/esm/index131.js +118 -97
  33. package/dist/esm/index132.js +32 -71
  34. package/dist/esm/index133.js +77 -84
  35. package/dist/esm/index134.js +174 -145
  36. package/dist/esm/index135.js +43 -135
  37. package/dist/esm/index136.js +6 -68
  38. package/dist/esm/index137.js +152 -21
  39. package/dist/esm/index138.js +14 -105
  40. package/dist/esm/index139.js +14 -6
  41. package/dist/esm/index140.js +98 -130
  42. package/dist/esm/index141.js +72 -275
  43. package/dist/esm/index142.js +88 -3
  44. package/dist/esm/index143.js +149 -4
  45. package/dist/esm/index144.js +137 -9
  46. package/dist/esm/index145.js +69 -2
  47. package/dist/esm/index146.js +24 -2
  48. package/dist/esm/index147.js +159 -3
  49. package/dist/esm/index148.js +6 -326
  50. package/dist/esm/index149.js +11 -13
  51. package/dist/esm/index150.js +19 -4
  52. package/dist/esm/index151.js +134 -54
  53. package/dist/esm/index152.js +79 -2
  54. package/dist/esm/index153.js +8 -6
  55. package/dist/esm/index154.js +26 -212
  56. package/dist/esm/index155.js +89 -31
  57. package/dist/esm/index156.js +351 -22
  58. package/dist/esm/index157.js +3 -6
  59. package/dist/esm/index158.js +5 -74
  60. package/dist/esm/index159.js +2 -6
  61. package/dist/esm/index160.js +3 -6
  62. package/dist/esm/index161.js +9 -36
  63. package/dist/esm/index162.js +303 -52
  64. package/dist/esm/index163.js +14 -3
  65. package/dist/esm/index164.js +4 -23
  66. package/dist/esm/index165.js +40 -436
  67. package/dist/esm/index166.js +8 -26
  68. package/dist/esm/index167.js +2 -27
  69. package/dist/esm/index168.js +6 -32
  70. package/dist/esm/index169.js +28 -32
  71. package/dist/esm/index170.js +196 -175
  72. package/dist/esm/index171.js +32 -9
  73. package/dist/esm/index172.js +22 -2
  74. package/dist/esm/index173.js +5 -12
  75. package/dist/esm/index174.js +68 -13
  76. package/dist/esm/index175.js +5 -27
  77. package/dist/esm/index176.js +5 -8
  78. package/dist/esm/index177.js +31 -51
  79. package/dist/esm/index178.js +116 -42
  80. package/dist/esm/index179.js +3 -9
  81. package/dist/esm/index180.js +18 -7
  82. package/dist/esm/index181.js +25 -15
  83. package/dist/esm/index182.js +31 -16
  84. package/dist/esm/index183.js +34 -24
  85. package/dist/esm/index184.js +23 -16
  86. package/dist/esm/index185.js +8 -54
  87. package/dist/esm/index186.js +193 -11
  88. package/dist/esm/index187.js +2 -161
  89. package/dist/esm/index188.js +467 -21
  90. package/dist/esm/index189.js +26 -126
  91. package/dist/esm/index190.js +153 -31
  92. package/dist/esm/index191.js +21 -6
  93. package/dist/esm/index192.js +127 -27
  94. package/dist/esm/index193.js +31 -184
  95. package/dist/esm/index194.js +7 -4
  96. package/dist/esm/index195.js +26 -63
  97. package/dist/esm/index196.js +56 -3
  98. package/dist/esm/index197.js +42 -17
  99. package/dist/esm/index198.js +188 -13
  100. package/dist/esm/index199.js +4 -24
  101. package/dist/esm/index2.js +2 -2
  102. package/dist/esm/index200.js +73 -11
  103. package/dist/esm/index201.js +17 -31
  104. package/dist/esm/index202.js +3 -3
  105. package/dist/esm/index203.js +15 -17
  106. package/dist/esm/index204.js +22 -26
  107. package/dist/esm/index205.js +11 -35
  108. package/dist/esm/index206.js +18 -7
  109. package/dist/esm/index207.js +32 -23
  110. package/dist/esm/index208.js +3 -29
  111. package/dist/esm/index209.js +18 -64
  112. package/dist/esm/index210.js +27 -9
  113. package/dist/esm/index211.js +34 -32
  114. package/dist/esm/index212.js +8 -27
  115. package/dist/esm/index213.js +7 -24
  116. package/dist/esm/index214.js +25 -3
  117. package/dist/esm/index215.js +28 -14
  118. package/dist/esm/index216.js +3 -103
  119. package/dist/esm/index217.js +75 -60
  120. package/dist/esm/index218.js +9 -5
  121. package/dist/esm/index219.js +12 -6
  122. package/dist/esm/index220.js +20 -26
  123. package/dist/esm/index221.js +8 -38
  124. package/dist/esm/index222.js +10 -13
  125. package/dist/esm/index223.js +11 -42
  126. package/dist/esm/index224.js +6 -5
  127. package/dist/esm/index225.js +6 -11
  128. package/dist/esm/index226.js +13 -19
  129. package/dist/esm/index227.js +30 -76
  130. package/dist/esm/index228.js +5 -2
  131. package/dist/esm/index229.js +2 -2
  132. package/dist/esm/index230.js +8 -8
  133. package/dist/esm/index231.js +3 -3
  134. package/dist/esm/index232.js +5 -5
  135. package/dist/esm/index233.js +17 -8
  136. package/dist/esm/index234.js +19 -6
  137. package/dist/esm/index235.js +42 -6
  138. package/dist/esm/index236.js +42 -11
  139. package/dist/esm/index237.js +8 -10
  140. package/dist/esm/index238.js +7 -13
  141. package/dist/esm/index239.js +15 -31
  142. package/dist/esm/index240.js +23 -5
  143. package/dist/esm/index241.js +22 -6
  144. package/dist/esm/index242.js +16 -19
  145. package/dist/esm/index243.js +52 -29
  146. package/dist/esm/index244.js +27 -20
  147. package/dist/esm/index245.js +24 -3
  148. package/dist/esm/index246.js +104 -17
  149. package/dist/esm/index247.js +3 -11
  150. package/dist/esm/index248.js +5 -21
  151. package/dist/esm/index249.js +31 -22
  152. package/dist/esm/index250.js +20 -5
  153. package/dist/esm/index251.js +3 -5
  154. package/dist/esm/index252.js +17 -8
  155. package/dist/esm/index253.js +5 -104
  156. package/dist/esm/index254.js +9 -3
  157. package/dist/esm/index255.js +102 -17
  158. package/dist/esm/index256.js +60 -167
  159. package/dist/esm/index257.js +5 -17
  160. package/dist/esm/index258.js +7 -10
  161. package/dist/esm/index259.js +27 -38
  162. package/dist/esm/index260.js +34 -2
  163. package/dist/esm/index261.js +13 -69
  164. package/dist/esm/index262.js +16 -34
  165. package/dist/esm/index263.js +77 -13
  166. package/dist/esm/index264.js +2 -41
  167. package/dist/esm/index265.js +15 -2
  168. package/dist/esm/index266.js +18 -4
  169. package/dist/esm/index267.js +170 -9
  170. package/dist/esm/index268.js +16 -18
  171. package/dist/esm/index269.js +10 -7
  172. package/dist/esm/index270.js +10 -12
  173. package/dist/esm/index271.js +2 -67
  174. package/dist/esm/index272.js +39 -64
  175. package/dist/esm/index273.js +2 -186
  176. package/dist/esm/index274.js +4 -22
  177. package/dist/esm/index275.js +9 -41
  178. package/dist/esm/index276.js +17 -74
  179. package/dist/esm/index277.js +7 -40
  180. package/dist/esm/index278.js +10 -15
  181. package/dist/esm/index279.js +72 -13
  182. package/dist/esm/index280.js +65 -7
  183. package/dist/esm/index281.js +187 -6
  184. package/dist/esm/index282.js +21 -35
  185. package/dist/esm/index283.js +42 -15
  186. package/dist/esm/index284.js +25 -8
  187. package/dist/esm/index285.js +91 -13
  188. package/dist/esm/index286.js +40 -9
  189. package/dist/esm/index287.js +15 -15
  190. package/dist/esm/index288.js +12 -21
  191. package/dist/esm/index289.js +7 -30
  192. package/dist/esm/index290.js +7 -2
  193. package/dist/esm/index291.js +36 -13
  194. package/dist/esm/index292.js +15 -12
  195. package/dist/esm/index293.js +8 -47
  196. package/dist/esm/index294.js +8 -9
  197. package/dist/esm/index295.js +16 -13
  198. package/dist/esm/index296.js +21 -13
  199. package/dist/esm/index297.js +28 -6
  200. package/dist/esm/index298.js +2 -16
  201. package/dist/esm/index299.js +12 -23
  202. package/dist/esm/index3.js +1 -1
  203. package/dist/esm/index300.js +12 -11
  204. package/dist/esm/index301.js +45 -22
  205. package/dist/esm/index302.js +9 -51
  206. package/dist/esm/index303.js +13 -17
  207. package/dist/esm/index304.js +13 -14
  208. package/dist/esm/index305.js +14 -11
  209. package/dist/esm/index306.js +8 -103
  210. package/dist/esm/index307.js +15 -5
  211. package/dist/esm/index308.js +23 -222
  212. package/dist/esm/index309.js +24 -6
  213. package/dist/esm/index310.js +32 -7
  214. package/dist/esm/index311.js +9 -26
  215. package/dist/esm/index312.js +49 -17
  216. package/dist/esm/index313.js +34 -142
  217. package/dist/esm/index314.js +18 -13
  218. package/dist/esm/index315.js +15 -36
  219. package/dist/esm/index316.js +11 -41
  220. package/dist/esm/index317.js +13 -2
  221. package/dist/esm/index318.js +19 -68
  222. package/dist/esm/index319.js +107 -3
  223. package/dist/esm/index320.js +100 -133
  224. package/dist/esm/index321.js +6 -155
  225. package/dist/esm/index322.js +7 -10
  226. package/dist/esm/index323.js +26 -16
  227. package/dist/esm/index324.js +12 -110
  228. package/dist/esm/index325.js +206 -127
  229. package/dist/esm/index326.js +12 -78
  230. package/dist/esm/index327.js +36 -2
  231. package/dist/esm/index328.js +41 -697
  232. package/dist/esm/index329.js +3 -138
  233. package/dist/esm/index330.js +68 -42
  234. package/dist/esm/index331.js +3 -200
  235. package/dist/esm/index332.js +136 -3
  236. package/dist/esm/index333.js +155 -46
  237. package/dist/esm/index334.js +9 -4
  238. package/dist/esm/index335.js +16 -40
  239. package/dist/esm/index336.js +133 -7
  240. package/dist/esm/index337.js +187 -56
  241. package/dist/esm/index338.js +2 -78
  242. package/dist/esm/index339.js +79 -4
  243. package/dist/esm/index340.js +11 -191
  244. package/dist/esm/index341.js +82 -55
  245. package/dist/esm/index342.js +159 -40
  246. package/dist/esm/index343.js +42 -4
  247. package/dist/esm/index344.js +656 -5
  248. package/dist/esm/index345.js +206 -2
  249. package/dist/esm/index346.js +174 -19
  250. package/dist/esm/index347.js +43 -0
  251. package/dist/esm/index348.js +7 -0
  252. package/dist/esm/index349.js +10 -0
  253. package/dist/esm/index350.js +65 -0
  254. package/dist/esm/index351.js +80 -0
  255. package/dist/esm/index352.js +122 -0
  256. package/dist/esm/index353.js +345 -0
  257. package/dist/esm/index354.js +163 -0
  258. package/dist/esm/index355.js +7 -0
  259. package/dist/esm/index356.js +7 -0
  260. package/dist/esm/index357.js +55 -0
  261. package/dist/esm/index358.js +7 -0
  262. package/dist/esm/index359.js +4 -0
  263. package/dist/esm/index360.js +24 -0
  264. package/dist/esm/index71.js +26 -17
  265. package/dist/esm/index73.js +2 -2
  266. package/dist/esm/index74.js +12 -40
  267. package/dist/esm/index75.js +49 -58
  268. package/dist/esm/index76.js +13 -43
  269. package/dist/esm/index77.js +28 -5
  270. package/dist/esm/index78.js +30 -48
  271. package/dist/esm/index79.js +29 -32
  272. package/dist/esm/index80.js +56 -4
  273. package/dist/esm/index81.js +54 -10
  274. package/dist/esm/index82.js +57 -67
  275. package/dist/esm/index83.js +5 -10
  276. package/dist/esm/index84.js +47 -28
  277. package/dist/esm/index85.js +37 -69
  278. package/dist/esm/index86.js +2 -20
  279. package/dist/esm/index87.js +69 -110
  280. package/dist/esm/index88.js +34 -60
  281. package/dist/esm/index89.js +13 -23
  282. package/dist/esm/index90.js +33 -39
  283. package/dist/esm/index91.js +3 -37
  284. package/dist/esm/index92.js +8 -57
  285. package/dist/esm/index93.js +118 -163
  286. package/dist/esm/index94.js +58 -36
  287. package/dist/esm/index95.js +23 -8
  288. package/dist/esm/index96.js +36 -31
  289. package/dist/esm/index97.js +38 -33
  290. package/dist/esm/index98.js +58 -9
  291. package/dist/esm/index99.js +164 -25
  292. package/dist/types/index.d.ts +1 -3
  293. package/package.json +4 -4
@@ -0,0 +1,122 @@
1
+ import { BaseError as c } from "./index341.js";
2
+ import { padRight as g, fromBytes as m, toNumber as h, toBigInt as z } from "./index333.js";
3
+ import { charCodeToBase16 as b, assertSize as o, trim as y, pad as p } from "./index357.js";
4
+ import { assertSize as x } from "./index347.js";
5
+ const B = /* @__PURE__ */ new TextDecoder(), $ = /* @__PURE__ */ new TextEncoder();
6
+ function U(e) {
7
+ return e instanceof Uint8Array ? e : typeof e == "string" ? S(e) : w(e);
8
+ }
9
+ function w(e) {
10
+ return e instanceof Uint8Array ? e : new Uint8Array(e);
11
+ }
12
+ function S(e, r = {}) {
13
+ const { size: n } = r;
14
+ let t = e;
15
+ n && (x(e, n), t = g(e, n));
16
+ let i = t.slice(2);
17
+ i.length % 2 && (i = `0${i}`);
18
+ const a = i.length / 2, f = new Uint8Array(a);
19
+ for (let u = 0, s = 0; u < a; u++) {
20
+ const d = b(i.charCodeAt(s++)), l = b(i.charCodeAt(s++));
21
+ if (d === void 0 || l === void 0)
22
+ throw new c(`Invalid byte sequence ("${i[s - 2]}${i[s - 1]}" in "${i}").`);
23
+ f[u] = d << 4 | l;
24
+ }
25
+ return f;
26
+ }
27
+ function j(e, r = {}) {
28
+ const { size: n } = r, t = $.encode(e);
29
+ return typeof n == "number" ? (o(t, n), E(t, n)) : t;
30
+ }
31
+ function E(e, r) {
32
+ return p(e, { dir: "right", size: r });
33
+ }
34
+ function T(e) {
35
+ return e.length;
36
+ }
37
+ function _(e, r, n, t = {}) {
38
+ const { strict: i } = t;
39
+ return e.slice(r, n);
40
+ }
41
+ function L(e, r = {}) {
42
+ const { size: n } = r;
43
+ typeof n < "u" && o(e, n);
44
+ const t = m(e, r);
45
+ return z(t, r);
46
+ }
47
+ function N(e, r = {}) {
48
+ const { size: n } = r;
49
+ let t = e;
50
+ if (typeof n < "u" && (o(t, n), t = A(t)), t.length > 1 || t[0] > 1)
51
+ throw new I(t);
52
+ return !!t[0];
53
+ }
54
+ function q(e, r = {}) {
55
+ const { size: n } = r;
56
+ typeof n < "u" && o(e, n);
57
+ const t = m(e, r);
58
+ return h(t, r);
59
+ }
60
+ function D(e, r = {}) {
61
+ const { size: n } = r;
62
+ let t = e;
63
+ return typeof n < "u" && (o(t, n), t = v(t)), B.decode(t);
64
+ }
65
+ function A(e) {
66
+ return y(e, { dir: "left" });
67
+ }
68
+ function v(e) {
69
+ return y(e, { dir: "right" });
70
+ }
71
+ class I extends c {
72
+ constructor(r) {
73
+ super(`Bytes value \`${r}\` is not a valid boolean.`, {
74
+ metaMessages: [
75
+ "The bytes array must contain a single byte of either a `0` or `1` value."
76
+ ]
77
+ }), Object.defineProperty(this, "name", {
78
+ enumerable: !0,
79
+ configurable: !0,
80
+ writable: !0,
81
+ value: "Bytes.InvalidBytesBooleanError"
82
+ });
83
+ }
84
+ }
85
+ class G extends c {
86
+ constructor({ givenSize: r, maxSize: n }) {
87
+ super(`Size cannot exceed \`${n}\` bytes. Given size: \`${r}\` bytes.`), Object.defineProperty(this, "name", {
88
+ enumerable: !0,
89
+ configurable: !0,
90
+ writable: !0,
91
+ value: "Bytes.SizeOverflowError"
92
+ });
93
+ }
94
+ }
95
+ class H extends c {
96
+ constructor({ size: r, targetSize: n, type: t }) {
97
+ super(`${t.charAt(0).toUpperCase()}${t.slice(1).toLowerCase()} size (\`${r}\`) exceeds padding size (\`${n}\`).`), Object.defineProperty(this, "name", {
98
+ enumerable: !0,
99
+ configurable: !0,
100
+ writable: !0,
101
+ value: "Bytes.SizeExceedsPaddingSizeError"
102
+ });
103
+ }
104
+ }
105
+ export {
106
+ I as InvalidBytesBooleanError,
107
+ H as SizeExceedsPaddingSizeError,
108
+ G as SizeOverflowError,
109
+ U as from,
110
+ w as fromArray,
111
+ S as fromHex,
112
+ j as fromString,
113
+ E as padRight,
114
+ T as size,
115
+ _ as slice,
116
+ L as toBigInt,
117
+ N as toBoolean,
118
+ q as toNumber,
119
+ D as toString,
120
+ A as trimLeft,
121
+ v as trimRight
122
+ };
@@ -0,0 +1,345 @@
1
+ import { InvalidTypeError as C, InvalidArrayError as _, ArrayLengthMismatchError as $, BytesSizeMismatchError as O } from "./index337.js";
2
+ import { assert as M, checksum as R } from "./index351.js";
3
+ import { toNumber as u, slice as T, toBoolean as D, toBigInt as U, toString as V, trimLeft as j } from "./index352.js";
4
+ import { BaseError as q } from "./index341.js";
5
+ import { size as h, fromNumber as B, concat as m, fromBytes as w, padLeft as S, fromBoolean as F, IntegerOutOfRangeError as G, padRight as b, fromString as H, slice as J } from "./index333.js";
6
+ import { integerRegex as K } from "./index355.js";
7
+ function l(t, e, s) {
8
+ const { checksumAddress: n, staticPosition: o } = s, i = I(e.type);
9
+ if (i) {
10
+ const [r, d] = i;
11
+ return X(t, { ...e, type: d }, { checksumAddress: n, length: r, staticPosition: o });
12
+ }
13
+ if (e.type === "tuple")
14
+ return tt(t, e, {
15
+ checksumAddress: n,
16
+ staticPosition: o
17
+ });
18
+ if (e.type === "address")
19
+ return Q(t, { checksum: n });
20
+ if (e.type === "bool")
21
+ return Y(t);
22
+ if (e.type.startsWith("bytes"))
23
+ return Z(t, e, { staticPosition: o });
24
+ if (e.type.startsWith("uint") || e.type.startsWith("int"))
25
+ return v(t, e);
26
+ if (e.type === "string")
27
+ return et(t, { staticPosition: o });
28
+ throw new C(e.type);
29
+ }
30
+ const k = 32, A = 32;
31
+ function Q(t, e = {}) {
32
+ const { checksum: s = !1 } = e, n = t.readBytes(32);
33
+ return [((i) => s ? R(i) : i)(w(T(n, -20))), 32];
34
+ }
35
+ function X(t, e, s) {
36
+ const { checksumAddress: n, length: o, staticPosition: i } = s;
37
+ if (!o) {
38
+ const c = u(t.readBytes(A)), a = i + c, f = a + k;
39
+ t.setPosition(a);
40
+ const y = u(t.readBytes(k)), p = g(e);
41
+ let P = 0;
42
+ const N = [];
43
+ for (let z = 0; z < y; ++z) {
44
+ t.setPosition(f + (p ? z * 32 : P));
45
+ const [L, E] = l(t, e, {
46
+ checksumAddress: n,
47
+ staticPosition: f
48
+ });
49
+ P += E, N.push(L);
50
+ }
51
+ return t.setPosition(i + 32), [N, 32];
52
+ }
53
+ if (g(e)) {
54
+ const c = u(t.readBytes(A)), a = i + c, f = [];
55
+ for (let y = 0; y < o; ++y) {
56
+ t.setPosition(a + y * 32);
57
+ const [p] = l(t, e, {
58
+ checksumAddress: n,
59
+ staticPosition: a
60
+ });
61
+ f.push(p);
62
+ }
63
+ return t.setPosition(i + 32), [f, 32];
64
+ }
65
+ let r = 0;
66
+ const d = [];
67
+ for (let c = 0; c < o; ++c) {
68
+ const [a, f] = l(t, e, {
69
+ checksumAddress: n,
70
+ staticPosition: i + r
71
+ });
72
+ r += f, d.push(a);
73
+ }
74
+ return [d, r];
75
+ }
76
+ function Y(t) {
77
+ return [D(t.readBytes(32), { size: 32 }), 32];
78
+ }
79
+ function Z(t, e, { staticPosition: s }) {
80
+ const [n, o] = e.type.split("bytes");
81
+ if (!o) {
82
+ const r = u(t.readBytes(32));
83
+ t.setPosition(s + r);
84
+ const d = u(t.readBytes(32));
85
+ if (d === 0)
86
+ return t.setPosition(s + 32), ["0x", 32];
87
+ const c = t.readBytes(d);
88
+ return t.setPosition(s + 32), [w(c), 32];
89
+ }
90
+ return [w(t.readBytes(Number.parseInt(o, 10), 32)), 32];
91
+ }
92
+ function v(t, e) {
93
+ const s = e.type.startsWith("int"), n = Number.parseInt(e.type.split("int")[1] || "256", 10), o = t.readBytes(32);
94
+ return [
95
+ n > 48 ? U(o, { signed: s }) : u(o, { signed: s }),
96
+ 32
97
+ ];
98
+ }
99
+ function tt(t, e, s) {
100
+ const { checksumAddress: n, staticPosition: o } = s, i = e.components.length === 0 || e.components.some(({ name: c }) => !c), r = i ? [] : {};
101
+ let d = 0;
102
+ if (g(e)) {
103
+ const c = u(t.readBytes(A)), a = o + c;
104
+ for (let f = 0; f < e.components.length; ++f) {
105
+ const y = e.components[f];
106
+ t.setPosition(a + d);
107
+ const [p, P] = l(t, y, {
108
+ checksumAddress: n,
109
+ staticPosition: a
110
+ });
111
+ d += P, r[i ? f : y?.name] = p;
112
+ }
113
+ return t.setPosition(o + 32), [r, 32];
114
+ }
115
+ for (let c = 0; c < e.components.length; ++c) {
116
+ const a = e.components[c], [f, y] = l(t, a, {
117
+ checksumAddress: n,
118
+ staticPosition: o
119
+ });
120
+ r[i ? c : a?.name] = f, d += y;
121
+ }
122
+ return [r, d];
123
+ }
124
+ function et(t, { staticPosition: e }) {
125
+ const s = u(t.readBytes(32)), n = e + s;
126
+ t.setPosition(n);
127
+ const o = u(t.readBytes(32));
128
+ if (o === 0)
129
+ return t.setPosition(e + 32), ["", 32];
130
+ const i = t.readBytes(o, 32), r = V(j(i));
131
+ return t.setPosition(e + 32), [r, 32];
132
+ }
133
+ function lt({ checksumAddress: t, parameters: e, values: s }) {
134
+ const n = [];
135
+ for (let o = 0; o < e.length; o++)
136
+ n.push(x({
137
+ checksumAddress: t,
138
+ parameter: e[o],
139
+ value: s[o]
140
+ }));
141
+ return n;
142
+ }
143
+ function x({ checksumAddress: t = !1, parameter: e, value: s }) {
144
+ const n = e, o = I(n.type);
145
+ if (o) {
146
+ const [i, r] = o;
147
+ return ot(s, {
148
+ checksumAddress: t,
149
+ length: i,
150
+ parameter: {
151
+ ...n,
152
+ type: r
153
+ }
154
+ });
155
+ }
156
+ if (n.type === "tuple")
157
+ return dt(s, {
158
+ checksumAddress: t,
159
+ parameter: n
160
+ });
161
+ if (n.type === "address")
162
+ return nt(s, {
163
+ checksum: t
164
+ });
165
+ if (n.type === "bool")
166
+ return it(s);
167
+ if (n.type.startsWith("uint") || n.type.startsWith("int")) {
168
+ const i = n.type.startsWith("int"), [, , r = "256"] = K.exec(n.type) ?? [];
169
+ return rt(s, {
170
+ signed: i,
171
+ size: Number(r)
172
+ });
173
+ }
174
+ if (n.type.startsWith("bytes"))
175
+ return st(s, { type: n.type });
176
+ if (n.type === "string")
177
+ return ct(s);
178
+ throw new C(n.type);
179
+ }
180
+ function W(t) {
181
+ let e = 0;
182
+ for (let i = 0; i < t.length; i++) {
183
+ const { dynamic: r, encoded: d } = t[i];
184
+ r ? e += 32 : e += h(d);
185
+ }
186
+ const s = [], n = [];
187
+ let o = 0;
188
+ for (let i = 0; i < t.length; i++) {
189
+ const { dynamic: r, encoded: d } = t[i];
190
+ r ? (s.push(B(e + o, { size: 32 })), n.push(d), o += h(d)) : s.push(d);
191
+ }
192
+ return m(...s, ...n);
193
+ }
194
+ function nt(t, e) {
195
+ const { checksum: s = !1 } = e;
196
+ return M(t, { strict: s }), {
197
+ dynamic: !1,
198
+ encoded: S(t.toLowerCase())
199
+ };
200
+ }
201
+ function ot(t, e) {
202
+ const { checksumAddress: s, length: n, parameter: o } = e, i = n === null;
203
+ if (!Array.isArray(t))
204
+ throw new _(t);
205
+ if (!i && t.length !== n)
206
+ throw new $({
207
+ expectedLength: n,
208
+ givenLength: t.length,
209
+ type: `${o.type}[${n}]`
210
+ });
211
+ let r = !1;
212
+ const d = [];
213
+ for (let c = 0; c < t.length; c++) {
214
+ const a = x({
215
+ checksumAddress: s,
216
+ parameter: o,
217
+ value: t[c]
218
+ });
219
+ a.dynamic && (r = !0), d.push(a);
220
+ }
221
+ if (i || r) {
222
+ const c = W(d);
223
+ if (i) {
224
+ const a = B(d.length, { size: 32 });
225
+ return {
226
+ dynamic: !0,
227
+ encoded: d.length > 0 ? m(a, c) : a
228
+ };
229
+ }
230
+ if (r)
231
+ return { dynamic: !0, encoded: c };
232
+ }
233
+ return {
234
+ dynamic: !1,
235
+ encoded: m(...d.map(({ encoded: c }) => c))
236
+ };
237
+ }
238
+ function st(t, { type: e }) {
239
+ const [, s] = e.split("bytes"), n = h(t);
240
+ if (!s) {
241
+ let o = t;
242
+ return n % 32 !== 0 && (o = b(o, Math.ceil((t.length - 2) / 2 / 32) * 32)), {
243
+ dynamic: !0,
244
+ encoded: m(S(B(n, { size: 32 })), o)
245
+ };
246
+ }
247
+ if (n !== Number.parseInt(s, 10))
248
+ throw new O({
249
+ expectedSize: Number.parseInt(s, 10),
250
+ value: t
251
+ });
252
+ return { dynamic: !1, encoded: b(t) };
253
+ }
254
+ function it(t) {
255
+ if (typeof t != "boolean")
256
+ throw new q(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);
257
+ return { dynamic: !1, encoded: S(F(t)) };
258
+ }
259
+ function rt(t, { signed: e, size: s }) {
260
+ if (typeof s == "number") {
261
+ const n = 2n ** (BigInt(s) - (e ? 1n : 0n)) - 1n, o = e ? -n - 1n : 0n;
262
+ if (t > n || t < o)
263
+ throw new G({
264
+ max: n.toString(),
265
+ min: o.toString(),
266
+ signed: e,
267
+ size: s / 8,
268
+ value: t.toString()
269
+ });
270
+ }
271
+ return {
272
+ dynamic: !1,
273
+ encoded: B(t, {
274
+ size: 32,
275
+ signed: e
276
+ })
277
+ };
278
+ }
279
+ function ct(t) {
280
+ const e = H(t), s = Math.ceil(h(e) / 32), n = [];
281
+ for (let o = 0; o < s; o++)
282
+ n.push(b(J(e, o * 32, (o + 1) * 32)));
283
+ return {
284
+ dynamic: !0,
285
+ encoded: m(b(B(h(e), { size: 32 })), ...n)
286
+ };
287
+ }
288
+ function dt(t, e) {
289
+ const { checksumAddress: s, parameter: n } = e;
290
+ let o = !1;
291
+ const i = [];
292
+ for (let r = 0; r < n.components.length; r++) {
293
+ const d = n.components[r], c = Array.isArray(t) ? r : d.name, a = x({
294
+ checksumAddress: s,
295
+ parameter: d,
296
+ value: t[c]
297
+ });
298
+ i.push(a), a.dynamic && (o = !0);
299
+ }
300
+ return {
301
+ dynamic: o,
302
+ encoded: o ? W(i) : m(...i.map(({ encoded: r }) => r))
303
+ };
304
+ }
305
+ function I(t) {
306
+ const e = t.match(/^(.*)\[(\d+)?\]$/);
307
+ return e ? (
308
+ // Return `null` if the array is dynamic.
309
+ [e[2] ? Number(e[2]) : null, e[1]]
310
+ ) : void 0;
311
+ }
312
+ function g(t) {
313
+ const { type: e } = t;
314
+ if (e === "string" || e === "bytes" || e.endsWith("[]"))
315
+ return !0;
316
+ if (e === "tuple")
317
+ return t.components?.some(g);
318
+ const s = I(t.type);
319
+ return !!(s && g({
320
+ ...t,
321
+ type: s[1]
322
+ }));
323
+ }
324
+ export {
325
+ Q as decodeAddress,
326
+ X as decodeArray,
327
+ Y as decodeBool,
328
+ Z as decodeBytes,
329
+ v as decodeNumber,
330
+ l as decodeParameter,
331
+ et as decodeString,
332
+ tt as decodeTuple,
333
+ W as encode,
334
+ nt as encodeAddress,
335
+ ot as encodeArray,
336
+ it as encodeBoolean,
337
+ st as encodeBytes,
338
+ rt as encodeNumber,
339
+ ct as encodeString,
340
+ dt as encodeTuple,
341
+ I as getArrayComponents,
342
+ g as hasDynamicChild,
343
+ x as prepareParameter,
344
+ lt as prepareParameters
345
+ };
@@ -0,0 +1,163 @@
1
+ import { BaseError as e } from "./index341.js";
2
+ const n = {
3
+ bytes: new Uint8Array(),
4
+ dataView: new DataView(new ArrayBuffer(0)),
5
+ position: 0,
6
+ positionReadCount: /* @__PURE__ */ new Map(),
7
+ recursiveReadCount: 0,
8
+ recursiveReadLimit: Number.POSITIVE_INFINITY,
9
+ assertReadLimit() {
10
+ if (this.recursiveReadCount >= this.recursiveReadLimit)
11
+ throw new h({
12
+ count: this.recursiveReadCount + 1,
13
+ limit: this.recursiveReadLimit
14
+ });
15
+ },
16
+ assertPosition(t) {
17
+ if (t < 0 || t > this.bytes.length - 1)
18
+ throw new r({
19
+ length: this.bytes.length,
20
+ position: t
21
+ });
22
+ },
23
+ decrementPosition(t) {
24
+ if (t < 0)
25
+ throw new o({ offset: t });
26
+ const i = this.position - t;
27
+ this.assertPosition(i), this.position = i;
28
+ },
29
+ getReadCount(t) {
30
+ return this.positionReadCount.get(t || this.position) || 0;
31
+ },
32
+ incrementPosition(t) {
33
+ if (t < 0)
34
+ throw new o({ offset: t });
35
+ const i = this.position + t;
36
+ this.assertPosition(i), this.position = i;
37
+ },
38
+ inspectByte(t) {
39
+ const i = t ?? this.position;
40
+ return this.assertPosition(i), this.bytes[i];
41
+ },
42
+ inspectBytes(t, i) {
43
+ const s = i ?? this.position;
44
+ return this.assertPosition(s + t - 1), this.bytes.subarray(s, s + t);
45
+ },
46
+ inspectUint8(t) {
47
+ const i = t ?? this.position;
48
+ return this.assertPosition(i), this.bytes[i];
49
+ },
50
+ inspectUint16(t) {
51
+ const i = t ?? this.position;
52
+ return this.assertPosition(i + 1), this.dataView.getUint16(i);
53
+ },
54
+ inspectUint24(t) {
55
+ const i = t ?? this.position;
56
+ return this.assertPosition(i + 2), (this.dataView.getUint16(i) << 8) + this.dataView.getUint8(i + 2);
57
+ },
58
+ inspectUint32(t) {
59
+ const i = t ?? this.position;
60
+ return this.assertPosition(i + 3), this.dataView.getUint32(i);
61
+ },
62
+ pushByte(t) {
63
+ this.assertPosition(this.position), this.bytes[this.position] = t, this.position++;
64
+ },
65
+ pushBytes(t) {
66
+ this.assertPosition(this.position + t.length - 1), this.bytes.set(t, this.position), this.position += t.length;
67
+ },
68
+ pushUint8(t) {
69
+ this.assertPosition(this.position), this.bytes[this.position] = t, this.position++;
70
+ },
71
+ pushUint16(t) {
72
+ this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, t), this.position += 2;
73
+ },
74
+ pushUint24(t) {
75
+ this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, t >> 8), this.dataView.setUint8(this.position + 2, t & 255), this.position += 3;
76
+ },
77
+ pushUint32(t) {
78
+ this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, t), this.position += 4;
79
+ },
80
+ readByte() {
81
+ this.assertReadLimit(), this._touch();
82
+ const t = this.inspectByte();
83
+ return this.position++, t;
84
+ },
85
+ readBytes(t, i) {
86
+ this.assertReadLimit(), this._touch();
87
+ const s = this.inspectBytes(t);
88
+ return this.position += i ?? t, s;
89
+ },
90
+ readUint8() {
91
+ this.assertReadLimit(), this._touch();
92
+ const t = this.inspectUint8();
93
+ return this.position += 1, t;
94
+ },
95
+ readUint16() {
96
+ this.assertReadLimit(), this._touch();
97
+ const t = this.inspectUint16();
98
+ return this.position += 2, t;
99
+ },
100
+ readUint24() {
101
+ this.assertReadLimit(), this._touch();
102
+ const t = this.inspectUint24();
103
+ return this.position += 3, t;
104
+ },
105
+ readUint32() {
106
+ this.assertReadLimit(), this._touch();
107
+ const t = this.inspectUint32();
108
+ return this.position += 4, t;
109
+ },
110
+ get remaining() {
111
+ return this.bytes.length - this.position;
112
+ },
113
+ setPosition(t) {
114
+ const i = this.position;
115
+ return this.assertPosition(t), this.position = t, () => this.position = i;
116
+ },
117
+ _touch() {
118
+ if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
119
+ return;
120
+ const t = this.getReadCount();
121
+ this.positionReadCount.set(this.position, t + 1), t > 0 && this.recursiveReadCount++;
122
+ }
123
+ };
124
+ function u(t, { recursiveReadLimit: i = 8192 } = {}) {
125
+ const s = Object.create(n);
126
+ return s.bytes = t, s.dataView = new DataView(t.buffer, t.byteOffset, t.byteLength), s.positionReadCount = /* @__PURE__ */ new Map(), s.recursiveReadLimit = i, s;
127
+ }
128
+ class o extends e {
129
+ constructor({ offset: i }) {
130
+ super(`Offset \`${i}\` cannot be negative.`), Object.defineProperty(this, "name", {
131
+ enumerable: !0,
132
+ configurable: !0,
133
+ writable: !0,
134
+ value: "Cursor.NegativeOffsetError"
135
+ });
136
+ }
137
+ }
138
+ class r extends e {
139
+ constructor({ length: i, position: s }) {
140
+ super(`Position \`${s}\` is out of bounds (\`0 < position < ${i}\`).`), Object.defineProperty(this, "name", {
141
+ enumerable: !0,
142
+ configurable: !0,
143
+ writable: !0,
144
+ value: "Cursor.PositionOutOfBoundsError"
145
+ });
146
+ }
147
+ }
148
+ class h extends e {
149
+ constructor({ count: i, limit: s }) {
150
+ super(`Recursive read limit of \`${s}\` exceeded (recursive read count: \`${i}\`).`), Object.defineProperty(this, "name", {
151
+ enumerable: !0,
152
+ configurable: !0,
153
+ writable: !0,
154
+ value: "Cursor.RecursiveReadLimitExceededError"
155
+ });
156
+ }
157
+ }
158
+ export {
159
+ o as NegativeOffsetError,
160
+ r as PositionOutOfBoundsError,
161
+ h as RecursiveReadLimitExceededError,
162
+ u as create
163
+ };
@@ -0,0 +1,7 @@
1
+ const e = /^(.*)\[([0-9]*)\]$/, n = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, t = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/, s = 2n ** 256n - 1n;
2
+ export {
3
+ e as arrayRegex,
4
+ n as bytesRegex,
5
+ t as integerRegex,
6
+ s as maxUint256
7
+ };
@@ -0,0 +1,7 @@
1
+ import { version as r } from "./index359.js";
2
+ function e() {
3
+ return r;
4
+ }
5
+ export {
6
+ e as getVersion
7
+ };
@@ -0,0 +1,55 @@
1
+ import { size as d, SizeOverflowError as g, SizeExceedsPaddingSizeError as s } from "./index352.js";
2
+ function z(e, r) {
3
+ if (d(e) > r)
4
+ throw new g({
5
+ givenSize: d(e),
6
+ maxSize: r
7
+ });
8
+ }
9
+ const i = {
10
+ zero: 48,
11
+ nine: 57,
12
+ A: 65,
13
+ F: 70,
14
+ a: 97,
15
+ f: 102
16
+ };
17
+ function a(e) {
18
+ if (e >= i.zero && e <= i.nine)
19
+ return e - i.zero;
20
+ if (e >= i.A && e <= i.F)
21
+ return e - (i.A - 10);
22
+ if (e >= i.a && e <= i.f)
23
+ return e - (i.a - 10);
24
+ }
25
+ function S(e, r = {}) {
26
+ const { dir: f, size: n = 32 } = r;
27
+ if (n === 0)
28
+ return e;
29
+ if (e.length > n)
30
+ throw new s({
31
+ size: e.length,
32
+ targetSize: n,
33
+ type: "Bytes"
34
+ });
35
+ const o = new Uint8Array(n);
36
+ for (let t = 0; t < n; t++) {
37
+ const l = f === "right";
38
+ o[l ? t : n - t - 1] = e[l ? t : e.length - t - 1];
39
+ }
40
+ return o;
41
+ }
42
+ function c(e, r = {}) {
43
+ const { dir: f = "left" } = r;
44
+ let n = e, o = 0;
45
+ for (let t = 0; t < n.length - 1 && n[f === "left" ? t : n.length - t - 1].toString() === "0"; t++)
46
+ o++;
47
+ return n = f === "left" ? n.slice(o) : n.slice(0, n.length - o), n;
48
+ }
49
+ export {
50
+ z as assertSize,
51
+ i as charCodeMap,
52
+ a as charCodeToBase16,
53
+ S as pad,
54
+ c as trim
55
+ };
@@ -0,0 +1,7 @@
1
+ import { LruMap as c } from "./index360.js";
2
+ const e = {
3
+ checksum: /* @__PURE__ */ new c(8192)
4
+ }, m = e.checksum;
5
+ export {
6
+ m as checksum
7
+ };
@@ -0,0 +1,4 @@
1
+ const o = "0.1.1";
2
+ export {
3
+ o as version
4
+ };