@coinbase/cdp-hooks 0.0.96 → 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 (282) hide show
  1. package/dist/esm/index100.js +35 -25
  2. package/dist/esm/index101.js +9 -46
  3. package/dist/esm/index102.js +31 -69
  4. package/dist/esm/index103.js +36 -40
  5. package/dist/esm/index104.js +9 -75
  6. package/dist/esm/index105.js +25 -27
  7. package/dist/esm/index106.js +46 -6
  8. package/dist/esm/index107.js +69 -16
  9. package/dist/esm/index108.js +40 -8
  10. package/dist/esm/index109.js +75 -13
  11. package/dist/esm/index110.js +31 -7
  12. package/dist/esm/index111.js +6 -9
  13. package/dist/esm/index112.js +16 -16
  14. package/dist/esm/index113.js +8 -12
  15. package/dist/esm/index114.js +13 -46
  16. package/dist/esm/index115.js +7 -13
  17. package/dist/esm/index116.js +9 -16
  18. package/dist/esm/index117.js +16 -13
  19. package/dist/esm/index118.js +11 -5
  20. package/dist/esm/index119.js +46 -35
  21. package/dist/esm/index120.js +13 -9
  22. package/dist/esm/index121.js +15 -7
  23. package/dist/esm/index122.js +13 -28
  24. package/dist/esm/index123.js +6 -10
  25. package/dist/esm/index124.js +32 -11
  26. package/dist/esm/index125.js +9 -11
  27. package/dist/esm/index126.js +8 -120
  28. package/dist/esm/index127.js +27 -32
  29. package/dist/esm/index128.js +10 -80
  30. package/dist/esm/index129.js +13 -176
  31. package/dist/esm/index130.js +11 -44
  32. package/dist/esm/index131.js +120 -6
  33. package/dist/esm/index132.js +30 -151
  34. package/dist/esm/index133.js +80 -14
  35. package/dist/esm/index134.js +177 -14
  36. package/dist/esm/index135.js +42 -97
  37. package/dist/esm/index136.js +6 -72
  38. package/dist/esm/index137.js +153 -86
  39. package/dist/esm/index138.js +14 -148
  40. package/dist/esm/index139.js +14 -136
  41. package/dist/esm/index140.js +94 -63
  42. package/dist/esm/index141.js +72 -23
  43. package/dist/esm/index142.js +83 -154
  44. package/dist/esm/index143.js +148 -6
  45. package/dist/esm/index144.js +136 -11
  46. package/dist/esm/index145.js +68 -19
  47. package/dist/esm/index146.js +23 -135
  48. package/dist/esm/index147.js +155 -75
  49. package/dist/esm/index148.js +6 -9
  50. package/dist/esm/index149.js +11 -28
  51. package/dist/esm/index150.js +17 -87
  52. package/dist/esm/index151.js +135 -350
  53. package/dist/esm/index152.js +79 -3
  54. package/dist/esm/index153.js +10 -5
  55. package/dist/esm/index154.js +29 -2
  56. package/dist/esm/index155.js +90 -3
  57. package/dist/esm/index156.js +351 -9
  58. package/dist/esm/index157.js +3 -327
  59. package/dist/esm/index158.js +5 -14
  60. package/dist/esm/index159.js +2 -5
  61. package/dist/esm/index160.js +3 -56
  62. package/dist/esm/index161.js +9 -13
  63. package/dist/esm/index162.js +327 -2
  64. package/dist/esm/index163.js +13 -7
  65. package/dist/esm/index164.js +4 -30
  66. package/dist/esm/index165.js +29 -188
  67. package/dist/esm/index166.js +13 -32
  68. package/dist/esm/index167.js +2 -22
  69. package/dist/esm/index168.js +7 -5
  70. package/dist/esm/index169.js +25 -68
  71. package/dist/esm/index170.js +214 -5
  72. package/dist/esm/index171.js +32 -6
  73. package/dist/esm/index172.js +20 -34
  74. package/dist/esm/index173.js +5 -119
  75. package/dist/esm/index174.js +74 -3
  76. package/dist/esm/index175.js +5 -18
  77. package/dist/esm/index176.js +5 -26
  78. package/dist/esm/index177.js +28 -26
  79. package/dist/esm/index178.js +105 -20
  80. package/dist/esm/index179.js +3 -24
  81. package/dist/esm/index180.js +17 -7
  82. package/dist/esm/index181.js +18 -185
  83. package/dist/esm/index182.js +34 -2
  84. package/dist/esm/index183.js +28 -461
  85. package/dist/esm/index184.js +16 -20
  86. package/dist/esm/index185.js +6 -158
  87. package/dist/esm/index186.js +193 -21
  88. package/dist/esm/index187.js +2 -128
  89. package/dist/esm/index188.js +467 -38
  90. package/dist/esm/index189.js +27 -6
  91. package/dist/esm/index190.js +160 -27
  92. package/dist/esm/index191.js +20 -54
  93. package/dist/esm/index192.js +126 -44
  94. package/dist/esm/index193.js +31 -184
  95. package/dist/esm/index194.js +7 -4
  96. package/dist/esm/index195.js +26 -72
  97. package/dist/esm/index196.js +52 -17
  98. package/dist/esm/index197.js +46 -3
  99. package/dist/esm/index198.js +188 -13
  100. package/dist/esm/index199.js +4 -24
  101. package/dist/esm/index200.js +73 -11
  102. package/dist/esm/index201.js +18 -16
  103. package/dist/esm/index202.js +3 -35
  104. package/dist/esm/index203.js +17 -3
  105. package/dist/esm/index204.js +23 -18
  106. package/dist/esm/index205.js +11 -27
  107. package/dist/esm/index206.js +17 -34
  108. package/dist/esm/index207.js +34 -8
  109. package/dist/esm/index208.js +3 -8
  110. package/dist/esm/index209.js +18 -25
  111. package/dist/esm/index210.js +26 -27
  112. package/dist/esm/index211.js +35 -3
  113. package/dist/esm/index212.js +8 -79
  114. package/dist/esm/index213.js +7 -9
  115. package/dist/esm/index214.js +23 -10
  116. package/dist/esm/index215.js +27 -20
  117. package/dist/esm/index216.js +3 -8
  118. package/dist/esm/index217.js +78 -9
  119. package/dist/esm/index218.js +9 -11
  120. package/dist/esm/index219.js +12 -6
  121. package/dist/esm/index220.js +21 -6
  122. package/dist/esm/index221.js +8 -13
  123. package/dist/esm/index222.js +9 -31
  124. package/dist/esm/index223.js +12 -5
  125. package/dist/esm/index224.js +6 -37
  126. package/dist/esm/index225.js +6 -110
  127. package/dist/esm/index226.js +12 -47
  128. package/dist/esm/index227.js +31 -31
  129. package/dist/esm/index228.js +5 -18
  130. package/dist/esm/index229.js +35 -17
  131. package/dist/esm/index230.js +108 -40
  132. package/dist/esm/index231.js +46 -40
  133. package/dist/esm/index232.js +32 -8
  134. package/dist/esm/index233.js +17 -7
  135. package/dist/esm/index234.js +19 -16
  136. package/dist/esm/index235.js +42 -22
  137. package/dist/esm/index236.js +40 -22
  138. package/dist/esm/index237.js +8 -16
  139. package/dist/esm/index238.js +7 -54
  140. package/dist/esm/index239.js +16 -27
  141. package/dist/esm/index240.js +22 -24
  142. package/dist/esm/index241.js +24 -104
  143. package/dist/esm/index242.js +17 -3
  144. package/dist/esm/index243.js +54 -5
  145. package/dist/esm/index244.js +26 -30
  146. package/dist/esm/index245.js +24 -20
  147. package/dist/esm/index246.js +104 -3
  148. package/dist/esm/index247.js +3 -18
  149. package/dist/esm/index248.js +5 -5
  150. package/dist/esm/index249.js +31 -8
  151. package/dist/esm/index250.js +19 -102
  152. package/dist/esm/index251.js +3 -64
  153. package/dist/esm/index252.js +17 -5
  154. package/dist/esm/index253.js +5 -6
  155. package/dist/esm/index254.js +8 -27
  156. package/dist/esm/index255.js +103 -33
  157. package/dist/esm/index256.js +64 -13
  158. package/dist/esm/index257.js +5 -16
  159. package/dist/esm/index258.js +6 -78
  160. package/dist/esm/index259.js +28 -2
  161. package/dist/esm/index260.js +33 -14
  162. package/dist/esm/index261.js +13 -18
  163. package/dist/esm/index262.js +16 -171
  164. package/dist/esm/index263.js +77 -16
  165. package/dist/esm/index264.js +2 -11
  166. package/dist/esm/index265.js +15 -10
  167. package/dist/esm/index266.js +18 -38
  168. package/dist/esm/index267.js +172 -2
  169. package/dist/esm/index268.js +17 -69
  170. package/dist/esm/index269.js +10 -34
  171. package/dist/esm/index270.js +10 -15
  172. package/dist/esm/index271.js +2 -41
  173. package/dist/esm/index272.js +41 -2
  174. package/dist/esm/index273.js +2 -5
  175. package/dist/esm/index274.js +4 -10
  176. package/dist/esm/index275.js +9 -18
  177. package/dist/esm/index276.js +19 -7
  178. package/dist/esm/index277.js +7 -11
  179. package/dist/esm/index278.js +11 -72
  180. package/dist/esm/index279.js +71 -64
  181. package/dist/esm/index280.js +60 -182
  182. package/dist/esm/index281.js +185 -20
  183. package/dist/esm/index282.js +21 -41
  184. package/dist/esm/index283.js +41 -24
  185. package/dist/esm/index284.js +24 -89
  186. package/dist/esm/index285.js +68 -18
  187. package/dist/esm/index286.js +34 -10
  188. package/dist/esm/index287.js +10 -7
  189. package/dist/esm/index288.js +13 -7
  190. package/dist/esm/index289.js +7 -6
  191. package/dist/esm/index290.js +6 -36
  192. package/dist/esm/index291.js +35 -14
  193. package/dist/esm/index292.js +15 -8
  194. package/dist/esm/index293.js +8 -8
  195. package/dist/esm/index294.js +8 -16
  196. package/dist/esm/index295.js +15 -21
  197. package/dist/esm/index296.js +22 -30
  198. package/dist/esm/index297.js +31 -2
  199. package/dist/esm/index298.js +2 -14
  200. package/dist/esm/index299.js +13 -12
  201. package/dist/esm/index3.js +1 -1
  202. package/dist/esm/index300.js +10 -45
  203. package/dist/esm/index301.js +47 -9
  204. package/dist/esm/index302.js +8 -12
  205. package/dist/esm/index303.js +10 -10
  206. package/dist/esm/index304.js +13 -14
  207. package/dist/esm/index305.js +14 -8
  208. package/dist/esm/index306.js +6 -13
  209. package/dist/esm/index307.js +15 -24
  210. package/dist/esm/index308.js +24 -24
  211. package/dist/esm/index309.js +20 -27
  212. package/dist/esm/index310.js +31 -9
  213. package/dist/esm/index311.js +9 -51
  214. package/dist/esm/index312.js +38 -24
  215. package/dist/esm/index313.js +37 -17
  216. package/dist/esm/index314.js +17 -14
  217. package/dist/esm/index315.js +14 -11
  218. package/dist/esm/index316.js +11 -12
  219. package/dist/esm/index317.js +12 -19
  220. package/dist/esm/index318.js +18 -106
  221. package/dist/esm/index319.js +105 -101
  222. package/dist/esm/index320.js +103 -6
  223. package/dist/esm/index321.js +7 -7
  224. package/dist/esm/index322.js +7 -27
  225. package/dist/esm/index323.js +26 -15
  226. package/dist/esm/index324.js +13 -211
  227. package/dist/esm/index325.js +213 -12
  228. package/dist/esm/index326.js +12 -35
  229. package/dist/esm/index327.js +35 -41
  230. package/dist/esm/index328.js +42 -2
  231. package/dist/esm/index329.js +3 -68
  232. package/dist/esm/index330.js +68 -3
  233. package/dist/esm/index331.js +3 -136
  234. package/dist/esm/index332.js +125 -163
  235. package/dist/esm/index333.js +174 -9
  236. package/dist/esm/index334.js +9 -16
  237. package/dist/esm/index335.js +16 -133
  238. package/dist/esm/index336.js +112 -172
  239. package/dist/esm/index337.js +194 -2
  240. package/dist/esm/index338.js +2 -79
  241. package/dist/esm/index339.js +77 -13
  242. package/dist/esm/index340.js +13 -89
  243. package/dist/esm/index341.js +70 -143
  244. package/dist/esm/index342.js +157 -36
  245. package/dist/esm/index343.js +41 -654
  246. package/dist/esm/index344.js +646 -196
  247. package/dist/esm/index345.js +201 -172
  248. package/dist/esm/index346.js +176 -3
  249. package/dist/esm/index347.js +1 -1
  250. package/dist/esm/index349.js +2 -2
  251. package/dist/esm/index350.js +1 -1
  252. package/dist/esm/index351.js +1 -1
  253. package/dist/esm/index352.js +2 -2
  254. package/dist/esm/index353.js +3 -3
  255. package/dist/esm/index354.js +1 -1
  256. package/dist/esm/index73.js +2 -2
  257. package/dist/esm/index74.js +1 -1
  258. package/dist/esm/index75.js +2 -2
  259. package/dist/esm/index76.js +1 -1
  260. package/dist/esm/index77.js +1 -1
  261. package/dist/esm/index78.js +1 -1
  262. package/dist/esm/index79.js +1 -1
  263. package/dist/esm/index80.js +2 -2
  264. package/dist/esm/index81.js +2 -2
  265. package/dist/esm/index82.js +5 -5
  266. package/dist/esm/index83.js +2 -2
  267. package/dist/esm/index85.js +37 -33
  268. package/dist/esm/index86.js +2 -4
  269. package/dist/esm/index87.js +69 -9
  270. package/dist/esm/index88.js +33 -117
  271. package/dist/esm/index89.js +13 -60
  272. package/dist/esm/index90.js +33 -23
  273. package/dist/esm/index91.js +3 -36
  274. package/dist/esm/index92.js +9 -41
  275. package/dist/esm/index93.js +118 -58
  276. package/dist/esm/index94.js +58 -165
  277. package/dist/esm/index95.js +21 -36
  278. package/dist/esm/index96.js +36 -9
  279. package/dist/esm/index97.js +38 -28
  280. package/dist/esm/index98.js +58 -36
  281. package/dist/esm/index99.js +167 -8
  282. package/package.json +3 -3
