@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,45 +1,113 @@
1
- import { IntegerOutOfRangeError as s, SizeOverflowError as a, InvalidHexBooleanError as z } from "./index176.js";
2
- import { size as f } from "./index159.js";
3
- import { trim as t } from "./index189.js";
4
- function u(r, { size: e }) {
5
- if (f(r) > e)
6
- throw new a({
7
- givenSize: f(r),
8
- maxSize: e
1
+ import { call as h } from "./index99.js";
2
+ import { OffchainLookupSenderMismatchError as w, OffchainLookupError as b, OffchainLookupResponseMalformedError as k } from "./index231.js";
3
+ import { HttpRequestError as m } from "./index152.js";
4
+ import { decodeErrorResult as g } from "./index172.js";
5
+ import { encodeAbiParameters as q } from "./index198.js";
6
+ import { isAddressEqual as E } from "./index218.js";
7
+ import { concat as L } from "./index206.js";
8
+ import { isHex as O } from "./index216.js";
9
+ import { localBatchGatewayUrl as R, localBatchGatewayRequest as x } from "./index232.js";
10
+ import { stringify as S } from "./index187.js";
11
+ const I = "0x556f1830", T = {
12
+ name: "OffchainLookup",
13
+ type: "error",
14
+ inputs: [
15
+ {
16
+ name: "sender",
17
+ type: "address"
18
+ },
19
+ {
20
+ name: "urls",
21
+ type: "string[]"
22
+ },
23
+ {
24
+ name: "callData",
25
+ type: "bytes"
26
+ },
27
+ {
28
+ name: "callbackFunction",
29
+ type: "bytes4"
30
+ },
31
+ {
32
+ name: "extraData",
33
+ type: "bytes"
34
+ }
35
+ ]
36
+ };
37
+ async function J(c, { blockNumber: i, blockTag: p, data: a, to: o }) {
38
+ const { args: n } = g({
39
+ data: a,
40
+ abi: [T]
41
+ }), [r, s, f, e, t] = n, { ccipRead: u } = c, d = u && typeof u?.request == "function" ? u.request : A;
42
+ try {
43
+ if (!E(o, r))
44
+ throw new w({ sender: r, to: o });
45
+ const l = s.includes(R) ? await x({
46
+ data: f,
47
+ ccipRequest: d
48
+ }) : await d({ data: f, sender: r, urls: s }), { data: y } = await h(c, {
49
+ blockNumber: i,
50
+ blockTag: p,
51
+ data: L([
52
+ e,
53
+ q([{ type: "bytes" }, { type: "bytes" }], [l, t])
54
+ ]),
55
+ to: o
9
56
  });
10
- }
11
- function g(r, e = {}) {
12
- const { signed: n } = e;
13
- e.size && u(r, { size: e.size });
14
- const i = BigInt(r);
15
- if (!n)
16
- return i;
17
- const o = (r.length - 2) / 2, m = (1n << BigInt(o) * 8n - 1n) - 1n;
18
- return i <= m ? i : i - BigInt(`0x${"f".padStart(o * 2, "f")}`) - 1n;
19
- }
20
- function x(r, e = {}) {
21
- let n = r;
22
- if (e.size && (u(n, { size: e.size }), n = t(n)), t(n) === "0x00")
23
- return !1;
24
- if (t(n) === "0x01")
25
- return !0;
26
- throw new z(n);
27
- }
28
- function E(r, e = {}) {
29
- const n = g(r, e), i = Number(n);
30
- if (!Number.isSafeInteger(i))
31
- throw new s({
32
- max: `${Number.MAX_SAFE_INTEGER}`,
33
- min: `${Number.MIN_SAFE_INTEGER}`,
34
- signed: e.signed,
35
- size: e.size,
36
- value: `${n}n`
57
+ return y;
58
+ } catch (l) {
59
+ throw new b({
60
+ callbackSelector: e,
61
+ cause: l,
62
+ data: a,
63
+ extraData: t,
64
+ sender: r,
65
+ urls: s
37
66
  });
38
- return i;
67
+ }
68
+ }
69
+ async function A({ data: c, sender: i, urls: p }) {
70
+ let a = new Error("An unknown error occurred.");
71
+ for (let o = 0; o < p.length; o++) {
72
+ const n = p[o], r = n.includes("{data}") ? "GET" : "POST", s = r === "POST" ? { data: c, sender: i } : void 0, f = r === "POST" ? { "Content-Type": "application/json" } : {};
73
+ try {
74
+ const e = await fetch(n.replace("{sender}", i.toLowerCase()).replace("{data}", c), {
75
+ body: JSON.stringify(s),
76
+ headers: f,
77
+ method: r
78
+ });
79
+ let t;
80
+ if (e.headers.get("Content-Type")?.startsWith("application/json") ? t = (await e.json()).data : t = await e.text(), !e.ok) {
81
+ a = new m({
82
+ body: s,
83
+ details: t?.error ? S(t.error) : e.statusText,
84
+ headers: e.headers,
85
+ status: e.status,
86
+ url: n
87
+ });
88
+ continue;
89
+ }
90
+ if (!O(t)) {
91
+ a = new k({
92
+ result: t,
93
+ url: n
94
+ });
95
+ continue;
96
+ }
97
+ return t;
98
+ } catch (e) {
99
+ a = new m({
100
+ body: s,
101
+ details: e.message,
102
+ url: n
103
+ });
104
+ }
105
+ }
106
+ throw a;
39
107
  }
40
108
  export {
41
- u as assertSize,
42
- g as hexToBigInt,
43
- x as hexToBool,
44
- E as hexToNumber
109
+ A as ccipRequest,
110
+ J as offchainLookup,
111
+ T as offchainLookupAbiItem,
112
+ I as offchainLookupSignature
45
113
  };
@@ -1,45 +1,51 @@
1
- import { BaseError as l } from "./index160.js";
2
- import { createCursor as r } from "./index187.js";
3
- import { hexToBytes as g } from "./index191.js";
4
- import { bytesToHex as u } from "./index192.js";
5
- function m(n, e = "hex") {
6
- const i = s(n), h = r(new Uint8Array(i.length));
7
- return i.encode(h), e === "hex" ? u(h.bytes) : h.bytes;
1
+ import { stringify as m } from "./index187.js";
2
+ import { BaseError as a } from "./index165.js";
3
+ import { getUrl as t } from "./index179.js";
4
+ class l extends a {
5
+ constructor({ callbackSelector: r, cause: e, data: n, extraData: f, sender: c, urls: o }) {
6
+ super(e.shortMessage || "An error occurred while fetching for an offchain result.", {
7
+ cause: e,
8
+ metaMessages: [
9
+ ...e.metaMessages || [],
10
+ e.metaMessages?.length ? "" : [],
11
+ "Offchain Gateway Call:",
12
+ o && [
13
+ " Gateway URL(s):",
14
+ ...o.map((d) => ` ${t(d)}`)
15
+ ],
16
+ ` Sender: ${c}`,
17
+ ` Data: ${n}`,
18
+ ` Callback selector: ${r}`,
19
+ ` Extra data: ${f}`
20
+ ].flat(),
21
+ name: "OffchainLookupError"
22
+ });
23
+ }
8
24
  }
9
- function s(n) {
10
- return Array.isArray(n) ? p(n.map((e) => s(e))) : y(n);
25
+ class u extends a {
26
+ constructor({ result: r, url: e }) {
27
+ super("Offchain gateway response is malformed. Response data must be a hex value.", {
28
+ metaMessages: [
29
+ `Gateway URL: ${t(e)}`,
30
+ `Response: ${m(r)}`
31
+ ],
32
+ name: "OffchainLookupResponseMalformedError"
33
+ });
34
+ }
11
35
  }
12
- function p(n) {
13
- const e = n.reduce((t, f) => t + f.length, 0), i = o(e);
14
- return {
15
- length: e <= 55 ? 1 + e : 1 + i + e,
16
- encode(t) {
17
- e <= 55 ? t.pushByte(192 + e) : (t.pushByte(247 + i), i === 1 ? t.pushUint8(e) : i === 2 ? t.pushUint16(e) : i === 3 ? t.pushUint24(e) : t.pushUint32(e));
18
- for (const { encode: f } of n)
19
- f(t);
20
- }
21
- };
22
- }
23
- function y(n) {
24
- const e = typeof n == "string" ? g(n) : n, i = o(e.length);
25
- return {
26
- length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + i + e.length,
27
- encode(t) {
28
- e.length === 1 && e[0] < 128 ? t.pushBytes(e) : e.length <= 55 ? (t.pushByte(128 + e.length), t.pushBytes(e)) : (t.pushByte(183 + i), i === 1 ? t.pushUint8(e.length) : i === 2 ? t.pushUint16(e.length) : i === 3 ? t.pushUint24(e.length) : t.pushUint32(e.length), t.pushBytes(e));
29
- }
30
- };
31
- }
32
- function o(n) {
33
- if (n < 2 ** 8)
34
- return 1;
35
- if (n < 2 ** 16)
36
- return 2;
37
- if (n < 2 ** 24)
38
- return 3;
39
- if (n < 2 ** 32)
40
- return 4;
41
- throw new l("Length is too large.");
36
+ class g extends a {
37
+ constructor({ sender: r, to: e }) {
38
+ super("Reverted sender address does not match target contract address (`to`).", {
39
+ metaMessages: [
40
+ `Contract address: ${e}`,
41
+ `OffchainLookup sender address: ${r}`
42
+ ],
43
+ name: "OffchainLookupSenderMismatchError"
44
+ });
45
+ }
42
46
  }
43
47
  export {
44
- m as toRlp
48
+ l as OffchainLookupError,
49
+ u as OffchainLookupResponseMalformedError,
50
+ g as OffchainLookupSenderMismatchError
45
51
  };
@@ -1,11 +1,35 @@
1
- import { stringToBytes as t } from "./index191.js";
2
- import { bytesToHex as e } from "./index192.js";
3
- import { keccak256 as i } from "./index207.js";
4
- import { encodedLabelToLabelhash as n } from "./index233.js";
5
- function c(r) {
6
- const o = new Uint8Array(32).fill(0);
7
- return r ? n(r) || i(t(r)) : e(o);
1
+ import { batchGatewayAbi as o } from "./index156.js";
2
+ import { solidityError as l } from "./index171.js";
3
+ import { decodeFunctionData as f } from "./index203.js";
4
+ import { encodeErrorResult as n } from "./index210.js";
5
+ import { encodeFunctionResult as p } from "./index215.js";
6
+ const d = "x-batch-gateway:true";
7
+ async function g(t) {
8
+ const { data: i, ccipRequest: c } = t, { args: [u] } = f({ abi: o, data: i }), e = [], s = [];
9
+ return await Promise.all(u.map(async (r, a) => {
10
+ try {
11
+ s[a] = r.urls.includes(d) ? await g({ data: r.data, ccipRequest: c }) : await c(r), e[a] = !1;
12
+ } catch (m) {
13
+ e[a] = !0, s[a] = h(m);
14
+ }
15
+ })), p({
16
+ abi: o,
17
+ functionName: "query",
18
+ result: [e, s]
19
+ });
20
+ }
21
+ function h(t) {
22
+ return t.name === "HttpRequestError" && t.status ? n({
23
+ abi: o,
24
+ errorName: "HttpError",
25
+ args: [t.status, t.shortMessage]
26
+ }) : n({
27
+ abi: [l],
28
+ errorName: "Error",
29
+ args: ["shortMessage" in t ? t.shortMessage : t.message]
30
+ });
8
31
  }
9
32
  export {
10
- c as labelhash
33
+ g as localBatchGatewayRequest,
34
+ d as localBatchGatewayUrl
11
35
  };
@@ -1,10 +1,20 @@
1
- import { isHex as e } from "./index211.js";
2
- function t(n) {
3
- if (n.length !== 66 || n.indexOf("[") !== 0 || n.indexOf("]") !== 65)
4
- return null;
5
- const r = `0x${n.slice(1, 65)}`;
6
- return e(r) ? r : null;
1
+ function r(c) {
2
+ const n = {
3
+ formatters: void 0,
4
+ fees: void 0,
5
+ serializers: void 0,
6
+ ...c
7
+ };
8
+ function t(i) {
9
+ return (e) => {
10
+ const o = typeof e == "function" ? e(i) : e, s = { ...i, ...o };
11
+ return Object.assign(s, { extend: t(s) });
12
+ };
13
+ }
14
+ return Object.assign(n, {
15
+ extend: t(n)
16
+ });
7
17
  }
8
18
  export {
9
- t as encodedLabelToLabelhash
19
+ r as defineChain
10
20
  };
@@ -1,19 +1,22 @@
1
- import { concat as a } from "./index201.js";
2
- import { toBytes as m, stringToBytes as c } from "./index191.js";
3
- import { bytesToHex as n } from "./index192.js";
4
- import { keccak256 as i } from "./index207.js";
5
- import { encodedLabelToLabelhash as f } from "./index233.js";
6
- function u(r) {
7
- let t = new Uint8Array(32).fill(0);
8
- if (!r)
9
- return n(t);
10
- const e = r.split(".");
11
- for (let o = e.length - 1; o >= 0; o -= 1) {
12
- const s = f(e[o]), l = s ? m(s) : i(c(e[o]), "bytes");
13
- t = i(a([t, l]), "bytes");
14
- }
15
- return n(t);
1
+ import { ChainDoesNotSupportContract as e } from "./index169.js";
2
+ function a({ blockNumber: o, chain: r, contract: c }) {
3
+ const t = r?.contracts?.[c];
4
+ if (!t)
5
+ throw new e({
6
+ chain: r,
7
+ contract: { name: c }
8
+ });
9
+ if (o && t.blockCreated && t.blockCreated > o)
10
+ throw new e({
11
+ blockNumber: o,
12
+ chain: r,
13
+ contract: {
14
+ name: c,
15
+ blockCreated: t.blockCreated
16
+ }
17
+ });
18
+ return t.address;
16
19
  }
17
20
  export {
18
- u as namehash
21
+ a as getChainContractAddress
19
22
  };
@@ -1,25 +1,45 @@
1
- import { AbiDecodingZeroDataError as m } from "./index157.js";
2
- import { BaseError as C } from "./index160.js";
3
- import { RawContractError as l, ContractFunctionZeroDataError as w, ContractFunctionRevertedError as g, ContractFunctionExecutionError as D } from "./index165.js";
4
- import { RpcRequestError as I } from "./index147.js";
5
- import { InternalRpcError as v, InvalidInputRpcError as x } from "./index183.js";
6
- const F = 3;
7
- function Z(r, { abi: e, address: E, args: d, docsPath: u, functionName: o, sender: f }) {
8
- const a = r instanceof l ? r : r instanceof C ? r.walk((R) => "data" in R) || r.walk() : {}, { code: c, data: t, details: n, message: s, shortMessage: i } = a, p = r instanceof m ? new w({ functionName: o }) : [F, v.code].includes(c) && (t || n || s || i) || c === x.code && n === "execution reverted" && t ? new g({
9
- abi: e,
10
- data: typeof t == "object" ? t.data : t,
11
- functionName: o,
12
- message: a instanceof I ? n : i ?? s
13
- }) : r;
14
- return new D(p, {
15
- abi: e,
16
- args: d,
17
- contractAddress: E,
18
- docsPath: u,
19
- functionName: o,
20
- sender: f
21
- });
1
+ import { IntegerOutOfRangeError as s, SizeOverflowError as a, InvalidHexBooleanError as z } from "./index181.js";
2
+ import { size as f } from "./index164.js";
3
+ import { trim as t } from "./index194.js";
4
+ function u(r, { size: e }) {
5
+ if (f(r) > e)
6
+ throw new a({
7
+ givenSize: f(r),
8
+ maxSize: e
9
+ });
10
+ }
11
+ function g(r, e = {}) {
12
+ const { signed: n } = e;
13
+ e.size && u(r, { size: e.size });
14
+ const i = BigInt(r);
15
+ if (!n)
16
+ return i;
17
+ const o = (r.length - 2) / 2, m = (1n << BigInt(o) * 8n - 1n) - 1n;
18
+ return i <= m ? i : i - BigInt(`0x${"f".padStart(o * 2, "f")}`) - 1n;
19
+ }
20
+ function x(r, e = {}) {
21
+ let n = r;
22
+ if (e.size && (u(n, { size: e.size }), n = t(n)), t(n) === "0x00")
23
+ return !1;
24
+ if (t(n) === "0x01")
25
+ return !0;
26
+ throw new z(n);
27
+ }
28
+ function E(r, e = {}) {
29
+ const n = g(r, e), i = Number(n);
30
+ if (!Number.isSafeInteger(i))
31
+ throw new s({
32
+ max: `${Number.MAX_SAFE_INTEGER}`,
33
+ min: `${Number.MIN_SAFE_INTEGER}`,
34
+ signed: e.signed,
35
+ size: e.size,
36
+ value: `${n}n`
37
+ });
38
+ return i;
22
39
  }
23
40
  export {
24
- Z as getContractError
41
+ u as assertSize,
42
+ g as hexToBigInt,
43
+ x as hexToBool,
44
+ E as hexToNumber
25
45
  };
@@ -1,27 +1,45 @@
1
- import { defineFormatter as s } from "./index237.js";
2
- import { formatTransaction as t } from "./index238.js";
3
- function a(e, f) {
4
- const i = (e.transactions ?? []).map((n) => typeof n == "string" ? n : t(n));
1
+ import { BaseError as l } from "./index165.js";
2
+ import { createCursor as r } from "./index192.js";
3
+ import { hexToBytes as g } from "./index196.js";
4
+ import { bytesToHex as u } from "./index197.js";
5
+ function m(n, e = "hex") {
6
+ const i = s(n), h = r(new Uint8Array(i.length));
7
+ return i.encode(h), e === "hex" ? u(h.bytes) : h.bytes;
8
+ }
9
+ function s(n) {
10
+ return Array.isArray(n) ? p(n.map((e) => s(e))) : y(n);
11
+ }
12
+ function p(n) {
13
+ const e = n.reduce((t, f) => t + f.length, 0), i = o(e);
14
+ return {
15
+ length: e <= 55 ? 1 + e : 1 + i + e,
16
+ encode(t) {
17
+ e <= 55 ? t.pushByte(192 + e) : (t.pushByte(247 + i), i === 1 ? t.pushUint8(e) : i === 2 ? t.pushUint16(e) : i === 3 ? t.pushUint24(e) : t.pushUint32(e));
18
+ for (const { encode: f } of n)
19
+ f(t);
20
+ }
21
+ };
22
+ }
23
+ function y(n) {
24
+ const e = typeof n == "string" ? g(n) : n, i = o(e.length);
5
25
  return {
6
- ...e,
7
- baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
8
- blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
9
- difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
10
- excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
11
- gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
12
- gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
13
- hash: e.hash ? e.hash : null,
14
- logsBloom: e.logsBloom ? e.logsBloom : null,
15
- nonce: e.nonce ? e.nonce : null,
16
- number: e.number ? BigInt(e.number) : null,
17
- size: e.size ? BigInt(e.size) : void 0,
18
- timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
19
- transactions: i,
20
- totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
26
+ length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + i + e.length,
27
+ encode(t) {
28
+ e.length === 1 && e[0] < 128 ? t.pushBytes(e) : e.length <= 55 ? (t.pushByte(128 + e.length), t.pushBytes(e)) : (t.pushByte(183 + i), i === 1 ? t.pushUint8(e.length) : i === 2 ? t.pushUint16(e.length) : i === 3 ? t.pushUint24(e.length) : t.pushUint32(e.length), t.pushBytes(e));
29
+ }
21
30
  };
22
31
  }
23
- const m = /* @__PURE__ */ s("block", a);
32
+ function o(n) {
33
+ if (n < 2 ** 8)
34
+ return 1;
35
+ if (n < 2 ** 16)
36
+ return 2;
37
+ if (n < 2 ** 24)
38
+ return 3;
39
+ if (n < 2 ** 32)
40
+ return 4;
41
+ throw new l("Length is too large.");
42
+ }
24
43
  export {
25
- m as defineBlock,
26
- a as formatBlock
44
+ m as toRlp
27
45
  };
@@ -1,19 +1,11 @@
1
- function i(f, n) {
2
- return ({ exclude: t, format: m }) => ({
3
- exclude: t,
4
- format: (r, o) => {
5
- const e = n(r, o);
6
- if (t)
7
- for (const a of t)
8
- delete e[a];
9
- return {
10
- ...e,
11
- ...m(r, o)
12
- };
13
- },
14
- type: f
15
- });
1
+ import { stringToBytes as t } from "./index196.js";
2
+ import { bytesToHex as e } from "./index197.js";
3
+ import { keccak256 as i } from "./index212.js";
4
+ import { encodedLabelToLabelhash as n } from "./index238.js";
5
+ function c(r) {
6
+ const o = new Uint8Array(32).fill(0);
7
+ return r ? n(r) || i(t(r)) : e(o);
16
8
  }
17
9
  export {
18
- i as defineFormatter
10
+ c as labelhash
19
11
  };
@@ -1,57 +1,10 @@
1
- import { hexToNumber as r } from "./index230.js";
2
- import { defineFormatter as u } from "./index237.js";
3
- const l = {
4
- "0x0": "legacy",
5
- "0x1": "eip2930",
6
- "0x2": "eip1559",
7
- "0x3": "eip4844",
8
- "0x4": "eip7702"
9
- };
10
- function m(e, i) {
11
- const d = {
12
- ...e,
13
- blockHash: e.blockHash ? e.blockHash : null,
14
- blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
15
- chainId: e.chainId ? r(e.chainId) : void 0,
16
- gas: e.gas ? BigInt(e.gas) : void 0,
17
- gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
18
- maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
19
- maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
20
- maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
21
- nonce: e.nonce ? r(e.nonce) : void 0,
22
- to: e.to ? e.to : null,
23
- transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
24
- type: e.type ? l[e.type] : void 0,
25
- typeHex: e.type ? e.type : void 0,
26
- value: e.value ? BigInt(e.value) : void 0,
27
- v: e.v ? BigInt(e.v) : void 0
28
- };
29
- return e.authorizationList && (d.authorizationList = f(e.authorizationList)), d.yParity = (() => {
30
- if (e.yParity)
31
- return Number(e.yParity);
32
- if (typeof d.v == "bigint") {
33
- if (d.v === 0n || d.v === 27n)
34
- return 0;
35
- if (d.v === 1n || d.v === 28n)
36
- return 1;
37
- if (d.v >= 35n)
38
- return d.v % 2n === 0n ? 1 : 0;
39
- }
40
- })(), d.type === "legacy" && (delete d.accessList, delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas, delete d.yParity), d.type === "eip2930" && (delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas), d.type === "eip1559" && delete d.maxFeePerBlobGas, d;
41
- }
42
- const x = /* @__PURE__ */ u("transaction", m);
43
- function f(e) {
44
- return e.map((i) => ({
45
- address: i.address,
46
- chainId: Number(i.chainId),
47
- nonce: Number(i.nonce),
48
- r: i.r,
49
- s: i.s,
50
- yParity: Number(i.yParity)
51
- }));
1
+ import { isHex as e } from "./index216.js";
2
+ function t(n) {
3
+ if (n.length !== 66 || n.indexOf("[") !== 0 || n.indexOf("]") !== 65)
4
+ return null;
5
+ const r = `0x${n.slice(1, 65)}`;
6
+ return e(r) ? r : null;
52
7
  }
53
8
  export {
54
- x as defineTransaction,
55
- m as formatTransaction,
56
- l as transactionType
9
+ t as encodedLabelToLabelhash
57
10
  };
@@ -1,30 +1,19 @@
1
- import { hexToNumber as d } from "./index230.js";
2
- import { defineFormatter as b } from "./index237.js";
3
- import { formatLog as m } from "./index214.js";
4
- import { transactionType as o } from "./index238.js";
5
- const f = {
6
- "0x0": "reverted",
7
- "0x1": "success"
8
- };
9
- function r(l, e) {
10
- const s = {
11
- ...l,
12
- blockNumber: l.blockNumber ? BigInt(l.blockNumber) : null,
13
- contractAddress: l.contractAddress ? l.contractAddress : null,
14
- cumulativeGasUsed: l.cumulativeGasUsed ? BigInt(l.cumulativeGasUsed) : null,
15
- effectiveGasPrice: l.effectiveGasPrice ? BigInt(l.effectiveGasPrice) : null,
16
- gasUsed: l.gasUsed ? BigInt(l.gasUsed) : null,
17
- logs: l.logs ? l.logs.map((u) => m(u)) : null,
18
- to: l.to ? l.to : null,
19
- transactionIndex: l.transactionIndex ? d(l.transactionIndex) : null,
20
- status: l.status ? f[l.status] : null,
21
- type: l.type ? o[l.type] || l.type : null
22
- };
23
- return l.blobGasPrice && (s.blobGasPrice = BigInt(l.blobGasPrice)), l.blobGasUsed && (s.blobGasUsed = BigInt(l.blobGasUsed)), s;
1
+ import { concat as a } from "./index206.js";
2
+ import { toBytes as m, stringToBytes as c } from "./index196.js";
3
+ import { bytesToHex as n } from "./index197.js";
4
+ import { keccak256 as i } from "./index212.js";
5
+ import { encodedLabelToLabelhash as f } from "./index238.js";
6
+ function u(r) {
7
+ let t = new Uint8Array(32).fill(0);
8
+ if (!r)
9
+ return n(t);
10
+ const e = r.split(".");
11
+ for (let o = e.length - 1; o >= 0; o -= 1) {
12
+ const s = f(e[o]), l = s ? m(s) : i(c(e[o]), "bytes");
13
+ t = i(a([t, l]), "bytes");
14
+ }
15
+ return n(t);
24
16
  }
25
- const v = /* @__PURE__ */ b("transactionReceipt", r);
26
17
  export {
27
- v as defineTransactionReceipt,
28
- r as formatTransactionReceipt,
29
- f as receiptStatuses
18
+ u as namehash
30
19
  };