@coinbase/cdp-hooks 0.0.94 → 0.0.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/dist/esm/index100.js +27 -44
  2. package/dist/esm/index101.js +44 -86
  3. package/dist/esm/index102.js +66 -37
  4. package/dist/esm/index103.js +40 -8
  5. package/dist/esm/index104.js +75 -6
  6. package/dist/esm/index105.js +31 -16
  7. package/dist/esm/index106.js +6 -8
  8. package/dist/esm/index107.js +16 -13
  9. package/dist/esm/index108.js +8 -7
  10. package/dist/esm/index109.js +13 -9
  11. package/dist/esm/index110.js +7 -16
  12. package/dist/esm/index111.js +9 -46
  13. package/dist/esm/index112.js +16 -13
  14. package/dist/esm/index113.js +11 -15
  15. package/dist/esm/index114.js +46 -13
  16. package/dist/esm/index115.js +13 -6
  17. package/dist/esm/index116.js +15 -34
  18. package/dist/esm/index117.js +13 -9
  19. package/dist/esm/index118.js +5 -7
  20. package/dist/esm/index119.js +35 -25
  21. package/dist/esm/index120.js +9 -10
  22. package/dist/esm/index121.js +7 -13
  23. package/dist/esm/index122.js +28 -11
  24. package/dist/esm/index123.js +10 -116
  25. package/dist/esm/index124.js +13 -32
  26. package/dist/esm/index125.js +11 -79
  27. package/dist/esm/index126.js +113 -170
  28. package/dist/esm/index127.js +26 -37
  29. package/dist/esm/index128.js +80 -6
  30. package/dist/esm/index129.js +177 -13
  31. package/dist/esm/index130.js +44 -13
  32. package/dist/esm/index131.js +6 -99
  33. package/dist/esm/index132.js +153 -71
  34. package/dist/esm/index133.js +14 -87
  35. package/dist/esm/index134.js +14 -148
  36. package/dist/esm/index135.js +93 -130
  37. package/dist/esm/index136.js +65 -61
  38. package/dist/esm/index137.js +87 -23
  39. package/dist/esm/index138.js +145 -102
  40. package/dist/esm/index139.js +136 -6
  41. package/dist/esm/index140.js +65 -128
  42. package/dist/esm/index141.js +24 -276
  43. package/dist/esm/index142.js +159 -3
  44. package/dist/esm/index143.js +7 -4
  45. package/dist/esm/index144.js +12 -9
  46. package/dist/esm/index145.js +20 -2
  47. package/dist/esm/index146.js +136 -2
  48. package/dist/esm/index147.js +79 -3
  49. package/dist/esm/index148.js +6 -323
  50. package/dist/esm/index149.js +28 -13
  51. package/dist/esm/index150.js +89 -4
  52. package/dist/esm/index151.js +351 -56
  53. package/dist/esm/index152.js +3 -2
  54. package/dist/esm/index153.js +5 -8
  55. package/dist/esm/index154.js +2 -215
  56. package/dist/esm/index155.js +3 -32
  57. package/dist/esm/index156.js +9 -22
  58. package/dist/esm/index157.js +326 -5
  59. package/dist/esm/index158.js +11 -71
  60. package/dist/esm/index159.js +4 -5
  61. package/dist/esm/index160.js +55 -5
  62. package/dist/esm/index161.js +10 -33
  63. package/dist/esm/index162.js +2 -76
  64. package/dist/esm/index163.js +8 -3
  65. package/dist/esm/index164.js +22 -15
  66. package/dist/esm/index165.js +193 -430
  67. package/dist/esm/index166.js +32 -31
  68. package/dist/esm/index167.js +20 -25
  69. package/dist/esm/index168.js +5 -33
  70. package/dist/esm/index169.js +72 -33
  71. package/dist/esm/index170.js +5 -193
  72. package/dist/esm/index171.js +5 -8
  73. package/dist/esm/index172.js +36 -2
  74. package/dist/esm/index173.js +115 -8
  75. package/dist/esm/index174.js +3 -19
  76. package/dist/esm/index175.js +13 -22
  77. package/dist/esm/index176.js +26 -8
  78. package/dist/esm/index177.js +29 -51
  79. package/dist/esm/index178.js +32 -43
  80. package/dist/esm/index179.js +23 -8
  81. package/dist/esm/index180.js +8 -7
  82. package/dist/esm/index181.js +193 -16
  83. package/dist/esm/index182.js +2 -19
  84. package/dist/esm/index183.js +468 -25
  85. package/dist/esm/index184.js +27 -16
  86. package/dist/esm/index185.js +159 -53
  87. package/dist/esm/index186.js +21 -11
  88. package/dist/esm/index187.js +124 -157
  89. package/dist/esm/index188.js +37 -20
  90. package/dist/esm/index189.js +6 -127
  91. package/dist/esm/index190.js +24 -35
  92. package/dist/esm/index191.js +55 -6
  93. package/dist/esm/index192.js +42 -24
  94. package/dist/esm/index193.js +12 -12
  95. package/dist/esm/index194.js +2 -2
  96. package/dist/esm/index195.js +57 -48
  97. package/dist/esm/index196.js +21 -3
  98. package/dist/esm/index197.js +3 -21
  99. package/dist/esm/index198.js +4 -4
  100. package/dist/esm/index199.js +3 -3
  101. package/dist/esm/index2.js +2 -2
  102. package/dist/esm/index200.js +2 -2
  103. package/dist/esm/index201.js +16 -32
  104. package/dist/esm/index202.js +35 -3
  105. package/dist/esm/index203.js +3 -19
  106. package/dist/esm/index204.js +18 -27
  107. package/dist/esm/index205.js +25 -33
  108. package/dist/esm/index206.js +35 -7
  109. package/dist/esm/index207.js +8 -25
  110. package/dist/esm/index208.js +7 -28
  111. package/dist/esm/index209.js +24 -63
  112. package/dist/esm/index210.js +28 -9
  113. package/dist/esm/index211.js +3 -33
  114. package/dist/esm/index212.js +79 -27
  115. package/dist/esm/index213.js +9 -24
  116. package/dist/esm/index214.js +12 -3
  117. package/dist/esm/index215.js +21 -14
  118. package/dist/esm/index216.js +8 -103
  119. package/dist/esm/index217.js +9 -63
  120. package/dist/esm/index218.js +11 -5
  121. package/dist/esm/index219.js +6 -6
  122. package/dist/esm/index220.js +6 -27
  123. package/dist/esm/index221.js +13 -38
  124. package/dist/esm/index222.js +32 -13
  125. package/dist/esm/index223.js +5 -43
  126. package/dist/esm/index224.js +37 -5
  127. package/dist/esm/index225.js +110 -11
  128. package/dist/esm/index226.js +48 -19
  129. package/dist/esm/index227.js +30 -76
  130. package/dist/esm/index228.js +18 -2
  131. package/dist/esm/index229.js +17 -35
  132. package/dist/esm/index230.js +40 -108
  133. package/dist/esm/index231.js +40 -46
  134. package/dist/esm/index232.js +8 -32
  135. package/dist/esm/index233.js +7 -8
  136. package/dist/esm/index234.js +16 -6
  137. package/dist/esm/index235.js +22 -6
  138. package/dist/esm/index236.js +24 -11
  139. package/dist/esm/index237.js +16 -10
  140. package/dist/esm/index238.js +54 -13
  141. package/dist/esm/index239.js +27 -32
  142. package/dist/esm/index240.js +25 -5
  143. package/dist/esm/index241.js +104 -8
  144. package/dist/esm/index242.js +3 -20
  145. package/dist/esm/index243.js +5 -31
  146. package/dist/esm/index244.js +31 -20
  147. package/dist/esm/index245.js +20 -3
  148. package/dist/esm/index246.js +3 -17
  149. package/dist/esm/index247.js +17 -10
  150. package/dist/esm/index248.js +5 -21
  151. package/dist/esm/index249.js +8 -22
  152. package/dist/esm/index250.js +103 -5
  153. package/dist/esm/index251.js +64 -5
  154. package/dist/esm/index252.js +5 -8
  155. package/dist/esm/index253.js +6 -104
  156. package/dist/esm/index254.js +28 -3
  157. package/dist/esm/index255.js +33 -18
  158. package/dist/esm/index256.js +13 -171
  159. package/dist/esm/index257.js +16 -17
  160. package/dist/esm/index258.js +79 -10
  161. package/dist/esm/index259.js +2 -39
  162. package/dist/esm/index260.js +15 -2
  163. package/dist/esm/index261.js +18 -69
  164. package/dist/esm/index262.js +170 -33
  165. package/dist/esm/index263.js +16 -13
  166. package/dist/esm/index264.js +10 -40
  167. package/dist/esm/index265.js +10 -2
  168. package/dist/esm/index266.js +38 -4
  169. package/dist/esm/index267.js +2 -11
  170. package/dist/esm/index268.js +69 -19
  171. package/dist/esm/index269.js +34 -7
  172. package/dist/esm/index270.js +13 -10
  173. package/dist/esm/index271.js +40 -66
  174. package/dist/esm/index272.js +2 -66
  175. package/dist/esm/index273.js +4 -185
  176. package/dist/esm/index274.js +8 -20
  177. package/dist/esm/index275.js +17 -40
  178. package/dist/esm/index276.js +7 -76
  179. package/dist/esm/index277.js +10 -39
  180. package/dist/esm/index278.js +72 -16
  181. package/dist/esm/index279.js +64 -12
  182. package/dist/esm/index280.js +187 -7
  183. package/dist/esm/index281.js +22 -6
  184. package/dist/esm/index282.js +42 -36
  185. package/dist/esm/index283.js +25 -15
  186. package/dist/esm/index284.js +90 -8
  187. package/dist/esm/index285.js +40 -12
  188. package/dist/esm/index286.js +16 -9
  189. package/dist/esm/index287.js +12 -15
  190. package/dist/esm/index288.js +7 -22
  191. package/dist/esm/index289.js +6 -30
  192. package/dist/esm/index290.js +37 -2
  193. package/dist/esm/index291.js +15 -13
  194. package/dist/esm/index292.js +8 -12
  195. package/dist/esm/index293.js +8 -47
  196. package/dist/esm/index294.js +16 -9
  197. package/dist/esm/index295.js +21 -12
  198. package/dist/esm/index296.js +30 -14
  199. package/dist/esm/index297.js +2 -9
  200. package/dist/esm/index298.js +13 -15
  201. package/dist/esm/index299.js +12 -24
  202. package/dist/esm/index3.js +1 -1
  203. package/dist/esm/index300.js +46 -10
  204. package/dist/esm/index301.js +9 -24
  205. package/dist/esm/index302.js +13 -51
  206. package/dist/esm/index303.js +13 -17
  207. package/dist/esm/index304.js +13 -13
  208. package/dist/esm/index305.js +8 -11
  209. package/dist/esm/index306.js +15 -103
  210. package/dist/esm/index307.js +24 -5
  211. package/dist/esm/index308.js +21 -220
  212. package/dist/esm/index309.js +31 -6
  213. package/dist/esm/index310.js +10 -7
  214. package/dist/esm/index311.js +49 -24
  215. package/dist/esm/index312.js +35 -17
  216. package/dist/esm/index313.js +18 -146
  217. package/dist/esm/index314.js +14 -12
  218. package/dist/esm/index315.js +12 -36
  219. package/dist/esm/index316.js +13 -42
  220. package/dist/esm/index317.js +20 -2
  221. package/dist/esm/index318.js +108 -69
  222. package/dist/esm/index319.js +103 -3
  223. package/dist/esm/index320.js +6 -136
  224. package/dist/esm/index321.js +7 -156
  225. package/dist/esm/index322.js +26 -9
  226. package/dist/esm/index323.js +15 -16
  227. package/dist/esm/index324.js +208 -108
  228. package/dist/esm/index325.js +12 -134
  229. package/dist/esm/index326.js +35 -78
  230. package/dist/esm/index327.js +42 -2
  231. package/dist/esm/index328.js +2 -698
  232. package/dist/esm/index329.js +67 -137
  233. package/dist/esm/index330.js +3 -42
  234. package/dist/esm/index331.js +127 -191
  235. package/dist/esm/index332.js +174 -3
  236. package/dist/esm/index333.js +9 -65
  237. package/dist/esm/index334.js +16 -4
  238. package/dist/esm/index335.js +128 -35
  239. package/dist/esm/index336.js +193 -7
  240. package/dist/esm/index337.js +2 -63
  241. package/dist/esm/index338.js +72 -71
  242. package/dist/esm/index339.js +15 -4
  243. package/dist/esm/index340.js +85 -189
  244. package/dist/esm/index341.js +144 -44
  245. package/dist/esm/index342.js +41 -43
  246. package/dist/esm/index343.js +655 -4
  247. package/dist/esm/index344.js +206 -5
  248. package/dist/esm/index345.js +177 -2
  249. package/dist/esm/index346.js +3 -21
  250. package/dist/esm/index347.js +43 -0
  251. package/dist/esm/index348.js +7 -0
  252. package/dist/esm/index349.js +10 -0
  253. package/dist/esm/index350.js +65 -0
  254. package/dist/esm/index351.js +80 -0
  255. package/dist/esm/index352.js +122 -0
  256. package/dist/esm/index353.js +345 -0
  257. package/dist/esm/index354.js +163 -0
  258. package/dist/esm/index355.js +7 -0
  259. package/dist/esm/index356.js +7 -0
  260. package/dist/esm/index357.js +55 -0
  261. package/dist/esm/index358.js +7 -0
  262. package/dist/esm/index359.js +4 -0
  263. package/dist/esm/index360.js +24 -0
  264. package/dist/esm/index71.js +26 -17
  265. package/dist/esm/index73.js +2 -2
  266. package/dist/esm/index74.js +12 -40
  267. package/dist/esm/index75.js +49 -58
  268. package/dist/esm/index76.js +13 -43
  269. package/dist/esm/index77.js +28 -5
  270. package/dist/esm/index78.js +30 -48
  271. package/dist/esm/index79.js +29 -32
  272. package/dist/esm/index80.js +56 -4
  273. package/dist/esm/index81.js +54 -10
  274. package/dist/esm/index82.js +57 -67
  275. package/dist/esm/index83.js +5 -10
  276. package/dist/esm/index84.js +47 -28
  277. package/dist/esm/index85.js +33 -69
  278. package/dist/esm/index86.js +3 -19
  279. package/dist/esm/index87.js +9 -110
  280. package/dist/esm/index88.js +118 -60
  281. package/dist/esm/index89.js +57 -20
  282. package/dist/esm/index90.js +22 -38
  283. package/dist/esm/index91.js +33 -34
  284. package/dist/esm/index92.js +38 -55
  285. package/dist/esm/index93.js +55 -160
  286. package/dist/esm/index94.js +162 -33
  287. package/dist/esm/index95.js +39 -9
  288. package/dist/esm/index96.js +8 -30
  289. package/dist/esm/index97.js +21 -26
  290. package/dist/esm/index98.js +35 -8
  291. package/dist/esm/index99.js +8 -28
  292. package/dist/types/index.d.ts +1 -3
  293. package/package.json +4 -4
