@pufferfinance/puffer-sdk 1.8.1 → 1.9.1

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 (197) hide show
  1. package/dist/api/puffer-client-helpers.cjs +1 -1
  2. package/dist/api/puffer-client-helpers.cjs.map +1 -1
  3. package/dist/api/puffer-client-helpers.js +82 -81
  4. package/dist/api/puffer-client-helpers.js.map +1 -1
  5. package/dist/api/puffer-client.cjs +1 -1
  6. package/dist/api/puffer-client.cjs.map +1 -1
  7. package/dist/api/puffer-client.d.ts +3 -0
  8. package/dist/api/puffer-client.js +56 -49
  9. package/dist/api/puffer-client.js.map +1 -1
  10. package/dist/ccip-BO_b9tFc.cjs +2 -0
  11. package/dist/ccip-BO_b9tFc.cjs.map +1 -0
  12. package/dist/ccip-DLDO0_x2.js +148 -0
  13. package/dist/ccip-DLDO0_x2.js.map +1 -0
  14. package/dist/chains/constants.cjs +1 -1
  15. package/dist/chains/constants.js +1 -1
  16. package/dist/constants-BjRNQpT2.js +1997 -0
  17. package/dist/constants-BjRNQpT2.js.map +1 -0
  18. package/dist/constants-DA2xUb9r.cjs +9 -0
  19. package/dist/constants-DA2xUb9r.cjs.map +1 -0
  20. package/dist/contracts/abis/holesky/PufferDepositor.cjs.map +1 -1
  21. package/dist/contracts/abis/holesky/PufferDepositor.js.map +1 -1
  22. package/dist/contracts/abis/holesky/PufferVaultV2.cjs.map +1 -1
  23. package/dist/contracts/abis/holesky/PufferVaultV2.js.map +1 -1
  24. package/dist/contracts/abis/l1-reward-manager-abis.cjs +1 -1
  25. package/dist/contracts/abis/l1-reward-manager-abis.cjs.map +1 -1
  26. package/dist/contracts/abis/l1-reward-manager-abis.js +1 -1
  27. package/dist/contracts/abis/l2-reward-manager-abis.cjs +1 -1
  28. package/dist/contracts/abis/l2-reward-manager-abis.cjs.map +1 -1
  29. package/dist/contracts/abis/l2-reward-manager-abis.js +1 -1
  30. package/dist/contracts/abis/mainnet/Accountant.cjs.map +1 -1
  31. package/dist/contracts/abis/mainnet/Accountant.js.map +1 -1
  32. package/dist/contracts/abis/mainnet/AtomicQueue.cjs +2 -0
  33. package/dist/contracts/abis/mainnet/AtomicQueue.cjs.map +1 -0
  34. package/dist/contracts/abis/mainnet/AtomicQueue.d.ts +328 -0
  35. package/dist/contracts/abis/mainnet/AtomicQueue.js +237 -0
  36. package/dist/contracts/abis/mainnet/AtomicQueue.js.map +1 -0
  37. package/dist/contracts/abis/mainnet/BoringVault.cjs.map +1 -1
  38. package/dist/contracts/abis/mainnet/BoringVault.js.map +1 -1
  39. package/dist/contracts/abis/mainnet/ERC20Permit.cjs.map +1 -1
  40. package/dist/contracts/abis/mainnet/ERC20Permit.js.map +1 -1
  41. package/dist/contracts/abis/mainnet/L1RewardManager.cjs.map +1 -1
  42. package/dist/contracts/abis/mainnet/L1RewardManager.js.map +1 -1
  43. package/dist/contracts/abis/mainnet/L2RewardManager.cjs.map +1 -1
  44. package/dist/contracts/abis/mainnet/L2RewardManager.js.map +1 -1
  45. package/dist/contracts/abis/mainnet/PufLocker.cjs.map +1 -1
  46. package/dist/contracts/abis/mainnet/PufLocker.js.map +1 -1
  47. package/dist/contracts/abis/mainnet/PufferDepositor.cjs.map +1 -1
  48. package/dist/contracts/abis/mainnet/PufferDepositor.js.map +1 -1
  49. package/dist/contracts/abis/mainnet/PufferL2Depositor.cjs.map +1 -1
  50. package/dist/contracts/abis/mainnet/PufferL2Depositor.js.map +1 -1
  51. package/dist/contracts/abis/mainnet/PufferVaultV2.cjs.map +1 -1
  52. package/dist/contracts/abis/mainnet/PufferVaultV2.js.map +1 -1
  53. package/dist/contracts/abis/mainnet/PufferWithdrawalManager.cjs.map +1 -1
  54. package/dist/contracts/abis/mainnet/PufferWithdrawalManager.js.map +1 -1
  55. package/dist/contracts/abis/mainnet/Teller.cjs.map +1 -1
  56. package/dist/contracts/abis/mainnet/Teller.js.map +1 -1
  57. package/dist/contracts/abis/nucleus-accountant-abis.cjs +1 -1
  58. package/dist/contracts/abis/nucleus-accountant-abis.cjs.map +1 -1
  59. package/dist/contracts/abis/nucleus-accountant-abis.js +1 -1
  60. package/dist/contracts/abis/nucleus-atomic-queue-abis.cjs +2 -0
  61. package/dist/contracts/abis/nucleus-atomic-queue-abis.cjs.map +1 -0
  62. package/dist/contracts/abis/nucleus-atomic-queue-abis.d.ts +332 -0
  63. package/dist/contracts/abis/nucleus-atomic-queue-abis.js +9 -0
  64. package/dist/contracts/abis/nucleus-atomic-queue-abis.js.map +1 -0
  65. package/dist/contracts/abis/nucleus-boring-vault-abis.cjs +1 -1
  66. package/dist/contracts/abis/nucleus-boring-vault-abis.cjs.map +1 -1
  67. package/dist/contracts/abis/nucleus-boring-vault-abis.js +1 -1
  68. package/dist/contracts/abis/nucleus-teller-abis.cjs +1 -1
  69. package/dist/contracts/abis/nucleus-teller-abis.cjs.map +1 -1
  70. package/dist/contracts/abis/nucleus-teller-abis.js +1 -1
  71. package/dist/contracts/abis/puf-locker-abis.cjs +1 -1
  72. package/dist/contracts/abis/puf-locker-abis.cjs.map +1 -1
  73. package/dist/contracts/abis/puf-locker-abis.js +1 -1
  74. package/dist/contracts/abis/puffer-depositor-abis.cjs +1 -1
  75. package/dist/contracts/abis/puffer-depositor-abis.cjs.map +1 -1
  76. package/dist/contracts/abis/puffer-depositor-abis.js +1 -1
  77. package/dist/contracts/abis/puffer-depositor-abis.js.map +1 -1
  78. package/dist/contracts/abis/puffer-vault-abis.cjs +1 -1
  79. package/dist/contracts/abis/puffer-vault-abis.cjs.map +1 -1
  80. package/dist/contracts/abis/puffer-vault-abis.js +1 -1
  81. package/dist/contracts/abis/puffer-vault-abis.js.map +1 -1
  82. package/dist/contracts/abis/puffer-withdrawal-manager-abis.cjs +1 -1
  83. package/dist/contracts/abis/puffer-withdrawal-manager-abis.cjs.map +1 -1
  84. package/dist/contracts/abis/puffer-withdrawal-manager-abis.js +1 -1
  85. package/dist/contracts/addresses.cjs +1 -1
  86. package/dist/contracts/addresses.cjs.map +1 -1
  87. package/dist/contracts/addresses.d.ts +14 -0
  88. package/dist/contracts/addresses.js +3 -2
  89. package/dist/contracts/addresses.js.map +1 -1
  90. package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
  91. package/dist/contracts/handlers/erc20-permit-handler.cjs.map +1 -1
  92. package/dist/contracts/handlers/erc20-permit-handler.d.ts +11128 -2714
  93. package/dist/contracts/handlers/erc20-permit-handler.js +3 -3
  94. package/dist/contracts/handlers/erc20-permit-handler.js.map +1 -1
  95. package/dist/contracts/handlers/l1-reward-manager-handler.cjs +1 -1
  96. package/dist/contracts/handlers/l1-reward-manager-handler.cjs.map +1 -1
  97. package/dist/contracts/handlers/l1-reward-manager-handler.d.ts +11128 -2714
  98. package/dist/contracts/handlers/l1-reward-manager-handler.js +2 -2
  99. package/dist/contracts/handlers/l1-reward-manager-handler.js.map +1 -1
  100. package/dist/contracts/handlers/l2-reward-manager-handler.cjs +1 -1
  101. package/dist/contracts/handlers/l2-reward-manager-handler.cjs.map +1 -1
  102. package/dist/contracts/handlers/l2-reward-manager-handler.d.ts +11128 -2714
  103. package/dist/contracts/handlers/l2-reward-manager-handler.js +2 -2
  104. package/dist/contracts/handlers/l2-reward-manager-handler.js.map +1 -1
  105. package/dist/contracts/handlers/nucleus-accountant-handler.cjs +1 -1
  106. package/dist/contracts/handlers/nucleus-accountant-handler.cjs.map +1 -1
  107. package/dist/contracts/handlers/nucleus-accountant-handler.d.ts +11128 -2714
  108. package/dist/contracts/handlers/nucleus-accountant-handler.js +1 -1
  109. package/dist/contracts/handlers/nucleus-accountant-handler.js.map +1 -1
  110. package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs +2 -0
  111. package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs.map +1 -0
  112. package/dist/contracts/handlers/nucleus-atomic-queue-handler.d.ts +14923 -0
  113. package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +89 -0
  114. package/dist/contracts/handlers/nucleus-atomic-queue-handler.js.map +1 -0
  115. package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
  116. package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs.map +1 -1
  117. package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +11128 -2714
  118. package/dist/contracts/handlers/nucleus-boring-vault-handler.js +2 -2
  119. package/dist/contracts/handlers/nucleus-boring-vault-handler.js.map +1 -1
  120. package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
  121. package/dist/contracts/handlers/nucleus-teller-handler.cjs.map +1 -1
  122. package/dist/contracts/handlers/nucleus-teller-handler.d.ts +11128 -2714
  123. package/dist/contracts/handlers/nucleus-teller-handler.js +2 -2
  124. package/dist/contracts/handlers/nucleus-teller-handler.js.map +1 -1
  125. package/dist/contracts/handlers/puf-locker-handler.cjs +1 -1
  126. package/dist/contracts/handlers/puf-locker-handler.cjs.map +1 -1
  127. package/dist/contracts/handlers/puf-locker-handler.d.ts +11128 -2714
  128. package/dist/contracts/handlers/puf-locker-handler.js +2 -2
  129. package/dist/contracts/handlers/puf-locker-handler.js.map +1 -1
  130. package/dist/contracts/handlers/puffer-depositor-handler.cjs +1 -1
  131. package/dist/contracts/handlers/puffer-depositor-handler.cjs.map +1 -1
  132. package/dist/contracts/handlers/puffer-depositor-handler.d.ts +11128 -2714
  133. package/dist/contracts/handlers/puffer-depositor-handler.js +2 -2
  134. package/dist/contracts/handlers/puffer-depositor-handler.js.map +1 -1
  135. package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs +1 -1
  136. package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs.map +1 -1
  137. package/dist/contracts/handlers/puffer-l2-depositor-handler.d.ts +11128 -2714
  138. package/dist/contracts/handlers/puffer-l2-depositor-handler.js +2 -2
  139. package/dist/contracts/handlers/puffer-l2-depositor-handler.js.map +1 -1
  140. package/dist/contracts/handlers/puffer-vault-handler.cjs +1 -1
  141. package/dist/contracts/handlers/puffer-vault-handler.cjs.map +1 -1
  142. package/dist/contracts/handlers/puffer-vault-handler.d.ts +11128 -2714
  143. package/dist/contracts/handlers/puffer-vault-handler.js +2 -2
  144. package/dist/contracts/handlers/puffer-vault-handler.js.map +1 -1
  145. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs +1 -1
  146. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs.map +1 -1
  147. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.d.ts +11128 -2714
  148. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js +2 -2
  149. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js.map +1 -1
  150. package/dist/contracts/tokens.cjs +1 -1
  151. package/dist/contracts/tokens.cjs.map +1 -1
  152. package/dist/contracts/tokens.js +1 -1
  153. package/dist/contracts/tokens.js.map +1 -1
  154. package/dist/createWalletClient-BuLYysrp.cjs +4 -0
  155. package/dist/createWalletClient-BuLYysrp.cjs.map +1 -0
  156. package/dist/createWalletClient-DNcW-ENe.js +2028 -0
  157. package/dist/createWalletClient-DNcW-ENe.js.map +1 -0
  158. package/dist/errors/base-error.cjs.map +1 -1
  159. package/dist/errors/base-error.js.map +1 -1
  160. package/dist/{getContract-MrPLx6gp.cjs → getContract-3QbyfZBF.cjs} +2 -2
  161. package/dist/getContract-3QbyfZBF.cjs.map +1 -0
  162. package/dist/{getContract-B3Spz0SO.js → getContract-CezEyDf-.js} +2 -2
  163. package/dist/{getContract-MrPLx6gp.cjs.map → getContract-CezEyDf-.js.map} +1 -1
  164. package/dist/main.cjs +1 -1
  165. package/dist/main.js +1 -1
  166. package/dist/secp256k1-3OC5y4qp.js +1579 -0
  167. package/dist/secp256k1-3OC5y4qp.js.map +1 -0
  168. package/dist/secp256k1-bcahnPX9.cjs +2 -0
  169. package/dist/secp256k1-bcahnPX9.cjs.map +1 -0
  170. package/dist/utils/version.cjs +1 -1
  171. package/dist/utils/version.js +1 -1
  172. package/dist/writeContract-ChuHpJLC.js +3799 -0
  173. package/dist/writeContract-ChuHpJLC.js.map +1 -0
  174. package/dist/writeContract-D97dSJQe.cjs +32 -0
  175. package/dist/writeContract-D97dSJQe.cjs.map +1 -0
  176. package/package.json +13 -13
  177. package/dist/ccip-D4klNwCt.js +0 -159
  178. package/dist/ccip-D4klNwCt.js.map +0 -1
  179. package/dist/ccip-DLDqFodf.cjs +0 -2
  180. package/dist/ccip-DLDqFodf.cjs.map +0 -1
  181. package/dist/constants-BvU-JhfL.cjs +0 -9
  182. package/dist/constants-BvU-JhfL.cjs.map +0 -1
  183. package/dist/constants-rWWWhxR_.js +0 -2099
  184. package/dist/constants-rWWWhxR_.js.map +0 -1
  185. package/dist/createWalletClient-Bmopj8MM.cjs +0 -4
  186. package/dist/createWalletClient-Bmopj8MM.cjs.map +0 -1
  187. package/dist/createWalletClient-DKcpswHR.js +0 -2007
  188. package/dist/createWalletClient-DKcpswHR.js.map +0 -1
  189. package/dist/getContract-B3Spz0SO.js.map +0 -1
  190. package/dist/secp256k1-BLbXMlpX.js +0 -1172
  191. package/dist/secp256k1-BLbXMlpX.js.map +0 -1
  192. package/dist/secp256k1-CFnFaJ0H.cjs +0 -2
  193. package/dist/secp256k1-CFnFaJ0H.cjs.map +0 -1
  194. package/dist/writeContract-BBHpAss8.cjs +0 -32
  195. package/dist/writeContract-BBHpAss8.cjs.map +0 -1
  196. package/dist/writeContract-RluxM31W.js +0 -3833
  197. package/dist/writeContract-RluxM31W.js.map +0 -1
