@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,139 +1,17 @@
1
- import { DecodeLogDataMismatch as S, DecodeLogTopicsMismatch as B } from "./index157.js";
2
- import { InvalidInputRpcError as C } from "./index183.js";
3
- import { decodeEventLog as T } from "./index195.js";
4
- import { encodeEventTopics as z } from "./index206.js";
5
- import { formatLog as I } from "./index214.js";
6
- import { getAction as u } from "./index288.js";
7
- import { observe as A } from "./index290.js";
8
- import { poll as O } from "./index291.js";
9
- import { stringify as P } from "./index182.js";
10
- import { createEventFilter as R } from "./index98.js";
11
- import { getBlockNumber as U } from "./index108.js";
12
- import { getFilterChanges as j } from "./index116.js";
13
- import { getLogs as q } from "./index119.js";
14
- import { uninstallFilter as x } from "./index131.js";
15
- function nt(r, { address: m, args: l, batch: h = !0, event: s, events: d, fromBlock: c, onError: y, onLogs: v, poll: E, pollingInterval: k = r.pollingInterval, strict: N }) {
16
- const D = typeof E < "u" ? E : typeof c == "bigint" ? !0 : !(r.transport.type === "webSocket" || r.transport.type === "ipc" || r.transport.type === "fallback" && (r.transport.transports[0].config.type === "webSocket" || r.transport.transports[0].config.type === "ipc")), F = N ?? !1;
17
- return D ? (() => {
18
- const p = P([
19
- "watchEvent",
20
- m,
21
- l,
22
- h,
23
- r.uid,
24
- s,
25
- k,
26
- c
27
- ]);
28
- return A(p, { onLogs: v, onError: y }, (a) => {
29
- let n;
30
- c !== void 0 && (n = c - 1n);
31
- let o, i = !1;
32
- const w = O(async () => {
33
- if (!i) {
34
- try {
35
- o = await u(r, R, "createEventFilter")({
36
- address: m,
37
- args: l,
38
- event: s,
39
- events: d,
40
- strict: F,
41
- fromBlock: c
42
- });
43
- } catch {
44
- }
45
- i = !0;
46
- return;
47
- }
48
- try {
49
- let t;
50
- if (o)
51
- t = await u(r, j, "getFilterChanges")({ filter: o });
52
- else {
53
- const e = await u(r, U, "getBlockNumber")({});
54
- n && n !== e ? t = await u(r, q, "getLogs")({
55
- address: m,
56
- args: l,
57
- event: s,
58
- events: d,
59
- fromBlock: n + 1n,
60
- toBlock: e
61
- }) : t = [], n = e;
62
- }
63
- if (t.length === 0)
64
- return;
65
- if (h)
66
- a.onLogs(t);
67
- else
68
- for (const e of t)
69
- a.onLogs([e]);
70
- } catch (t) {
71
- o && t instanceof C && (i = !1), a.onError?.(t);
72
- }
73
- }, {
74
- emitOnBegin: !0,
75
- interval: k
76
- });
77
- return async () => {
78
- o && await u(r, x, "uninstallFilter")({ filter: o }), w();
79
- };
80
- });
81
- })() : (() => {
82
- let p = !0, a = () => p = !1;
83
- return (async () => {
84
- try {
85
- const n = (() => {
86
- if (r.transport.type === "fallback") {
87
- const t = r.transport.transports.find((e) => e.config.type === "webSocket" || e.config.type === "ipc");
88
- return t ? t.value : r.transport;
89
- }
90
- return r.transport;
91
- })(), o = d ?? (s ? [s] : void 0);
92
- let i = [];
93
- o && (i = [o.flatMap((e) => z({
94
- abi: [e],
95
- eventName: e.name,
96
- args: l
97
- }))], s && (i = i[0]));
98
- const { unsubscribe: w } = await n.subscribe({
99
- params: ["logs", { address: m, topics: i }],
100
- onData(t) {
101
- if (!p)
102
- return;
103
- const e = t.result;
104
- try {
105
- const { eventName: f, args: b } = T({
106
- abi: o ?? [],
107
- data: e.data,
108
- topics: e.topics,
109
- strict: F
110
- }), g = I(e, { args: b, eventName: f });
111
- v([g]);
112
- } catch (f) {
113
- let b, g;
114
- if (f instanceof S || f instanceof B) {
115
- if (N)
116
- return;
117
- b = f.abiItem.name, g = f.abiItem.inputs?.some((L) => !("name" in L && L.name));
118
- }
119
- const M = I(e, {
120
- args: g ? [] : {},
121
- eventName: b
122
- });
123
- v([M]);
124
- }
125
- },
126
- onError(t) {
127
- y?.(t);
128
- }
129
- });
130
- a = w, p || a();
131
- } catch (n) {
132
- y?.(n);
133
- }
134
- })(), () => a();
135
- })();
1
+ import { getAction as p } from "./index289.js";
2
+ import { hashTypedData as h } from "./index255.js";
3
+ import { verifyHash as d } from "./index137.js";
4
+ async function v(a, t) {
5
+ const { address: r, factory: e, factoryData: o, signature: s, message: y, primaryType: f, types: i, domain: c, ...m } = t, n = h({ message: y, primaryType: f, types: i, domain: c });
6
+ return p(a, d, "verifyHash")({
7
+ address: r,
8
+ factory: e,
9
+ factoryData: o,
10
+ hash: n,
11
+ signature: s,
12
+ ...m
13
+ });
136
14
  }
137
15
  export {
138
- nt as watchEvent
16
+ v as verifyTypedData
139
17
  };
@@ -1,71 +1,102 @@
1
- import { getAction as c } from "./index288.js";
2
- import { observe as p } from "./index290.js";
3
- import { poll as b } from "./index291.js";
4
- import { stringify as m } from "./index182.js";
5
- import { createPendingTransactionFilter as d } from "./index99.js";
6
- import { getFilterChanges as h } from "./index116.js";
7
- import { uninstallFilter as P } from "./index131.js";
8
- function D(r, { batch: u = !0, onError: i, onTransactions: l, poll: f, pollingInterval: g = r.pollingInterval }) {
9
- return (typeof f < "u" ? f : r.transport.type !== "webSocket" && r.transport.type !== "ipc") ? (() => {
10
- const a = m([
11
- "watchPendingTransactions",
12
- r.uid,
13
- u,
14
- g
15
- ]);
16
- return p(a, { onTransactions: l, onError: i }, (t) => {
17
- let n;
18
- const s = b(async () => {
19
- try {
20
- if (!n)
21
- try {
22
- n = await c(r, d, "createPendingTransactionFilter")({});
1
+ import { BlockNotFoundError as D } from "./index168.js";
2
+ import { WaitForTransactionReceiptTimeoutError as M, TransactionNotFoundError as O, TransactionReceiptNotFoundError as W } from "./index178.js";
3
+ import { getAction as l } from "./index289.js";
4
+ import { observe as q } from "./index291.js";
5
+ import { withResolvers as z } from "./index293.js";
6
+ import { withRetry as B } from "./index250.js";
7
+ import { stringify as G } from "./index187.js";
8
+ import { getBlock as H } from "./index112.js";
9
+ import { getTransaction as J } from "./index127.js";
10
+ import { getTransactionReceipt as g } from "./index130.js";
11
+ import { watchBlockNumber as K } from "./index141.js";
12
+ async function re(r, b) {
13
+ const {
14
+ checkReplacement: F = !0,
15
+ confirmations: n = 1,
16
+ hash: s,
17
+ onReplaced: _,
18
+ retryCount: v = 6,
19
+ retryDelay: y = ({ count: t }) => ~~(1 << t) * 200,
20
+ // exponential backoff
21
+ timeout: N = 18e4
22
+ } = b, I = G(["waitForTransactionReceipt", r.uid, s]), E = b.pollingInterval ? b.pollingInterval : r.chain?.experimental_preconfirmationTime ? r.chain.experimental_preconfirmationTime : r.pollingInterval;
23
+ let i, a, e, c = !1, p, d;
24
+ const { promise: j, resolve: x, reject: R } = z(), w = N ? setTimeout(() => {
25
+ d?.(), p?.(), R(new M({ hash: s }));
26
+ }, N) : void 0;
27
+ return p = q(I, { onReplaced: _, resolve: x, reject: R }, async (t) => {
28
+ if (e = await l(r, g, "getTransactionReceipt")({ hash: s }).catch(() => {
29
+ }), e && n <= 1) {
30
+ clearTimeout(w), t.resolve(e), p?.();
31
+ return;
32
+ }
33
+ d = l(r, K, "watchBlockNumber")({
34
+ emitMissed: !0,
35
+ emitOnBegin: !0,
36
+ poll: !0,
37
+ pollingInterval: E,
38
+ async onBlockNumber(A) {
39
+ const u = (f) => {
40
+ clearTimeout(w), d?.(), f(), p?.();
41
+ };
42
+ let m = A;
43
+ if (!c)
44
+ try {
45
+ if (e) {
46
+ if (n > 1 && (!e.blockNumber || m - e.blockNumber + 1n < n))
47
+ return;
48
+ u(() => t.resolve(e));
23
49
  return;
24
- } catch (o) {
25
- throw s(), o;
26
50
  }
27
- const e = await c(r, h, "getFilterChanges")({ filter: n });
28
- if (e.length === 0)
29
- return;
30
- if (u)
31
- t.onTransactions(e);
32
- else
33
- for (const o of e)
34
- t.onTransactions([o]);
35
- } catch (e) {
36
- t.onError?.(e);
37
- }
38
- }, {
39
- emitOnBegin: !0,
40
- interval: g
41
- });
42
- return async () => {
43
- n && await c(r, P, "uninstallFilter")({ filter: n }), s();
44
- };
45
- });
46
- })() : (() => {
47
- let a = !0, t = () => a = !1;
48
- return (async () => {
49
- try {
50
- const { unsubscribe: n } = await r.transport.subscribe({
51
- params: ["newPendingTransactions"],
52
- onData(s) {
53
- if (!a)
51
+ if (F && !i && (c = !0, await B(async () => {
52
+ i = await l(r, J, "getTransaction")({ hash: s }), i.blockNumber && (m = i.blockNumber);
53
+ }, {
54
+ delay: y,
55
+ retryCount: v
56
+ }), c = !1), e = await l(r, g, "getTransactionReceipt")({ hash: s }), n > 1 && (!e.blockNumber || m - e.blockNumber + 1n < n))
54
57
  return;
55
- const e = s.result;
56
- l([e]);
57
- },
58
- onError(s) {
59
- i?.(s);
58
+ u(() => t.resolve(e));
59
+ } catch (f) {
60
+ if (f instanceof O || f instanceof W) {
61
+ if (!i) {
62
+ c = !1;
63
+ return;
64
+ }
65
+ try {
66
+ a = i, c = !0;
67
+ const T = await B(() => l(r, H, "getBlock")({
68
+ blockNumber: m,
69
+ includeTransactions: !0
70
+ }), {
71
+ delay: y,
72
+ retryCount: v,
73
+ shouldRetry: ({ error: k }) => k instanceof D
74
+ });
75
+ c = !1;
76
+ const o = T.transactions.find(({ from: k, nonce: C }) => k === a.from && C === a.nonce);
77
+ if (!o || (e = await l(r, g, "getTransactionReceipt")({
78
+ hash: o.hash
79
+ }), n > 1 && (!e.blockNumber || m - e.blockNumber + 1n < n)))
80
+ return;
81
+ let h = "replaced";
82
+ o.to === a.to && o.value === a.value && o.input === a.input ? h = "repriced" : o.from === o.to && o.value === 0n && (h = "cancelled"), u(() => {
83
+ t.onReplaced?.({
84
+ reason: h,
85
+ replacedTransaction: a,
86
+ transaction: o,
87
+ transactionReceipt: e
88
+ }), t.resolve(e);
89
+ });
90
+ } catch (T) {
91
+ u(() => t.reject(T));
92
+ }
93
+ } else
94
+ u(() => t.reject(f));
60
95
  }
61
- });
62
- t = n, a || t();
63
- } catch (n) {
64
- i?.(n);
65
96
  }
66
- })(), () => t();
67
- })();
97
+ });
98
+ }), j;
68
99
  }
69
100
  export {
70
- D as watchPendingTransactions
101
+ re as waitForTransactionReceipt
71
102
  };
@@ -1,26 +1,75 @@
1
- import { hashMessage as g } from "./index248.js";
2
- import { parseSiweMessage as l } from "./index313.js";
3
- import { validateSiweMessage as p } from "./index314.js";
4
- import { verifyHash as h } from "./index132.js";
5
- async function S(a, r) {
6
- const { address: i, domain: t, message: s, nonce: o, scheme: n, signature: d, time: m = /* @__PURE__ */ new Date(), ...f } = r, e = l(s);
7
- if (!e.address || !p({
8
- address: i,
9
- domain: t,
10
- message: e,
11
- nonce: o,
12
- scheme: n,
13
- time: m
14
- }))
15
- return !1;
16
- const c = g(s);
17
- return h(a, {
18
- address: e.address,
19
- hash: c,
20
- signature: d,
21
- ...f
22
- });
1
+ import { hexToBigInt as d } from "./index235.js";
2
+ import { getAction as w } from "./index289.js";
3
+ import { observe as k } from "./index291.js";
4
+ import { poll as g } from "./index292.js";
5
+ import { stringify as y } from "./index187.js";
6
+ import { getBlockNumber as h } from "./index113.js";
7
+ function H(r, { emitOnBegin: c = !1, emitMissed: a = !1, onBlockNumber: l, onError: b, poll: i, pollingInterval: m = r.pollingInterval }) {
8
+ const N = typeof i < "u" ? i : !(r.transport.type === "webSocket" || r.transport.type === "ipc" || r.transport.type === "fallback" && (r.transport.transports[0].config.type === "webSocket" || r.transport.transports[0].config.type === "ipc"));
9
+ let t;
10
+ return N ? (() => {
11
+ const p = y([
12
+ "watchBlockNumber",
13
+ r.uid,
14
+ c,
15
+ a,
16
+ m
17
+ ]);
18
+ return k(p, { onBlockNumber: l, onError: b }, (n) => g(async () => {
19
+ try {
20
+ const o = await w(r, h, "getBlockNumber")({ cacheTime: 0 });
21
+ if (t !== void 0) {
22
+ if (o === t)
23
+ return;
24
+ if (o - t > 1 && a)
25
+ for (let e = t + 1n; e < o; e++)
26
+ n.onBlockNumber(e, t), t = e;
27
+ }
28
+ (t === void 0 || o > t) && (n.onBlockNumber(o, t), t = o);
29
+ } catch (o) {
30
+ n.onError?.(o);
31
+ }
32
+ }, {
33
+ emitOnBegin: c,
34
+ interval: m
35
+ }));
36
+ })() : (() => {
37
+ const p = y([
38
+ "watchBlockNumber",
39
+ r.uid,
40
+ c,
41
+ a
42
+ ]);
43
+ return k(p, { onBlockNumber: l, onError: b }, (n) => {
44
+ let o = !0, e = () => o = !1;
45
+ return (async () => {
46
+ try {
47
+ const f = (() => {
48
+ if (r.transport.type === "fallback") {
49
+ const s = r.transport.transports.find((u) => u.config.type === "webSocket" || u.config.type === "ipc");
50
+ return s ? s.value : r.transport;
51
+ }
52
+ return r.transport;
53
+ })(), { unsubscribe: B } = await f.subscribe({
54
+ params: ["newHeads"],
55
+ onData(s) {
56
+ if (!o)
57
+ return;
58
+ const u = d(s.result?.number);
59
+ n.onBlockNumber(u, t), t = u;
60
+ },
61
+ onError(s) {
62
+ n.onError?.(s);
63
+ }
64
+ });
65
+ e = B, o || e();
66
+ } catch (f) {
67
+ b?.(f);
68
+ }
69
+ })(), () => e();
70
+ });
71
+ })();
23
72
  }
24
73
  export {
25
- S as verifySiweMessage
74
+ H as watchBlockNumber
26
75
  };
@@ -1,161 +1,90 @@
1
- import { parseAccount as M } from "./index86.js";
2
- import { internal_estimateFeesPerGas as R } from "./index101.js";
3
- import { estimateGas as B } from "./index102.js";
4
- import { getBlock as N } from "./index107.js";
5
- import { getTransactionCount as _ } from "./index124.js";
6
- import { MaxFeePerGasTooLowError as K, Eip1559FeesNotSupportedError as S } from "./index179.js";
7
- import { blobsToCommitments as z } from "./index216.js";
8
- import { blobsToProofs as L } from "./index217.js";
9
- import { commitmentsToVersionedHashes as $ } from "./index218.js";
10
- import { toBlobSidecars as v } from "./index221.js";
11
- import { getAction as u } from "./index288.js";
12
- import { LruMap as j } from "./index215.js";
13
- import { assertRequest as D } from "./index257.js";
14
- import { getTransactionType as J } from "./index260.js";
15
- import { fillTransaction as O } from "./index104.js";
16
- import { getChainId as Q } from "./index110.js";
17
- const U = [
18
- "blobVersionedHashes",
19
- "chainId",
20
- "fees",
21
- "gas",
22
- "nonce",
23
- "type"
24
- ], E = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new j(128);
25
- async function le(a, H) {
26
- let e = H;
27
- e.account ??= a.account, e.parameters ??= U;
28
- const { account: b, chain: o = a.chain, nonceManager: g, parameters: r } = e, i = (() => {
29
- if (typeof o?.prepareTransactionRequest == "function")
30
- return {
31
- fn: o.prepareTransactionRequest,
32
- runAt: ["beforeFillTransaction"]
33
- };
34
- if (Array.isArray(o?.prepareTransactionRequest))
35
- return {
36
- fn: o.prepareTransactionRequest[0],
37
- runAt: o.prepareTransactionRequest[1].runAt
38
- };
39
- })();
40
- let p;
41
- async function T() {
42
- return p || (typeof e.chainId < "u" ? e.chainId : o ? o.id : (p = await u(a, Q, "getChainId")({}), p));
43
- }
44
- const f = b && M(b);
45
- let s = e.nonce;
46
- if (r.includes("nonce") && typeof s > "u" && f && g) {
47
- const t = await T();
48
- s = await g.consume({
49
- address: f.address,
50
- chainId: t,
51
- client: a
52
- });
53
- }
54
- i?.fn && i.runAt?.includes("beforeFillTransaction") && (e = await i.fn({ ...e, chain: o }, {
55
- phase: "beforeFillTransaction"
56
- }), s ??= e.nonce);
57
- const x = ((r.includes("blobVersionedHashes") || r.includes("sidecars")) && e.kzg && e.blobs || w.get(a.uid) === !1 || !["fees", "gas"].some((n) => r.includes(n)) ? !1 : !!(r.includes("chainId") && typeof e.chainId != "number" || r.includes("nonce") && typeof s != "number" || r.includes("fees") && typeof e.gasPrice != "bigint" && (typeof e.maxFeePerGas != "bigint" || typeof e.maxPriorityFeePerGas != "bigint") || r.includes("gas") && typeof e.gas != "bigint")) ? await u(a, O, "fillTransaction")({ ...e, nonce: s }).then((t) => {
58
- const { chainId: n, from: c, gas: y, gasPrice: d, nonce: G, maxFeePerBlobGas: k, maxFeePerGas: I, maxPriorityFeePerGas: A, type: q, ...F } = t.transaction;
59
- return w.set(a.uid, !0), {
60
- ...e,
61
- ...c ? { from: c } : {},
62
- ...q && !e.type ? { type: q } : {},
63
- ...typeof n < "u" ? { chainId: n } : {},
64
- ...typeof y < "u" ? { gas: y } : {},
65
- ...typeof d < "u" ? { gasPrice: d } : {},
66
- ...typeof G < "u" ? { nonce: G } : {},
67
- ...typeof k < "u" && e.type !== "legacy" && e.type !== "eip2930" ? { maxFeePerBlobGas: k } : {},
68
- ...typeof I < "u" && e.type !== "legacy" && e.type !== "eip2930" ? { maxFeePerGas: I } : {},
69
- ...typeof A < "u" && e.type !== "legacy" && e.type !== "eip2930" ? { maxPriorityFeePerGas: A } : {},
70
- ..."nonceKey" in F && typeof F.nonceKey < "u" ? { nonceKey: F.nonceKey } : {}
71
- };
72
- }).catch((t) => {
73
- const n = t;
74
- return n.name !== "TransactionExecutionError" || n.walk?.((y) => {
75
- const d = y;
76
- return d.name === "MethodNotFoundRpcError" || d.name === "MethodNotSupportedRpcError";
77
- }) && w.set(a.uid, !1), e;
78
- }) : e;
79
- s ??= x.nonce, e = {
80
- ...x,
81
- ...f ? { from: f?.address } : {},
82
- ...s ? { nonce: s } : {}
83
- };
84
- const { blobs: l, gas: C, kzg: h, type: V } = e;
85
- i?.fn && i.runAt?.includes("beforeFillParameters") && (e = await i.fn({ ...e, chain: o }, {
86
- phase: "beforeFillParameters"
87
- }));
88
- let m;
89
- async function P() {
90
- return m || (m = await u(a, N, "getBlock")({ blockTag: "latest" }), m);
91
- }
92
- if (r.includes("nonce") && typeof s > "u" && f && !g && (e.nonce = await u(a, _, "getTransactionCount")({
93
- address: f.address,
94
- blockTag: "pending"
95
- })), (r.includes("blobVersionedHashes") || r.includes("sidecars")) && l && h) {
96
- const t = z({ blobs: l, kzg: h });
97
- if (r.includes("blobVersionedHashes")) {
98
- const n = $({
99
- commitments: t,
100
- to: "hex"
101
- });
102
- e.blobVersionedHashes = n;
103
- }
104
- if (r.includes("sidecars")) {
105
- const n = L({ blobs: l, commitments: t, kzg: h }), c = v({
106
- blobs: l,
107
- commitments: t,
108
- proofs: n,
109
- to: "hex"
110
- });
111
- e.sidecars = c;
112
- }
113
- }
114
- if (r.includes("chainId") && (e.chainId = await T()), (r.includes("fees") || r.includes("type")) && typeof V > "u")
115
- try {
116
- e.type = J(e);
117
- } catch {
118
- let t = E.get(a.uid);
119
- typeof t > "u" && (t = typeof (await P())?.baseFeePerGas == "bigint", E.set(a.uid, t)), e.type = t ? "eip1559" : "legacy";
120
- }
121
- if (r.includes("fees"))
122
- if (e.type !== "legacy" && e.type !== "eip2930") {
123
- if (typeof e.maxFeePerGas > "u" || typeof e.maxPriorityFeePerGas > "u") {
124
- const t = await P(), { maxFeePerGas: n, maxPriorityFeePerGas: c } = await R(a, {
125
- block: t,
126
- chain: o,
127
- request: e
1
+ import { getAction as p } from "./index289.js";
2
+ import { observe as h } from "./index291.js";
3
+ import { poll as v } from "./index292.js";
4
+ import { stringify as S } from "./index187.js";
5
+ import { getBlock as i } from "./index112.js";
6
+ function P(r, { blockTag: l = r.experimental_blockTag ?? "latest", emitMissed: y = !1, emitOnBegin: m = !1, onBlock: k, onError: f, includeTransactions: B, poll: d, pollingInterval: w = r.pollingInterval }) {
7
+ const g = typeof d < "u" ? d : !(r.transport.type === "webSocket" || r.transport.type === "ipc" || r.transport.type === "fallback" && (r.transport.transports[0].config.type === "webSocket" || r.transport.transports[0].config.type === "ipc")), a = B ?? !1;
8
+ let e;
9
+ return g ? (() => {
10
+ const o = S([
11
+ "watchBlocks",
12
+ r.uid,
13
+ l,
14
+ y,
15
+ m,
16
+ a,
17
+ w
18
+ ]);
19
+ return h(o, { onBlock: k, onError: f }, (s) => v(async () => {
20
+ try {
21
+ const t = await p(r, i, "getBlock")({
22
+ blockTag: l,
23
+ includeTransactions: a
128
24
  });
129
- if (typeof e.maxPriorityFeePerGas > "u" && e.maxFeePerGas && e.maxFeePerGas < c)
130
- throw new K({
131
- maxPriorityFeePerGas: c
132
- });
133
- e.maxPriorityFeePerGas = c, e.maxFeePerGas = n;
25
+ if (t.number !== null && e?.number != null) {
26
+ if (t.number === e.number)
27
+ return;
28
+ if (t.number - e.number > 1 && y)
29
+ for (let u = e?.number + 1n; u < t.number; u++) {
30
+ const b = await p(r, i, "getBlock")({
31
+ blockNumber: u,
32
+ includeTransactions: a
33
+ });
34
+ s.onBlock(b, e), e = b;
35
+ }
36
+ }
37
+ // If no previous block exists, emit.
38
+ (e?.number == null || // If the block tag is "pending" with no block number, emit.
39
+ l === "pending" && t?.number == null || // If the next block number is greater than the previous block number, emit.
40
+ // We don't want to emit blocks in the past.
41
+ t.number !== null && t.number > e.number) && (s.onBlock(t, e), e = t);
42
+ } catch (t) {
43
+ s.onError?.(t);
134
44
  }
135
- } else {
136
- if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u")
137
- throw new S();
138
- if (typeof e.gasPrice > "u") {
139
- const t = await P(), { gasPrice: n } = await R(a, {
140
- block: t,
141
- chain: o,
142
- request: e,
143
- type: "legacy"
45
+ }, {
46
+ emitOnBegin: m,
47
+ interval: w
48
+ }));
49
+ })() : (() => {
50
+ let o = !0, s = !0, t = () => o = !1;
51
+ return (async () => {
52
+ try {
53
+ m && p(r, i, "getBlock")({
54
+ blockTag: l,
55
+ includeTransactions: a
56
+ }).then((n) => {
57
+ o && s && (k(n, void 0), s = !1);
58
+ }).catch(f);
59
+ const u = (() => {
60
+ if (r.transport.type === "fallback") {
61
+ const n = r.transport.transports.find((c) => c.config.type === "webSocket" || c.config.type === "ipc");
62
+ return n ? n.value : r.transport;
63
+ }
64
+ return r.transport;
65
+ })(), { unsubscribe: b } = await u.subscribe({
66
+ params: ["newHeads"],
67
+ async onData(n) {
68
+ if (!o)
69
+ return;
70
+ const c = await p(r, i, "getBlock")({
71
+ blockNumber: n.result?.number,
72
+ includeTransactions: a
73
+ }).catch(() => {
74
+ });
75
+ o && (k(c, e), s = !1, e = c);
76
+ },
77
+ onError(n) {
78
+ f?.(n);
79
+ }
144
80
  });
145
- e.gasPrice = n;
81
+ t = b, o || t();
82
+ } catch (u) {
83
+ f?.(u);
146
84
  }
147
- }
148
- return r.includes("gas") && typeof C > "u" && (e.gas = await u(a, B, "estimateGas")({
149
- ...e,
150
- account: f,
151
- prepare: f?.type === "local" ? [] : ["blobVersionedHashes"]
152
- })), i?.fn && i.runAt?.includes("afterFillParameters") && (e = await i.fn({ ...e, chain: o }, {
153
- phase: "afterFillParameters"
154
- })), D(e), delete e.parameters, e;
85
+ })(), () => t();
86
+ })();
155
87
  }
156
88
  export {
157
- U as defaultParameters,
158
- E as eip1559NetworkCache,
159
- le as prepareTransactionRequest,
160
- w as supportsFillTransaction
89
+ P as watchBlocks
161
90
  };