@@ -1,33 +1,34 @@
1
- import { BaseError as n } from "./index151.js";
2
- class i extends n {
3
- constructor({ blockNumber: e, chain: t, contract: o }) {
4
- super(`Chain "${t.name}" does not support contract "${o.name}".`, {
5
- metaMessages: [
6
- "This could be due to any of the following:",
7
- ...e && o.blockCreated && o.blockCreated > e ? [
8
- `- The contract "${o.name}" was not deployed until block ${o.blockCreated} (current block ${e}).`
9
- ] : [
10
- `- The chain does not have the contract "${o.name}" configured.`
11
- ]
12
- ],
13
- name: "ChainDoesNotSupportContract"
14
- });
15
- }
16
- }
17
- class s extends n {
18
- constructor() {
19
- super("No chain was provided to the Client.", {
20
- name: "ClientChainNotConfiguredError"
21
- });
22
- }
23
- }
24
- class d extends n {
25
- constructor({ chainId: e }) {
26
- super(typeof e == "number" ? `Chain ID "${e}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
27
- }
28
- }
1
+ const e = {
2
+ 1: "An `assert` condition failed.",
3
+ 17: "Arithmetic operation resulted in underflow or overflow.",
4
+ 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
5
+ 33: "Attempted to convert to an invalid type.",
6
+ 34: "Attempted to access a storage byte array that is incorrectly encoded.",
7
+ 49: "Performed `.pop()` on an empty array",
8
+ 50: "Array index is out of bounds.",
9
+ 65: "Allocated too much memory or created an array which is too large.",
10
+ 81: "Attempted to call a zero-initialized variable of internal function type."
11
+ }, o = {
12
+ inputs: [
13
+ {
14
+ name: "message",
15
+ type: "string"
16
+ }
17
+ ],
18
+ name: "Error",
19
+ type: "error"
20
+ }, t = {
21
+ inputs: [
22
+ {
23
+ name: "reason",
24
+ type: "uint256"
25
+ }
26
+ ],
27
+ name: "Panic",
28
+ type: "error"
29
+ };
29
30
  export {
30
- i as ChainDoesNotSupportContract,
31
- s as ClientChainNotConfiguredError,
32
- d as InvalidChainIdError
31
+ e as panicReasons,
32
+ o as solidityError,
33
+ t as solidityPanic
33
34
  };
@@ -1,29 +1,24 @@
1
- import { BaseError as o } from "./index151.js";
2
- class i extends o {
3
- constructor({ max: e, min: r, signed: s, size: a, value: t }) {
4
- super(`Number "${t}" is not in safe ${a ? `${a * 8}-bit ${s ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${r} to ${e})` : `(above ${r})`}`, { name: "IntegerOutOfRangeError" });
5
- }
6
- }
7
- class u extends o {
8
- constructor(e) {
9
- super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
10
- name: "InvalidBytesBooleanError"
1
+ import { solidityError as m, solidityPanic as s } from "./index166.js";
2
+ import { AbiDecodingZeroDataError as c, AbiErrorSignatureNotFoundError as d } from "./index157.js";
3
+ import { slice as e } from "./index188.js";
4
+ import { toFunctionSelector as u } from "./index194.js";
5
+ import { decodeAbiParameters as f } from "./index185.js";
6
+ import { formatAbiItem as p } from "./index158.js";
7
+ function y(n) {
8
+ const { abi: a, data: t } = n, o = e(t, 0, 4);
9
+ if (o === "0x")
10
+ throw new c();
11
+ const r = [...a || [], m, s].find((i) => i.type === "error" && o === u(p(i)));
12
+ if (!r)
13
+ throw new d(o, {
14
+ docsPath: "/docs/contract/decodeErrorResult"
11
15
  });
12
- }
13
- }
14
- class c extends o {
15
- constructor(e) {
16
- super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`, { name: "InvalidHexBooleanError" });
17
- }
18
- }
19
- class v extends o {
20
- constructor({ givenSize: e, maxSize: r }) {
21
- super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
22
- }
16
+ return {
17
+ abiItem: r,
18
+ args: "inputs" in r && r.inputs && r.inputs.length > 0 ? f(r.inputs, e(t, 4)) : void 0,
19
+ errorName: r.name
20
+ };
23
21
  }