@@ -1,3833 +0,0 @@
1
- import { B as h, w as T, k as Ie, j as Re, n as P, c as J, v as z, I as K, p as H, M as Ar, d as $r, N as ue, i as jr, A as qt, O as pe, f as V, y as Ht, o as Ne, P as Or, q as ze, D as Fr, Q as Mr, x as Cr, R as kr, S as Ge, U as Ut, X as U, Y as Sr, g as De, Z as ce, _ as Oe, $ as wt, a0 as vt, a1 as Pt, a2 as xt, a3 as Et, a4 as At, a5 as $t, a6 as jt, a7 as Fe, a8 as ye, a9 as Ot, aa as Tr, K as Br, ab as Ir, ac as Rr, ad as Nr, ae as zr, af as Gr, ag as Dr, u as de, ah as Me, ai as Vt, aj as _r, ak as Lr, al as qr } from "./constants-rWWWhxR_.js";
2
- const Hr = "1.0.5";
3
- class F extends Error {
4
- constructor(t, r = {}) {
5
- var s;
6
- const n = r.cause instanceof F ? r.cause.details : (s = r.cause) != null && s.message ? r.cause.message : r.details, a = r.cause instanceof F && r.cause.docsPath || r.docsPath, o = [
7
- t || "An error occurred.",
8
- "",
9
- ...r.metaMessages ? [...r.metaMessages, ""] : [],
10
- ...a ? [`Docs: https://abitype.dev${a}`] : [],
11
- ...n ? [`Details: ${n}`] : [],
12
- `Version: abitype@${Hr}`
13
- ].join(`
14
- `);
15
- super(o), Object.defineProperty(this, "details", {
16
- enumerable: !0,
17
- configurable: !0,
18
- writable: !0,
19
- value: void 0
20
- }), Object.defineProperty(this, "docsPath", {
21
- enumerable: !0,
22
- configurable: !0,
23
- writable: !0,
24
- value: void 0
25
- }), Object.defineProperty(this, "metaMessages", {
26
- enumerable: !0,
27
- configurable: !0,
28
- writable: !0,
29
- value: void 0
30
- }), Object.defineProperty(this, "shortMessage", {
31
- enumerable: !0,
32
- configurable: !0,
33
- writable: !0,
34
- value: void 0
35
- }), Object.defineProperty(this, "name", {
36
- enumerable: !0,
37
- configurable: !0,
38
- writable: !0,
39
- value: "AbiTypeError"
40
- }), r.cause && (this.cause = r.cause), this.details = n, this.docsPath = a, this.metaMessages = r.metaMessages, this.shortMessage = t;
41
- }
42
- }
43
- function D(e, t) {
44
- const r = e.exec(t);
45
- return r == null ? void 0 : r.groups;
46
- }
47
- const Zt = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, Wt = /^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)?$/, Jt = /^\(.+?\).*?$/, Ft = /^tuple(?<array>(\[(\d*)\])*)$/;
48
- function Ce(e) {
49
- let t = e.type;
50
- if (Ft.test(e.type) && "components" in e) {
51
- t = "(";
52
- const r = e.components.length;
53
- for (let a = 0; a < r; a++) {
54
- const o = e.components[a];
55
- t += Ce(o), a < r - 1 && (t += ", ");
56
- }
57
- const n = D(Ft, e.type);
58
- return t += `)${(n == null ? void 0 : n.array) ?? ""}`, Ce({
59
- ...e,
60
- type: t
61
- });
62
- }
63
- return "indexed" in e && e.indexed && (t = `${t} indexed`), e.name ? `${t} ${e.name}` : t;
64
- }
65
- function te(e) {
66
- let t = "";
67
- const r = e.length;
68
- for (let n = 0; n < r; n++) {
69
- const a = e[n];
70
- t += Ce(a), n !== r - 1 && (t += ", ");
71
- }
72
- return t;
73
- }
74
- function Ur(e) {
75
- return e.type === "function" ? `function ${e.name}(${te(e.inputs)})${e.stateMutability && e.stateMutability !== "nonpayable" ? ` ${e.stateMutability}` : ""}${e.outputs.length ? ` returns (${te(e.outputs)})` : ""}` : e.type === "event" ? `event ${e.name}(${te(e.inputs)})` : e.type === "error" ? `error ${e.name}(${te(e.inputs)})` : e.type === "constructor" ? `constructor(${te(e.inputs)})${e.stateMutability === "payable" ? " payable" : ""}` : e.type === "fallback" ? "fallback()" : "receive() external payable";
76
- }
77
- const Kt = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
78
- function Vr(e) {
79
- return Kt.test(e);
80
- }
81
- function Zr(e) {
82
- return D(Kt, e);
83
- }
84
- const Yt = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
85
- function Wr(e) {
86
- return Yt.test(e);
87
- }
88
- function Jr(e) {
89
- return D(Yt, e);
90
- }
91
- const Xt = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;
92
- function Kr(e) {
93
- return Xt.test(e);
94
- }
95
- function Yr(e) {
96
- return D(Xt, e);
97
- }
98
- const Qt = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
99
- function er(e) {
100
- return Qt.test(e);
101
- }
102
- function Xr(e) {
103
- return D(Qt, e);
104
- }
105
- const tr = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;
106
- function Qr(e) {
107
- return tr.test(e);
108
- }
109
- function en(e) {
110
- return D(tr, e);
111
- }
112
- const tn = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
113
- function rn(e) {
114
- return tn.test(e);
115
- }
116
- const nn = /^receive\(\) external payable$/;
117
- function an(e) {
118
- return nn.test(e);
119
- }
120
- const sn = /* @__PURE__ */ new Set(["indexed"]), ke = /* @__PURE__ */ new Set([
121
- "calldata",
122
- "memory",
123
- "storage"
124
- ]);
125
- class on extends F {
126
- constructor({ type: t }) {
127
- super("Unknown type.", {
128
- metaMessages: [
129
- `Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`
130
- ]
131
- }), Object.defineProperty(this, "name", {
132
- enumerable: !0,
133
- configurable: !0,
134
- writable: !0,
135
- value: "UnknownTypeError"
136
- });
137
- }
138
- }
139
- class cn extends F {
140
- constructor({ type: t }) {
141
- super("Unknown type.", {
142
- metaMessages: [`Type "${t}" is not a valid ABI type.`]
143
- }), Object.defineProperty(this, "name", {
144
- enumerable: !0,
145
- configurable: !0,
146
- writable: !0,
147
- value: "UnknownSolidityTypeError"
148
- });
149
- }
150
- }
151
- class un extends F {
152
- constructor({ param: t }) {
153
- super("Invalid ABI parameter.", {
154
- details: t
155
- }), Object.defineProperty(this, "name", {
156
- enumerable: !0,
157
- configurable: !0,
158
- writable: !0,
159
- value: "InvalidParameterError"
160
- });
161
- }
162
- }
163
- class dn extends F {
164
- constructor({ param: t, name: r }) {
165
- super("Invalid ABI parameter.", {
166
- details: t,
167
- metaMessages: [
168
- `"${r}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`
169
- ]
170
- }), Object.defineProperty(this, "name", {
171
- enumerable: !0,
172
- configurable: !0,
173
- writable: !0,
174
- value: "SolidityProtectedKeywordError"
175
- });
176
- }
177
- }
178
- class ln extends F {
179
- constructor({ param: t, type: r, modifier: n }) {
180
- super("Invalid ABI parameter.", {
181
- details: t,
182
- metaMessages: [
183
- `Modifier "${n}" not allowed${r ? ` in "${r}" type` : ""}.`
184
- ]
185
- }), Object.defineProperty(this, "name", {
186
- enumerable: !0,
187
- configurable: !0,
188
- writable: !0,
189
- value: "InvalidModifierError"
190
- });
191
- }
192
- }
193
- class fn extends F {
194
- constructor({ param: t, type: r, modifier: n }) {
195
- super("Invalid ABI parameter.", {
196
- details: t,
197
- metaMessages: [
198
- `Modifier "${n}" not allowed${r ? ` in "${r}" type` : ""}.`,
199
- `Data location can only be specified for array, struct, or mapping types, but "${n}" was given.`
200
- ]
201
- }), Object.defineProperty(this, "name", {
202
- enumerable: !0,
203
- configurable: !0,
204
- writable: !0,
205
- value: "InvalidFunctionModifierError"
206
- });
207
- }
208
- }
209
- class bn extends F {
210
- constructor({ abiParameter: t }) {
211
- super("Invalid ABI parameter.", {
212
- details: JSON.stringify(t, null, 2),
213
- metaMessages: ["ABI parameter type is invalid."]
214
- }), Object.defineProperty(this, "name", {
215
- enumerable: !0,
216
- configurable: !0,
217
- writable: !0,
218
- value: "InvalidAbiTypeParameterError"
219
- });
220
- }
221
- }
222
- class re extends F {
223
- constructor({ signature: t, type: r }) {
224
- super(`Invalid ${r} signature.`, {
225
- details: t
226
- }), Object.defineProperty(this, "name", {
227
- enumerable: !0,
228
- configurable: !0,
229
- writable: !0,
230
- value: "InvalidSignatureError"
231
- });
232
- }
233
- }
234
- class pn extends F {
235
- constructor({ signature: t }) {
236
- super("Unknown signature.", {
237
- details: t
238
- }), Object.defineProperty(this, "name", {
239
- enumerable: !0,
240
- configurable: !0,
241
- writable: !0,
242
- value: "UnknownSignatureError"
243
- });
244
- }
245
- }
246
- class yn extends F {
247
- constructor({ signature: t }) {
248
- super("Invalid struct signature.", {
249
- details: t,
250
- metaMessages: ["No properties exist."]
251
- }), Object.defineProperty(this, "name", {
252
- enumerable: !0,
253
- configurable: !0,
254
- writable: !0,
255
- value: "InvalidStructSignatureError"
256
- });
257
- }
258
- }
259
- class mn extends F {
260
- constructor({ type: t }) {
261
- super("Circular reference detected.", {
262
- metaMessages: [`Struct "${t}" is a circular reference.`]
263
- }), Object.defineProperty(this, "name", {
264
- enumerable: !0,
265
- configurable: !0,
266
- writable: !0,
267
- value: "CircularReferenceError"
268
- });
269
- }
270
- }
271
- class hn extends F {
272
- constructor({ current: t, depth: r }) {
273
- super("Unbalanced parentheses.", {
274
- metaMessages: [
275
- `"${t.trim()}" has too many ${r > 0 ? "opening" : "closing"} parentheses.`
276
- ],
277
- details: `Depth "${r}"`
278
- }), Object.defineProperty(this, "name", {
279
- enumerable: !0,
280
- configurable: !0,
281
- writable: !0,
282
- value: "InvalidParenthesisError"
283
- });
284
- }
285
- }
286
- function gn(e, t) {
287
- return t ? `${t}:${e}` : e;
288
- }
289
- const xe = /* @__PURE__ */ new Map([
290
- // Unnamed
291
- ["address", { type: "address" }],
292
- ["bool", { type: "bool" }],
293
- ["bytes", { type: "bytes" }],
294
- ["bytes32", { type: "bytes32" }],
295
- ["int", { type: "int256" }],
296
- ["int256", { type: "int256" }],
297
- ["string", { type: "string" }],
298
- ["uint", { type: "uint256" }],
299
- ["uint8", { type: "uint8" }],
300
- ["uint16", { type: "uint16" }],
301
- ["uint24", { type: "uint24" }],
302
- ["uint32", { type: "uint32" }],
303
- ["uint64", { type: "uint64" }],
304
- ["uint96", { type: "uint96" }],
305
- ["uint112", { type: "uint112" }],
306
- ["uint160", { type: "uint160" }],
307
- ["uint192", { type: "uint192" }],
308
- ["uint256", { type: "uint256" }],
309
- // Named
310
- ["address owner", { type: "address", name: "owner" }],
311
- ["address to", { type: "address", name: "to" }],
312
- ["bool approved", { type: "bool", name: "approved" }],
313
- ["bytes _data", { type: "bytes", name: "_data" }],
314
- ["bytes data", { type: "bytes", name: "data" }],
315
- ["bytes signature", { type: "bytes", name: "signature" }],
316
- ["bytes32 hash", { type: "bytes32", name: "hash" }],
317
- ["bytes32 r", { type: "bytes32", name: "r" }],
318
- ["bytes32 root", { type: "bytes32", name: "root" }],
319
- ["bytes32 s", { type: "bytes32", name: "s" }],
320
- ["string name", { type: "string", name: "name" }],
321
- ["string symbol", { type: "string", name: "symbol" }],
322
- ["string tokenURI", { type: "string", name: "tokenURI" }],
323
- ["uint tokenId", { type: "uint256", name: "tokenId" }],
324
- ["uint8 v", { type: "uint8", name: "v" }],
325
- ["uint256 balance", { type: "uint256", name: "balance" }],
326
- ["uint256 tokenId", { type: "uint256", name: "tokenId" }],
327
- ["uint256 value", { type: "uint256", name: "value" }],
328
- // Indexed
329
- [
330
- "event:address indexed from",
331
- { type: "address", name: "from", indexed: !0 }
332
- ],
333
- ["event:address indexed to", { type: "address", name: "to", indexed: !0 }],
334
- [
335
- "event:uint indexed tokenId",
336
- { type: "uint256", name: "tokenId", indexed: !0 }
337
- ],
338
- [
339
- "event:uint256 indexed tokenId",
340
- { type: "uint256", name: "tokenId", indexed: !0 }
341
- ]
342
- ]);
343
- function wn(e, t = {}) {
344
- if (Kr(e)) {
345
- const r = Yr(e);
346
- if (!r)
347
- throw new re({ signature: e, type: "function" });
348
- const n = S(r.parameters), a = [], o = n.length;
349
- for (let i = 0; i < o; i++)
350
- a.push(q(n[i], {
351
- modifiers: ke,
352
- structs: t,
353
- type: "function"
354
- }));
355
- const s = [];
356
- if (r.returns) {
357
- const i = S(r.returns), c = i.length;
358
- for (let u = 0; u < c; u++)
359
- s.push(q(i[u], {
360
- modifiers: ke,
361
- structs: t,
362
- type: "function"
363
- }));
364
- }
365
- return {
366
- name: r.name,
367
- type: "function",
368
- stateMutability: r.stateMutability ?? "nonpayable",
369
- inputs: a,
370
- outputs: s
371
- };
372
- }
373
- if (Wr(e)) {
374
- const r = Jr(e);
375
- if (!r)
376
- throw new re({ signature: e, type: "event" });
377
- const n = S(r.parameters), a = [], o = n.length;
378
- for (let s = 0; s < o; s++)
379
- a.push(q(n[s], {
380
- modifiers: sn,
381
- structs: t,
382
- type: "event"
383
- }));
384
- return { name: r.name, type: "event", inputs: a };
385
- }
386
- if (Vr(e)) {
387
- const r = Zr(e);
388
- if (!r)
389
- throw new re({ signature: e, type: "error" });
390
- const n = S(r.parameters), a = [], o = n.length;
391
- for (let s = 0; s < o; s++)
392
- a.push(q(n[s], { structs: t, type: "error" }));
393
- return { name: r.name, type: "error", inputs: a };
394
- }
395
- if (Qr(e)) {
396
- const r = en(e);
397
- if (!r)
398
- throw new re({ signature: e, type: "constructor" });
399
- const n = S(r.parameters), a = [], o = n.length;
400
- for (let s = 0; s < o; s++)
401
- a.push(q(n[s], { structs: t, type: "constructor" }));
402
- return {
403
- type: "constructor",
404
- stateMutability: r.stateMutability ?? "nonpayable",
405
- inputs: a
406
- };
407
- }
408
- if (rn(e))
409
- return { type: "fallback" };
410
- if (an(e))
411
- return {
412
- type: "receive",
413
- stateMutability: "payable"
414
- };
415
- throw new pn({ signature: e });
416
- }
417
- const vn = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, Pn = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, xn = /^u?int$/;
418
- function q(e, t) {
419
- var l, f;
420
- const r = gn(e, t == null ? void 0 : t.type);
421
- if (xe.has(r))
422
- return xe.get(r);
423
- const n = Jt.test(e), a = D(n ? Pn : vn, e);
424
- if (!a)
425
- throw new un({ param: e });
426
- if (a.name && An(a.name))
427
- throw new dn({ param: e, name: a.name });
428
- const o = a.name ? { name: a.name } : {}, s = a.modifier === "indexed" ? { indexed: !0 } : {}, i = (t == null ? void 0 : t.structs) ?? {};
429
- let c, u = {};
430
- if (n) {
431
- c = "tuple";
432
- const y = S(a.type), b = [], p = y.length;
433
- for (let m = 0; m < p; m++)
434
- b.push(q(y[m], { structs: i }));
435
- u = { components: b };
436
- } else if (a.type in i)
437
- c = "tuple", u = { components: i[a.type] };
438
- else if (xn.test(a.type))
439
- c = `${a.type}256`;
440
- else if (c = a.type, (t == null ? void 0 : t.type) !== "struct" && !rr(c))
441
- throw new cn({ type: c });
442
- if (a.modifier) {
443
- if (!((f = (l = t == null ? void 0 : t.modifiers) == null ? void 0 : l.has) != null && f.call(l, a.modifier)))
444
- throw new ln({
445
- param: e,
446
- type: t == null ? void 0 : t.type,
447
- modifier: a.modifier
448
- });
449
- if (ke.has(a.modifier) && !$n(c, !!a.array))
450
- throw new fn({
451
- param: e,
452
- type: t == null ? void 0 : t.type,
453
- modifier: a.modifier
454
- });
455
- }
456
- const d = {
457
- type: `${c}${a.array ?? ""}`,
458
- ...o,
459
- ...s,
460
- ...u
461
- };
462
- return xe.set(r, d), d;
463
- }
464
- function S(e, t = [], r = "", n = 0) {
465
- const a = e.trim().length;
466
- for (let o = 0; o < a; o++) {
467
- const s = e[o], i = e.slice(o + 1);
468
- switch (s) {
469
- case ",":
470
- return n === 0 ? S(i, [...t, r.trim()]) : S(i, t, `${r}${s}`, n);
471
- case "(":
472
- return S(i, t, `${r}${s}`, n + 1);
473
- case ")":
474
- return S(i, t, `${r}${s}`, n - 1);
475
- default:
476
- return S(i, t, `${r}${s}`, n);
477
- }
478
- }
479
- if (r === "")
480
- return t;
481
- if (n !== 0)
482
- throw new hn({ current: r, depth: n });
483
- return t.push(r.trim()), t;
484
- }
485
- function rr(e) {
486
- return e === "address" || e === "bool" || e === "function" || e === "string" || Zt.test(e) || Wt.test(e);
487
- }
488
- const En = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;
489
- function An(e) {
490
- return e === "address" || e === "bool" || e === "function" || e === "string" || e === "tuple" || Zt.test(e) || Wt.test(e) || En.test(e);
491
- }
492
- function $n(e, t) {
493
- return t || e === "bytes" || e === "string" || e === "tuple";
494
- }
495
- function jn(e) {
496
- const t = {}, r = e.length;
497
- for (let s = 0; s < r; s++) {
498
- const i = e[s];
499
- if (!er(i))
500
- continue;
501
- const c = Xr(i);
502
- if (!c)
503
- throw new re({ signature: i, type: "struct" });
504
- const u = c.properties.split(";"), d = [], l = u.length;
505
- for (let f = 0; f < l; f++) {
506
- const b = u[f].trim();
507
- if (!b)
508
- continue;
509
- const p = q(b, {
510
- type: "struct"
511
- });
512
- d.push(p);
513
- }
514
- if (!d.length)
515
- throw new yn({ signature: i });
516
- t[c.name] = d;
517
- }
518
- const n = {}, a = Object.entries(t), o = a.length;
519
- for (let s = 0; s < o; s++) {
520
- const [i, c] = a[s];
521
- n[i] = nr(c, t);
522
- }
523
- return n;
524
- }
525
- const On = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
526
- function nr(e, t, r = /* @__PURE__ */ new Set()) {
527
- const n = [], a = e.length;
528
- for (let o = 0; o < a; o++) {
529
- const s = e[o];
530
- if (Jt.test(s.type))
531
- n.push(s);
532
- else {
533
- const c = D(On, s.type);
534
- if (!(c != null && c.type))
535
- throw new bn({ abiParameter: s });
536
- const { array: u, type: d } = c;
537
- if (d in t) {
538
- if (r.has(d))
539
- throw new mn({ type: d });
540
- n.push({
541
- ...s,
542
- type: `tuple${u ?? ""}`,
543
- components: nr(t[d] ?? [], t, /* @__PURE__ */ new Set([...r, d]))
544
- });
545
- } else if (rr(d))
546
- n.push(s);
547
- else
548
- throw new on({ type: d });
549
- }
550
- }
551
- return n;
552
- }
553
- function ar(e) {
554
- const t = jn(e), r = [], n = e.length;
555
- for (let a = 0; a < n; a++) {
556
- const o = e[a];
557
- er(o) || r.push(wn(o, t));
558
- }
559
- return r;
560
- }
561
- function E(e, t, r) {
562
- const n = e[t.name];
563
- if (typeof n == "function")
564
- return n;
565
- const a = e[r];
566
- return typeof a == "function" ? a : (o) => t(e, o);
567
- }
568
- function G(e, { includeName: t = !1 } = {}) {
569
- if (e.type !== "function" && e.type !== "event" && e.type !== "error")
570
- throw new Gn(e.type);
571
- return `${e.name}(${me(e.inputs, { includeName: t })})`;
572
- }
573
- function me(e, { includeName: t = !1 } = {}) {
574
- return e ? e.map((r) => Fn(r, { includeName: t })).join(t ? ", " : ",") : "";
575
- }
576
- function Fn(e, { includeName: t }) {
577
- return e.type.startsWith("tuple") ? `(${me(e.components, { includeName: t })})${e.type.slice(5)}` : e.type + (t && e.name ? ` ${e.name}` : "");
578
- }
579
- class Mn extends h {
580
- constructor({ docsPath: t }) {
581
- super([
582
- "A constructor was not found on the ABI.",
583
- "Make sure you are using the correct ABI and that the constructor exists on it."
584
- ].join(`
585
- `), {
586
- docsPath: t
587
- }), Object.defineProperty(this, "name", {
588
- enumerable: !0,
589
- configurable: !0,
590
- writable: !0,
591
- value: "AbiConstructorNotFoundError"
592
- });
593
- }
594
- }
595
- class Mt extends h {
596
- constructor({ docsPath: t }) {
597
- super([
598
- "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
599
- "Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
600
- ].join(`
601
- `), {
602
- docsPath: t
603
- }), Object.defineProperty(this, "name", {
604
- enumerable: !0,
605
- configurable: !0,
606
- writable: !0,
607
- value: "AbiConstructorParamsNotFoundError"
608
- });
609
- }
610
- }
611
- class sr extends h {
612
- constructor({ data: t, params: r, size: n }) {
613
- super([`Data size of ${n} bytes is too small for given parameters.`].join(`
614
- `), {
615
- metaMessages: [
616
- `Params: (${me(r, { includeName: !0 })})`,
617
- `Data: ${t} (${n} bytes)`
618
- ]
619
- }), Object.defineProperty(this, "name", {
620
- enumerable: !0,
621
- configurable: !0,
622
- writable: !0,
623
- value: "AbiDecodingDataSizeTooSmallError"
624
- }), Object.defineProperty(this, "data", {
625
- enumerable: !0,
626
- configurable: !0,
627
- writable: !0,
628
- value: void 0
629
- }), Object.defineProperty(this, "params", {
630
- enumerable: !0,
631
- configurable: !0,
632
- writable: !0,
633
- value: void 0
634
- }), Object.defineProperty(this, "size", {
635
- enumerable: !0,
636
- configurable: !0,
637
- writable: !0,
638
- value: void 0
639
- }), this.data = t, this.params = r, this.size = n;
640
- }
641
- }
642
- class _e extends h {
643
- constructor() {
644
- super('Cannot decode zero data ("0x") with ABI parameters.'), Object.defineProperty(this, "name", {
645
- enumerable: !0,
646
- configurable: !0,
647
- writable: !0,
648
- value: "AbiDecodingZeroDataError"
649
- });
650
- }
651
- }
652
- class Cn extends h {
653
- constructor({ expectedLength: t, givenLength: r, type: n }) {
654
- super([
655
- `ABI encoding array length mismatch for type ${n}.`,
656
- `Expected length: ${t}`,
657
- `Given length: ${r}`
658
- ].join(`
659
- `)), Object.defineProperty(this, "name", {
660
- enumerable: !0,
661
- configurable: !0,
662
- writable: !0,
663
- value: "AbiEncodingArrayLengthMismatchError"
664
- });
665
- }
666
- }
667
- class kn extends h {
668
- constructor({ expectedSize: t, value: r }) {
669
- super(`Size of bytes "${r}" (bytes${T(r)}) does not match expected size (bytes${t}).`), Object.defineProperty(this, "name", {
670
- enumerable: !0,
671
- configurable: !0,
672
- writable: !0,
673
- value: "AbiEncodingBytesSizeMismatchError"
674
- });
675
- }
676
- }
677
- class Sn extends h {
678
- constructor({ expectedLength: t, givenLength: r }) {
679
- super([
680
- "ABI encoding params/values length mismatch.",
681
- `Expected length (params): ${t}`,
682
- `Given length (values): ${r}`
683
- ].join(`
684
- `)), Object.defineProperty(this, "name", {
685
- enumerable: !0,
686
- configurable: !0,
687
- writable: !0,
688
- value: "AbiEncodingLengthMismatchError"
689
- });
690
- }
691
- }
692
- class or extends h {
693
- constructor(t, { docsPath: r }) {
694
- super([
695
- `Encoded error signature "${t}" not found on ABI.`,
696
- "Make sure you are using the correct ABI and that the error exists on it.",
697
- `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`
698
- ].join(`
699
- `), {
700
- docsPath: r
701
- }), Object.defineProperty(this, "name", {
702
- enumerable: !0,
703
- configurable: !0,
704
- writable: !0,
705
- value: "AbiErrorSignatureNotFoundError"
706
- }), Object.defineProperty(this, "signature", {
707
- enumerable: !0,
708
- configurable: !0,
709
- writable: !0,
710
- value: void 0
711
- }), this.signature = t;
712
- }
713
- }
714
- class Tn extends h {
715
- constructor({ docsPath: t }) {
716
- super("Cannot extract event signature from empty topics.", {
717
- docsPath: t
718
- }), Object.defineProperty(this, "name", {
719
- enumerable: !0,
720
- configurable: !0,
721
- writable: !0,
722
- value: "AbiEventSignatureEmptyTopicsError"
723
- });
724
- }
725
- }
726
- class ir extends h {
727
- constructor(t, { docsPath: r }) {
728
- super([
729
- `Encoded event signature "${t}" not found on ABI.`,
730
- "Make sure you are using the correct ABI and that the event exists on it.",
731
- `You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`
732
- ].join(`
733
- `), {
734
- docsPath: r
735
- }), Object.defineProperty(this, "name", {
736
- enumerable: !0,
737
- configurable: !0,
738
- writable: !0,
739
- value: "AbiEventSignatureNotFoundError"
740
- });
741
- }
742
- }
743
- class Ct extends h {
744
- constructor(t, { docsPath: r } = {}) {
745
- super([
746
- `Event ${t ? `"${t}" ` : ""}not found on ABI.`,
747
- "Make sure you are using the correct ABI and that the event exists on it."
748
- ].join(`
749
- `), {
750
- docsPath: r
751
- }), Object.defineProperty(this, "name", {
752
- enumerable: !0,
753
- configurable: !0,
754
- writable: !0,
755
- value: "AbiEventNotFoundError"
756
- });
757
- }
758
- }
759
- class le extends h {
760
- constructor(t, { docsPath: r } = {}) {
761
- super([
762
- `Function ${t ? `"${t}" ` : ""}not found on ABI.`,
763
- "Make sure you are using the correct ABI and that the function exists on it."
764
- ].join(`
765
- `), {
766
- docsPath: r
767
- }), Object.defineProperty(this, "name", {
768
- enumerable: !0,
769
- configurable: !0,
770
- writable: !0,
771
- value: "AbiFunctionNotFoundError"
772
- });
773
- }
774
- }
775
- class Bn extends h {
776
- constructor(t, { docsPath: r }) {
777
- super([
778
- `Function "${t}" does not contain any \`outputs\` on ABI.`,
779
- "Cannot decode function result without knowing what the parameter types are.",
780
- "Make sure you are using the correct ABI and that the function exists on it."
781
- ].join(`
782
- `), {
783
- docsPath: r
784
- }), Object.defineProperty(this, "name", {
785
- enumerable: !0,
786
- configurable: !0,
787
- writable: !0,
788
- value: "AbiFunctionOutputsNotFoundError"
789
- });
790
- }
791
- }
792
- class In extends h {
793
- constructor(t, r) {
794
- super("Found ambiguous types in overloaded ABI items.", {
795
- metaMessages: [
796
- `\`${t.type}\` in \`${G(t.abiItem)}\`, and`,
797
- `\`${r.type}\` in \`${G(r.abiItem)}\``,
798
- "",
799
- "These types encode differently and cannot be distinguished at runtime.",
800
- "Remove one of the ambiguous items in the ABI."
801
- ]
802
- }), Object.defineProperty(this, "name", {
803
- enumerable: !0,
804
- configurable: !0,
805
- writable: !0,
806
- value: "AbiItemAmbiguityError"
807
- });
808
- }
809
- }
810
- class ps extends h {
811
- constructor({ expectedSize: t, givenSize: r }) {
812
- super(`Expected bytes${t}, got bytes${r}.`), Object.defineProperty(this, "name", {
813
- enumerable: !0,
814
- configurable: !0,
815
- writable: !0,
816
- value: "BytesSizeMismatchError"
817
- });
818
- }
819
- }
820
- class fe extends h {
821
- constructor({ abiItem: t, data: r, params: n, size: a }) {
822
- super([
823
- `Data size of ${a} bytes is too small for non-indexed event parameters.`
824
- ].join(`
825
- `), {
826
- metaMessages: [
827
- `Params: (${me(n, { includeName: !0 })})`,
828
- `Data: ${r} (${a} bytes)`
829
- ]
830
- }), Object.defineProperty(this, "name", {
831
- enumerable: !0,
832
- configurable: !0,
833
- writable: !0,
834
- value: "DecodeLogDataMismatch"
835
- }), Object.defineProperty(this, "abiItem", {
836
- enumerable: !0,
837
- configurable: !0,
838
- writable: !0,
839
- value: void 0
840
- }), Object.defineProperty(this, "data", {
841
- enumerable: !0,
842
- configurable: !0,
843
- writable: !0,
844
- value: void 0
845
- }), Object.defineProperty(this, "params", {
846
- enumerable: !0,
847
- configurable: !0,
848
- writable: !0,
849
- value: void 0
850
- }), Object.defineProperty(this, "size", {
851
- enumerable: !0,
852
- configurable: !0,
853
- writable: !0,
854
- value: void 0
855
- }), this.abiItem = t, this.data = r, this.params = n, this.size = a;
856
- }
857
- }
858
- class Le extends h {
859
- constructor({ abiItem: t, param: r }) {
860
- super([
861
- `Expected a topic for indexed event parameter${r.name ? ` "${r.name}"` : ""} on event "${G(t, { includeName: !0 })}".`
862
- ].join(`
863
- `)), Object.defineProperty(this, "name", {
864
- enumerable: !0,
865
- configurable: !0,
866
- writable: !0,
867
- value: "DecodeLogTopicsMismatch"
868
- }), Object.defineProperty(this, "abiItem", {
869
- enumerable: !0,
870
- configurable: !0,
871
- writable: !0,
872
- value: void 0
873
- }), this.abiItem = t;
874
- }
875
- }
876
- class Rn extends h {
877
- constructor(t, { docsPath: r }) {
878
- super([
879
- `Type "${t}" is not a valid encoding type.`,
880
- "Please provide a valid ABI type."
881
- ].join(`
882
- `), { docsPath: r }), Object.defineProperty(this, "name", {
883
- enumerable: !0,
884
- configurable: !0,
885
- writable: !0,
886
- value: "InvalidAbiEncodingType"
887
- });
888
- }
889
- }
890
- class Nn extends h {
891
- constructor(t, { docsPath: r }) {
892
- super([
893
- `Type "${t}" is not a valid decoding type.`,
894
- "Please provide a valid ABI type."
895
- ].join(`
896
- `), { docsPath: r }), Object.defineProperty(this, "name", {
897
- enumerable: !0,
898
- configurable: !0,
899
- writable: !0,
900
- value: "InvalidAbiDecodingType"
901
- });
902
- }
903
- }
904
- class zn extends h {
905
- constructor(t) {
906
- super([`Value "${t}" is not a valid array.`].join(`
907
- `)), Object.defineProperty(this, "name", {
908
- enumerable: !0,
909
- configurable: !0,
910
- writable: !0,
911
- value: "InvalidArrayError"
912
- });
913
- }
914
- }
915
- class Gn extends h {
916
- constructor(t) {
917
- super([
918
- `"${t}" is not a valid definition type.`,
919
- 'Valid types: "function", "event", "error"'
920
- ].join(`
921
- `)), Object.defineProperty(this, "name", {
922
- enumerable: !0,
923
- configurable: !0,
924
- writable: !0,
925
- value: "InvalidDefinitionTypeError"
926
- });
927
- }
928
- }
929
- class Dn extends h {
930
- constructor(t) {
931
- super(`Filter type "${t}" is not supported.`), Object.defineProperty(this, "name", {
932
- enumerable: !0,
933
- configurable: !0,
934
- writable: !0,
935
- value: "FilterTypeNotSupportedError"
936
- });
937
- }
938
- }
939
- const _n = (e) => Ie(Re(e));
940
- function Ln(e) {
941
- return _n(e);
942
- }
943
- function qn(e) {
944
- let t = !0, r = "", n = 0, a = "", o = !1;
945
- for (let s = 0; s < e.length; s++) {
946
- const i = e[s];
947
- if (["(", ")", ","].includes(i) && (t = !0), i === "(" && n++, i === ")" && n--, !!t) {
948
- if (n === 0) {
949
- if (i === " " && ["event", "function", ""].includes(a))
950
- a = "";
951
- else if (a += i, i === ")") {
952
- o = !0;
953
- break;
954
- }
955
- continue;
956
- }
957
- if (i === " ") {
958
- e[s - 1] !== "," && r !== "," && r !== ",(" && (r = "", t = !1);
959
- continue;
960
- }
961
- a += i, r += i;
962
- }
963
- }
964
- if (!o)
965
- throw new h("Unable to normalize signature.");
966
- return a;
967
- }
968
- const Hn = (e) => {
969
- const t = typeof e == "string" ? e : Ur(e);
970
- return qn(t);
971
- };
972
- function cr(e) {
973
- return Ln(Hn(e));
974
- }
975
- const qe = cr;
976
- function He(e, t) {
977
- if (e.length !== t.length)
978
- throw new Sn({
979
- expectedLength: e.length,
980
- givenLength: t.length
981
- });
982
- const r = Un({
983
- params: e,
984
- values: t
985
- }), n = Ve(r);
986
- return n.length === 0 ? "0x" : n;
987
- }
988
- function Un({ params: e, values: t }) {
989
- const r = [];
990
- for (let n = 0; n < e.length; n++)
991
- r.push(Ue({ param: e[n], value: t[n] }));
992
- return r;
993
- }
994
- function Ue({ param: e, value: t }) {
995
- const r = Ze(e.type);
996
- if (r) {
997
- const [n, a] = r;
998
- return Zn(t, { length: n, param: { ...e, type: a } });
999
- }
1000
- if (e.type === "tuple")
1001
- return Xn(t, {
1002
- param: e
1003
- });
1004
- if (e.type === "address")
1005
- return Vn(t);
1006
- if (e.type === "bool")
1007
- return Jn(t);
1008
- if (e.type.startsWith("uint") || e.type.startsWith("int")) {
1009
- const n = e.type.startsWith("int");
1010
- return Kn(t, { signed: n });
1011
- }
1012
- if (e.type.startsWith("bytes"))
1013
- return Wn(t, { param: e });
1014
- if (e.type === "string")
1015
- return Yn(t);
1016
- throw new Rn(e.type, {
1017
- docsPath: "/docs/contract/encodeAbiParameters"
1018
- });
1019
- }
1020
- function Ve(e) {
1021
- let t = 0;
1022
- for (let o = 0; o < e.length; o++) {
1023
- const { dynamic: s, encoded: i } = e[o];
1024
- s ? t += 32 : t += T(i);
1025
- }
1026
- const r = [], n = [];
1027
- let a = 0;
1028
- for (let o = 0; o < e.length; o++) {
1029
- const { dynamic: s, encoded: i } = e[o];
1030
- s ? (r.push(P(t + a, { size: 32 })), n.push(i), a += T(i)) : r.push(i);
1031
- }
1032
- return J([...r, ...n]);
1033
- }
1034
- function Vn(e) {
1035
- if (!z(e))
1036
- throw new K({ address: e });
1037
- return { dynamic: !1, encoded: H(e.toLowerCase()) };
1038
- }
1039
- function Zn(e, { length: t, param: r }) {
1040
- const n = t === null;
1041
- if (!Array.isArray(e))
1042
- throw new zn(e);
1043
- if (!n && e.length !== t)
1044
- throw new Cn({
1045
- expectedLength: t,
1046
- givenLength: e.length,
1047
- type: `${r.type}[${t}]`
1048
- });
1049
- let a = !1;
1050
- const o = [];
1051
- for (let s = 0; s < e.length; s++) {
1052
- const i = Ue({ param: r, value: e[s] });
1053
- i.dynamic && (a = !0), o.push(i);
1054
- }
1055
- if (n || a) {
1056
- const s = Ve(o);
1057
- if (n) {
1058
- const i = P(o.length, { size: 32 });
1059
- return {
1060
- dynamic: !0,
1061
- encoded: o.length > 0 ? J([i, s]) : i
1062
- };
1063
- }
1064
- if (a)
1065
- return { dynamic: !0, encoded: s };
1066
- }
1067
- return {
1068
- dynamic: !1,
1069
- encoded: J(o.map(({ encoded: s }) => s))
1070
- };
1071
- }
1072
- function Wn(e, { param: t }) {
1073
- const [, r] = t.type.split("bytes"), n = T(e);
1074
- if (!r) {
1075
- let a = e;
1076
- return n % 32 !== 0 && (a = H(a, {
1077
- dir: "right",
1078
- size: Math.ceil((e.length - 2) / 2 / 32) * 32
1079
- })), {
1080
- dynamic: !0,
1081
- encoded: J([H(P(n, { size: 32 })), a])
1082
- };
1083
- }
1084
- if (n !== Number.parseInt(r))
1085
- throw new kn({
1086
- expectedSize: Number.parseInt(r),
1087
- value: e
1088
- });
1089
- return { dynamic: !1, encoded: H(e, { dir: "right" }) };
1090
- }
1091
- function Jn(e) {
1092
- if (typeof e != "boolean")
1093
- throw new h(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
1094
- return { dynamic: !1, encoded: H(Ar(e)) };
1095
- }
1096
- function Kn(e, { signed: t }) {
1097
- return {
1098
- dynamic: !1,
1099
- encoded: P(e, {
1100
- size: 32,
1101
- signed: t
1102
- })
1103
- };
1104
- }
1105
- function Yn(e) {
1106
- const t = $r(e), r = Math.ceil(T(t) / 32), n = [];
1107
- for (let a = 0; a < r; a++)
1108
- n.push(H(ue(t, a * 32, (a + 1) * 32), {
1109
- dir: "right"
1110
- }));
1111
- return {
1112
- dynamic: !0,
1113
- encoded: J([
1114
- H(P(T(t), { size: 32 })),
1115
- ...n
1116
- ])
1117
- };
1118
- }
1119
- function Xn(e, { param: t }) {
1120
- let r = !1;
1121
- const n = [];
1122
- for (let a = 0; a < t.components.length; a++) {
1123
- const o = t.components[a], s = Array.isArray(e) ? a : o.name, i = Ue({
1124
- param: o,
1125
- value: e[s]
1126
- });
1127
- n.push(i), i.dynamic && (r = !0);
1128
- }
1129
- return {
1130
- dynamic: r,
1131
- encoded: r ? Ve(n) : J(n.map(({ encoded: a }) => a))
1132
- };
1133
- }
1134
- function Ze(e) {
1135
- const t = e.match(/^(.*)\[(\d+)?\]$/);
1136
- return t ? (
1137
- // Return `null` if the array is dynamic.
1138
- [t[2] ? Number(t[2]) : null, t[1]]
1139
- ) : void 0;
1140
- }
1141
- const We = (e) => ue(cr(e), 0, 4);
1142
- function X(e) {
1143
- const { abi: t, args: r = [], name: n } = e, a = jr(n, { strict: !1 }), o = t.filter((i) => a ? i.type === "function" ? We(i) === n : i.type === "event" ? qe(i) === n : !1 : "name" in i && i.name === n);
1144
- if (o.length === 0)
1145
- return;
1146
- if (o.length === 1)
1147
- return o[0];
1148
- let s;
1149
- for (const i of o) {
1150
- if (!("inputs" in i))
1151
- continue;
1152
- if (!r || r.length === 0) {
1153
- if (!i.inputs || i.inputs.length === 0)
1154
- return i;
1155
- continue;
1156
- }
1157
- if (!i.inputs || i.inputs.length === 0 || i.inputs.length !== r.length)
1158
- continue;
1159
- if (r.every((u, d) => {
1160
- const l = "inputs" in i && i.inputs[d];
1161
- return l ? Se(u, l) : !1;
1162
- })) {
1163
- if (s && "inputs" in s && s.inputs) {
1164
- const u = ur(i.inputs, s.inputs, r);
1165
- if (u)
1166
- throw new In({
1167
- abiItem: i,
1168
- type: u[0]
1169
- }, {
1170
- abiItem: s,
1171
- type: u[1]
1172
- });
1173
- }
1174
- s = i;
1175
- }
1176
- }
1177
- return s || o[0];
1178
- }
1179
- function Se(e, t) {
1180
- const r = typeof e, n = t.type;
1181
- switch (n) {
1182
- case "address":
1183
- return z(e, { strict: !1 });
1184
- case "bool":
1185
- return r === "boolean";
1186
- case "function":
1187
- return r === "string";
1188
- case "string":
1189
- return r === "string";
1190
- default:
1191
- return n === "tuple" && "components" in t ? Object.values(t.components).every((a, o) => Se(Object.values(e)[o], a)) : /^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) ? r === "number" || r === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n) ? r === "string" || e instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n) ? Array.isArray(e) && e.every((a) => Se(a, {
1192
- ...t,
1193
- // Pop off `[]` or `[M]` from end of type
1194
- type: n.replace(/(\[[0-9]{0,}\])$/, "")
1195
- })) : !1;
1196
- }
1197
- }
1198
- function ur(e, t, r) {
1199
- for (const n in e) {
1200
- const a = e[n], o = t[n];
1201
- if (a.type === "tuple" && o.type === "tuple" && "components" in a && "components" in o)
1202
- return ur(a.components, o.components, r[n]);
1203
- const s = [a.type, o.type];
1204
- if (s.includes("address") && s.includes("bytes20") ? !0 : s.includes("address") && s.includes("string") ? z(r[n], { strict: !1 }) : s.includes("address") && s.includes("bytes") ? z(r[n], { strict: !1 }) : !1)
1205
- return s;
1206
- }
1207
- }
1208
- const kt = "/docs/contract/encodeEventTopics";
1209
- function Je(e) {
1210
- var c;
1211
- const { abi: t, eventName: r, args: n } = e;
1212
- let a = t[0];
1213
- if (r) {
1214
- const u = X({ abi: t, name: r });
1215
- if (!u)
1216
- throw new Ct(r, { docsPath: kt });
1217
- a = u;
1218
- }
1219
- if (a.type !== "event")
1220
- throw new Ct(void 0, { docsPath: kt });
1221
- const o = G(a), s = qe(o);
1222
- let i = [];
1223
- if (n && "inputs" in a) {
1224
- const u = (c = a.inputs) == null ? void 0 : c.filter((l) => "indexed" in l && l.indexed), d = Array.isArray(n) ? n : Object.values(n).length > 0 ? (u == null ? void 0 : u.map((l) => n[l.name])) ?? [] : [];
1225
- d.length > 0 && (i = (u == null ? void 0 : u.map((l, f) => Array.isArray(d[f]) ? d[f].map((y, b) => St({ param: l, value: d[f][b] })) : d[f] ? St({ param: l, value: d[f] }) : null)) ?? []);
1226
- }
1227
- return [s, ...i];
1228
- }
1229
- function St({ param: e, value: t }) {
1230
- if (e.type === "string" || e.type === "bytes")
1231
- return Ie(Re(t));
1232
- if (e.type === "tuple" || e.type.match(/^(.*)\[(\d+)?\]$/))
1233
- throw new Dn(e.type);
1234
- return He([e], [t]);
1235
- }
1236
- function Qn(e, { method: t }) {
1237
- var n, a;
1238
- const r = {};
1239
- return e.transport.type === "fallback" && ((a = (n = e.transport).onResponse) == null || a.call(n, ({ method: o, response: s, status: i, transport: c }) => {
1240
- i === "success" && t === o && (r[s] = c.request);
1241
- })), (o) => r[o] || e.request;
1242
- }
1243
- async function ea(e, t) {
1244
- const { address: r, abi: n, args: a, eventName: o, fromBlock: s, strict: i, toBlock: c } = t, u = Qn(e, {
1245
- method: "eth_newFilter"
1246
- }), d = o ? Je({
1247
- abi: n,
1248
- args: a,
1249
- eventName: o
1250
- }) : void 0, l = await e.request({
1251
- method: "eth_newFilter",
1252
- params: [
1253
- {
1254
- address: r,
1255
- fromBlock: typeof s == "bigint" ? P(s) : s,
1256
- toBlock: typeof c == "bigint" ? P(c) : c,
1257
- topics: d
1258
- }
1259
- ]
1260
- });
1261
- return {
1262
- abi: n,
1263
- args: a,
1264
- eventName: o,
1265
- id: l,
1266
- request: u(l),
1267
- strict: !!i,
1268
- type: "event"
1269
- };
1270
- }
1271
- function _(e) {
1272
- return typeof e == "string" ? { address: e, type: "json-rpc" } : e;
1273
- }
1274
- const Tt = "/docs/contract/encodeFunctionData";
1275
- function ta(e) {
1276
- const { abi: t, args: r, functionName: n } = e;
1277
- let a = t[0];
1278
- if (n) {
1279
- const o = X({
1280
- abi: t,
1281
- args: r,
1282
- name: n
1283
- });
1284
- if (!o)
1285
- throw new le(n, { docsPath: Tt });
1286
- a = o;
1287
- }
1288
- if (a.type !== "function")
1289
- throw new le(void 0, { docsPath: Tt });
1290
- return {
1291
- abi: [a],
1292
- functionName: We(G(a))
1293
- };
1294
- }
1295
- function ae(e) {
1296
- const { args: t } = e, { abi: r, functionName: n } = (() => {
1297
- var i;
1298
- return e.abi.length === 1 && ((i = e.functionName) != null && i.startsWith("0x")) ? e : ta(e);
1299
- })(), a = r[0], o = n, s = "inputs" in a && a.inputs ? He(a.inputs, t ?? []) : void 0;
1300
- return qt([o, s ?? "0x"]);
1301
- }
1302
- const ra = {
1303
- 1: "An `assert` condition failed.",
1304
- 17: "Arithmetic operation resulted in underflow or overflow.",
1305
- 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
1306
- 33: "Attempted to convert to an invalid type.",
1307
- 34: "Attempted to access a storage byte array that is incorrectly encoded.",
1308
- 49: "Performed `.pop()` on an empty array",
1309
- 50: "Array index is out of bounds.",
1310
- 65: "Allocated too much memory or created an array which is too large.",
1311
- 81: "Attempted to call a zero-initialized variable of internal function type."
1312
- }, na = {
1313
- inputs: [
1314
- {
1315
- name: "message",
1316
- type: "string"
1317
- }
1318
- ],
1319
- name: "Error",
1320
- type: "error"
1321
- }, aa = {
1322
- inputs: [
1323
- {
1324
- name: "reason",
1325
- type: "uint256"
1326
- }
1327
- ],
1328
- name: "Panic",
1329
- type: "error"
1330
- };
1331
- function sa(e, t = {}) {
1332
- typeof t.size < "u" && pe(e, { size: t.size });
1333
- const r = V(e, t);
1334
- return Ht(r, t);
1335
- }
1336
- function oa(e, t = {}) {
1337
- let r = e;
1338
- if (typeof t.size < "u" && (pe(r, { size: t.size }), r = Ne(r)), r.length > 1 || r[0] > 1)
1339
- throw new Or(r);
1340
- return !!r[0];
1341
- }
1342
- function N(e, t = {}) {
1343
- typeof t.size < "u" && pe(e, { size: t.size });
1344
- const r = V(e, t);
1345
- return ze(r, t);
1346
- }
1347
- function ia(e, t = {}) {
1348
- let r = e;
1349
- return typeof t.size < "u" && (pe(r, { size: t.size }), r = Ne(r, { dir: "right" })), new TextDecoder().decode(r);
1350
- }
1351
- function he(e, t) {
1352
- const r = typeof t == "string" ? Fr(t) : t, n = Mr(r);
1353
- if (T(r) === 0 && e.length > 0)
1354
- throw new _e();
1355
- if (T(t) && T(t) < 32)
1356
- throw new sr({
1357
- data: typeof t == "string" ? t : V(t),
1358
- params: e,
1359
- size: T(t)
1360
- });
1361
- let a = 0;
1362
- const o = [];
1363
- for (let s = 0; s < e.length; ++s) {
1364
- const i = e[s];
1365
- n.setPosition(a);
1366
- const [c, u] = W(n, i, {
1367
- staticPosition: 0
1368
- });
1369
- a += u, o.push(c);
1370
- }
1371
- return o;
1372
- }
1373
- function W(e, t, { staticPosition: r }) {
1374
- const n = Ze(t.type);
1375
- if (n) {
1376
- const [a, o] = n;
1377
- return ua(e, { ...t, type: o }, { length: a, staticPosition: r });
1378
- }
1379
- if (t.type === "tuple")
1380
- return ba(e, t, { staticPosition: r });
1381
- if (t.type === "address")
1382
- return ca(e);
1383
- if (t.type === "bool")
1384
- return da(e);
1385
- if (t.type.startsWith("bytes"))
1386
- return la(e, t, { staticPosition: r });
1387
- if (t.type.startsWith("uint") || t.type.startsWith("int"))
1388
- return fa(e, t);
1389
- if (t.type === "string")
1390
- return pa(e, { staticPosition: r });
1391
- throw new Nn(t.type, {
1392
- docsPath: "/docs/contract/decodeAbiParameters"
1393
- });
1394
- }
1395
- const Bt = 32, Te = 32;
1396
- function ca(e) {
1397
- const t = e.readBytes(32);
1398
- return [Cr(V(kr(t, -20))), 32];
1399
- }
1400
- function ua(e, t, { length: r, staticPosition: n }) {
1401
- if (!r) {
1402
- const s = N(e.readBytes(Te)), i = n + s, c = i + Bt;
1403
- e.setPosition(i);
1404
- const u = N(e.readBytes(Bt)), d = ne(t);
1405
- let l = 0;
1406
- const f = [];
1407
- for (let y = 0; y < u; ++y) {
1408
- e.setPosition(c + (d ? y * 32 : l));
1409
- const [b, p] = W(e, t, {
1410
- staticPosition: c
1411
- });
1412
- l += p, f.push(b);
1413
- }
1414
- return e.setPosition(n + 32), [f, 32];
1415
- }
1416
- if (ne(t)) {
1417
- const s = N(e.readBytes(Te)), i = n + s, c = [];
1418
- for (let u = 0; u < r; ++u) {
1419
- e.setPosition(i + u * 32);
1420
- const [d] = W(e, t, {
1421
- staticPosition: i
1422
- });
1423
- c.push(d);
1424
- }
1425
- return e.setPosition(n + 32), [c, 32];
1426
- }
1427
- let a = 0;
1428
- const o = [];
1429
- for (let s = 0; s < r; ++s) {
1430
- const [i, c] = W(e, t, {
1431
- staticPosition: n + a
1432
- });
1433
- a += c, o.push(i);
1434
- }
1435
- return [o, a];
1436
- }
1437
- function da(e) {
1438
- return [oa(e.readBytes(32), { size: 32 }), 32];
1439
- }
1440
- function la(e, t, { staticPosition: r }) {
1441
- const [n, a] = t.type.split("bytes");
1442
- if (!a) {
1443
- const s = N(e.readBytes(32));
1444
- e.setPosition(r + s);
1445
- const i = N(e.readBytes(32));
1446
- if (i === 0)
1447
- return e.setPosition(r + 32), ["0x", 32];
1448
- const c = e.readBytes(i);
1449
- return e.setPosition(r + 32), [V(c), 32];
1450
- }
1451
- return [V(e.readBytes(Number.parseInt(a), 32)), 32];
1452
- }
1453
- function fa(e, t) {
1454
- const r = t.type.startsWith("int"), n = Number.parseInt(t.type.split("int")[1] || "256"), a = e.readBytes(32);
1455
- return [
1456
- n > 48 ? sa(a, { signed: r }) : N(a, { signed: r }),
1457
- 32
1458
- ];
1459
- }
1460
- function ba(e, t, { staticPosition: r }) {
1461
- const n = t.components.length === 0 || t.components.some(({ name: s }) => !s), a = n ? [] : {};
1462
- let o = 0;
1463
- if (ne(t)) {
1464
- const s = N(e.readBytes(Te)), i = r + s;
1465
- for (let c = 0; c < t.components.length; ++c) {
1466
- const u = t.components[c];
1467
- e.setPosition(i + o);
1468
- const [d, l] = W(e, u, {
1469
- staticPosition: i
1470
- });
1471
- o += l, a[n ? c : u == null ? void 0 : u.name] = d;
1472
- }
1473
- return e.setPosition(r + 32), [a, 32];
1474
- }
1475
- for (let s = 0; s < t.components.length; ++s) {
1476
- const i = t.components[s], [c, u] = W(e, i, {
1477
- staticPosition: r
1478
- });
1479
- a[n ? s : i == null ? void 0 : i.name] = c, o += u;
1480
- }
1481
- return [a, o];
1482
- }
1483
- function pa(e, { staticPosition: t }) {
1484
- const r = N(e.readBytes(32)), n = t + r;
1485
- e.setPosition(n);
1486
- const a = N(e.readBytes(32));
1487
- if (a === 0)
1488
- return e.setPosition(t + 32), ["", 32];
1489
- const o = e.readBytes(a, 32), s = ia(Ne(o));
1490
- return e.setPosition(t + 32), [s, 32];
1491
- }
1492
- function ne(e) {
1493
- var n;
1494
- const { type: t } = e;
1495
- if (t === "string" || t === "bytes" || t.endsWith("[]"))
1496
- return !0;
1497
- if (t === "tuple")
1498
- return (n = e.components) == null ? void 0 : n.some(ne);
1499
- const r = Ze(e.type);
1500
- return !!(r && ne({ ...e, type: r[1] }));
1501
- }
1502
- function ya(e) {
1503
- const { abi: t, data: r } = e, n = ue(r, 0, 4);
1504
- if (n === "0x")
1505
- throw new _e();
1506
- const o = [...t || [], na, aa].find((s) => s.type === "error" && n === We(G(s)));
1507
- if (!o)
1508
- throw new or(n, {
1509
- docsPath: "/docs/contract/decodeErrorResult"
1510
- });
1511
- return {
1512
- abiItem: o,
1513
- args: "inputs" in o && o.inputs && o.inputs.length > 0 ? he(o.inputs, ue(r, 4)) : void 0,
1514
- errorName: o.name
1515
- };
1516
- }
1517
- const Y = (e, t, r) => JSON.stringify(e, (n, a) => typeof a == "bigint" ? a.toString() : a, r);
1518
- function dr({ abiItem: e, args: t, includeFunctionName: r = !0, includeName: n = !1 }) {
1519
- if ("name" in e && "inputs" in e && e.inputs)
1520
- return `${r ? e.name : ""}(${e.inputs.map((a, o) => `${n && a.name ? `${a.name}: ` : ""}${typeof t[o] == "object" ? Y(t[o]) : t[o]}`).join(", ")})`;
1521
- }
1522
- class ma extends h {
1523
- constructor({ address: t }) {
1524
- super(`State for account "${t}" is set multiple times.`), Object.defineProperty(this, "name", {
1525
- enumerable: !0,
1526
- configurable: !0,
1527
- writable: !0,
1528
- value: "AccountStateConflictError"
1529
- });
1530
- }
1531
- }
1532
- class ha extends h {
1533
- constructor() {
1534
- super("state and stateDiff are set on the same account."), Object.defineProperty(this, "name", {
1535
- enumerable: !0,
1536
- configurable: !0,
1537
- writable: !0,
1538
- value: "StateAssignmentConflictError"
1539
- });
1540
- }
1541
- }
1542
- function It(e) {
1543
- return e.reduce((t, { slot: r, value: n }) => `${t} ${r}: ${n}
1544
- `, "");
1545
- }
1546
- function ga(e) {
1547
- return e.reduce((t, { address: r, ...n }) => {
1548
- let a = `${t} ${r}:
1549
- `;
1550
- return n.nonce && (a += ` nonce: ${n.nonce}
1551
- `), n.balance && (a += ` balance: ${n.balance}
1552
- `), n.code && (a += ` code: ${n.code}
1553
- `), n.state && (a += ` state:
1554
- `, a += It(n.state)), n.stateDiff && (a += ` stateDiff:
1555
- `, a += It(n.stateDiff)), a;
1556
- }, ` State Override:
1557
- `).slice(0, -1);
1558
- }
1559
- class wa extends h {
1560
- constructor(t, { account: r, docsPath: n, chain: a, data: o, gas: s, gasPrice: i, maxFeePerGas: c, maxPriorityFeePerGas: u, nonce: d, to: l, value: f, stateOverride: y }) {
1561
- var m;
1562
- const b = r ? _(r) : void 0;
1563
- let p = Ge({
1564
- from: b == null ? void 0 : b.address,
1565
- to: l,
1566
- value: typeof f < "u" && `${Ut(f)} ${((m = a == null ? void 0 : a.nativeCurrency) == null ? void 0 : m.symbol) || "ETH"}`,
1567
- data: o,
1568
- gas: s,
1569
- gasPrice: typeof i < "u" && `${U(i)} gwei`,
1570
- maxFeePerGas: typeof c < "u" && `${U(c)} gwei`,
1571
- maxPriorityFeePerGas: typeof u < "u" && `${U(u)} gwei`,
1572
- nonce: d
1573
- });
1574
- y && (p += `
1575
- ${ga(y)}`), super(t.shortMessage, {
1576
- cause: t,
1577
- docsPath: n,
1578
- metaMessages: [
1579
- ...t.metaMessages ? [...t.metaMessages, " "] : [],
1580
- "Raw Call Arguments:",
1581
- p
1582
- ].filter(Boolean)
1583
- }), Object.defineProperty(this, "cause", {
1584
- enumerable: !0,
1585
- configurable: !0,
1586
- writable: !0,
1587
- value: void 0
1588
- }), Object.defineProperty(this, "name", {
1589
- enumerable: !0,
1590
- configurable: !0,
1591
- writable: !0,
1592
- value: "CallExecutionError"
1593
- }), this.cause = t;
1594
- }
1595
- }
1596
- class va extends h {
1597
- constructor(t, { abi: r, args: n, contractAddress: a, docsPath: o, functionName: s, sender: i }) {
1598
- const c = X({ abi: r, args: n, name: s }), u = c ? dr({
1599
- abiItem: c,
1600
- args: n,
1601
- includeFunctionName: !1,
1602
- includeName: !1
1603
- }) : void 0, d = c ? G(c, { includeName: !0 }) : void 0, l = Ge({
1604
- address: a && Sr(a),
1605
- function: d,
1606
- args: u && u !== "()" && `${[...Array((s == null ? void 0 : s.length) ?? 0).keys()].map(() => " ").join("")}${u}`,
1607
- sender: i
1608
- });
1609
- super(t.shortMessage || `An unknown error occurred while executing the contract function "${s}".`, {
1610
- cause: t,
1611
- docsPath: o,
1612
- metaMessages: [
1613
- ...t.metaMessages ? [...t.metaMessages, " "] : [],
1614
- l && "Contract Call:",
1615
- l
1616
- ].filter(Boolean)
1617
- }), Object.defineProperty(this, "abi", {
1618
- enumerable: !0,
1619
- configurable: !0,
1620
- writable: !0,
1621
- value: void 0
1622
- }), Object.defineProperty(this, "args", {
1623
- enumerable: !0,
1624
- configurable: !0,
1625
- writable: !0,
1626
- value: void 0
1627
- }), Object.defineProperty(this, "cause", {
1628
- enumerable: !0,
1629
- configurable: !0,
1630
- writable: !0,
1631
- value: void 0
1632
- }), Object.defineProperty(this, "contractAddress", {
1633
- enumerable: !0,
1634
- configurable: !0,
1635
- writable: !0,
1636
- value: void 0
1637
- }), Object.defineProperty(this, "formattedArgs", {
1638
- enumerable: !0,
1639
- configurable: !0,
1640
- writable: !0,
1641
- value: void 0
1642
- }), Object.defineProperty(this, "functionName", {
1643
- enumerable: !0,
1644
- configurable: !0,
1645
- writable: !0,
1646
- value: void 0
1647
- }), Object.defineProperty(this, "sender", {
1648
- enumerable: !0,
1649
- configurable: !0,
1650
- writable: !0,
1651
- value: void 0
1652
- }), Object.defineProperty(this, "name", {
1653
- enumerable: !0,
1654
- configurable: !0,
1655
- writable: !0,
1656
- value: "ContractFunctionExecutionError"
1657
- }), this.abi = r, this.args = n, this.cause = t, this.contractAddress = a, this.functionName = s, this.sender = i;
1658
- }
1659
- }
1660
- class Pa extends h {
1661
- constructor({ abi: t, data: r, functionName: n, message: a }) {
1662
- let o, s, i, c;
1663
- if (r && r !== "0x")
1664
- try {
1665
- s = ya({ abi: t, data: r });
1666
- const { abiItem: d, errorName: l, args: f } = s;
1667
- if (l === "Error")
1668
- c = f[0];
1669
- else if (l === "Panic") {
1670
- const [y] = f;
1671
- c = ra[y];
1672
- } else {
1673
- const y = d ? G(d, { includeName: !0 }) : void 0, b = d && f ? dr({
1674
- abiItem: d,
1675
- args: f,
1676
- includeFunctionName: !1,
1677
- includeName: !1
1678
- }) : void 0;
1679
- i = [
1680
- y ? `Error: ${y}` : "",
1681
- b && b !== "()" ? ` ${[...Array((l == null ? void 0 : l.length) ?? 0).keys()].map(() => " ").join("")}${b}` : ""
1682
- ];
1683
- }
1684
- } catch (d) {
1685
- o = d;
1686
- }
1687
- else a && (c = a);
1688
- let u;
1689
- o instanceof or && (u = o.signature, i = [
1690
- `Unable to decode signature "${u}" as it was not found on the provided ABI.`,
1691
- "Make sure you are using the correct ABI and that the error exists on it.",
1692
- `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`
1693
- ]), super(c && c !== "execution reverted" || u ? [
1694
- `The contract function "${n}" reverted with the following ${u ? "signature" : "reason"}:`,
1695
- c || u
1696
- ].join(`
1697
- `) : `The contract function "${n}" reverted.`, {
1698
- cause: o,
1699
- metaMessages: i
1700
- }), Object.defineProperty(this, "name", {
1701
- enumerable: !0,
1702
- configurable: !0,
1703
- writable: !0,
1704
- value: "ContractFunctionRevertedError"
1705
- }), Object.defineProperty(this, "data", {
1706
- enumerable: !0,
1707
- configurable: !0,
1708
- writable: !0,
1709
- value: void 0
1710
- }), Object.defineProperty(this, "reason", {
1711
- enumerable: !0,
1712
- configurable: !0,
1713
- writable: !0,
1714
- value: void 0
1715
- }), Object.defineProperty(this, "signature", {
1716
- enumerable: !0,
1717
- configurable: !0,
1718
- writable: !0,
1719
- value: void 0
1720
- }), this.data = s, this.reason = c, this.signature = u;
1721
- }
1722
- }
1723
- class xa extends h {
1724
- constructor({ functionName: t }) {
1725
- super(`The contract function "${t}" returned no data ("0x").`, {
1726
- metaMessages: [
1727
- "This could be due to any of the following:",
1728
- ` - The contract does not have the function "${t}",`,
1729
- " - The parameters passed to the contract function may be invalid, or",
1730
- " - The address is not a contract."
1731
- ]
1732
- }), Object.defineProperty(this, "name", {
1733
- enumerable: !0,
1734
- configurable: !0,
1735
- writable: !0,
1736
- value: "ContractFunctionZeroDataError"
1737
- });
1738
- }
1739
- }
1740
- class Ea extends h {
1741
- constructor({ factory: t }) {
1742
- super(`Deployment for counterfactual contract call failed${t ? ` for factory "${t}".` : ""}`, {
1743
- metaMessages: [
1744
- "Please ensure:",
1745
- "- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).",
1746
- "- The `factoryData` is a valid encoded function call for contract deployment function on the factory."
1747
- ]
1748
- }), Object.defineProperty(this, "name", {
1749
- enumerable: !0,
1750
- configurable: !0,
1751
- writable: !0,
1752
- value: "CounterfactualDeploymentFailedError"
1753
- });
1754
- }
1755
- }
1756
- class lr extends h {
1757
- constructor({ data: t, message: r }) {
1758
- super(r || ""), Object.defineProperty(this, "code", {
1759
- enumerable: !0,
1760
- configurable: !0,
1761
- writable: !0,
1762
- value: 3
1763
- }), Object.defineProperty(this, "name", {
1764
- enumerable: !0,
1765
- configurable: !0,
1766
- writable: !0,
1767
- value: "RawContractError"
1768
- }), Object.defineProperty(this, "data", {
1769
- enumerable: !0,
1770
- configurable: !0,
1771
- writable: !0,
1772
- value: void 0
1773
- }), this.data = t;
1774
- }
1775
- }
1776
- class ys extends h {
1777
- constructor({ body: t, cause: r, details: n, headers: a, status: o, url: s }) {
1778
- super("HTTP request failed.", {
1779
- cause: r,
1780
- details: n,
1781
- metaMessages: [
1782
- o && `Status: ${o}`,
1783
- `URL: ${De(s)}`,
1784
- t && `Request body: ${Y(t)}`
1785
- ].filter(Boolean)
1786
- }), Object.defineProperty(this, "name", {
1787
- enumerable: !0,
1788
- configurable: !0,
1789
- writable: !0,
1790
- value: "HttpRequestError"
1791
- }), Object.defineProperty(this, "body", {
1792
- enumerable: !0,
1793
- configurable: !0,
1794
- writable: !0,
1795
- value: void 0
1796
- }), Object.defineProperty(this, "headers", {
1797
- enumerable: !0,
1798
- configurable: !0,
1799
- writable: !0,
1800
- value: void 0
1801
- }), Object.defineProperty(this, "status", {
1802
- enumerable: !0,
1803
- configurable: !0,
1804
- writable: !0,
1805
- value: void 0
1806
- }), Object.defineProperty(this, "url", {
1807
- enumerable: !0,
1808
- configurable: !0,
1809
- writable: !0,
1810
- value: void 0
1811
- }), this.body = t, this.headers = a, this.status = o, this.url = s;
1812
- }
1813
- }
1814
- class Aa extends h {
1815
- constructor({ body: t, error: r, url: n }) {
1816
- super("RPC Request failed.", {
1817
- cause: r,
1818
- details: r.message,
1819
- metaMessages: [`URL: ${De(n)}`, `Request body: ${Y(t)}`]
1820
- }), Object.defineProperty(this, "name", {
1821
- enumerable: !0,
1822
- configurable: !0,
1823
- writable: !0,
1824
- value: "RpcRequestError"
1825
- }), Object.defineProperty(this, "code", {
1826
- enumerable: !0,
1827
- configurable: !0,
1828
- writable: !0,
1829
- value: void 0
1830
- }), this.code = r.code;
1831
- }
1832
- }
1833
- class ms extends h {
1834
- constructor({ body: t, url: r }) {
1835
- super("The request took too long to respond.", {
1836
- details: "The request timed out.",
1837
- metaMessages: [`URL: ${De(r)}`, `Request body: ${Y(t)}`]
1838
- }), Object.defineProperty(this, "name", {
1839
- enumerable: !0,
1840
- configurable: !0,
1841
- writable: !0,
1842
- value: "TimeoutError"
1843
- });
1844
- }
1845
- }
1846
- const $a = -1;
1847
- class M extends h {
1848
- constructor(t, { code: r, docsPath: n, metaMessages: a, shortMessage: o }) {
1849
- super(o, {
1850
- cause: t,
1851
- docsPath: n,
1852
- metaMessages: a || (t == null ? void 0 : t.metaMessages)
1853
- }), Object.defineProperty(this, "name", {
1854
- enumerable: !0,
1855
- configurable: !0,
1856
- writable: !0,
1857
- value: "RpcError"
1858
- }), Object.defineProperty(this, "code", {
1859
- enumerable: !0,
1860
- configurable: !0,
1861
- writable: !0,
1862
- value: void 0
1863
- }), this.name = t.name, this.code = t instanceof Aa ? t.code : r ?? $a;
1864
- }
1865
- }
1866
- class Q extends M {
1867
- constructor(t, r) {
1868
- super(t, r), Object.defineProperty(this, "name", {
1869
- enumerable: !0,
1870
- configurable: !0,
1871
- writable: !0,
1872
- value: "ProviderRpcError"
1873
- }), Object.defineProperty(this, "data", {
1874
- enumerable: !0,
1875
- configurable: !0,
1876
- writable: !0,
1877
- value: void 0
1878
- }), this.data = r.data;
1879
- }
1880
- }
1881
- class Ke extends M {
1882
- constructor(t) {
1883
- super(t, {
1884
- code: Ke.code,
1885
- shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
1886
- }), Object.defineProperty(this, "name", {
1887
- enumerable: !0,
1888
- configurable: !0,
1889
- writable: !0,
1890
- value: "ParseRpcError"
1891
- });
1892
- }
1893
- }
1894
- Object.defineProperty(Ke, "code", {
1895
- enumerable: !0,
1896
- configurable: !0,
1897
- writable: !0,
1898
- value: -32700
1899
- });
1900
- class Ye extends M {
1901
- constructor(t) {
1902
- super(t, {
1903
- code: Ye.code,
1904
- shortMessage: "JSON is not a valid request object."
1905
- }), Object.defineProperty(this, "name", {
1906
- enumerable: !0,
1907
- configurable: !0,
1908
- writable: !0,
1909
- value: "InvalidRequestRpcError"
1910
- });
1911
- }
1912
- }
1913
- Object.defineProperty(Ye, "code", {
1914
- enumerable: !0,
1915
- configurable: !0,
1916
- writable: !0,
1917
- value: -32600
1918
- });
1919
- class Xe extends M {
1920
- constructor(t, { method: r } = {}) {
1921
- super(t, {
1922
- code: Xe.code,
1923
- shortMessage: `The method${r ? ` "${r}"` : ""} does not exist / is not available.`
1924
- }), Object.defineProperty(this, "name", {
1925
- enumerable: !0,
1926
- configurable: !0,
1927
- writable: !0,
1928
- value: "MethodNotFoundRpcError"
1929
- });
1930
- }
1931
- }
1932
- Object.defineProperty(Xe, "code", {
1933
- enumerable: !0,
1934
- configurable: !0,
1935
- writable: !0,
1936
- value: -32601
1937
- });
1938
- class Qe extends M {
1939
- constructor(t) {
1940
- super(t, {
1941
- code: Qe.code,
1942
- shortMessage: [
1943
- "Invalid parameters were provided to the RPC method.",
1944
- "Double check you have provided the correct parameters."
1945
- ].join(`
1946
- `)
1947
- }), Object.defineProperty(this, "name", {
1948
- enumerable: !0,
1949
- configurable: !0,
1950
- writable: !0,
1951
- value: "InvalidParamsRpcError"
1952
- });
1953
- }
1954
- }
1955
- Object.defineProperty(Qe, "code", {
1956
- enumerable: !0,
1957
- configurable: !0,
1958
- writable: !0,
1959
- value: -32602
1960
- });
1961
- class ge extends M {
1962
- constructor(t) {
1963
- super(t, {
1964
- code: ge.code,
1965
- shortMessage: "An internal error was received."
1966
- }), Object.defineProperty(this, "name", {
1967
- enumerable: !0,
1968
- configurable: !0,
1969
- writable: !0,
1970
- value: "InternalRpcError"
1971
- });
1972
- }
1973
- }
1974
- Object.defineProperty(ge, "code", {
1975
- enumerable: !0,
1976
- configurable: !0,
1977
- writable: !0,
1978
- value: -32603
1979
- });
1980
- class we extends M {
1981
- constructor(t) {
1982
- super(t, {
1983
- code: we.code,
1984
- shortMessage: [
1985
- "Missing or invalid parameters.",
1986
- "Double check you have provided the correct parameters."
1987
- ].join(`
1988
- `)
1989
- }), Object.defineProperty(this, "name", {
1990
- enumerable: !0,
1991
- configurable: !0,
1992
- writable: !0,
1993
- value: "InvalidInputRpcError"
1994
- });
1995
- }
1996
- }
1997
- Object.defineProperty(we, "code", {
1998
- enumerable: !0,
1999
- configurable: !0,
2000
- writable: !0,
2001
- value: -32e3
2002
- });
2003
- class et extends M {
2004
- constructor(t) {
2005
- super(t, {
2006
- code: et.code,
2007
- shortMessage: "Requested resource not found."
2008
- }), Object.defineProperty(this, "name", {
2009
- enumerable: !0,
2010
- configurable: !0,
2011
- writable: !0,
2012
- value: "ResourceNotFoundRpcError"
2013
- });
2014
- }
2015
- }
2016
- Object.defineProperty(et, "code", {
2017
- enumerable: !0,
2018
- configurable: !0,
2019
- writable: !0,
2020
- value: -32001
2021
- });
2022
- class tt extends M {
2023
- constructor(t) {
2024
- super(t, {
2025
- code: tt.code,
2026
- shortMessage: "Requested resource not available."
2027
- }), Object.defineProperty(this, "name", {
2028
- enumerable: !0,
2029
- configurable: !0,
2030
- writable: !0,
2031
- value: "ResourceUnavailableRpcError"
2032
- });
2033
- }
2034
- }
2035
- Object.defineProperty(tt, "code", {
2036
- enumerable: !0,
2037
- configurable: !0,
2038
- writable: !0,
2039
- value: -32002
2040
- });
2041
- class rt extends M {
2042
- constructor(t) {
2043
- super(t, {
2044
- code: rt.code,
2045
- shortMessage: "Transaction creation failed."
2046
- }), Object.defineProperty(this, "name", {
2047
- enumerable: !0,
2048
- configurable: !0,
2049
- writable: !0,
2050
- value: "TransactionRejectedRpcError"
2051
- });
2052
- }
2053
- }
2054
- Object.defineProperty(rt, "code", {
2055
- enumerable: !0,
2056
- configurable: !0,
2057
- writable: !0,
2058
- value: -32003
2059
- });
2060
- class nt extends M {
2061
- constructor(t, { method: r } = {}) {
2062
- super(t, {
2063
- code: nt.code,
2064
- shortMessage: `Method${r ? ` "${r}"` : ""} is not implemented.`
2065
- }), Object.defineProperty(this, "name", {
2066
- enumerable: !0,
2067
- configurable: !0,
2068
- writable: !0,
2069
- value: "MethodNotSupportedRpcError"
2070
- });
2071
- }
2072
- }
2073
- Object.defineProperty(nt, "code", {
2074
- enumerable: !0,
2075
- configurable: !0,
2076
- writable: !0,
2077
- value: -32004
2078
- });
2079
- class at extends M {
2080
- constructor(t) {
2081
- super(t, {
2082
- code: at.code,
2083
- shortMessage: "Request exceeds defined limit."
2084
- }), Object.defineProperty(this, "name", {
2085
- enumerable: !0,
2086
- configurable: !0,
2087
- writable: !0,
2088
- value: "LimitExceededRpcError"
2089
- });
2090
- }
2091
- }
2092
- Object.defineProperty(at, "code", {
2093
- enumerable: !0,
2094
- configurable: !0,
2095
- writable: !0,
2096
- value: -32005
2097
- });
2098
- class st extends M {
2099
- constructor(t) {
2100
- super(t, {
2101
- code: st.code,
2102
- shortMessage: "Version of JSON-RPC protocol is not supported."
2103
- }), Object.defineProperty(this, "name", {
2104
- enumerable: !0,
2105
- configurable: !0,
2106
- writable: !0,
2107
- value: "JsonRpcVersionUnsupportedError"
2108
- });
2109
- }
2110
- }
2111
- Object.defineProperty(st, "code", {
2112
- enumerable: !0,
2113
- configurable: !0,
2114
- writable: !0,
2115
- value: -32006
2116
- });
2117
- class ot extends Q {
2118
- constructor(t) {
2119
- super(t, {
2120
- code: ot.code,
2121
- shortMessage: "User rejected the request."
2122
- }), Object.defineProperty(this, "name", {
2123
- enumerable: !0,
2124
- configurable: !0,
2125
- writable: !0,
2126
- value: "UserRejectedRequestError"
2127
- });
2128
- }
2129
- }
2130
- Object.defineProperty(ot, "code", {
2131
- enumerable: !0,
2132
- configurable: !0,
2133
- writable: !0,
2134
- value: 4001
2135
- });
2136
- class it extends Q {
2137
- constructor(t) {
2138
- super(t, {
2139
- code: it.code,
2140
- shortMessage: "The requested method and/or account has not been authorized by the user."
2141
- }), Object.defineProperty(this, "name", {
2142
- enumerable: !0,
2143
- configurable: !0,
2144
- writable: !0,
2145
- value: "UnauthorizedProviderError"
2146
- });
2147
- }
2148
- }
2149
- Object.defineProperty(it, "code", {
2150
- enumerable: !0,
2151
- configurable: !0,
2152
- writable: !0,
2153
- value: 4100
2154
- });
2155
- class ct extends Q {
2156
- constructor(t, { method: r } = {}) {
2157
- super(t, {
2158
- code: ct.code,
2159
- shortMessage: `The Provider does not support the requested method${r ? ` " ${r}"` : ""}.`
2160
- }), Object.defineProperty(this, "name", {
2161
- enumerable: !0,
2162
- configurable: !0,
2163
- writable: !0,
2164
- value: "UnsupportedProviderMethodError"
2165
- });
2166
- }
2167
- }
2168
- Object.defineProperty(ct, "code", {
2169
- enumerable: !0,
2170
- configurable: !0,
2171
- writable: !0,
2172
- value: 4200
2173
- });
2174
- class ut extends Q {
2175
- constructor(t) {
2176
- super(t, {
2177
- code: ut.code,
2178
- shortMessage: "The Provider is disconnected from all chains."
2179
- }), Object.defineProperty(this, "name", {
2180
- enumerable: !0,
2181
- configurable: !0,
2182
- writable: !0,
2183
- value: "ProviderDisconnectedError"
2184
- });
2185
- }
2186
- }
2187
- Object.defineProperty(ut, "code", {
2188
- enumerable: !0,
2189
- configurable: !0,
2190
- writable: !0,
2191
- value: 4900
2192
- });
2193
- class dt extends Q {
2194
- constructor(t) {
2195
- super(t, {
2196
- code: dt.code,
2197
- shortMessage: "The Provider is not connected to the requested chain."
2198
- }), Object.defineProperty(this, "name", {
2199
- enumerable: !0,
2200
- configurable: !0,
2201
- writable: !0,
2202
- value: "ChainDisconnectedError"
2203
- });
2204
- }
2205
- }
2206
- Object.defineProperty(dt, "code", {
2207
- enumerable: !0,
2208
- configurable: !0,
2209
- writable: !0,
2210
- value: 4901
2211
- });
2212
- class lt extends Q {
2213
- constructor(t) {
2214
- super(t, {
2215
- code: lt.code,
2216
- shortMessage: "An error occurred when attempting to switch chain."
2217
- }), Object.defineProperty(this, "name", {
2218
- enumerable: !0,
2219
- configurable: !0,
2220
- writable: !0,
2221
- value: "SwitchChainError"
2222
- });
2223
- }
2224
- }
2225
- Object.defineProperty(lt, "code", {
2226
- enumerable: !0,
2227
- configurable: !0,
2228
- writable: !0,
2229
- value: 4902
2230
- });
2231
- class hs extends M {
2232
- constructor(t) {
2233
- super(t, {
2234
- shortMessage: "An unknown RPC error occurred."
2235
- }), Object.defineProperty(this, "name", {
2236
- enumerable: !0,
2237
- configurable: !0,
2238
- writable: !0,
2239
- value: "UnknownRpcError"
2240
- });
2241
- }
2242
- }
2243
- const ja = 3;
2244
- function ft(e, { abi: t, address: r, args: n, docsPath: a, functionName: o, sender: s }) {
2245
- const { code: i, data: c, message: u, shortMessage: d } = e instanceof lr ? e : e instanceof h ? e.walk((f) => "data" in f) || e.walk() : {}, l = e instanceof _e ? new xa({ functionName: o }) : [ja, ge.code].includes(i) && (c || u || d) ? new Pa({
2246
- abi: t,
2247
- data: typeof c == "object" ? c.data : c,
2248
- functionName: o,
2249
- message: d ?? u
2250
- }) : e;
2251
- return new va(l, {
2252
- abi: t,
2253
- args: n,
2254
- contractAddress: r,
2255
- docsPath: a,
2256
- functionName: o,
2257
- sender: s
2258
- });
2259
- }
2260
- class Oa extends h {
2261
- constructor(t, { account: r, docsPath: n, chain: a, data: o, gas: s, gasPrice: i, maxFeePerGas: c, maxPriorityFeePerGas: u, nonce: d, to: l, value: f }) {
2262
- var b;
2263
- const y = Ge({
2264
- from: r == null ? void 0 : r.address,
2265
- to: l,
2266
- value: typeof f < "u" && `${Ut(f)} ${((b = a == null ? void 0 : a.nativeCurrency) == null ? void 0 : b.symbol) || "ETH"}`,
2267
- data: o,
2268
- gas: s,
2269
- gasPrice: typeof i < "u" && `${U(i)} gwei`,
2270
- maxFeePerGas: typeof c < "u" && `${U(c)} gwei`,
2271
- maxPriorityFeePerGas: typeof u < "u" && `${U(u)} gwei`,
2272
- nonce: d
2273
- });
2274
- super(t.shortMessage, {
2275
- cause: t,
2276
- docsPath: n,
2277
- metaMessages: [
2278
- ...t.metaMessages ? [...t.metaMessages, " "] : [],
2279
- "Estimate Gas Arguments:",
2280
- y
2281
- ].filter(Boolean)
2282
- }), Object.defineProperty(this, "cause", {
2283
- enumerable: !0,
2284
- configurable: !0,
2285
- writable: !0,
2286
- value: void 0
2287
- }), Object.defineProperty(this, "name", {
2288
- enumerable: !0,
2289
- configurable: !0,
2290
- writable: !0,
2291
- value: "EstimateGasExecutionError"
2292
- }), this.cause = t;
2293
- }
2294
- }
2295
- function bt(e, t) {
2296
- const r = (e.details || "").toLowerCase(), n = e instanceof h ? e.walk((a) => a.code === ce.code) : e;
2297
- return n instanceof h ? new ce({
2298
- cause: e,
2299
- message: n.details
2300
- }) : ce.nodeMessage.test(r) ? new ce({
2301
- cause: e,
2302
- message: e.details
2303
- }) : Oe.nodeMessage.test(r) ? new Oe({
2304
- cause: e,
2305
- maxFeePerGas: t == null ? void 0 : t.maxFeePerGas
2306
- }) : wt.nodeMessage.test(r) ? new wt({
2307
- cause: e,
2308
- maxFeePerGas: t == null ? void 0 : t.maxFeePerGas
2309
- }) : vt.nodeMessage.test(r) ? new vt({ cause: e, nonce: t == null ? void 0 : t.nonce }) : Pt.nodeMessage.test(r) ? new Pt({ cause: e, nonce: t == null ? void 0 : t.nonce }) : xt.nodeMessage.test(r) ? new xt({ cause: e, nonce: t == null ? void 0 : t.nonce }) : Et.nodeMessage.test(r) ? new Et({ cause: e }) : At.nodeMessage.test(r) ? new At({ cause: e, gas: t == null ? void 0 : t.gas }) : $t.nodeMessage.test(r) ? new $t({ cause: e, gas: t == null ? void 0 : t.gas }) : jt.nodeMessage.test(r) ? new jt({ cause: e }) : Fe.nodeMessage.test(r) ? new Fe({
2310
- cause: e,
2311
- maxFeePerGas: t == null ? void 0 : t.maxFeePerGas,
2312
- maxPriorityFeePerGas: t == null ? void 0 : t.maxPriorityFeePerGas
2313
- }) : new ye({
2314
- cause: e
2315
- });
2316
- }
2317
- function Fa(e, { docsPath: t, ...r }) {
2318
- const n = (() => {
2319
- const a = bt(e, r);
2320
- return a instanceof ye ? e : a;
2321
- })();
2322
- return new Oa(n, {
2323
- docsPath: t,
2324
- ...r
2325
- });
2326
- }
2327
- function pt(e, { format: t }) {
2328
- if (!t)
2329
- return {};
2330
- const r = {};
2331
- function n(o) {
2332
- const s = Object.keys(o);
2333
- for (const i of s)
2334
- i in e && (r[i] = e[i]), o[i] && typeof o[i] == "object" && !Array.isArray(o[i]) && n(o[i]);
2335
- }
2336
- const a = t(e || {});
2337
- return n(a), r;
2338
- }
2339
- const Ma = {
2340
- legacy: "0x0",
2341
- eip2930: "0x1",
2342
- eip1559: "0x2",
2343
- eip4844: "0x3"
2344
- };
2345
- function yt(e) {
2346
- const t = {};
2347
- return typeof e.accessList < "u" && (t.accessList = e.accessList), typeof e.blobVersionedHashes < "u" && (t.blobVersionedHashes = e.blobVersionedHashes), typeof e.blobs < "u" && (typeof e.blobs[0] != "string" ? t.blobs = e.blobs.map((r) => V(r)) : t.blobs = e.blobs), typeof e.data < "u" && (t.data = e.data), typeof e.from < "u" && (t.from = e.from), typeof e.gas < "u" && (t.gas = P(e.gas)), typeof e.gasPrice < "u" && (t.gasPrice = P(e.gasPrice)), typeof e.maxFeePerBlobGas < "u" && (t.maxFeePerBlobGas = P(e.maxFeePerBlobGas)), typeof e.maxFeePerGas < "u" && (t.maxFeePerGas = P(e.maxFeePerGas)), typeof e.maxPriorityFeePerGas < "u" && (t.maxPriorityFeePerGas = P(e.maxPriorityFeePerGas)), typeof e.nonce < "u" && (t.nonce = P(e.nonce)), typeof e.to < "u" && (t.to = e.to), typeof e.type < "u" && (t.type = Ma[e.type]), typeof e.value < "u" && (t.value = P(e.value)), t;
2348
- }
2349
- function Rt(e) {
2350
- if (!(!e || e.length === 0))
2351
- return e.reduce((t, { slot: r, value: n }) => {
2352
- if (r.length !== 66)
2353
- throw new Ot({
2354
- size: r.length,
2355
- targetSize: 66,
2356
- type: "hex"
2357
- });
2358
- if (n.length !== 66)
2359
- throw new Ot({
2360
- size: n.length,
2361
- targetSize: 66,
2362
- type: "hex"
2363
- });
2364
- return t[r] = n, t;
2365
- }, {});
2366
- }
2367
- function Ca(e) {
2368
- const { balance: t, nonce: r, state: n, stateDiff: a, code: o } = e, s = {};
2369
- if (o !== void 0 && (s.code = o), t !== void 0 && (s.balance = P(t)), r !== void 0 && (s.nonce = P(r)), n !== void 0 && (s.state = Rt(n)), a !== void 0) {
2370
- if (s.state)
2371
- throw new ha();
2372
- s.stateDiff = Rt(a);
2373
- }
2374
- return s;
2375
- }
2376
- function fr(e) {
2377
- if (!e)
2378
- return;
2379
- const t = {};
2380
- for (const { address: r, ...n } of e) {
2381
- if (!z(r, { strict: !1 }))
2382
- throw new K({ address: r });
2383
- if (t[r])
2384
- throw new ma({ address: r });
2385
- t[r] = Ca(n);
2386
- }
2387
- return t;
2388
- }
2389
- function ve(e) {
2390
- const { account: t, gasPrice: r, maxFeePerGas: n, maxPriorityFeePerGas: a, to: o } = e, s = t ? _(t) : void 0;
2391
- if (s && !z(s.address))
2392
- throw new K({ address: s.address });
2393
- if (o && !z(o))
2394
- throw new K({ address: o });
2395
- if (typeof r < "u" && (typeof n < "u" || typeof a < "u"))
2396
- throw new Tr();
2397
- if (n && n > 2n ** 256n - 1n)
2398
- throw new Oe({ maxFeePerGas: n });
2399
- if (a && n && a > n)
2400
- throw new Fe({ maxFeePerGas: n, maxPriorityFeePerGas: a });
2401
- }
2402
- class ka extends h {
2403
- constructor() {
2404
- super("`baseFeeMultiplier` must be greater than 1."), Object.defineProperty(this, "name", {
2405
- enumerable: !0,
2406
- configurable: !0,
2407
- writable: !0,
2408
- value: "BaseFeeScalarError"
2409
- });
2410
- }
2411
- }
2412
- class mt extends h {
2413
- constructor() {
2414
- super("Chain does not support EIP-1559 fees."), Object.defineProperty(this, "name", {
2415
- enumerable: !0,
2416
- configurable: !0,
2417
- writable: !0,
2418
- value: "Eip1559FeesNotSupportedError"
2419
- });
2420
- }
2421
- }
2422
- class Sa extends h {
2423
- constructor({ maxPriorityFeePerGas: t }) {
2424
- super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${U(t)} gwei).`), Object.defineProperty(this, "name", {
2425
- enumerable: !0,
2426
- configurable: !0,
2427
- writable: !0,
2428
- value: "MaxFeePerGasTooLowError"
2429
- });
2430
- }
2431
- }
2432
- class Ta extends h {
2433
- constructor({ blockHash: t, blockNumber: r }) {
2434
- let n = "Block";
2435
- t && (n = `Block at hash "${t}"`), r && (n = `Block at number "${r}"`), super(`${n} could not be found.`), Object.defineProperty(this, "name", {
2436
- enumerable: !0,
2437
- configurable: !0,
2438
- writable: !0,
2439
- value: "BlockNotFoundError"
2440
- });
2441
- }
2442
- }
2443
- async function be(e, { blockHash: t, blockNumber: r, blockTag: n, includeTransactions: a } = {}) {
2444
- var d, l, f;
2445
- const o = n ?? "latest", s = a ?? !1, i = r !== void 0 ? P(r) : void 0;
2446
- let c = null;
2447
- if (t ? c = await e.request({
2448
- method: "eth_getBlockByHash",
2449
- params: [t, s]
2450
- }, { dedupe: !0 }) : c = await e.request({
2451
- method: "eth_getBlockByNumber",
2452
- params: [i || o, s]
2453
- }, { dedupe: !!i }), !c)
2454
- throw new Ta({ blockHash: t, blockNumber: r });
2455
- return (((f = (l = (d = e.chain) == null ? void 0 : d.formatters) == null ? void 0 : l.block) == null ? void 0 : f.format) || Br)(c);
2456
- }
2457
- async function br(e) {
2458
- const t = await e.request({
2459
- method: "eth_gasPrice"
2460
- });
2461
- return BigInt(t);
2462
- }
2463
- async function gs(e, t) {
2464
- return pr(e, t);
2465
- }
2466
- async function pr(e, t) {
2467
- var o, s, i;
2468
- const { block: r, chain: n = e.chain, request: a } = t || {};
2469
- if (typeof ((o = n == null ? void 0 : n.fees) == null ? void 0 : o.defaultPriorityFee) == "function") {
2470
- const c = r || await E(e, be, "getBlock")({});
2471
- return n.fees.defaultPriorityFee({
2472
- block: c,
2473
- client: e,
2474
- request: a
2475
- });
2476
- }
2477
- if (typeof ((s = n == null ? void 0 : n.fees) == null ? void 0 : s.defaultPriorityFee) < "u")
2478
- return (i = n == null ? void 0 : n.fees) == null ? void 0 : i.defaultPriorityFee;
2479
- try {
2480
- const c = await e.request({
2481
- method: "eth_maxPriorityFeePerGas"
2482
- });
2483
- return Ht(c);
2484
- } catch {
2485
- const [c, u] = await Promise.all([
2486
- r ? Promise.resolve(r) : E(e, be, "getBlock")({}),
2487
- E(e, br, "getGasPrice")({})
2488
- ]);
2489
- if (typeof c.baseFeePerGas != "bigint")
2490
- throw new mt();
2491
- const d = u - c.baseFeePerGas;
2492
- return d < 0n ? 0n : d;
2493
- }
2494
- }
2495
- async function ws(e, t) {
2496
- return Be(e, t);
2497
- }
2498
- async function Be(e, t) {
2499
- var f, y;
2500
- const { block: r, chain: n = e.chain, request: a, type: o = "eip1559" } = t || {}, s = await (async () => {
2501
- var b, p;
2502
- return typeof ((b = n == null ? void 0 : n.fees) == null ? void 0 : b.baseFeeMultiplier) == "function" ? n.fees.baseFeeMultiplier({
2503
- block: r,
2504
- client: e,
2505
- request: a
2506
- }) : ((p = n == null ? void 0 : n.fees) == null ? void 0 : p.baseFeeMultiplier) ?? 1.2;
2507
- })();
2508
- if (s < 1)
2509
- throw new ka();
2510
- const c = 10 ** (((f = s.toString().split(".")[1]) == null ? void 0 : f.length) ?? 0), u = (b) => b * BigInt(Math.ceil(s * c)) / BigInt(c), d = r || await E(e, be, "getBlock")({});
2511
- if (typeof ((y = n == null ? void 0 : n.fees) == null ? void 0 : y.estimateFeesPerGas) == "function") {
2512
- const b = await n.fees.estimateFeesPerGas({
2513
- block: r,
2514
- client: e,
2515
- multiply: u,
2516
- request: a,
2517
- type: o
2518
- });
2519
- if (b !== null)
2520
- return b;
2521
- }
2522
- if (o === "eip1559") {
2523
- if (typeof d.baseFeePerGas != "bigint")
2524
- throw new mt();
2525
- const b = typeof (a == null ? void 0 : a.maxPriorityFeePerGas) == "bigint" ? a.maxPriorityFeePerGas : await pr(e, {
2526
- block: d,
2527
- chain: n,
2528
- request: a
2529
- }), p = u(d.baseFeePerGas);
2530
- return {
2531
- maxFeePerGas: (a == null ? void 0 : a.maxFeePerGas) ?? p + b,
2532
- maxPriorityFeePerGas: b
2533
- };
2534
- }
2535
- return {
2536
- gasPrice: (a == null ? void 0 : a.gasPrice) ?? u(await E(e, br, "getGasPrice")({}))
2537
- };
2538
- }
2539
- async function Ba(e, { address: t, blockTag: r = "latest", blockNumber: n }) {
2540
- const a = await e.request({
2541
- method: "eth_getTransactionCount",
2542
- params: [t, n ? P(n) : r]
2543
- }, { dedupe: !!n });
2544
- return ze(a);
2545
- }
2546
- async function yr(e) {
2547
- const t = await e.request({
2548
- method: "eth_chainId"
2549
- }, { dedupe: !0 });
2550
- return ze(t);
2551
- }
2552
- const mr = [
2553
- "blobVersionedHashes",
2554
- "chainId",
2555
- "fees",
2556
- "gas",
2557
- "nonce",
2558
- "type"
2559
- ];
2560
- async function hr(e, t) {
2561
- const { account: r = e.account, blobs: n, chain: a, gas: o, kzg: s, nonce: i, parameters: c = mr, type: u } = t, d = r ? _(r) : void 0, l = { ...t, ...d ? { from: d == null ? void 0 : d.address } : {} };
2562
- let f;
2563
- async function y() {
2564
- return f || (f = await E(e, be, "getBlock")({ blockTag: "latest" }), f);
2565
- }
2566
- let b;
2567
- async function p() {
2568
- return b || (a ? a.id : typeof t.chainId < "u" ? t.chainId : (b = await E(e, yr, "getChainId")({}), b));
2569
- }
2570
- if ((c.includes("blobVersionedHashes") || c.includes("sidecars")) && n && s) {
2571
- const m = Ir({ blobs: n, kzg: s });
2572
- if (c.includes("blobVersionedHashes")) {
2573
- const v = Rr({
2574
- commitments: m,
2575
- to: "hex"
2576
- });
2577
- l.blobVersionedHashes = v;
2578
- }
2579
- if (c.includes("sidecars")) {
2580
- const v = Nr({ blobs: n, commitments: m, kzg: s }), g = zr({
2581
- blobs: n,
2582
- commitments: m,
2583
- proofs: v,
2584
- to: "hex"
2585
- });
2586
- l.sidecars = g;
2587
- }
2588
- }
2589
- if (c.includes("chainId") && (l.chainId = await p()), c.includes("nonce") && typeof i > "u" && d)
2590
- if (d.nonceManager) {
2591
- const m = await p();
2592
- l.nonce = await d.nonceManager.consume({
2593
- address: d.address,
2594
- chainId: m,
2595
- client: e
2596
- });
2597
- } else
2598
- l.nonce = await E(e, Ba, "getTransactionCount")({
2599
- address: d.address,
2600
- blockTag: "pending"
2601
- });
2602
- if ((c.includes("fees") || c.includes("type")) && typeof u > "u")
2603
- try {
2604
- l.type = Gr(l);
2605
- } catch {
2606
- const m = await y();
2607
- l.type = typeof (m == null ? void 0 : m.baseFeePerGas) == "bigint" ? "eip1559" : "legacy";
2608
- }
2609
- if (c.includes("fees"))
2610
- if (l.type !== "legacy" && l.type !== "eip2930") {
2611
- if (typeof l.maxFeePerGas > "u" || typeof l.maxPriorityFeePerGas > "u") {
2612
- const m = await y(), { maxFeePerGas: v, maxPriorityFeePerGas: g } = await Be(e, {
2613
- block: m,
2614
- chain: a,
2615
- request: l
2616
- });
2617
- if (typeof t.maxPriorityFeePerGas > "u" && t.maxFeePerGas && t.maxFeePerGas < g)
2618
- throw new Sa({
2619
- maxPriorityFeePerGas: g
2620
- });
2621
- l.maxPriorityFeePerGas = g, l.maxFeePerGas = v;
2622
- }
2623
- } else {
2624
- if (typeof t.maxFeePerGas < "u" || typeof t.maxPriorityFeePerGas < "u")
2625
- throw new mt();
2626
- const m = await y(), { gasPrice: v } = await Be(e, {
2627
- block: m,
2628
- chain: a,
2629
- request: l,
2630
- type: "legacy"
2631
- });
2632
- l.gasPrice = v;
2633
- }
2634
- return c.includes("gas") && typeof o > "u" && (l.gas = await E(e, gr, "estimateGas")({
2635
- ...l,
2636
- account: d ? { address: d.address, type: "json-rpc" } : void 0
2637
- })), ve(l), delete l.parameters, l;
2638
- }
2639
- async function gr(e, t) {
2640
- var a, o, s;
2641
- const r = t.account ?? e.account, n = r ? _(r) : void 0;
2642
- try {
2643
- const { accessList: i, blobs: c, blobVersionedHashes: u, blockNumber: d, blockTag: l, data: f, gas: y, gasPrice: b, maxFeePerBlobGas: p, maxFeePerGas: m, maxPriorityFeePerGas: v, nonce: g, to: $, value: x, stateOverride: j, ...O } = await hr(e, {
2644
- ...t,
2645
- parameters: (
2646
- // Some RPC Providers do not compute versioned hashes from blobs. We will need
2647
- // to compute them.
2648
- (n == null ? void 0 : n.type) === "local" ? void 0 : ["blobVersionedHashes"]
2649
- )
2650
- }), w = (d ? P(d) : void 0) || l, A = fr(j);
2651
- ve(t);
2652
- const L = (s = (o = (a = e.chain) == null ? void 0 : a.formatters) == null ? void 0 : o.transactionRequest) == null ? void 0 : s.format, k = (L || yt)({
2653
- // Pick out extra data that might exist on the chain's transaction request type.
2654
- ...pt(O, { format: L }),
2655
- from: n == null ? void 0 : n.address,
2656
- accessList: i,
2657
- blobs: c,
2658
- blobVersionedHashes: u,
2659
- data: f,
2660
- gas: y,
2661
- gasPrice: b,
2662
- maxFeePerBlobGas: p,
2663
- maxFeePerGas: m,
2664
- maxPriorityFeePerGas: v,
2665
- nonce: g,
2666
- to: $,
2667
- value: x
2668
- }), R = await e.request({
2669
- method: "eth_estimateGas",
2670
- params: A ? [k, w ?? "latest", A] : w ? [k, w] : [k]
2671
- });
2672
- return BigInt(R);
2673
- } catch (i) {
2674
- throw Fa(i, {
2675
- ...t,
2676
- account: n,
2677
- chain: e.chain
2678
- });
2679
- }
2680
- }
2681
- async function vs(e, t) {
2682
- const { abi: r, address: n, args: a, functionName: o, ...s } = t, i = ae({
2683
- abi: r,
2684
- args: a,
2685
- functionName: o
2686
- });
2687
- try {
2688
- return await E(e, gr, "estimateGas")({
2689
- data: i,
2690
- to: n,
2691
- ...s
2692
- });
2693
- } catch (c) {
2694
- const u = s.account ? _(s.account) : void 0;
2695
- throw ft(c, {
2696
- abi: r,
2697
- address: n,
2698
- args: a,
2699
- docsPath: "/docs/contract/estimateContractGas",
2700
- functionName: o,
2701
- sender: u == null ? void 0 : u.address
2702
- });
2703
- }
2704
- }
2705
- function Ia(e, t) {
2706
- if (!z(e, { strict: !1 }))
2707
- throw new K({ address: e });
2708
- if (!z(t, { strict: !1 }))
2709
- throw new K({ address: t });
2710
- return e.toLowerCase() === t.toLowerCase();
2711
- }
2712
- const Nt = "/docs/contract/decodeEventLog";
2713
- function wr(e) {
2714
- const { abi: t, data: r, strict: n, topics: a } = e, o = n ?? !0, [s, ...i] = a;
2715
- if (!s)
2716
- throw new Tn({ docsPath: Nt });
2717
- const c = t.find((p) => p.type === "event" && s === qe(G(p)));
2718
- if (!(c && "name" in c) || c.type !== "event")
2719
- throw new ir(s, { docsPath: Nt });
2720
- const { name: u, inputs: d } = c, l = d == null ? void 0 : d.some((p) => !("name" in p && p.name));
2721
- let f = l ? [] : {};
2722
- const y = d.filter((p) => "indexed" in p && p.indexed);
2723
- for (let p = 0; p < y.length; p++) {
2724
- const m = y[p], v = i[p];
2725
- if (!v)
2726
- throw new Le({
2727
- abiItem: c,
2728
- param: m
2729
- });
2730
- f[l ? p : m.name || p] = Ra({ param: m, value: v });
2731
- }
2732
- const b = d.filter((p) => !("indexed" in p && p.indexed));
2733
- if (b.length > 0) {
2734
- if (r && r !== "0x")
2735
- try {
2736
- const p = he(b, r);
2737
- if (p)
2738
- if (l)
2739
- f = [...f, ...p];
2740
- else
2741
- for (let m = 0; m < b.length; m++)
2742
- f[b[m].name] = p[m];
2743
- } catch (p) {
2744
- if (o)
2745
- throw p instanceof sr || p instanceof Dr ? new fe({
2746
- abiItem: c,
2747
- data: r,
2748
- params: b,
2749
- size: T(r)
2750
- }) : p;
2751
- }
2752
- else if (o)
2753
- throw new fe({
2754
- abiItem: c,
2755
- data: "0x",
2756
- params: b,
2757
- size: 0
2758
- });
2759
- }
2760
- return {
2761
- eventName: u,
2762
- args: Object.values(f).length > 0 ? f : void 0
2763
- };
2764
- }
2765
- function Ra({ param: e, value: t }) {
2766
- return e.type === "string" || e.type === "bytes" || e.type === "tuple" || e.type.match(/^(.*)\[(\d+)?\]$/) ? t : (he([e], t) || [])[0];
2767
- }
2768
- function vr(e) {
2769
- const { abi: t, args: r, logs: n, strict: a = !0 } = e, o = (() => {
2770
- if (e.eventName)
2771
- return Array.isArray(e.eventName) ? e.eventName : [e.eventName];
2772
- })();
2773
- return n.map((s) => {
2774
- var i;
2775
- try {
2776
- const c = X({
2777
- abi: t,
2778
- name: s.topics[0]
2779
- });
2780
- if (!c)
2781
- return null;
2782
- const u = wr({
2783
- ...s,
2784
- abi: [c],
2785
- strict: a
2786
- });
2787
- return o && !o.includes(u.eventName) || !Na({
2788
- args: u.args,
2789
- inputs: c.inputs,
2790
- matchArgs: r
2791
- }) ? null : { ...u, ...s };
2792
- } catch (c) {
2793
- let u, d;
2794
- if (c instanceof ir)
2795
- return null;
2796
- if (c instanceof fe || c instanceof Le) {
2797
- if (a)
2798
- return null;
2799
- u = c.abiItem.name, d = (i = c.abiItem.inputs) == null ? void 0 : i.some((l) => !("name" in l && l.name));
2800
- }
2801
- return { ...s, args: d ? [] : {}, eventName: u };
2802
- }
2803
- }).filter(Boolean);
2804
- }
2805
- function Na(e) {
2806
- const { args: t, inputs: r, matchArgs: n } = e;
2807
- if (!n)
2808
- return !0;
2809
- if (!t)
2810
- return !1;
2811
- function a(o, s, i) {
2812
- try {
2813
- return o.type === "address" ? Ia(s, i) : o.type === "string" || o.type === "bytes" ? Ie(Re(s)) === i : s === i;
2814
- } catch {
2815
- return !1;
2816
- }
2817
- }
2818
- return Array.isArray(t) && Array.isArray(n) ? n.every((o, s) => {
2819
- if (!o)
2820
- return !0;
2821
- const i = r[s];
2822
- return i ? (Array.isArray(o) ? o : [o]).some((u) => a(i, u, t[s])) : !1;
2823
- }) : typeof t == "object" && !Array.isArray(t) && typeof n == "object" && !Array.isArray(n) ? Object.entries(n).every(([o, s]) => {
2824
- if (!s)
2825
- return !0;
2826
- const i = r.find((u) => u.name === o);
2827
- return i ? (Array.isArray(s) ? s : [s]).some((u) => a(i, u, t[o])) : !1;
2828
- }) : !1;
2829
- }
2830
- async function za(e, { address: t, blockHash: r, fromBlock: n, toBlock: a, event: o, events: s, args: i, strict: c } = {}) {
2831
- const u = c ?? !1, d = s ?? (o ? [o] : void 0);
2832
- let l = [];
2833
- d && (l = [d.flatMap((p) => Je({
2834
- abi: [p],
2835
- eventName: p.name,
2836
- args: s ? void 0 : i
2837
- }))], o && (l = l[0]));
2838
- let f;
2839
- r ? f = await e.request({
2840
- method: "eth_getLogs",
2841
- params: [{ address: t, topics: l, blockHash: r }]
2842
- }) : f = await e.request({
2843
- method: "eth_getLogs",
2844
- params: [
2845
- {
2846
- address: t,
2847
- topics: l,
2848
- fromBlock: typeof n == "bigint" ? P(n) : n,
2849
- toBlock: typeof a == "bigint" ? P(a) : a
2850
- }
2851
- ]
2852
- });
2853
- const y = f.map((b) => de(b));
2854
- return d ? vr({
2855
- abi: d,
2856
- args: i,
2857
- logs: y,
2858
- strict: u
2859
- }) : y;
2860
- }
2861
- async function Ga(e, t) {
2862
- const { abi: r, address: n, args: a, blockHash: o, eventName: s, fromBlock: i, toBlock: c, strict: u } = t, d = s ? X({ abi: r, name: s }) : void 0, l = d ? void 0 : r.filter((f) => f.type === "event");
2863
- return E(e, za, "getLogs")({
2864
- address: n,
2865
- args: a,
2866
- blockHash: o,
2867
- event: d,
2868
- events: l,
2869
- fromBlock: i,
2870
- toBlock: c,
2871
- strict: u
2872
- });
2873
- }
2874
- const Ee = "/docs/contract/decodeFunctionResult";
2875
- function ht(e) {
2876
- const { abi: t, args: r, functionName: n, data: a } = e;
2877
- let o = t[0];
2878
- if (n) {
2879
- const i = X({ abi: t, args: r, name: n });
2880
- if (!i)
2881
- throw new le(n, { docsPath: Ee });
2882
- o = i;
2883
- }
2884
- if (o.type !== "function")
2885
- throw new le(void 0, { docsPath: Ee });
2886
- if (!o.outputs)
2887
- throw new Bn(o.name, { docsPath: Ee });
2888
- const s = he(o.outputs, a);
2889
- if (s && s.length > 1)
2890
- return s;
2891
- if (s && s.length === 1)
2892
- return s[0];
2893
- }
2894
- const zt = [
2895
- {
2896
- inputs: [
2897
- {
2898
- components: [
2899
- {
2900
- name: "target",
2901
- type: "address"
2902
- },
2903
- {
2904
- name: "allowFailure",
2905
- type: "bool"
2906
- },
2907
- {
2908
- name: "callData",
2909
- type: "bytes"
2910
- }
2911
- ],
2912
- name: "calls",
2913
- type: "tuple[]"
2914
- }
2915
- ],
2916
- name: "aggregate3",
2917
- outputs: [
2918
- {
2919
- components: [
2920
- {
2921
- name: "success",
2922
- type: "bool"
2923
- },
2924
- {
2925
- name: "returnData",
2926
- type: "bytes"
2927
- }
2928
- ],
2929
- name: "returnData",
2930
- type: "tuple[]"
2931
- }
2932
- ],
2933
- stateMutability: "view",
2934
- type: "function"
2935
- }
2936
- ], Pr = [
2937
- {
2938
- inputs: [],
2939
- name: "ResolverNotFound",
2940
- type: "error"
2941
- },
2942
- {
2943
- inputs: [],
2944
- name: "ResolverWildcardNotSupported",
2945
- type: "error"
2946
- },
2947
- {
2948
- inputs: [],
2949
- name: "ResolverNotContract",
2950
- type: "error"
2951
- },
2952
- {
2953
- inputs: [
2954
- {
2955
- name: "returnData",
2956
- type: "bytes"
2957
- }
2958
- ],
2959
- name: "ResolverError",
2960
- type: "error"
2961
- },
2962
- {
2963
- inputs: [
2964
- {
2965
- components: [
2966
- {
2967
- name: "status",
2968
- type: "uint16"
2969
- },
2970
- {
2971
- name: "message",
2972
- type: "string"
2973
- }
2974
- ],
2975
- name: "errors",
2976
- type: "tuple[]"
2977
- }
2978
- ],
2979
- name: "HttpError",
2980
- type: "error"
2981
- }
2982
- ], Ps = [
2983
- ...Pr,
2984
- {
2985
- name: "resolve",
2986
- type: "function",
2987
- stateMutability: "view",
2988
- inputs: [
2989
- { name: "name", type: "bytes" },
2990
- { name: "data", type: "bytes" }
2991
- ],
2992
- outputs: [
2993
- { name: "", type: "bytes" },
2994
- { name: "address", type: "address" }
2995
- ]
2996
- },
2997
- {
2998
- name: "resolve",
2999
- type: "function",
3000
- stateMutability: "view",
3001
- inputs: [
3002
- { name: "name", type: "bytes" },
3003
- { name: "data", type: "bytes" },
3004
- { name: "gateways", type: "string[]" }
3005
- ],
3006
- outputs: [
3007
- { name: "", type: "bytes" },
3008
- { name: "address", type: "address" }
3009
- ]
3010
- }
3011
- ], xs = [
3012
- ...Pr,
3013
- {
3014
- name: "reverse",
3015
- type: "function",
3016
- stateMutability: "view",
3017
- inputs: [{ type: "bytes", name: "reverseName" }],
3018
- outputs: [
3019
- { type: "string", name: "resolvedName" },
3020
- { type: "address", name: "resolvedAddress" },
3021
- { type: "address", name: "reverseResolver" },
3022
- { type: "address", name: "resolver" }
3023
- ]
3024
- },
3025
- {
3026
- name: "reverse",
3027
- type: "function",
3028
- stateMutability: "view",
3029
- inputs: [
3030
- { type: "bytes", name: "reverseName" },
3031
- { type: "string[]", name: "gateways" }
3032
- ],
3033
- outputs: [
3034
- { type: "string", name: "resolvedName" },
3035
- { type: "address", name: "resolvedAddress" },
3036
- { type: "address", name: "reverseResolver" },
3037
- { type: "address", name: "resolver" }
3038
- ]
3039
- }
3040
- ], Es = [
3041
- {
3042
- name: "text",
3043
- type: "function",
3044
- stateMutability: "view",
3045
- inputs: [
3046
- { name: "name", type: "bytes32" },
3047
- { name: "key", type: "string" }
3048
- ],
3049
- outputs: [{ name: "", type: "string" }]
3050
- }
3051
- ], As = [
3052
- {
3053
- name: "addr",
3054
- type: "function",
3055
- stateMutability: "view",
3056
- inputs: [{ name: "name", type: "bytes32" }],
3057
- outputs: [{ name: "", type: "address" }]
3058
- },
3059
- {
3060
- name: "addr",
3061
- type: "function",
3062
- stateMutability: "view",
3063
- inputs: [
3064
- { name: "name", type: "bytes32" },
3065
- { name: "coinType", type: "uint256" }
3066
- ],
3067
- outputs: [{ name: "", type: "bytes" }]
3068
- }
3069
- ], $s = [
3070
- {
3071
- inputs: [
3072
- {
3073
- name: "_signer",
3074
- type: "address"
3075
- },
3076
- {
3077
- name: "_hash",
3078
- type: "bytes32"
3079
- },
3080
- {
3081
- name: "_signature",
3082
- type: "bytes"
3083
- }
3084
- ],
3085
- stateMutability: "nonpayable",
3086
- type: "constructor"
3087
- }
3088
- ], Da = "0x82ad56cb", _a = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe", La = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe", js = "0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572", Ae = "/docs/contract/encodeDeployData";
3089
- function xr(e) {
3090
- const { abi: t, args: r, bytecode: n } = e;
3091
- if (!r || r.length === 0)
3092
- return n;
3093
- const a = t.find((s) => "type" in s && s.type === "constructor");
3094
- if (!a)
3095
- throw new Mn({ docsPath: Ae });
3096
- if (!("inputs" in a))
3097
- throw new Mt({ docsPath: Ae });
3098
- if (!a.inputs || a.inputs.length === 0)
3099
- throw new Mt({ docsPath: Ae });
3100
- const o = He(a.inputs, r);
3101
- return qt([n, o]);
3102
- }
3103
- function qa({ blockNumber: e, chain: t, contract: r }) {
3104
- var a;
3105
- const n = (a = t == null ? void 0 : t.contracts) == null ? void 0 : a[r];
3106
- if (!n)
3107
- throw new Me({
3108
- chain: t,
3109
- contract: { name: r }
3110
- });
3111
- if (e && n.blockCreated && n.blockCreated > e)
3112
- throw new Me({
3113
- blockNumber: e,
3114
- chain: t,
3115
- contract: {
3116
- name: r,
3117
- blockCreated: n.blockCreated
3118
- }
3119
- });
3120
- return n.address;
3121
- }
3122
- function Ha(e, { docsPath: t, ...r }) {
3123
- const n = (() => {
3124
- const a = bt(e, r);
3125
- return a instanceof ye ? e : a;
3126
- })();
3127
- return new wa(n, {
3128
- docsPath: t,
3129
- ...r
3130
- });
3131
- }
3132
- const $e = /* @__PURE__ */ new Map();
3133
- function Ua({ fn: e, id: t, shouldSplitBatch: r, wait: n = 0, sort: a }) {
3134
- const o = async () => {
3135
- const d = c();
3136
- s();
3137
- const l = d.map(({ args: f }) => f);
3138
- l.length !== 0 && e(l).then((f) => {
3139
- var y;
3140
- a && Array.isArray(f) && f.sort(a);
3141
- for (let b = 0; b < d.length; b++) {
3142
- const { pendingPromise: p } = d[b];
3143
- (y = p.resolve) == null || y.call(p, [f[b], f]);
3144
- }
3145
- }).catch((f) => {
3146
- var y;
3147
- for (let b = 0; b < d.length; b++) {
3148
- const { pendingPromise: p } = d[b];
3149
- (y = p.reject) == null || y.call(p, f);
3150
- }
3151
- });
3152
- }, s = () => $e.delete(t), i = () => c().map(({ args: d }) => d), c = () => $e.get(t) || [], u = (d) => $e.set(t, [...c(), d]);
3153
- return {
3154
- flush: s,
3155
- async schedule(d) {
3156
- const l = {}, f = new Promise((p, m) => {
3157
- l.resolve = p, l.reject = m;
3158
- });
3159
- return (r == null ? void 0 : r([...i(), d])) && o(), c().length > 0 ? (u({ args: d, pendingPromise: l }), f) : (u({ args: d, pendingPromise: l }), setTimeout(o, n), f);
3160
- }
3161
- };
3162
- }
3163
- async function Er(e, t) {
3164
- var B, k, R, se;
3165
- const { account: r = e.account, batch: n = !!((B = e.batch) != null && B.multicall), blockNumber: a, blockTag: o = "latest", accessList: s, blobs: i, code: c, data: u, factory: d, factoryData: l, gas: f, gasPrice: y, maxFeePerBlobGas: b, maxFeePerGas: p, maxPriorityFeePerGas: m, nonce: v, to: g, value: $, stateOverride: x, ...j } = t, O = r ? _(r) : void 0;
3166
- if (c && (d || l))
3167
- throw new h("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
3168
- if (c && g)
3169
- throw new h("Cannot provide both `code` & `to` as parameters.");
3170
- const C = c && u, w = d && l && g && u, A = C || w, L = C ? Wa({
3171
- code: c,
3172
- data: u
3173
- }) : w ? Ja({
3174
- data: u,
3175
- factory: d,
3176
- factoryData: l,
3177
- to: g
3178
- }) : u;
3179
- try {
3180
- ve(t);
3181
- const I = (a ? P(a) : void 0) || o, ee = fr(x), oe = (se = (R = (k = e.chain) == null ? void 0 : k.formatters) == null ? void 0 : R.transactionRequest) == null ? void 0 : se.format, ie = (oe || yt)({
3182
- // Pick out extra data that might exist on the chain's transaction request type.
3183
- ...pt(j, { format: oe }),
3184
- from: O == null ? void 0 : O.address,
3185
- accessList: s,
3186
- blobs: i,
3187
- data: L,
3188
- gas: f,
3189
- gasPrice: y,
3190
- maxFeePerBlobGas: b,
3191
- maxFeePerGas: p,
3192
- maxPriorityFeePerGas: m,
3193
- nonce: v,
3194
- to: A ? void 0 : g,
3195
- value: $
3196
- });
3197
- if (n && Va({ request: ie }) && !ee)
3198
- try {
3199
- return await Za(e, {
3200
- ...ie,
3201
- blockNumber: a,
3202
- blockTag: o
3203
- });
3204
- } catch (Pe) {
3205
- if (!(Pe instanceof Vt) && !(Pe instanceof Me))
3206
- throw Pe;
3207
- }
3208
- const gt = await e.request({
3209
- method: "eth_call",
3210
- params: ee ? [
3211
- ie,
3212
- I,
3213
- ee
3214
- ] : [ie, I]
3215
- });
3216
- return gt === "0x" ? { data: void 0 } : { data: gt };
3217
- } catch (Z) {
3218
- const I = Ka(Z), { offchainLookup: ee, offchainLookupSignature: oe } = await import("./ccip-D4klNwCt.js");
3219
- if (e.ccipRead !== !1 && (I == null ? void 0 : I.slice(0, 10)) === oe && g)
3220
- return { data: await ee(e, { data: I, to: g }) };
3221
- throw A && (I == null ? void 0 : I.slice(0, 10)) === "0x101bb98d" ? new Ea({ factory: d }) : Ha(Z, {
3222
- ...t,
3223
- account: O,
3224
- chain: e.chain
3225
- });
3226
- }
3227
- }
3228
- function Va({ request: e }) {
3229
- const { data: t, to: r, ...n } = e;
3230
- return !(!t || t.startsWith(Da) || !r || Object.values(n).filter((a) => typeof a < "u").length > 0);
3231
- }
3232
- async function Za(e, t) {
3233
- var p;
3234
- const { batchSize: r = 1024, wait: n = 0 } = typeof ((p = e.batch) == null ? void 0 : p.multicall) == "object" ? e.batch.multicall : {}, { blockNumber: a, blockTag: o = "latest", data: s, multicallAddress: i, to: c } = t;
3235
- let u = i;
3236
- if (!u) {
3237
- if (!e.chain)
3238
- throw new Vt();
3239
- u = qa({
3240
- blockNumber: a,
3241
- chain: e.chain,
3242
- contract: "multicall3"
3243
- });
3244
- }
3245
- const l = (a ? P(a) : void 0) || o, { schedule: f } = Ua({
3246
- id: `${e.uid}.${l}`,
3247
- wait: n,
3248
- shouldSplitBatch(m) {
3249
- return m.reduce((g, { data: $ }) => g + ($.length - 2), 0) > r * 2;
3250
- },
3251
- fn: async (m) => {
3252
- const v = m.map((x) => ({
3253
- allowFailure: !0,
3254
- callData: x.data,
3255
- target: x.to
3256
- })), g = ae({
3257
- abi: zt,
3258
- args: [v],
3259
- functionName: "aggregate3"
3260
- }), $ = await e.request({
3261
- method: "eth_call",
3262
- params: [
3263
- {
3264
- data: g,
3265
- to: u
3266
- },
3267
- l
3268
- ]
3269
- });
3270
- return ht({
3271
- abi: zt,
3272
- args: [v],
3273
- functionName: "aggregate3",
3274
- data: $ || "0x"
3275
- });
3276
- }
3277
- }), [{ returnData: y, success: b }] = await f({ data: s, to: c });
3278
- if (!b)
3279
- throw new lr({ data: y });
3280
- return y === "0x" ? { data: void 0 } : { data: y };
3281
- }
3282
- function Wa(e) {
3283
- const { code: t, data: r } = e;
3284
- return xr({
3285
- abi: ar(["constructor(bytes, bytes)"]),
3286
- bytecode: _a,
3287
- args: [t, r]
3288
- });
3289
- }
3290
- function Ja(e) {
3291
- const { data: t, factory: r, factoryData: n, to: a } = e;
3292
- return xr({
3293
- abi: ar(["constructor(address, bytes, address, bytes)"]),
3294
- bytecode: La,
3295
- args: [a, t, r, n]
3296
- });
3297
- }
3298
- function Ka(e) {
3299
- var r;
3300
- if (!(e instanceof h))
3301
- return;
3302
- const t = e.walk();
3303
- return typeof (t == null ? void 0 : t.data) == "object" ? (r = t.data) == null ? void 0 : r.data : t.data;
3304
- }
3305
- async function Os(e, t) {
3306
- const { abi: r, address: n, args: a, functionName: o, ...s } = t, i = ae({
3307
- abi: r,
3308
- args: a,
3309
- functionName: o
3310
- });
3311
- try {
3312
- const { data: c } = await E(e, Er, "call")({
3313
- ...s,
3314
- data: i,
3315
- to: n
3316
- });
3317
- return ht({
3318
- abi: r,
3319
- args: a,
3320
- functionName: o,
3321
- data: c || "0x"
3322
- });
3323
- } catch (c) {
3324
- throw ft(c, {
3325
- abi: r,
3326
- address: n,
3327
- args: a,
3328
- docsPath: "/docs/contract/readContract",
3329
- functionName: o
3330
- });
3331
- }
3332
- }
3333
- async function Fs(e, t) {
3334
- const { abi: r, address: n, args: a, dataSuffix: o, functionName: s, ...i } = t, c = i.account ? _(i.account) : e.account, u = ae({ abi: r, args: a, functionName: s });
3335
- try {
3336
- const { data: d } = await E(e, Er, "call")({
3337
- batch: !1,
3338
- data: `${u}${o ? o.replace("0x", "") : ""}`,
3339
- to: n,
3340
- ...i,
3341
- account: c
3342
- }), l = ht({
3343
- abi: r,
3344
- args: a,
3345
- functionName: s,
3346
- data: d || "0x"
3347
- }), f = r.filter((y) => "name" in y && y.name === t.functionName);
3348
- return {
3349
- result: l,
3350
- request: {
3351
- abi: f,
3352
- address: n,
3353
- args: a,
3354
- dataSuffix: o,
3355
- functionName: s,
3356
- ...i,
3357
- account: c
3358
- }
3359
- };
3360
- } catch (d) {
3361
- throw ft(d, {
3362
- abi: r,
3363
- address: n,
3364
- args: a,
3365
- docsPath: "/docs/contract/simulateContract",
3366
- functionName: s,
3367
- sender: c == null ? void 0 : c.address
3368
- });
3369
- }
3370
- }
3371
- const je = /* @__PURE__ */ new Map(), Gt = /* @__PURE__ */ new Map();
3372
- let Ya = 0;
3373
- function Dt(e, t, r) {
3374
- const n = ++Ya, a = () => je.get(e) || [], o = () => {
3375
- const d = a();
3376
- je.set(e, d.filter((l) => l.id !== n));
3377
- }, s = () => {
3378
- const d = Gt.get(e);
3379
- a().length === 1 && d && d(), o();
3380
- }, i = a();
3381
- if (je.set(e, [
3382
- ...i,
3383
- { id: n, fns: t }
3384
- ]), i && i.length > 0)
3385
- return s;
3386
- const c = {};
3387
- for (const d in t)
3388
- c[d] = (...l) => {
3389
- var y, b;
3390
- const f = a();
3391
- if (f.length !== 0)
3392
- for (const p of f)
3393
- (b = (y = p.fns)[d]) == null || b.call(y, ...l);
3394
- };
3395
- const u = r(c);
3396
- return typeof u == "function" && Gt.set(e, u), s;
3397
- }
3398
- async function _t(e) {
3399
- return new Promise((t) => setTimeout(t, e));
3400
- }
3401
- function Xa(e, { emitOnBegin: t, initialWaitTime: r, interval: n }) {
3402
- let a = !0;
3403
- const o = () => a = !1;
3404
- return (async () => {
3405
- let i;
3406
- t && (i = await e({ unpoll: o }));
3407
- const c = await (r == null ? void 0 : r(i)) ?? n;
3408
- await _t(c);
3409
- const u = async () => {
3410
- a && (await e({ unpoll: o }), await _t(n), u());
3411
- };
3412
- u();
3413
- })(), o;
3414
- }
3415
- const Qa = /* @__PURE__ */ new Map(), es = /* @__PURE__ */ new Map();
3416
- function ts(e) {
3417
- const t = (a, o) => ({
3418
- clear: () => o.delete(a),
3419
- get: () => o.get(a),
3420
- set: (s) => o.set(a, s)
3421
- }), r = t(e, Qa), n = t(e, es);
3422
- return {
3423
- clear: () => {
3424
- r.clear(), n.clear();
3425
- },
3426
- promise: r,
3427
- response: n
3428
- };
3429
- }
3430
- async function rs(e, { cacheKey: t, cacheTime: r = Number.POSITIVE_INFINITY }) {
3431
- const n = ts(t), a = n.response.get();
3432
- if (a && r > 0 && (/* @__PURE__ */ new Date()).getTime() - a.created.getTime() < r)
3433
- return a.data;
3434
- let o = n.promise.get();
3435
- o || (o = e(), n.promise.set(o));
3436
- try {
3437
- const s = await o;
3438
- return n.response.set({ created: /* @__PURE__ */ new Date(), data: s }), s;
3439
- } finally {
3440
- n.promise.clear();
3441
- }
3442
- }
3443
- const ns = (e) => `blockNumber.${e}`;
3444
- async function as(e, { cacheTime: t = e.cacheTime } = {}) {
3445
- const r = await rs(() => e.request({
3446
- method: "eth_blockNumber"
3447
- }), { cacheKey: ns(e.uid), cacheTime: t });
3448
- return BigInt(r);
3449
- }
3450
- async function ss(e, { filter: t }) {
3451
- const r = "strict" in t && t.strict, n = await t.request({
3452
- method: "eth_getFilterChanges",
3453
- params: [t.id]
3454
- });
3455
- if (typeof n[0] == "string")
3456
- return n;
3457
- const a = n.map((o) => de(o));
3458
- return !("abi" in t) || !t.abi ? a : vr({
3459
- abi: t.abi,
3460
- logs: a,
3461
- strict: r
3462
- });
3463
- }
3464
- async function os(e, { filter: t }) {
3465
- return t.request({
3466
- method: "eth_uninstallFilter",
3467
- params: [t.id]
3468
- });
3469
- }
3470
- function Ms(e, t) {
3471
- const { abi: r, address: n, args: a, batch: o = !0, eventName: s, fromBlock: i, onError: c, onLogs: u, poll: d, pollingInterval: l = e.pollingInterval, strict: f } = t;
3472
- return (typeof d < "u" ? d : typeof i == "bigint" ? !0 : !(e.transport.type === "webSocket" || e.transport.type === "fallback" && e.transport.transports[0].config.type === "webSocket")) ? (() => {
3473
- const m = f ?? !1, v = Y([
3474
- "watchContractEvent",
3475
- n,
3476
- a,
3477
- o,
3478
- e.uid,
3479
- s,
3480
- l,
3481
- m,
3482
- i
3483
- ]);
3484
- return Dt(v, { onLogs: u, onError: c }, (g) => {
3485
- let $;
3486
- i !== void 0 && ($ = i - 1n);
3487
- let x, j = !1;
3488
- const O = Xa(async () => {
3489
- var C;
3490
- if (!j) {
3491
- try {
3492
- x = await E(e, ea, "createContractEventFilter")({
3493
- abi: r,
3494
- address: n,
3495
- args: a,
3496
- eventName: s,
3497
- strict: m,
3498
- fromBlock: i
3499
- });
3500
- } catch {
3501
- }
3502
- j = !0;
3503
- return;
3504
- }
3505
- try {
3506
- let w;
3507
- if (x)
3508
- w = await E(e, ss, "getFilterChanges")({ filter: x });
3509
- else {
3510
- const A = await E(e, as, "getBlockNumber")({});
3511
- $ && $ < A ? w = await E(e, Ga, "getContractEvents")({
3512
- abi: r,
3513
- address: n,
3514
- args: a,
3515
- eventName: s,
3516
- fromBlock: $ + 1n,
3517
- toBlock: A,
3518
- strict: m
3519
- }) : w = [], $ = A;
3520
- }
3521
- if (w.length === 0)
3522
- return;
3523
- if (o)
3524
- g.onLogs(w);
3525
- else
3526
- for (const A of w)
3527
- g.onLogs([A]);
3528
- } catch (w) {
3529
- x && w instanceof we && (j = !1), (C = g.onError) == null || C.call(g, w);
3530
- }
3531
- }, {
3532
- emitOnBegin: !0,
3533
- interval: l
3534
- });
3535
- return async () => {
3536
- x && await E(e, os, "uninstallFilter")({ filter: x }), O();
3537
- };
3538
- });
3539
- })() : (() => {
3540
- const m = f ?? !1, v = Y([
3541
- "watchContractEvent",
3542
- n,
3543
- a,
3544
- o,
3545
- e.uid,
3546
- s,
3547
- l,
3548
- m
3549
- ]);
3550
- let g = !0, $ = () => g = !1;
3551
- return Dt(v, { onLogs: u, onError: c }, (x) => ((async () => {
3552
- try {
3553
- const j = (() => {
3554
- if (e.transport.type === "fallback") {
3555
- const w = e.transport.transports.find((A) => A.config.type === "webSocket");
3556
- return w ? w.value : e.transport;
3557
- }
3558
- return e.transport;
3559
- })(), O = s ? Je({
3560
- abi: r,
3561
- eventName: s,
3562
- args: a
3563
- }) : [], { unsubscribe: C } = await j.subscribe({
3564
- params: ["logs", { address: n, topics: O }],
3565
- onData(w) {
3566
- var L;
3567
- if (!g)
3568
- return;
3569
- const A = w.result;
3570
- try {
3571
- const { eventName: B, args: k } = wr({
3572
- abi: r,
3573
- data: A.data,
3574
- topics: A.topics,
3575
- strict: f
3576
- }), R = de(A, {
3577
- args: k,
3578
- eventName: B
3579
- });
3580
- x.onLogs([R]);
3581
- } catch (B) {
3582
- let k, R;
3583
- if (B instanceof fe || B instanceof Le) {
3584
- if (f)
3585
- return;
3586
- k = B.abiItem.name, R = (L = B.abiItem.inputs) == null ? void 0 : L.some((Z) => !("name" in Z && Z.name));
3587
- }
3588
- const se = de(A, {
3589
- args: R ? [] : {},
3590
- eventName: k
3591
- });
3592
- x.onLogs([se]);
3593
- }
3594
- },
3595
- onError(w) {
3596
- var A;
3597
- (A = x.onError) == null || A.call(x, w);
3598
- }
3599
- });
3600
- $ = C, g || $();
3601
- } catch (j) {
3602
- c == null || c(j);
3603
- }
3604
- })(), () => $()));
3605
- })();
3606
- }
3607
- class is extends h {
3608
- constructor({ docsPath: t } = {}) {
3609
- super([
3610
- "Could not find an Account to execute with this Action.",
3611
- "Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."
3612
- ].join(`
3613
- `), {
3614
- docsPath: t,
3615
- docsSlug: "account"
3616
- }), Object.defineProperty(this, "name", {
3617
- enumerable: !0,
3618
- configurable: !0,
3619
- writable: !0,
3620
- value: "AccountNotFoundError"
3621
- });
3622
- }
3623
- }
3624
- class Lt extends h {
3625
- constructor({ docsPath: t, metaMessages: r, type: n }) {
3626
- super(`Account type "${n}" is not supported.`, {
3627
- docsPath: t,
3628
- metaMessages: r
3629
- }), Object.defineProperty(this, "name", {
3630
- enumerable: !0,
3631
- configurable: !0,
3632
- writable: !0,
3633
- value: "AccountTypeNotSupportedError"
3634
- });
3635
- }
3636
- }
3637
- function cs({ chain: e, currentChainId: t }) {
3638
- if (!e)
3639
- throw new _r();
3640
- if (t !== e.id)
3641
- throw new Lr({ chain: e, currentChainId: t });
3642
- }
3643
- function us(e, { docsPath: t, ...r }) {
3644
- const n = (() => {
3645
- const a = bt(e, r);
3646
- return a instanceof ye ? e : a;
3647
- })();
3648
- return new qr(n, {
3649
- docsPath: t,
3650
- ...r
3651
- });
3652
- }
3653
- async function ds(e, { serializedTransaction: t }) {
3654
- return e.request({
3655
- method: "eth_sendRawTransaction",
3656
- params: [t]
3657
- }, { retryCount: 0 });
3658
- }
3659
- async function ls(e, t) {
3660
- var v, g, $, x;
3661
- const { account: r = e.account, chain: n = e.chain, accessList: a, blobs: o, data: s, gas: i, gasPrice: c, maxFeePerBlobGas: u, maxFeePerGas: d, maxPriorityFeePerGas: l, nonce: f, to: y, value: b, ...p } = t;
3662
- if (!r)
3663
- throw new is({
3664
- docsPath: "/docs/actions/wallet/sendTransaction"
3665
- });
3666
- const m = _(r);
3667
- try {
3668
- ve(t);
3669
- let j;
3670
- if (n !== null && (j = await E(e, yr, "getChainId")({}), cs({
3671
- currentChainId: j,
3672
- chain: n
3673
- })), m.type === "json-rpc") {
3674
- const O = ($ = (g = (v = e.chain) == null ? void 0 : v.formatters) == null ? void 0 : g.transactionRequest) == null ? void 0 : $.format, w = (O || yt)({
3675
- // Pick out extra data that might exist on the chain's transaction request type.
3676
- ...pt(p, { format: O }),
3677
- accessList: a,
3678
- blobs: o,
3679
- chainId: j,
3680
- data: s,
3681
- from: m.address,
3682
- gas: i,
3683
- gasPrice: c,
3684
- maxFeePerBlobGas: u,
3685
- maxFeePerGas: d,
3686
- maxPriorityFeePerGas: l,
3687
- nonce: f,
3688
- to: y,
3689
- value: b
3690
- });
3691
- return await e.request({
3692
- method: "eth_sendTransaction",
3693
- params: [w]
3694
- }, { retryCount: 0 });
3695
- }
3696
- if (m.type === "local") {
3697
- const O = await E(e, hr, "prepareTransactionRequest")({
3698
- account: m,
3699
- accessList: a,
3700
- blobs: o,
3701
- chain: n,
3702
- chainId: j,
3703
- data: s,
3704
- gas: i,
3705
- gasPrice: c,
3706
- maxFeePerBlobGas: u,
3707
- maxFeePerGas: d,
3708
- maxPriorityFeePerGas: l,
3709
- nonce: f,
3710
- parameters: [...mr, "sidecars"],
3711
- to: y,
3712
- value: b,
3713
- ...p
3714
- }), C = (x = n == null ? void 0 : n.serializers) == null ? void 0 : x.transaction, w = await m.signTransaction(O, {
3715
- serializer: C
3716
- });
3717
- return await E(e, ds, "sendRawTransaction")({
3718
- serializedTransaction: w
3719
- });
3720
- }
3721
- throw m.type === "smart" ? new Lt({
3722
- metaMessages: [
3723
- "Consider using the `sendUserOperation` Action instead."
3724
- ],
3725
- docsPath: "/docs/actions/bundler/sendUserOperation",
3726
- type: "smart"
3727
- }) : new Error("incompatible account type.");
3728
- } catch (j) {
3729
- throw j instanceof Lt ? j : us(j, {
3730
- ...t,
3731
- account: m,
3732
- chain: t.chain || void 0
3733
- });
3734
- }
3735
- }
3736
- async function Cs(e, t) {
3737
- const { abi: r, address: n, args: a, dataSuffix: o, functionName: s, ...i } = t, c = ae({
3738
- abi: r,
3739
- args: a,
3740
- functionName: s
3741
- });
3742
- return E(e, ls, "sendTransaction")({
3743
- data: `${c}${o ? o.replace("0x", "") : ""}`,
3744
- to: n,
3745
- ...i
3746
- });
3747
- }
3748
- export {
3749
- zt as $,
3750
- Ua as A,
3751
- Pa as B,
3752
- dt as C,
3753
- ra as D,
3754
- qa as E,
3755
- ae as F,
3756
- As as G,
3757
- ys as H,
3758
- we as I,
3759
- st as J,
3760
- Ps as K,
3761
- at as L,
3762
- nt as M,
3763
- ht as N,
3764
- Es as O,
3765
- ut as P,
3766
- xs as Q,
3767
- tt as R,
3768
- lt as S,
3769
- rt as T,
3770
- ot as U,
3771
- Qn as V,
3772
- Je as W,
3773
- vr as X,
3774
- ps as Y,
3775
- as as Z,
3776
- ft as _,
3777
- Ga as a,
3778
- _e as a0,
3779
- lr as a1,
3780
- xr as a2,
3781
- $s as a3,
3782
- js as a4,
3783
- wa as a5,
3784
- Dt as a6,
3785
- Xa as a7,
3786
- be as a8,
3787
- Ta as a9,
3788
- wr as aa,
3789
- fe as ab,
3790
- Le as ac,
3791
- os as ad,
3792
- ss as ae,
3793
- za as af,
3794
- gr as ag,
3795
- yr as ah,
3796
- ws as ai,
3797
- br as aj,
3798
- gs as ak,
3799
- Ba as al,
3800
- hr as am,
3801
- ds as an,
3802
- ls as ao,
3803
- is as ap,
3804
- ve as aq,
3805
- cs as ar,
3806
- yt as as,
3807
- Cs as b,
3808
- ea as c,
3809
- Y as d,
3810
- vs as e,
3811
- ya as f,
3812
- E as g,
3813
- Er as h,
3814
- Ia as i,
3815
- He as j,
3816
- _t as k,
3817
- hs as l,
3818
- ct as m,
3819
- it as n,
3820
- et as o,
3821
- _ as p,
3822
- ge as q,
3823
- Os as r,
3824
- Fs as s,
3825
- Qe as t,
3826
- Xe as u,
3827
- Ye as v,
3828
- Ms as w,
3829
- Ke as x,
3830
- ms as y,
3831
- Aa as z
3832
- };
3833
- //# sourceMappingURL=writeContract-RluxM31W.js.map