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