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