24
22
  export {
25
- i as IntegerOutOfRangeError,
26
- u as InvalidBytesBooleanError,
27
- c as InvalidHexBooleanError,
28
- v as SizeOverflowError
23
+ y as decodeErrorResult
29
24
  };
@@ -1,36 +1,8 @@
1
- import { BaseError as r } from "./index151.js";
2
- class s extends r {
3
- constructor({ data: a }) {
4
- super("Unable to extract image from metadata. The metadata may be malformed or invalid.", {
5
- metaMessages: [
6
- "- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.",
7
- "",
8
- `Provided data: ${JSON.stringify(a)}`
9
- ],
10
- name: "EnsAvatarInvalidMetadataError"
11
- });
12
- }
13
- }
14
- class o extends r {
15
- constructor({ reason: a }) {
16
- super(`ENS NFT avatar URI is invalid. ${a}`, {
17
- name: "EnsAvatarInvalidNftUriError"
18
- });
19
- }
20
- }
21
- class n extends r {
22
- constructor({ uri: a }) {
23
- super(`Unable to resolve ENS avatar URI "${a}". The URI may be malformed, invalid, or does not respond with a valid image.`, { name: "EnsAvatarUriResolutionError" });
24
- }
25
- }
26
- class i extends r {
27
- constructor({ namespace: a }) {
28
- super(`ENS NFT avatar namespace "${a}" is not supported. Must be "erc721" or "erc1155".`, { name: "EnsAvatarUnsupportedNamespaceError" });
29
- }
1
+ import { stringify as o } from "./index182.js";
2
+ function p({ abiItem: n, args: r, includeFunctionName: f = !0, includeName: i = !1 }) {
3
+ if ("name" in n && "inputs" in n && n.inputs)
4
+ return `${f ? n.name : ""}(${n.inputs.map((e, t) => `${i && e.name ? `${e.name}: ` : ""}${typeof r[t] == "object" ? o(r[t]) : r[t]}`).join(", ")})`;
30
5
  }
31
6
  export {
32
- s as EnsAvatarInvalidMetadataError,
33
- o as EnsAvatarInvalidNftUriError,
34
- i as EnsAvatarUnsupportedNamespaceError,
35
- n as EnsAvatarUriResolutionError
7
+ p as formatAbiItemWithArgs
36
8
  };
@@ -1,37 +1,76 @@
1
- import { formatEther as E } from "./index159.js";
2
- import { formatGwei as t } from "./index160.js";
3
- import { BaseError as y } from "./index151.js";
4
- import { prettyPrint as l } from "./index162.js";
5
- class x extends y {
6
- constructor(e, { account: a, docsPath: n, chain: m, data: f, gas: u, gasPrice: r, maxFeePerGas: o, maxPriorityFeePerGas: s, nonce: d, to: p, value: i }) {
7
- const g = l({
8
- from: a?.address,
9
- to: p,
10
- value: typeof i < "u" && `${E(i)} ${m?.nativeCurrency?.symbol || "ETH"}`,
11
- data: f,
12
- gas: u,
13
- gasPrice: typeof r < "u" && `${t(r)} gwei`,
14
- maxFeePerGas: typeof o < "u" && `${t(o)} gwei`,
15
- maxPriorityFeePerGas: typeof s < "u" && `${t(s)} gwei`,
16
- nonce: d
17
- });
18
- super(e.shortMessage, {
19
- cause: e,
20
- docsPath: n,
21
- metaMessages: [
22
- ...e.metaMessages ? [...e.metaMessages, " "] : [],
23
- "Estimate Gas Arguments:",
24
- g
25
- ].filter(Boolean),
26
- name: "EstimateGasExecutionError"
27
- }), Object.defineProperty(this, "cause", {
28
- enumerable: !0,
29
- configurable: !0,
30
- writable: !0,
31
- value: void 0
32
- }), this.cause = e;
1
+ import { AbiItemAmbiguityError as y } from "./index157.js";
2
+ import { isHex as d } from "./index211.js";
3
+ import { isAddress as f } from "./index200.js";
4
+ import { toEventSelector as g } from "./index197.js";
5
+ import { toFunctionSelector as b } from "./index194.js";
6
+ function w(s) {
7
+ const { abi: o, args: e = [], name: n } = s, u = d(n, { strict: !1 }), i = o.filter((t) => u ? t.type === "function" ? b(t) === n : t.type === "event" ? g(t) === n : !1 : "name" in t && t.name === n);
8
+ if (i.length === 0)
9
+ return;
10
+ if (i.length === 1)
11
+ return i[0];
12
+ let r;
13
+ for (const t of i) {
14
+ if (!("inputs" in t))
15
+ continue;
16
+ if (!e || e.length === 0) {
17
+ if (!t.inputs || t.inputs.length === 0)
18
+ return t;
19
+ continue;
20
+ }
21
+ if (!t.inputs || t.inputs.length === 0 || t.inputs.length !== e.length)
22
+ continue;
23
+ if (e.every((c, m) => {
24
+ const l = "inputs" in t && t.inputs[m];
25
+ return l ? p(c, l) : !1;
26
+ })) {
27
+ if (r && "inputs" in r && r.inputs) {
28
+ const c = a(t.inputs, r.inputs, e);
29
+ if (c)
30
+ throw new y({
31
+ abiItem: t,
32
+ type: c[0]
33
+ }, {
34
+ abiItem: r,
35
+ type: c[1]
36
+ });
37
+ }
38
+ r = t;
39
+ }
40
+ }
41
+ return r || i[0];
42
+ }
43
+ function p(s, o) {
44
+ const e = typeof s, n = o.type;
45
+ switch (n) {
46
+ case "address":
47
+ return f(s, { strict: !1 });
48
+ case "bool":
49
+ return e === "boolean";
50
+ case "function":
51
+ return e === "string";
52
+ case "string":
53
+ return e === "string";
54
+ default:
55
+ return n === "tuple" && "components" in o ? Object.values(o.components).every((u, i) => e === "object" && p(Object.values(s)[i], u)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n) ? e === "number" || e === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n) ? e === "string" || s instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n) ? Array.isArray(s) && s.every((u) => p(u, {
56
+ ...o,
57
+ // Pop off `[]` or `[M]` from end of type
58
+ type: n.replace(/(\[[0-9]{0,}\])$/, "")
59
+ })) : !1;
60
+ }
61
+ }
62
+ function a(s, o, e) {
63
+ for (const n in s) {
64
+ const u = s[n], i = o[n];
65
+ if (u.type === "tuple" && i.type === "tuple" && "components" in u && "components" in i)
66
+ return a(u.components, i.components, e[n]);
67
+ const r = [u.type, i.type];
68
+ if (r.includes("address") && r.includes("bytes20") ? !0 : r.includes("address") && r.includes("string") ? f(e[n], { strict: !1 }) : r.includes("address") && r.includes("bytes") ? f(e[n], { strict: !1 }) : !1)
69
+ return r;
33
70
  }
34
71
  }
35
72
  export {
36
- x as EstimateGasExecutionError
73
+ w as getAbiItem,
74
+ a as getAmbiguousTypes,
75
+ p as isArgOfType
37
76
  };
@@ -1,196 +1,8 @@
1
- import { formatGwei as a } from "./index160.js";
2
- import { BaseError as t } from "./index151.js";
3
- class s extends t {
4
- constructor({ cause: r, message: e } = {}) {
5
- const n = e?.replace("execution reverted: ", "")?.replace("execution reverted", "");
6
- super(`Execution reverted ${n ? `with reason: ${n}` : "for an unknown reason"}.`, {
7
- cause: r,
8
- name: "ExecutionRevertedError"
9
- });
10
- }
11
- }
12
- Object.defineProperty(s, "code", {
13
- enumerable: !0,
14
- configurable: !0,
15
- writable: !0,
16
- value: 3
17
- });
18
- Object.defineProperty(s, "nodeMessage", {
19
- enumerable: !0,
20
- configurable: !0,
21
- writable: !0,
22
- value: /execution reverted/
23
- });
24
- class c extends t {
25
- constructor({ cause: r, maxFeePerGas: e } = {}) {
26
- super(`The fee cap (\`maxFeePerGas\`${e ? ` = ${a(e)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
27
- cause: r,
28
- name: "FeeCapTooHighError"
29
- });
30
- }
31
- }
32
- Object.defineProperty(c, "nodeMessage", {
33
- enumerable: !0,
34
- configurable: !0,
35
- writable: !0,
36
- value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
37
- });
38
- class i extends t {
39
- constructor({ cause: r, maxFeePerGas: e } = {}) {
40
- super(`The fee cap (\`maxFeePerGas\`${e ? ` = ${a(e)}` : ""} gwei) cannot be lower than the block base fee.`, {
41
- cause: r,
42
- name: "FeeCapTooLowError"
43
- });
44
- }
45
- }
46
- Object.defineProperty(i, "nodeMessage", {
47
- enumerable: !0,
48
- configurable: !0,
49
- writable: !0,
50
- value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
51
- });
52
- class u extends t {
53
- constructor({ cause: r, nonce: e } = {}) {
54
- super(`Nonce provided for the transaction ${e ? `(${e}) ` : ""}is higher than the next one expected.`, { cause: r, name: "NonceTooHighError" });
55
- }
56
- }
57
- Object.defineProperty(u, "nodeMessage", {
58
- enumerable: !0,
59
- configurable: !0,
60
- writable: !0,
61
- value: /nonce too high/
62
- });
63
- class l extends t {
64
- constructor({ cause: r, nonce: e } = {}) {
65
- super([
66
- `Nonce provided for the transaction ${e ? `(${e}) ` : ""}is lower than the current nonce of the account.`,
67
- "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
68
- ].join(`
69
- `), { cause: r, name: "NonceTooLowError" });
70
- }
71
- }
72
- Object.defineProperty(l, "nodeMessage", {
73
- enumerable: !0,
74
- configurable: !0,
75
- writable: !0,
76
- value: /nonce too low|transaction already imported|already known/
77
- });
78
- class d extends t {
79
- constructor({ cause: r, nonce: e } = {}) {
80
- super(`Nonce provided for the transaction ${e ? `(${e}) ` : ""}exceeds the maximum allowed nonce.`, { cause: r, name: "NonceMaxValueError" });
81
- }
82
- }
83
- Object.defineProperty(d, "nodeMessage", {
84
- enumerable: !0,
85
- configurable: !0,
86
- writable: !0,
87
- value: /nonce has max value/
88
- });
89
- class h extends t {
90
- constructor({ cause: r } = {}) {
91
- super([
92
- "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
93
- ].join(`
94
- `), {
95
- cause: r,
96
- metaMessages: [
97
- "This error could arise when the account does not have enough funds to:",
98
- " - pay for the total gas fee,",
99
- " - pay for the value to send.",
100
- " ",
101
- "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
102
- " - `gas` is the amount of gas needed for transaction to execute,",
103
- " - `gas fee` is the gas fee,",
104
- " - `value` is the amount of ether to send to the recipient."
105
- ],
106
- name: "InsufficientFundsError"
107
- });
108
- }
109
- }
110
- Object.defineProperty(h, "nodeMessage", {
111
- enumerable: !0,
112
- configurable: !0,
113
- writable: !0,
114
- value: /insufficient funds|exceeds transaction sender account balance/
115
- });
116
- class f extends t {
117
- constructor({ cause: r, gas: e } = {}) {
118
- super(`The amount of gas ${e ? `(${e}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
119
- cause: r,
120
- name: "IntrinsicGasTooHighError"
121
- });
122
- }
123
- }
124
- Object.defineProperty(f, "nodeMessage", {
125
- enumerable: !0,
126
- configurable: !0,
127
- writable: !0,
128
- value: /intrinsic gas too high|gas limit reached/
129
- });
130
- class p extends t {
131
- constructor({ cause: r, gas: e } = {}) {
132
- super(`The amount of gas ${e ? `(${e}) ` : ""}provided for the transaction is too low.`, {
133
- cause: r,
134
- name: "IntrinsicGasTooLowError"
135
- });
136
- }
137
- }
138
- Object.defineProperty(p, "nodeMessage", {
139
- enumerable: !0,
140
- configurable: !0,
141
- writable: !0,
142
- value: /intrinsic gas too low/
143
- });
144
- class g extends t {
145
- constructor({ cause: r }) {
146
- super("The transaction type is not supported for this chain.", {
147
- cause: r,
148
- name: "TransactionTypeNotSupportedError"
149
- });
150
- }
151
- }
152
- Object.defineProperty(g, "nodeMessage", {
153
- enumerable: !0,
154
- configurable: !0,
155
- writable: !0,
156
- value: /transaction type not valid/
157
- });
158
- class b extends t {
159
- constructor({ cause: r, maxPriorityFeePerGas: e, maxFeePerGas: n } = {}) {
160
- super([
161
- `The provided tip (\`maxPriorityFeePerGas\`${e ? ` = ${a(e)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n ? ` = ${a(n)} gwei` : ""}).`
162
- ].join(`
163
- `), {
164
- cause: r,
165
- name: "TipAboveFeeCapError"
166
- });
167
- }
168
- }
169
- Object.defineProperty(b, "nodeMessage", {
170
- enumerable: !0,
171
- configurable: !0,
172
- writable: !0,
173
- value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
174
- });
175
- class x extends t {
176
- constructor({ cause: r }) {
177
- super(`An error occurred while executing: ${r?.shortMessage}`, {
178
- cause: r,
179
- name: "UnknownNodeError"
180
- });
181
- }
1
+ import { etherUnits as o } from "./index156.js";
2
+ import { formatUnits as e } from "./index264.js";
3
+ function f(r, t = "wei") {
4
+ return e(r, o[t]);
182
5
  }
183
6
  export {
184
- s as ExecutionRevertedError,
185
- c as FeeCapTooHighError,
186
- i as FeeCapTooLowError,
187
- h as InsufficientFundsError,
188
- f as IntrinsicGasTooHighError,
189
- p as IntrinsicGasTooLowError,
190
- d as NonceMaxValueError,
191
- u as NonceTooHighError,
192
- l as NonceTooLowError,
193
- b as TipAboveFeeCapError,
194
- g as TransactionTypeNotSupportedError,
195
- x as UnknownNodeError
7
+ f as formatEther
196
8
  };
@@ -1,11 +1,8 @@
1
- import { BaseError as e } from "./index151.js";
2
- class p extends e {
3
- constructor(r) {
4
- super(`Filter type "${r}" is not supported.`, {
5
- name: "FilterTypeNotSupportedError"
6
- });
7
- }
1
+ import { gweiUnits as i } from "./index156.js";
2
+ import { formatUnits as o } from "./index264.js";
3
+ function f(r, t = "wei") {
4
+ return o(r, i[t]);
8
5
  }
9
6
  export {
10
- p as FilterTypeNotSupportedError
7
+ f as formatGwei
11
8
  };
@@ -1,4 +1,38 @@
1
- const g = (r, n, i) => JSON.stringify(r, (e, t) => typeof t == "bigint" ? t.toString() : t, i);
1
+ import { BaseError as a } from "./index160.js";
2
+ class f extends a {
3
+ constructor({ address: r }) {
4
+ super(`State for account "${r}" is set multiple times.`, {
5
+ name: "AccountStateConflictError"
6
+ });
7
+ }
8
+ }
9
+ class s extends a {
10
+ constructor() {
11
+ super("state and stateDiff are set on the same account.", {
12
+ name: "StateAssignmentConflictError"
13
+ });
14
+ }
15
+ }
16
+ function o(n) {
17
+ return n.reduce((r, { slot: c, value: e }) => `${r} ${c}: ${e}
18
+ `, "");
19
+ }
20
+ function u(n) {
21
+ return n.reduce((r, { address: c, ...e }) => {
22
+ let t = `${r} ${c}:
23
+ `;
24
+ return e.nonce && (t += ` nonce: ${e.nonce}
25
+ `), e.balance && (t += ` balance: ${e.balance}
26
+ `), e.code && (t += ` code: ${e.code}
27
+ `), e.state && (t += ` state:
28
+ `, t += o(e.state)), e.stateDiff && (t += ` stateDiff:
29
+ `, t += o(e.stateDiff)), t;
30
+ }, ` State Override:
31
+ `).slice(0, -1);
32
+ }
2
33
  export {
3
- g as stringify
34
+ f as AccountStateConflictError,
35
+ s as StateAssignmentConflictError,
36
+ o as prettyStateMapping,
37
+ u as prettyStateOverride
4
38
  };
@@ -1,15 +1,122 @@
1
- import { BaseError as r } from "./index151.js";
2
- class d extends r {
3
- constructor({ address: s }) {
4
- super(`Address "${s}" is invalid.`, {
1
+ import { formatEther as E } from "./index170.js";
2
+ import { formatGwei as c } from "./index171.js";
3
+ import { BaseError as o } from "./index160.js";
4
+ function m(a) {
5
+ const e = Object.entries(a).map(([r, t]) => t === void 0 || t === !1 ? null : [r, t]).filter(Boolean), s = e.reduce((r, [t]) => Math.max(r, t.length), 0);
6
+ return e.map(([r, t]) => ` ${`${r}:`.padEnd(s + 1)} ${t}`).join(`
7
+ `);
8
+ }
9
+ class $ extends o {
10
+ constructor({ v: e }) {
11
+ super(`Invalid \`v\` value "${e}". Expected 27 or 28.`, {
12
+ name: "InvalidLegacyVError"
13
+ });
14
+ }
15
+ }
16
+ class v extends o {
17
+ constructor({ transaction: e }) {
18
+ super("Cannot infer a transaction type from provided transaction.", {
5
19
  metaMessages: [
6
- "- Address must be a hex value of 20 bytes (40 hex characters).",
7
- "- Address must match its checksum counterpart."
20
+ "Provided Transaction:",
21
+ "{",
22
+ m(e),
23
+ "}",
24
+ "",
25
+ "To infer the type, either provide:",
26
+ "- a `type` to the Transaction, or",
27
+ "- an EIP-1559 Transaction with `maxFeePerGas`, or",
28
+ "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
29
+ "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
30
+ "- an EIP-7702 Transaction with `authorizationList`, or",
31
+ "- a Legacy Transaction with `gasPrice`"
8
32
  ],
9
- name: "InvalidAddressError"
33
+ name: "InvalidSerializableTransactionError"
34
+ });
35
+ }
36
+ }
37
+ class w extends o {
38
+ constructor({ storageKey: e }) {
39
+ super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length - 2) / 2)} bytes.`, { name: "InvalidStorageKeySizeError" });
40
+ }
41
+ }
42
+ class x extends o {
43
+ constructor(e, { account: s, docsPath: r, chain: t, data: n, gas: i, gasPrice: d, maxFeePerGas: u, maxPriorityFeePerGas: l, nonce: f, to: p, value: h }) {
44
+ const T = m({
45
+ chain: t && `${t?.name} (id: ${t?.id})`,
46
+ from: s?.address,
47
+ to: p,
48
+ value: typeof h < "u" && `${E(h)} ${t?.nativeCurrency?.symbol || "ETH"}`,
49
+ data: n,
50
+ gas: i,
51
+ gasPrice: typeof d < "u" && `${c(d)} gwei`,
52
+ maxFeePerGas: typeof u < "u" && `${c(u)} gwei`,
53
+ maxPriorityFeePerGas: typeof l < "u" && `${c(l)} gwei`,
54
+ nonce: f
55
+ });
56
+ super(e.shortMessage, {
57
+ cause: e,
58
+ docsPath: r,
59
+ metaMessages: [
60
+ ...e.metaMessages ? [...e.metaMessages, " "] : [],
61
+ "Request Arguments:",
62
+ T
63
+ ].filter(Boolean),
64
+ name: "TransactionExecutionError"
65
+ }), Object.defineProperty(this, "cause", {
66
+ enumerable: !0,
67
+ configurable: !0,
68
+ writable: !0,
69
+ value: void 0
70
+ }), this.cause = e;
71
+ }
72
+ }
73
+ class I extends o {
74
+ constructor({ blockHash: e, blockNumber: s, blockTag: r, hash: t, index: n }) {
75
+ let i = "Transaction";
76
+ r && n !== void 0 && (i = `Transaction at block time "${r}" at index "${n}"`), e && n !== void 0 && (i = `Transaction at block hash "${e}" at index "${n}"`), s && n !== void 0 && (i = `Transaction at block number "${s}" at index "${n}"`), t && (i = `Transaction with hash "${t}"`), super(`${i} could not be found.`, {
77
+ name: "TransactionNotFoundError"
78
+ });
79
+ }
80
+ }
81
+ class P extends o {
82
+ constructor({ hash: e }) {
83
+ super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`, {
84
+ name: "TransactionReceiptNotFoundError"
10
85
  });