@@ -1,106 +1,23 @@
1
- import { encodeAbiParameters as d } from "./index193.js";
2
- import { concat as h } from "./index201.js";
3
- import { toHex as p } from "./index192.js";
4
- import { keccak256 as i } from "./index207.js";
5
- import { getTypesForEIP712Domain as T, validateTypedData as D } from "./index251.js";
6
- function k(t) {
7
- const { domain: n = {}, message: e, primaryType: o } = t, r = {
8
- EIP712Domain: T({ domain: n }),
9
- ...t.types
10
- };
11
- D({
12
- domain: n,
13
- message: e,
14
- primaryType: o,
15
- types: r
1
+ import { wait as w } from "./index251.js";
2
+ function p(n, { delay: e = 100, retryCount: o = 2, shouldRetry: c = () => !0 } = {}) {
3
+ return new Promise((s, y) => {
4
+ const a = async ({ count: r = 0 } = {}) => {
5
+ const f = async ({ error: t }) => {
6
+ const i = typeof e == "function" ? e({ count: r, error: t }) : e;
7
+ i && await w(i), a({ count: r + 1 });
8
+ };
9
+ try {
10
+ const t = await n();
11
+ s(t);
12
+ } catch (t) {
13
+ if (r < o && await c({ count: r, error: t }))
14
+ return f({ error: t });
15
+ y(t);
16
+ }
17
+ };
18
+ a();
16
19
  });
17
- const a = ["0x1901"];
18
- return n && a.push(l({
19
- domain: n,
20
- types: r
21
- })), o !== "EIP712Domain" && a.push(f({
22
- data: e,
23
- primaryType: o,
24
- types: r
25
- })), i(h(a));
26
- }
27
- function l({ domain: t, types: n }) {
28
- return f({
29
- data: t,
30
- primaryType: "EIP712Domain",
31
- types: n
32
- });
33
- }
34
- function f({ data: t, primaryType: n, types: e }) {
35
- const o = m({
36
- data: t,
37
- primaryType: n,
38
- types: e
39
- });
40
- return i(o);
41
- }
42
- function m({ data: t, primaryType: n, types: e }) {
43
- const o = [{ type: "bytes32" }], r = [b({ primaryType: n, types: e })];
44
- for (const a of e[n]) {
45
- const [c, s] = y({
46
- types: e,
47
- name: a.name,
48
- type: a.type,
49
- value: t[a.name]
50
- });
51
- o.push(c), r.push(s);
52
- }
53
- return d(o, r);
54
- }
55
- function b({ primaryType: t, types: n }) {
56
- const e = p(I({ primaryType: t, types: n }));
57
- return i(e);
58
- }
59
- function I({ primaryType: t, types: n }) {
60
- let e = "";
61
- const o = u({ primaryType: t, types: n });
62
- o.delete(t);
63
- const r = [t, ...Array.from(o).sort()];
64
- for (const a of r)
65
- e += `${a}(${n[a].map(({ name: c, type: s }) => `${s} ${c}`).join(",")})`;
66
- return e;
67
- }
68
- function u({ primaryType: t, types: n }, e = /* @__PURE__ */ new Set()) {
69
- const r = t.match(/^\w*/u)?.[0];
70
- if (e.has(r) || n[r] === void 0)
71
- return e;
72
- e.add(r);
73
- for (const a of n[r])
74
- u({ primaryType: a.type, types: n }, e);
75
- return e;
76
- }
77
- function y({ types: t, name: n, type: e, value: o }) {
78
- if (t[e] !== void 0)
79
- return [
80
- { type: "bytes32" },
81
- i(m({ data: o, primaryType: e, types: t }))
82
- ];
83
- if (e === "bytes")
84
- return [{ type: "bytes32" }, i(o)];
85
- if (e === "string")
86
- return [{ type: "bytes32" }, i(p(o))];
87
- if (e.lastIndexOf("]") === e.length - 1) {
88
- const r = e.slice(0, e.lastIndexOf("[")), a = o.map((c) => y({
89
- name: n,
90
- type: r,
91
- types: t,
92
- value: c
93
- }));
94
- return [
95
- { type: "bytes32" },
96
- i(d(a.map(([c]) => c), a.map(([, c]) => c)))
97
- ];
98
- }
99
- return [{ type: e }, o];
100
20
  }
101
21
  export {
102
- I as encodeType,
103
- l as hashDomain,
104
- f as hashStruct,
105
- k as hashTypedData
22
+ p as withRetry
106
23
  };
@@ -1,67 +1,6 @@
1
- import { BytesSizeMismatchError as I } from "./index157.js";
2
- import { InvalidAddressError as v } from "./index161.js";
3
- import { InvalidDomainError as w, InvalidPrimaryTypeError as E, InvalidStructTypeError as z } from "./index184.js";
4
- import { isAddress as D } from "./index200.js";
5
- import { size as c } from "./index159.js";
6
- import { numberToHex as T } from "./index192.js";
7
- import { integerRegex as x, bytesRegex as P } from "./index203.js";
8
- function C(e) {
9
- const { domain: o, message: y, primaryType: s, types: r } = e, a = (d, g) => {
10
- for (const h of d) {
11
- const { name: b, type: i } = h, t = g[b], m = i.match(x);
12
- if (m && (typeof t == "number" || typeof t == "bigint")) {
13
- const [u, n, l] = m;
14
- T(t, {
15
- signed: n === "int",
16
- size: Number.parseInt(l, 10) / 8
17
- });
18
- }
19
- if (i === "address" && typeof t == "string" && !D(t))
20
- throw new v({ address: t });
21
- const f = i.match(P);
22
- if (f) {
23
- const [u, n] = f;
24
- if (n && c(t) !== Number.parseInt(n, 10))
25
- throw new I({
26
- expectedSize: Number.parseInt(n, 10),
27
- givenSize: c(t)
28
- });
29
- }
30
- const p = r[i];
31
- p && (S(i), a(p, t));
32
- }
33
- };
34
- if (r.EIP712Domain && o) {
35
- if (typeof o != "object")
36
- throw new w({ domain: o });
37
- a(r.EIP712Domain, o);
38
- }
39
- if (s !== "EIP712Domain")
40
- if (r[s])
41
- a(r[s], y);
42
- else
43
- throw new E({ primaryType: s, types: r });
44
- }
45
- function j({ domain: e }) {
46
- return [
47
- typeof e?.name == "string" && { name: "name", type: "string" },
48
- e?.version && { name: "version", type: "string" },
49
- (typeof e?.chainId == "number" || typeof e?.chainId == "bigint") && {
50
- name: "chainId",
51
- type: "uint256"
52
- },
53
- e?.verifyingContract && {
54
- name: "verifyingContract",
55
- type: "address"
56
- },
57
- e?.salt && { name: "salt", type: "bytes32" }
58
- ].filter(Boolean);
59
- }
60
- function S(e) {
61
- if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
62
- throw new z({ type: e });
1
+ async function n(e) {
2
+ return new Promise((t) => setTimeout(t, e));
63
3
  }
64
4
  export {
65
- j as getTypesForEIP712Domain,
66
- C as validateTypedData
5
+ n as wait
67
6
  };
@@ -1,8 +1,20 @@
1
- import { publicKeyToAddress as o } from "./index253.js";
2
- import { recoverPublicKey as c } from "./index254.js";
3
- async function s({ hash: r, signature: e }) {
4
- return o(await c({ hash: r, signature: e }));
1
+ function u(n, { errorInstance: i = new Error("timed out"), timeout: t, signal: l }) {
2
+ return new Promise((a, o) => {
3
+ (async () => {
4
+ let e;
5
+ try {
6
+ const r = new AbortController();
7
+ t > 0 && (e = setTimeout(() => {
8
+ l && r.abort();
9
+ }, t)), a(await n({ signal: r?.signal || null }));
10
+ } catch (r) {
11
+ r?.name === "AbortError" && o(i), o(r);
12
+ } finally {
13
+ clearTimeout(e);
14
+ }
15
+ })();
16
+ });
5
17
  }
6
18
  export {
7
- s as recoverAddress
19
+ u as withTimeout
8
20
  };
@@ -1,9 +1,8 @@
1
- import { checksumAddress as e } from "./index186.js";
2
- import { keccak256 as o } from "./index207.js";
3
- function d(r) {
4
- const s = o(`0x${r.substring(4)}`).substring(26);
5
- return e(`0x${s}`);
1
+ import { keccak256 as o } from "./index212.js";
2
+ import { toPrefixedMessage as t } from "./index254.js";
3
+ function f(e, r) {
4
+ return o(t(e), r);
6
5
  }
7
6
  export {
8
- d as publicKeyToAddress
7
+ f as hashMessage
9
8
  };
@@ -1,30 +1,11 @@
1
- import { isHex as i } from "./index211.js";
2
- import { size as b } from "./index159.js";
3
- import { hexToBigInt as n, hexToNumber as d } from "./index230.js";
4
- import { toHex as c } from "./index192.js";
5
- async function R({ hash: r, signature: e }) {
6
- const u = i(r) ? r : c(r), { secp256k1: t } = await import("./index255.js");
7
- return `0x${(() => {
8
- if (typeof e == "object" && "r" in e && "s" in e) {
9
- const { r: p, s: v, v: y, yParity: l } = e, x = Number(l ?? y), a = s(x);
10
- return new t.Signature(n(p), n(v)).addRecoveryBit(a);
11
- }
12
- const o = i(e) ? e : c(e);
13
- if (b(o) !== 65)
14
- throw new Error("invalid signature length");
15
- const f = d(`0x${o.slice(130)}`), m = s(f);
16
- return t.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(m);
17
- })().recoverPublicKey(u.substring(2)).toHex(!1)}`;
18
- }
19
- function s(r) {
20
- if (r === 0 || r === 1)
21
- return r;
22
- if (r === 27)
23
- return 0;
24
- if (r === 28)
25
- return 1;
26
- throw new Error("Invalid yParityOrV value");
1
+ import { presignMessagePrefix as e } from "./index160.js";
2
+ import { concat as n } from "./index206.js";
3
+ import { size as f } from "./index164.js";
4
+ import { stringToHex as o, bytesToHex as p } from "./index197.js";
5
+ function u(r) {
6
+ const t = typeof r == "string" ? o(r) : typeof r.raw == "string" ? r.raw : p(r.raw), i = o(`${e}${f(t)}`);
7
+ return n([i, t]);
27
8
  }
28
9
  export {
29
- R as recoverPublicKey
10
+ u as toPrefixedMessage
30
11
  };
@@ -1,36 +1,106 @@
1
- import { sha256 as C } from "./index319.js";
2
- import { createCurve as G } from "./index323.js";
3
- import { Field as N, mod as k, pow2 as t } from "./index324.js";
4
- const q = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), w = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), M = BigInt(0), O = BigInt(1), _ = BigInt(2), h = (n, f) => (n + f / _) / f;
5
- function W(n) {
6
- const f = q, e = BigInt(3), r = BigInt(6), B = BigInt(11), a = BigInt(22), s = BigInt(23), i = BigInt(44), g = BigInt(88), o = n * n * n % f, c = o * o * n % f, d = t(c, e, f) * c % f, b = t(d, e, f) * c % f, m = t(b, _, f) * o % f, I = t(m, B, f) * m % f, p = t(I, a, f) * I % f, x = t(p, i, f) * p % f, E = t(x, g, f) * x % f, F = t(E, i, f) * p % f, P = t(F, e, f) * c % f, S = t(P, s, f) * I % f, v = t(S, r, f) * o % f, u = t(v, _, f);
7
- if (!l.eql(l.sqr(u), n))
8
- throw new Error("Cannot find square root");
9
- return u;
10
- }
11
- const l = N(q, void 0, void 0, { sqrt: W }), D = G({
12
- a: M,
13
- b: BigInt(7),
14
- Fp: l,
15
- n: w,
16
- Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
17
- Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
18
- h: BigInt(1),
19
- lowS: !0,
20
- // Allow only low-S signatures by default in sign() and verify()
21
- endo: {
22
- // Endomorphism, see above
23
- beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
24
- splitScalar: (n) => {
25
- const f = w, e = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -O * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), B = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), a = e, s = BigInt("0x100000000000000000000000000000000"), i = h(a * n, f), g = h(-r * n, f);
26
- let o = k(n - i * e - g * B, f), c = k(-i * r - g * a, f);
27
- const d = o > s, b = c > s;
28
- if (d && (o = f - o), b && (c = f - c), o > s || c > s)
29
- throw new Error("splitScalar: Endomorphism failed, k=" + n);
30
- return { k1neg: d, k1: o, k2neg: b, k2: c };
31
- }
1
+ import { encodeAbiParameters as d } from "./index198.js";
2
+ import { concat as h } from "./index206.js";
3
+ import { toHex as p } from "./index197.js";
4
+ import { keccak256 as i } from "./index212.js";
5
+ import { getTypesForEIP712Domain as T, validateTypedData as D } from "./index256.js";
6
+ function k(t) {
7
+ const { domain: n = {}, message: e, primaryType: o } = t, r = {
8
+ EIP712Domain: T({ domain: n }),
9
+ ...t.types
10
+ };
11
+ D({
12
+ domain: n,
13
+ message: e,
14
+ primaryType: o,
15
+ types: r
16
+ });
17
+ const a = ["0x1901"];
18
+ return n && a.push(l({
19
+ domain: n,
20
+ types: r
21
+ })), o !== "EIP712Domain" && a.push(f({
22
+ data: e,
23
+ primaryType: o,
24
+ types: r
25
+ })), i(h(a));
26
+ }
27
+ function l({ domain: t, types: n }) {
28
+ return f({
29
+ data: t,
30
+ primaryType: "EIP712Domain",
31
+ types: n
32
+ });
33
+ }
34
+ function f({ data: t, primaryType: n, types: e }) {
35
+ const o = m({
36
+ data: t,
37
+ primaryType: n,
38
+ types: e
39
+ });
40
+ return i(o);
41
+ }
42
+ function m({ data: t, primaryType: n, types: e }) {
43
+ const o = [{ type: "bytes32" }], r = [b({ primaryType: n, types: e })];
44
+ for (const a of e[n]) {
45
+ const [c, s] = y({
46
+ types: e,
47
+ name: a.name,
48
+ type: a.type,
49
+ value: t[a.name]
50
+ });
51
+ o.push(c), r.push(s);
32
52
  }
33
- }, C);
53
+ return d(o, r);
54
+ }
55
+ function b({ primaryType: t, types: n }) {
56
+ const e = p(I({ primaryType: t, types: n }));
57
+ return i(e);
58
+ }
59
+ function I({ primaryType: t, types: n }) {
60
+ let e = "";
61
+ const o = u({ primaryType: t, types: n });
62
+ o.delete(t);
63
+ const r = [t, ...Array.from(o).sort()];
64
+ for (const a of r)
65
+ e += `${a}(${n[a].map(({ name: c, type: s }) => `${s} ${c}`).join(",")})`;
66
+ return e;
67
+ }
68
+ function u({ primaryType: t, types: n }, e = /* @__PURE__ */ new Set()) {
69
+ const r = t.match(/^\w*/u)?.[0];
70
+ if (e.has(r) || n[r] === void 0)
71
+ return e;
72
+ e.add(r);
73
+ for (const a of n[r])
74
+ u({ primaryType: a.type, types: n }, e);
75
+ return e;
76
+ }
77
+ function y({ types: t, name: n, type: e, value: o }) {
78
+ if (t[e] !== void 0)
79
+ return [
80
+ { type: "bytes32" },
81
+ i(m({ data: o, primaryType: e, types: t }))
82
+ ];
83
+ if (e === "bytes")
84
+ return [{ type: "bytes32" }, i(o)];
85
+ if (e === "string")
86
+ return [{ type: "bytes32" }, i(p(o))];
87
+ if (e.lastIndexOf("]") === e.length - 1) {
88
+ const r = e.slice(0, e.lastIndexOf("[")), a = o.map((c) => y({
89
+ name: n,
90
+ type: r,
91
+ types: t,
92
+ value: c
93
+ }));
94
+ return [
95
+ { type: "bytes32" },
96
+ i(d(a.map(([c]) => c), a.map(([, c]) => c)))
97
+ ];
98
+ }
99
+ return [{ type: e }, o];
100
+ }
34
101
  export {
35
- D as secp256k1
102
+ I as encodeType,
103
+ l as hashDomain,
104
+ f as hashStruct,
105
+ k as hashTypedData
36
106
  };
@@ -1,16 +1,67 @@
1
- import { secp256k1 as f } from "./index255.js";
2
- import { hexToBigInt as t } from "./index230.js";
3
- import { hexToBytes as m } from "./index191.js";
4
- function s({ r: o, s: i, to: u = "hex", v: r, yParity: e }) {
5
- const a = (() => {
6
- if (e === 0 || e === 1)
7
- return e;
8
- if (r && (r === 27n || r === 28n || r >= 35n))
9
- return r % 2n === 0n ? 1 : 0;
10
- throw new Error("Invalid `v` or `yParity` value");
11
- })(), n = `0x${new f.Signature(t(o), t(i)).toCompactHex()}${a === 0 ? "1b" : "1c"}`;
12
- return u === "hex" ? n : m(n);
1
+ import { BytesSizeMismatchError as I } from "./index162.js";
2
+ import { InvalidAddressError as v } from "./index166.js";
3
+ import { InvalidDomainError as w, InvalidPrimaryTypeError as E, InvalidStructTypeError as z } from "./index189.js";
4
+ import { isAddress as D } from "./index205.js";
5
+ import { size as c } from "./index164.js";
6
+ import { numberToHex as T } from "./index197.js";
7
+ import { integerRegex as x, bytesRegex as P } from "./index208.js";
8
+ function C(e) {
9
+ const { domain: o, message: y, primaryType: s, types: r } = e, a = (d, g) => {
10
+ for (const h of d) {
11
+ const { name: b, type: i } = h, t = g[b], m = i.match(x);
12
+ if (m && (typeof t == "number" || typeof t == "bigint")) {
13
+ const [u, n, l] = m;
14
+ T(t, {
15
+ signed: n === "int",
16
+ size: Number.parseInt(l, 10) / 8
17
+ });
18
+ }
19
+ if (i === "address" && typeof t == "string" && !D(t))
20
+ throw new v({ address: t });
21
+ const f = i.match(P);
22
+ if (f) {
23
+ const [u, n] = f;
24
+ if (n && c(t) !== Number.parseInt(n, 10))
25
+ throw new I({
26
+ expectedSize: Number.parseInt(n, 10),
27
+ givenSize: c(t)
28
+ });
29
+ }
30
+ const p = r[i];
31
+ p && (S(i), a(p, t));
32
+ }
33
+ };
34
+ if (r.EIP712Domain && o) {
35
+ if (typeof o != "object")
36
+ throw new w({ domain: o });
37
+ a(r.EIP712Domain, o);
38
+ }
39
+ if (s !== "EIP712Domain")
40
+ if (r[s])
41
+ a(r[s], y);
42
+ else
43
+ throw new E({ primaryType: s, types: r });
44
+ }
45
+ function j({ domain: e }) {
46
+ return [
47
+ typeof e?.name == "string" && { name: "name", type: "string" },
48
+ e?.version && { name: "version", type: "string" },
49
+ (typeof e?.chainId == "number" || typeof e?.chainId == "bigint") && {
50
+ name: "chainId",
51
+ type: "uint256"
52
+ },
53
+ e?.verifyingContract && {
54
+ name: "verifyingContract",
55
+ type: "address"
56
+ },
57
+ e?.salt && { name: "salt", type: "bytes32" }
58
+ ].filter(Boolean);
59
+ }
60
+ function S(e) {
61
+ if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
62
+ throw new z({ type: e });
13
63
  }
14
64
  export {
15
- s as serializeSignature
65
+ j as getTypesForEIP712Domain,
66
+ C as validateTypedData
16
67
  };
@@ -1,19 +1,8 @@
1
- import { parseAccount as d } from "./index86.js";
2
- import { maxUint256 as m } from "./index154.js";
3
- import { InvalidAddressError as i } from "./index161.js";
4
- import { FeeCapTooHighError as c, TipAboveFeeCapError as f } from "./index181.js";
5
- import { isAddress as a } from "./index200.js";
6
- function A(n) {
7
- const { account: s, maxFeePerGas: r, maxPriorityFeePerGas: o, to: e } = n, t = s ? d(s) : void 0;
8
- if (t && !a(t.address))
9
- throw new i({ address: t.address });
10
- if (e && !a(e))
11
- throw new i({ address: e });
12
- if (r && r > m)
13
- throw new c({ maxFeePerGas: r });
14
- if (o && r && o > r)
15
- throw new f({ maxFeePerGas: r, maxPriorityFeePerGas: o });
1
+ import { publicKeyToAddress as o } from "./index258.js";
2
+ import { recoverPublicKey as c } from "./index259.js";
3
+ async function s({ hash: r, signature: e }) {
4
+ return o(await c({ hash: r, signature: e }));
16
5
  }
17
6
  export {
18
- A as assertRequest
7
+ s as recoverAddress
19
8
  };
@@ -1,81 +1,9 @@
1
- import { versionedHashVersionKzg as c } from "./index259.js";
2
- import { maxUint256 as m } from "./index154.js";
3
- import { InvalidAddressError as s } from "./index161.js";
4
- import { BaseError as h } from "./index160.js";
5
- import { EmptyBlobError as P, InvalidVersionedHashSizeError as p, InvalidVersionedHashVersionError as x } from "./index224.js";
6
- import { InvalidChainIdError as n } from "./index164.js";
7
- import { FeeCapTooHighError as w, TipAboveFeeCapError as E } from "./index181.js";
8
- import { isAddress as f } from "./index200.js";
9
- import { size as F } from "./index159.js";
10
- import { slice as I } from "./index188.js";
11
- import { hexToNumber as G } from "./index230.js";
12
- function C(t) {
13
- const { authorizationList: e } = t;
14
- if (e)
15
- for (const o of e) {
16
- const { chainId: r } = o, i = o.address;
17
- if (!f(i))
18
- throw new s({ address: i });
19
- if (r < 0)
20
- throw new n({ chainId: r });
21
- }
22
- d(t);
23
- }
24
- function L(t) {
25
- const { blobVersionedHashes: e } = t;
26
- if (e) {
27
- if (e.length === 0)
28
- throw new P();
29
- for (const o of e) {
30
- const r = F(o), i = G(I(o, 0, 1));
31
- if (r !== 32)
32
- throw new p({ hash: o, size: r });
33
- if (i !== c)
34
- throw new x({
35
- hash: o,
36
- version: i
37
- });
38
- }
39
- }
40
- d(t);
41
- }
42
- function d(t) {
43
- const { chainId: e, maxPriorityFeePerGas: o, maxFeePerGas: r, to: i } = t;
44
- if (e <= 0)
45
- throw new n({ chainId: e });
46
- if (i && !f(i))
47
- throw new s({ address: i });
48
- if (r && r > m)
49
- throw new w({ maxFeePerGas: r });
50
- if (o && r && o > r)
51
- throw new E({ maxFeePerGas: r, maxPriorityFeePerGas: o });
52
- }
53
- function B(t) {
54
- const { chainId: e, maxPriorityFeePerGas: o, gasPrice: r, maxFeePerGas: i, to: a } = t;
55
- if (e <= 0)
56
- throw new n({ chainId: e });
57
- if (a && !f(a))
58
- throw new s({ address: a });
59
- if (o || i)
60
- throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
61
- if (r && r > m)
62
- throw new w({ maxFeePerGas: r });
63
- }
64
- function K(t) {
65
- const { chainId: e, maxPriorityFeePerGas: o, gasPrice: r, maxFeePerGas: i, to: a } = t;
66
- if (a && !f(a))
67
- throw new s({ address: a });
68
- if (typeof e < "u" && e <= 0)
69
- throw new n({ chainId: e });
70
- if (o || i)
71
- throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
72
- if (r && r > m)
73
- throw new w({ maxFeePerGas: r });
1
+ import { checksumAddress as e } from "./index191.js";
2
+ import { keccak256 as o } from "./index212.js";
3
+ function d(r) {
4
+ const s = o(`0x${r.substring(4)}`).substring(26);
5
+ return e(`0x${s}`);
74
6
  }
75
7
  export {
76
- d as assertTransactionEIP1559,
77
- B as assertTransactionEIP2930,
78
- L as assertTransactionEIP4844,
79
- C as assertTransactionEIP7702,
80
- K as assertTransactionLegacy
8
+ d as publicKeyToAddress
81
9
  };
@@ -1,4 +1,30 @@
1
- const e = 1;
1
+ import { isHex as i } from "./index216.js";
2
+ import { size as b } from "./index164.js";
3
+ import { hexToBigInt as n, hexToNumber as d } from "./index235.js";
4
+ import { toHex as c } from "./index197.js";
5
+ async function R({ hash: r, signature: e }) {
6
+ const u = i(r) ? r : c(r), { secp256k1: t } = await import("./index260.js");
7
+ return `0x${(() => {
8
+ if (typeof e == "object" && "r" in e && "s" in e) {
9
+ const { r: p, s: v, v: y, yParity: l } = e, x = Number(l ?? y), a = s(x);
10
+ return new t.Signature(n(p), n(v)).addRecoveryBit(a);
11
+ }
12
+ const o = i(e) ? e : c(e);
13
+ if (b(o) !== 65)
14
+ throw new Error("invalid signature length");
15
+ const f = d(`0x${o.slice(130)}`), m = s(f);
16
+ return t.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(m);
17
+ })().recoverPublicKey(u.substring(2)).toHex(!1)}`;
18
+ }
19
+ function s(r) {
20
+ if (r === 0 || r === 1)
21
+ return r;
22
+ if (r === 27)
23
+ return 0;
24
+ if (r === 28)
25
+ return 1;
26
+ throw new Error("Invalid yParityOrV value");
27
+ }
2
28
  export {
3
- e as versionedHashVersionKzg
29
+ R as recoverPublicKey
4
30
  };