11
86
  }
12
87
  }
88
+ class R extends o {
89
+ constructor({ receipt: e }) {
90
+ super(`Transaction with hash "${e.transactionHash}" reverted.`, {
91
+ metaMessages: [
92
+ 'The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.',
93
+ " ",
94
+ "You can attempt to extract the revert reason by:",
95
+ "- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract",
96
+ "- using the `call` Action with raw `data`"
97
+ ],
98
+ name: "TransactionReceiptRevertedError"
99
+ }), Object.defineProperty(this, "receipt", {
100
+ enumerable: !0,
101
+ configurable: !0,
102
+ writable: !0,
103
+ value: void 0
104
+ }), this.receipt = e;
105
+ }
106
+ }
107
+ class M extends o {
108
+ constructor({ hash: e }) {
109
+ super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`, { name: "WaitForTransactionReceiptTimeoutError" });
110
+ }
111
+ }
13
112
  export {
14
- d as InvalidAddressError
113
+ $ as InvalidLegacyVError,
114
+ v as InvalidSerializableTransactionError,
115
+ w as InvalidStorageKeySizeError,
116
+ x as TransactionExecutionError,
117
+ I as TransactionNotFoundError,
118
+ P as TransactionReceiptNotFoundError,
119
+ R as TransactionReceiptRevertedError,
120
+ M as WaitForTransactionReceiptTimeoutError,
121
+ m as prettyPrint
15
122
  };