@pufferfinance/puffer-sdk 1.23.1 → 1.24.0

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 (134) 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 +3 -3
  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-FdkpGaX4.cjs +2 -0
  8. package/dist/ccip-FdkpGaX4.cjs.map +1 -0
  9. package/dist/{ccip-CiQCCFUl.js → ccip-w5ez1DCx.js} +43 -39
  10. package/dist/ccip-w5ez1DCx.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-BaHwPdbi.js → constants-BweLzNUt.js} +690 -616
  15. package/dist/constants-BweLzNUt.js.map +1 -0
  16. package/dist/constants-JN89aXws.cjs +9 -0
  17. package/dist/constants-JN89aXws.cjs.map +1 -0
  18. package/dist/contracts/addresses.cjs +1 -1
  19. package/dist/contracts/addresses.js +1 -1
  20. package/dist/contracts/handlers/carrot-staking-handler.cjs +1 -1
  21. package/dist/contracts/handlers/carrot-staking-handler.d.ts +368 -352
  22. package/dist/contracts/handlers/carrot-staking-handler.js +2 -2
  23. package/dist/contracts/handlers/concrete-vault-handler.cjs +1 -1
  24. package/dist/contracts/handlers/concrete-vault-handler.d.ts +368 -352
  25. package/dist/contracts/handlers/concrete-vault-handler.js +2 -2
  26. package/dist/contracts/handlers/distributor-handler.cjs +1 -1
  27. package/dist/contracts/handlers/distributor-handler.d.ts +368 -352
  28. package/dist/contracts/handlers/distributor-handler.js +2 -2
  29. package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
  30. package/dist/contracts/handlers/erc20-permit-handler.cjs.map +1 -1
  31. package/dist/contracts/handlers/erc20-permit-handler.d.ts +368 -352
  32. package/dist/contracts/handlers/erc20-permit-handler.js +3 -3
  33. package/dist/contracts/handlers/erc20-permit-handler.js.map +1 -1
  34. package/dist/contracts/handlers/guardian-module-handler.cjs +1 -1
  35. package/dist/contracts/handlers/guardian-module-handler.d.ts +368 -352
  36. package/dist/contracts/handlers/guardian-module-handler.js +2 -2
  37. package/dist/contracts/handlers/institutional-access-manager-handler.cjs +1 -1
  38. package/dist/contracts/handlers/institutional-access-manager-handler.d.ts +368 -352
  39. package/dist/contracts/handlers/institutional-access-manager-handler.js +3 -3
  40. package/dist/contracts/handlers/institutional-vault-handler.cjs +1 -1
  41. package/dist/contracts/handlers/institutional-vault-handler.d.ts +368 -352
  42. package/dist/contracts/handlers/institutional-vault-handler.js +2 -2
  43. package/dist/contracts/handlers/l1-reward-manager-handler.cjs +1 -1
  44. package/dist/contracts/handlers/l1-reward-manager-handler.d.ts +368 -352
  45. package/dist/contracts/handlers/l1-reward-manager-handler.js +2 -2
  46. package/dist/contracts/handlers/l2-reward-manager-handler.cjs +1 -1
  47. package/dist/contracts/handlers/l2-reward-manager-handler.d.ts +368 -352
  48. package/dist/contracts/handlers/l2-reward-manager-handler.js +2 -2
  49. package/dist/contracts/handlers/mtw-carrot-handler.cjs +1 -1
  50. package/dist/contracts/handlers/mtw-carrot-handler.d.ts +368 -352
  51. package/dist/contracts/handlers/mtw-carrot-handler.js +2 -2
  52. package/dist/contracts/handlers/nucleus-accountant-handler.cjs +1 -1
  53. package/dist/contracts/handlers/nucleus-accountant-handler.d.ts +368 -352
  54. package/dist/contracts/handlers/nucleus-accountant-handler.js +1 -1
  55. package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs +1 -1
  56. package/dist/contracts/handlers/nucleus-atomic-queue-handler.d.ts +368 -352
  57. package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +2 -2
  58. package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
  59. package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +368 -352
  60. package/dist/contracts/handlers/nucleus-boring-vault-handler.js +2 -2
  61. package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
  62. package/dist/contracts/handlers/nucleus-teller-handler.d.ts +368 -352
  63. package/dist/contracts/handlers/nucleus-teller-handler.js +2 -2
  64. package/dist/contracts/handlers/puf-locker-handler.cjs +1 -1
  65. package/dist/contracts/handlers/puf-locker-handler.d.ts +368 -352
  66. package/dist/contracts/handlers/puf-locker-handler.js +2 -2
  67. package/dist/contracts/handlers/puffer-depositor-handler.cjs +1 -1
  68. package/dist/contracts/handlers/puffer-depositor-handler.d.ts +368 -352
  69. package/dist/contracts/handlers/puffer-depositor-handler.js +2 -2
  70. package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs +1 -1
  71. package/dist/contracts/handlers/puffer-l2-depositor-handler.d.ts +368 -352
  72. package/dist/contracts/handlers/puffer-l2-depositor-handler.js +2 -2
  73. package/dist/contracts/handlers/puffer-oracle-v2-handler.cjs +1 -1
  74. package/dist/contracts/handlers/puffer-oracle-v2-handler.d.ts +368 -352
  75. package/dist/contracts/handlers/puffer-oracle-v2-handler.js +2 -2
  76. package/dist/contracts/handlers/puffer-protocol-handler.cjs +1 -1
  77. package/dist/contracts/handlers/puffer-protocol-handler.d.ts +368 -352
  78. package/dist/contracts/handlers/puffer-protocol-handler.js +2 -2
  79. package/dist/contracts/handlers/puffer-vault-handler.cjs +1 -1
  80. package/dist/contracts/handlers/puffer-vault-handler.d.ts +368 -352
  81. package/dist/contracts/handlers/puffer-vault-handler.js +2 -2
  82. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs +1 -1
  83. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.d.ts +368 -352
  84. package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js +2 -2
  85. package/dist/contracts/handlers/validator-ticket-handler.cjs +1 -1
  86. package/dist/contracts/handlers/validator-ticket-handler.d.ts +368 -352
  87. package/dist/contracts/handlers/validator-ticket-handler.js +2 -2
  88. package/dist/contracts/tokens.cjs +1 -1
  89. package/dist/contracts/tokens.js +1 -1
  90. package/dist/contracts/vaults-addresses.cjs +1 -1
  91. package/dist/contracts/vaults-addresses.js +1 -1
  92. package/dist/createWalletClient-CYva1_XM.js +3262 -0
  93. package/dist/createWalletClient-CYva1_XM.js.map +1 -0
  94. package/dist/createWalletClient-LeyDLKOH.cjs +5 -0
  95. package/dist/createWalletClient-LeyDLKOH.cjs.map +1 -0
  96. package/dist/{getContract-DGV8J5xI.js → getContract-BES7gSby.js} +2 -2
  97. package/dist/getContract-BES7gSby.js.map +1 -0
  98. package/dist/{getContract-RNLlK54b.cjs → getContract-F-fd_vf7.cjs} +2 -2
  99. package/dist/{getContract-DGV8J5xI.js.map → getContract-F-fd_vf7.cjs.map} +1 -1
  100. package/dist/localBatchGatewayRequest-CCdxn5t3.js +90 -0
  101. package/dist/localBatchGatewayRequest-CCdxn5t3.js.map +1 -0
  102. package/dist/localBatchGatewayRequest-DCWU6kQW.cjs +2 -0
  103. package/dist/localBatchGatewayRequest-DCWU6kQW.cjs.map +1 -0
  104. package/dist/main.cjs +1 -1
  105. package/dist/main.js +1 -1
  106. package/dist/secp256k1-DGP4Y7VW.js +1291 -0
  107. package/dist/secp256k1-DGP4Y7VW.js.map +1 -0
  108. package/dist/secp256k1-QOxLqUEc.cjs +2 -0
  109. package/dist/secp256k1-QOxLqUEc.cjs.map +1 -0
  110. package/dist/utils/version.cjs +1 -1
  111. package/dist/utils/version.js +1 -1
  112. package/dist/writeContract-Cqc9vxbU.cjs +36 -0
  113. package/dist/writeContract-Cqc9vxbU.cjs.map +1 -0
  114. package/dist/{writeContract-BU3yK-Xj.js → writeContract-QAArm5iD.js} +1894 -1361
  115. package/dist/writeContract-QAArm5iD.js.map +1 -0
  116. package/package.json +2 -2
  117. package/dist/ccip-CiQCCFUl.js.map +0 -1
  118. package/dist/ccip-DIWF4nDh.cjs +0 -2
  119. package/dist/ccip-DIWF4nDh.cjs.map +0 -1
  120. package/dist/constants-BaHwPdbi.js.map +0 -1
  121. package/dist/constants-c-vATmlG.cjs +0 -9
  122. package/dist/constants-c-vATmlG.cjs.map +0 -1
  123. package/dist/createWalletClient-D74YRepQ.js +0 -3290
  124. package/dist/createWalletClient-D74YRepQ.js.map +0 -1
  125. package/dist/createWalletClient-DKSH6l9_.cjs +0 -6
  126. package/dist/createWalletClient-DKSH6l9_.cjs.map +0 -1
  127. package/dist/getContract-RNLlK54b.cjs.map +0 -1
  128. package/dist/secp256k1-B-LxKJrQ.js +0 -1340
  129. package/dist/secp256k1-B-LxKJrQ.js.map +0 -1
  130. package/dist/secp256k1-CC-cv1vD.cjs +0 -2
  131. package/dist/secp256k1-CC-cv1vD.cjs.map +0 -1
  132. package/dist/writeContract-BU3yK-Xj.js.map +0 -1
  133. package/dist/writeContract-CKqv1dsa.cjs +0 -32
  134. package/dist/writeContract-CKqv1dsa.cjs.map +0 -1
@@ -0,0 +1,3262 @@
1
+ import { B as ut, C as jn, D as Hn, E as Wn, F as Gn, G as Q, J as D, K as W, L as _, M as Ne, N as Re, O as We, P as Vn, h as F, Q as Mt, R as H, S as ie, m as Jn, V as fe, H as re, W as Zn, U as ke, X as dt, Y as ft, Z as lt, _ as pt, $ as ht, a0 as mt, a1 as gt, a2 as bt, a3 as yt, a4 as wt, a5 as vt, a6 as Pe, T as Tt, a7 as At, a8 as xt, a9 as Se, aa as Be, ab as Ct, ac as Et, ad as kt, ae as It, af as Nt, ag as Kn, ah as Qn, ai as Rt, aj as Xn, ak as ce, al as Pt, am as Lt, g as C, r as U, an as ve, ao as St, ap as Yn, aq as Ge, ar as Ve, as as er, at as tr, au as Je, av as Ut, aw as nr, l as Ze, ax as rr, ay as sr, az as ar, aA as Te, aB as $e, aC as or, aD as jt, aE as Ht, aF as ir, aG as cr, aH as ur, aI as dr, aJ as fr, aK as Ke, aL as Qe, aM as ze, aN as X, aO as ee, aP as M, aQ as ae, aR as Wt, aS as lr, aT as pr, aU as Bt, aV as Gt, aW as hr, k as Vt, j as Xe, aX as mr, aY as gr, aZ as Z, a_ as br, a$ as yr, b0 as wr, b1 as vr, b2 as Ye, b3 as Jt, b4 as et, w as Tr, s as Ar, b5 as Zt, b6 as Kt, b7 as Qt, b8 as xr, b9 as Cr, ba as Er, a as kr, bb as Ae, bc as Ir, bd as Nr, e as Rr, c as Pr, be as ue, bf as Sr, bg as Br, d as $r } from "./writeContract-QAArm5iD.js";
2
+ import { n as R, c as Y, B as $, h as j, x as be, y as zr, z as Xt, A as De, L as Dr, D as ye, i as Yt, b as oe, a as Fr, F as q, s as se, t as G, G as we, I as en, J as _r, K as Fe, e as qr, M as tn, T as nn, N as Or, O as rn, P as Mr, Q as Lr, U as Ur, R as jr, S as Hr, W as sn, X as Wr, Y as Gr } from "./constants-BweLzNUt.js";
3
+ import { l as an } from "./localBatchGatewayRequest-CCdxn5t3.js";
4
+ import { secp256k1 as Vr } from "./secp256k1-DGP4Y7VW.js";
5
+ function $t(e) {
6
+ let t;
7
+ if (typeof e == "string")
8
+ t = ut(e);
9
+ else {
10
+ const n = jn(e), r = e.length;
11
+ for (let s = 0; s < r; s++) {
12
+ const a = e[s];
13
+ if (!Hn(a)) {
14
+ t = ut(a, n);
15
+ break;
16
+ }
17
+ }
18
+ }
19
+ if (!t)
20
+ throw new Wn({ signature: e });
21
+ return t;
22
+ }
23
+ function Jr(e, t) {
24
+ if (Dt(e) > t)
25
+ throw new ns({
26
+ givenSize: Dt(e),
27
+ maxSize: t
28
+ });
29
+ }
30
+ const L = {
31
+ zero: 48,
32
+ nine: 57,
33
+ A: 65,
34
+ F: 70,
35
+ a: 97,
36
+ f: 102
37
+ };
38
+ function zt(e) {
39
+ if (e >= L.zero && e <= L.nine)
40
+ return e - L.zero;
41
+ if (e >= L.A && e <= L.F)
42
+ return e - (L.A - 10);
43
+ if (e >= L.a && e <= L.f)
44
+ return e - (L.a - 10);
45
+ }
46
+ function Zr(e, t = {}) {
47
+ const { dir: n, size: r = 32 } = t;
48
+ if (r === 0)
49
+ return e;
50
+ if (e.length > r)
51
+ throw new rs({
52
+ size: e.length,
53
+ targetSize: r,
54
+ type: "Bytes"
55
+ });
56
+ const s = new Uint8Array(r);
57
+ for (let a = 0; a < r; a++) {
58
+ const o = n === "right";
59
+ s[o ? a : r - a - 1] = e[o ? a : e.length - a - 1];
60
+ }
61
+ return s;
62
+ }
63
+ const Kr = /* @__PURE__ */ new TextEncoder();
64
+ function Qr(e) {
65
+ return e instanceof Uint8Array ? e : typeof e == "string" ? Yr(e) : Xr(e);
66
+ }
67
+ function Xr(e) {
68
+ return e instanceof Uint8Array ? e : new Uint8Array(e);
69
+ }
70
+ function Yr(e, t = {}) {
71
+ const { size: n } = t;
72
+ let r = e;
73
+ n && (Gn(e, n), r = Q(e, n));
74
+ let s = r.slice(2);
75
+ s.length % 2 && (s = `0${s}`);
76
+ const a = s.length / 2, o = new Uint8Array(a);
77
+ for (let i = 0, u = 0; i < a; i++) {
78
+ const c = zt(s.charCodeAt(u++)), d = zt(s.charCodeAt(u++));
79
+ if (c === void 0 || d === void 0)
80
+ throw new D(`Invalid byte sequence ("${s[u - 2]}${s[u - 1]}" in "${s}").`);
81
+ o[i] = c * 16 + d;
82
+ }
83
+ return o;
84
+ }
85
+ function es(e, t = {}) {
86
+ const { size: n } = t, r = Kr.encode(e);
87
+ return typeof n == "number" ? (Jr(r, n), ts(r, n)) : r;
88
+ }
89
+ function ts(e, t) {
90
+ return Zr(e, { dir: "right", size: t });
91
+ }
92
+ function Dt(e) {
93
+ return e.length;
94
+ }
95
+ class ns extends D {
96
+ constructor({ givenSize: t, maxSize: n }) {
97
+ super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`), Object.defineProperty(this, "name", {
98
+ enumerable: !0,
99
+ configurable: !0,
100
+ writable: !0,
101
+ value: "Bytes.SizeOverflowError"
102
+ });
103
+ }
104
+ }
105
+ class rs extends D {
106
+ constructor({ size: t, targetSize: n, type: r }) {
107
+ super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`), Object.defineProperty(this, "name", {
108
+ enumerable: !0,
109
+ configurable: !0,
110
+ writable: !0,
111
+ value: "Bytes.SizeExceedsPaddingSizeError"
112
+ });
113
+ }
114
+ }
115
+ const on = "0x5792579257925792579257925792579257925792579257925792579257925792", cn = R(0, {
116
+ size: 32
117
+ });
118
+ async function ss(e, t) {
119
+ const { account: n = e.account, capabilities: r, chain: s = e.chain, experimental_fallback: a, experimental_fallbackDelay: o = 32, forceAtomic: i = !1, id: u, version: c = "2.0.0" } = t, d = n ? _(n) : null, l = t.calls.map((p) => {
120
+ const f = p, h = f.abi ? W({
121
+ abi: f.abi,
122
+ functionName: f.functionName,
123
+ args: f.args
124
+ }) : f.data;
125
+ return {
126
+ data: f.dataSuffix && h ? Y([h, f.dataSuffix]) : h,
127
+ to: f.to,
128
+ value: f.value ? R(f.value) : void 0
129
+ };
130
+ });
131
+ try {
132
+ const p = await e.request({
133
+ method: "wallet_sendCalls",
134
+ params: [
135
+ {
136
+ atomicRequired: i,
137
+ calls: l,
138
+ capabilities: r,
139
+ chainId: R(s.id),
140
+ from: d == null ? void 0 : d.address,
141
+ id: u,
142
+ version: c
143
+ }
144
+ ]
145
+ }, { retryCount: 0 });
146
+ return typeof p == "string" ? { id: p } : p;
147
+ } catch (p) {
148
+ const f = p;
149
+ if (a && (f.name === "MethodNotFoundRpcError" || f.name === "MethodNotSupportedRpcError" || f.name === "UnknownRpcError" || f.details.toLowerCase().includes("does not exist / is not available") || f.details.toLowerCase().includes("missing or invalid. request()") || f.details.toLowerCase().includes("did not match any variant of untagged enum") || f.details.toLowerCase().includes("account upgraded to unsupported contract") || f.details.toLowerCase().includes("eip-7702 not supported") || f.details.toLowerCase().includes("unsupported wc_ method"))) {
150
+ if (r && Object.values(r).some((b) => !b.optional)) {
151
+ const b = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";
152
+ throw new Ne(new $(b, {
153
+ details: b
154
+ }));
155
+ }
156
+ if (i && l.length > 1) {
157
+ const m = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";
158
+ throw new Re(new $(m, {
159
+ details: m
160
+ }));
161
+ }
162
+ const h = [];
163
+ for (const m of l) {
164
+ const b = We(e, {
165
+ account: d,
166
+ chain: s,
167
+ data: m.data,
168
+ to: m.to,
169
+ value: m.value ? j(m.value) : void 0
170
+ });
171
+ h.push(b), o > 0 && await new Promise((w) => setTimeout(w, o));
172
+ }
173
+ const g = await Promise.allSettled(h);
174
+ if (g.every((m) => m.status === "rejected"))
175
+ throw g[0].reason;
176
+ const y = g.map((m) => m.status === "fulfilled" ? m.value : cn);
177
+ return {
178
+ id: Y([
179
+ ...y,
180
+ R(s.id, { size: 32 }),
181
+ on
182
+ ])
183
+ };
184
+ }
185
+ throw Vn(p, {
186
+ ...t,
187
+ account: d,
188
+ chain: t.chain
189
+ });
190
+ }
191
+ }
192
+ async function un(e, t) {
193
+ async function n(d) {
194
+ if (d.endsWith(on.slice(2))) {
195
+ const p = Xt(De(d, -64, -32)), f = De(d, 0, -64).slice(2).match(/.{1,64}/g), h = await Promise.all(f.map((y) => cn.slice(2) !== y ? e.request({
196
+ method: "eth_getTransactionReceipt",
197
+ params: [`0x${y}`]
198
+ }, { dedupe: !0 }) : void 0)), g = h.some((y) => y === null) ? 100 : h.every((y) => (y == null ? void 0 : y.status) === "0x1") ? 200 : h.every((y) => (y == null ? void 0 : y.status) === "0x0") ? 500 : 600;
199
+ return {
200
+ atomic: !1,
201
+ chainId: be(p),
202
+ receipts: h.filter(Boolean),
203
+ status: g,
204
+ version: "2.0.0"
205
+ };
206
+ }
207
+ return e.request({
208
+ method: "wallet_getCallsStatus",
209
+ params: [d]
210
+ });
211
+ }
212
+ const { atomic: r = !1, chainId: s, receipts: a, version: o = "2.0.0", ...i } = await n(t.id), [u, c] = (() => {
213
+ const d = i.status;
214
+ return d >= 100 && d < 200 ? ["pending", d] : d >= 200 && d < 300 ? ["success", d] : d >= 300 && d < 700 ? ["failure", d] : d === "CONFIRMED" ? ["success", 200] : d === "PENDING" ? ["pending", 100] : [void 0, d];
215
+ })();
216
+ return {
217
+ ...i,
218
+ atomic: r,
219
+ // @ts-expect-error: for backwards compatibility
220
+ chainId: s ? be(s) : void 0,
221
+ receipts: (a == null ? void 0 : a.map((d) => ({
222
+ ...d,
223
+ blockNumber: j(d.blockNumber),
224
+ gasUsed: j(d.gasUsed),
225
+ status: zr[d.status]
226
+ }))) ?? [],
227
+ statusCode: c,
228
+ status: u,
229
+ version: o
230
+ };
231
+ }
232
+ async function as(e, t) {
233
+ const { id: n, pollingInterval: r = e.pollingInterval, status: s = ({ statusCode: p }) => p >= 200, timeout: a = 6e4 } = t, o = F(["waitForCallsStatus", e.uid, n]), { promise: i, resolve: u, reject: c } = Mt();
234
+ let d;
235
+ const l = H(o, { resolve: u, reject: c }, (p) => {
236
+ const f = ie(async () => {
237
+ const h = (g) => {
238
+ clearTimeout(d), f(), g(), l();
239
+ };
240
+ try {
241
+ const g = await un(e, { id: n });
242
+ if (!s(g))
243
+ return;
244
+ h(() => p.resolve(g));
245
+ } catch (g) {
246
+ h(() => p.reject(g));
247
+ }
248
+ }, {
249
+ interval: r,
250
+ emitOnBegin: !0
251
+ });
252
+ return f;
253
+ });
254
+ return d = a ? setTimeout(() => {
255
+ l(), clearTimeout(d), c(new os({ id: n }));
256
+ }, a) : void 0, await i;
257
+ }
258
+ class os extends $ {
259
+ constructor({ id: t }) {
260
+ super(`Timed out while waiting for call bundle with id "${t}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" });
261
+ }
262
+ }
263
+ const _e = 256;
264
+ let le = _e, pe;
265
+ function dn(e = 11) {
266
+ if (!pe || le + e > _e * 2) {
267
+ pe = "", le = 0;
268
+ for (let t = 0; t < _e; t++)
269
+ pe += (256 + Math.random() * 256 | 0).toString(16).substring(1);
270
+ }
271
+ return pe.substring(le, le++ + e);
272
+ }
273
+ function fn(e) {
274
+ const { batch: t, chain: n, ccipRead: r, key: s = "base", name: a = "Base Client", type: o = "base" } = e, i = e.experimental_blockTag ?? (typeof (n == null ? void 0 : n.experimental_preconfirmationTime) == "number" ? "pending" : void 0), u = (n == null ? void 0 : n.blockTime) ?? 12e3, c = Math.min(Math.max(Math.floor(u / 2), 500), 4e3), d = e.pollingInterval ?? c, l = e.cacheTime ?? d, p = e.account ? _(e.account) : void 0, { config: f, request: h, value: g } = e.transport({
275
+ chain: n,
276
+ pollingInterval: d
277
+ }), y = { ...f, ...g }, m = {
278
+ account: p,
279
+ batch: t,
280
+ cacheTime: l,
281
+ ccipRead: r,
282
+ chain: n,
283
+ key: s,
284
+ name: a,
285
+ pollingInterval: d,
286
+ request: h,
287
+ transport: y,
288
+ type: o,
289
+ uid: dn(),
290
+ ...i ? { experimental_blockTag: i } : {}
291
+ };
292
+ function b(w) {
293
+ return (x) => {
294
+ const T = x(w);
295
+ for (const v in m)
296
+ delete T[v];
297
+ const k = { ...w, ...T };
298
+ return Object.assign(k, { extend: b(k) });
299
+ };
300
+ }
301
+ return Object.assign(m, { extend: b(m) });
302
+ }
303
+ const he = /* @__PURE__ */ new Dr(8192);
304
+ function is(e, { enabled: t = !0, id: n }) {
305
+ if (!t || !n)
306
+ return e();
307
+ if (he.get(n))
308
+ return he.get(n);
309
+ const r = e().finally(() => he.delete(n));
310
+ return he.set(n, r), r;
311
+ }
312
+ function qe(e, { delay: t = 100, retryCount: n = 2, shouldRetry: r = () => !0 } = {}) {
313
+ return new Promise((s, a) => {
314
+ const o = async ({ count: i = 0 } = {}) => {
315
+ const u = async ({ error: c }) => {
316
+ const d = typeof t == "function" ? t({ count: i, error: c }) : t;
317
+ d && await Jn(d), o({ count: i + 1 });
318
+ };
319
+ try {
320
+ const c = await e();
321
+ s(c);
322
+ } catch (c) {
323
+ if (i < n && await r({ count: i, error: c }))
324
+ return u({ error: c });
325
+ a(c);
326
+ }
327
+ };
328
+ o();
329
+ });
330
+ }
331
+ function cs(e, t = {}) {
332
+ return async (n, r = {}) => {
333
+ var l;
334
+ const { dedupe: s = !1, methods: a, retryDelay: o = 150, retryCount: i = 3, uid: u } = {
335
+ ...t,
336
+ ...r
337
+ }, { method: c } = n;
338
+ if ((l = a == null ? void 0 : a.exclude) != null && l.includes(c))
339
+ throw new fe(new Error("method not supported"), {
340
+ method: c
341
+ });
342
+ if (a != null && a.include && !a.include.includes(c))
343
+ throw new fe(new Error("method not supported"), {
344
+ method: c
345
+ });
346
+ const d = s ? ye(`${u}.${F(n)}`) : void 0;
347
+ return is(() => qe(async () => {
348
+ try {
349
+ return await e(n);
350
+ } catch (p) {
351
+ const f = p;
352
+ switch (f.code) {
353
+ // -32700
354
+ case It.code:
355
+ throw new It(f);
356
+ // -32600
357
+ case kt.code:
358
+ throw new kt(f);
359
+ // -32601
360
+ case Et.code:
361
+ throw new Et(f, { method: n.method });
362
+ // -32602
363
+ case Ct.code:
364
+ throw new Ct(f);
365
+ // -32603
366
+ case Be.code:
367
+ throw new Be(f);
368
+ // -32000
369
+ case Se.code:
370
+ throw new Se(f);
371
+ // -32001
372
+ case xt.code:
373
+ throw new xt(f);
374
+ // -32002
375
+ case At.code:
376
+ throw new At(f);
377
+ // -32003
378
+ case Tt.code:
379
+ throw new Tt(f);
380
+ // -32004
381
+ case fe.code:
382
+ throw new fe(f, {
383
+ method: n.method
384
+ });
385
+ // -32005
386
+ case Pe.code:
387
+ throw new Pe(f);
388
+ // -32006
389
+ case vt.code:
390
+ throw new vt(f);
391
+ // 4001
392
+ case ke.code:
393
+ throw new ke(f);
394
+ // 4100
395
+ case wt.code:
396
+ throw new wt(f);
397
+ // 4200
398
+ case yt.code:
399
+ throw new yt(f);
400
+ // 4900
401
+ case bt.code:
402
+ throw new bt(f);
403
+ // 4901
404
+ case gt.code:
405
+ throw new gt(f);
406
+ // 4902
407
+ case mt.code:
408
+ throw new mt(f);
409
+ // 5700
410
+ case Ne.code:
411
+ throw new Ne(f);
412
+ // 5710
413
+ case ht.code:
414
+ throw new ht(f);
415
+ // 5720
416
+ case pt.code:
417
+ throw new pt(f);
418
+ // 5730
419
+ case lt.code:
420
+ throw new lt(f);
421
+ // 5740
422
+ case ft.code:
423
+ throw new ft(f);
424
+ // 5750
425
+ case dt.code:
426
+ throw new dt(f);
427
+ // 5760
428
+ case Re.code:
429
+ throw new Re(f);
430
+ // CAIP-25: User Rejected Error
431
+ // https://docs.walletconnect.com/2.0/specs/clients/sign/error-codes#rejected-caip-25
432
+ case 5e3:
433
+ throw new ke(f);
434
+ default:
435
+ throw p instanceof $ ? p : new Zn(f);
436
+ }
437
+ }
438
+ }, {
439
+ delay: ({ count: p, error: f }) => {
440
+ var h;
441
+ if (f && f instanceof re) {
442
+ const g = (h = f == null ? void 0 : f.headers) == null ? void 0 : h.get("Retry-After");
443
+ if (g != null && g.match(/\d/))
444
+ return Number.parseInt(g) * 1e3;
445
+ }
446
+ return ~~(1 << p) * o;
447
+ },
448
+ retryCount: i,
449
+ shouldRetry: ({ error: p }) => us(p)
450
+ }), { enabled: s, id: d });
451
+ };
452
+ }
453
+ function us(e) {
454
+ return "code" in e && typeof e.code == "number" ? e.code === -1 || e.code === Pe.code || e.code === Be.code : e instanceof re && e.status ? e.status === 403 || e.status === 408 || e.status === 413 || e.status === 429 || e.status === 500 || e.status === 502 || e.status === 503 || e.status === 504 : !0;
455
+ }
456
+ function ds({ key: e, methods: t, name: n, request: r, retryCount: s = 3, retryDelay: a = 150, timeout: o, type: i }, u) {
457
+ const c = dn();
458
+ return {
459
+ config: {
460
+ key: e,
461
+ methods: t,
462
+ name: n,
463
+ request: r,
464
+ retryCount: s,
465
+ retryDelay: a,
466
+ timeout: o,
467
+ type: i
468
+ },
469
+ request: cs(r, { methods: t, retryCount: s, retryDelay: a, uid: c }),
470
+ value: u
471
+ };
472
+ }
473
+ class fs extends $ {
474
+ constructor() {
475
+ super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.", {
476
+ docsPath: "/docs/clients/intro",
477
+ name: "UrlRequiredError"
478
+ });
479
+ }
480
+ }
481
+ function ls(e, { errorInstance: t = new Error("timed out"), timeout: n, signal: r }) {
482
+ return new Promise((s, a) => {
483
+ (async () => {
484
+ let o;
485
+ try {
486
+ const i = new AbortController();
487
+ n > 0 && (o = setTimeout(() => {
488
+ r && i.abort();
489
+ }, n)), s(await e({ signal: (i == null ? void 0 : i.signal) || null }));
490
+ } catch (i) {
491
+ (i == null ? void 0 : i.name) === "AbortError" && a(t), a(i);
492
+ } finally {
493
+ clearTimeout(o);
494
+ }
495
+ })();
496
+ });
497
+ }
498
+ function ps() {
499
+ return {
500
+ current: 0,
501
+ take() {
502
+ return this.current++;
503
+ },
504
+ reset() {
505
+ this.current = 0;
506
+ }
507
+ };
508
+ }
509
+ const Ft = /* @__PURE__ */ ps();
510
+ function hs(e, t = {}) {
511
+ return {
512
+ async request(n) {
513
+ var l;
514
+ const { body: r, onRequest: s = t.onRequest, onResponse: a = t.onResponse, timeout: o = t.timeout ?? 1e4 } = n, i = {
515
+ ...t.fetchOptions ?? {},
516
+ ...n.fetchOptions ?? {}
517
+ }, { headers: u, method: c, signal: d } = i;
518
+ try {
519
+ const p = await ls(async ({ signal: h }) => {
520
+ const g = {
521
+ ...i,
522
+ body: Array.isArray(r) ? F(r.map((w) => ({
523
+ jsonrpc: "2.0",
524
+ id: w.id ?? Ft.take(),
525
+ ...w
526
+ }))) : F({
527
+ jsonrpc: "2.0",
528
+ id: r.id ?? Ft.take(),
529
+ ...r
530
+ }),
531
+ headers: {
532
+ "Content-Type": "application/json",
533
+ ...u
534
+ },
535
+ method: c || "POST",
536
+ signal: d || (o > 0 ? h : null)
537
+ }, y = new Request(e, g), m = await (s == null ? void 0 : s(y, g)) ?? { ...g, url: e };
538
+ return await fetch(m.url ?? e, m);
539
+ }, {
540
+ errorInstance: new Nt({ body: r, url: e }),
541
+ timeout: o,
542
+ signal: !0
543
+ });
544
+ a && await a(p);
545
+ let f;
546
+ if ((l = p.headers.get("Content-Type")) != null && l.startsWith("application/json"))
547
+ f = await p.json();
548
+ else {
549
+ f = await p.text();
550
+ try {
551
+ f = JSON.parse(f || "{}");
552
+ } catch (h) {
553
+ if (p.ok)
554
+ throw h;
555
+ f = { error: f };
556
+ }
557
+ }
558
+ if (!p.ok)
559
+ throw new re({
560
+ body: r,
561
+ details: F(f.error) || p.statusText,
562
+ headers: p.headers,
563
+ status: p.status,
564
+ url: e
565
+ });
566
+ return f;
567
+ } catch (p) {
568
+ throw p instanceof re || p instanceof Nt ? p : new re({
569
+ body: r,
570
+ cause: p,
571
+ url: e
572
+ });
573
+ }
574
+ }
575
+ };
576
+ }
577
+ function go(e, t = {}) {
578
+ const { batch: n, fetchOptions: r, key: s = "http", methods: a, name: o = "HTTP JSON-RPC", onFetchRequest: i, onFetchResponse: u, retryDelay: c, raw: d } = t;
579
+ return ({ chain: l, retryCount: p, timeout: f }) => {
580
+ const { batchSize: h = 1e3, wait: g = 0 } = typeof n == "object" ? n : {}, y = t.retryCount ?? p, m = f ?? t.timeout ?? 1e4, b = e || (l == null ? void 0 : l.rpcUrls.default.http[0]);
581
+ if (!b)
582
+ throw new fs();
583
+ const w = hs(b, {
584
+ fetchOptions: r,
585
+ onRequest: i,
586
+ onResponse: u,
587
+ timeout: m
588
+ });
589
+ return ds({
590
+ key: s,
591
+ methods: a,
592
+ name: o,
593
+ async request({ method: x, params: T }) {
594
+ const k = { method: x, params: T }, { schedule: v } = Kn({
595
+ id: b,
596
+ wait: g,
597
+ shouldSplitBatch(E) {
598
+ return E.length > h;
599
+ },
600
+ fn: (E) => w.request({
601
+ body: E
602
+ }),
603
+ sort: (E, P) => E.id - P.id
604
+ }), I = async (E) => n ? v(E) : [
605
+ await w.request({
606
+ body: E
607
+ })
608
+ ], [{ error: N, result: B }] = await I(k);
609
+ if (d)
610
+ return { error: N, result: B };
611
+ if (N)
612
+ throw new Qn({
613
+ body: k,
614
+ error: N,
615
+ url: b
616
+ });
617
+ return B;
618
+ },
619
+ retryCount: y,
620
+ retryDelay: c,
621
+ timeout: m,
622
+ type: "http"
623
+ }, {
624
+ fetchOptions: r,
625
+ url: b
626
+ });
627
+ };
628
+ }
629
+ function tt(e, t) {
630
+ var r, s, a, o, i, u;
631
+ if (!(e instanceof $))
632
+ return !1;
633
+ const n = e.walk((c) => c instanceof Rt);
634
+ return n instanceof Rt ? !!(((r = n.data) == null ? void 0 : r.errorName) === "ResolverNotFound" || ((s = n.data) == null ? void 0 : s.errorName) === "ResolverWildcardNotSupported" || ((a = n.data) == null ? void 0 : a.errorName) === "ResolverNotContract" || ((o = n.data) == null ? void 0 : o.errorName) === "ResolverError" || ((i = n.data) == null ? void 0 : i.errorName) === "HttpError" || (u = n.reason) != null && u.includes("Wildcard on non-extended resolvers is not supported") || t === "reverse" && n.reason === Xn[50]) : !1;
635
+ }
636
+ function ln(e) {
637
+ if (e.length !== 66 || e.indexOf("[") !== 0 || e.indexOf("]") !== 65)
638
+ return null;
639
+ const t = `0x${e.slice(1, 65)}`;
640
+ return Yt(t) ? t : null;
641
+ }
642
+ function me(e) {
643
+ let t = new Uint8Array(32).fill(0);
644
+ if (!e)
645
+ return oe(t);
646
+ const n = e.split(".");
647
+ for (let r = n.length - 1; r >= 0; r -= 1) {
648
+ const s = ln(n[r]), a = s ? Fr(s) : q(se(n[r]), "bytes");
649
+ t = q(Y([t, a]), "bytes");
650
+ }
651
+ return oe(t);
652
+ }
653
+ function ms(e) {
654
+ return `[${e.slice(2)}]`;
655
+ }
656
+ function gs(e) {
657
+ const t = new Uint8Array(32).fill(0);
658
+ return e ? ln(e) || q(se(e)) : oe(t);
659
+ }
660
+ function xe(e) {
661
+ const t = e.replace(/^\.|\.$/gm, "");
662
+ if (t.length === 0)
663
+ return new Uint8Array(1);
664
+ const n = new Uint8Array(se(t).byteLength + 2);
665
+ let r = 0;
666
+ const s = t.split(".");
667
+ for (let a = 0; a < s.length; a++) {
668
+ let o = se(s[a]);
669
+ o.byteLength > 255 && (o = se(ms(gs(s[a])))), n[r] = o.length, n.set(o, r + 1), r += o.length + 1;
670
+ }
671
+ return n.byteLength !== r + 1 ? n.slice(0, r + 1) : n;
672
+ }
673
+ async function bs(e, t) {
674
+ const { blockNumber: n, blockTag: r, coinType: s, name: a, gatewayUrls: o, strict: i } = t, { chain: u } = e, c = (() => {
675
+ if (t.universalResolverAddress)
676
+ return t.universalResolverAddress;
677
+ if (!u)
678
+ throw new Error("client chain not configured. universalResolverAddress is required.");
679
+ return ce({
680
+ blockNumber: n,
681
+ chain: u,
682
+ contract: "ensUniversalResolver"
683
+ });
684
+ })(), d = u == null ? void 0 : u.ensTlds;
685
+ if (d && !d.some((l) => a.endsWith(l)))
686
+ return null;
687
+ try {
688
+ const l = W({
689
+ abi: Pt,
690
+ functionName: "addr",
691
+ ...s != null ? { args: [me(a), BigInt(s)] } : { args: [me(a)] }
692
+ }), p = {
693
+ address: c,
694
+ abi: Lt,
695
+ functionName: "resolve",
696
+ args: [
697
+ G(xe(a)),
698
+ l,
699
+ o ?? [an]
700
+ ],
701
+ blockNumber: n,
702
+ blockTag: r
703
+ }, h = await C(e, U, "readContract")(p);
704
+ if (h[0] === "0x")
705
+ return null;
706
+ const g = ve({
707
+ abi: Pt,
708
+ args: s != null ? [me(a), BigInt(s)] : void 0,
709
+ functionName: "addr",
710
+ data: h[0]
711
+ });
712
+ return g === "0x" || Xt(g) === "0x00" ? null : g;
713
+ } catch (l) {
714
+ if (i)
715
+ throw l;
716
+ if (tt(l, "resolve"))
717
+ return null;
718
+ throw l;
719
+ }
720
+ }
721
+ class ys extends $ {
722
+ constructor({ data: t }) {
723
+ super("Unable to extract image from metadata. The metadata may be malformed or invalid.", {
724
+ metaMessages: [
725
+ "- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.",
726
+ "",
727
+ `Provided data: ${JSON.stringify(t)}`
728
+ ],
729
+ name: "EnsAvatarInvalidMetadataError"
730
+ });
731
+ }
732
+ }
733
+ class ne extends $ {
734
+ constructor({ reason: t }) {
735
+ super(`ENS NFT avatar URI is invalid. ${t}`, {
736
+ name: "EnsAvatarInvalidNftUriError"
737
+ });
738
+ }
739
+ }
740
+ class nt extends $ {
741
+ constructor({ uri: t }) {
742
+ super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`, { name: "EnsAvatarUriResolutionError" });
743
+ }
744
+ }
745
+ class ws extends $ {
746
+ constructor({ namespace: t }) {
747
+ super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`, { name: "EnsAvatarUnsupportedNamespaceError" });
748
+ }
749
+ }
750
+ const vs = /(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/, Ts = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/, As = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/, xs = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
751
+ async function Cs(e) {
752
+ try {
753
+ const t = await fetch(e, { method: "HEAD" });
754
+ if (t.status === 200) {
755
+ const n = t.headers.get("content-type");
756
+ return n == null ? void 0 : n.startsWith("image/");
757
+ }
758
+ return !1;
759
+ } catch (t) {
760
+ return typeof t == "object" && typeof t.response < "u" || !globalThis.hasOwnProperty("Image") ? !1 : new Promise((n) => {
761
+ const r = new Image();
762
+ r.onload = () => {
763
+ n(!0);
764
+ }, r.onerror = () => {
765
+ n(!1);
766
+ }, r.src = e;
767
+ });
768
+ }
769
+ }
770
+ function _t(e, t) {
771
+ return e ? e.endsWith("/") ? e.slice(0, -1) : e : t;
772
+ }
773
+ function pn({ uri: e, gatewayUrls: t }) {
774
+ const n = As.test(e);
775
+ if (n)
776
+ return { uri: e, isOnChain: !0, isEncoded: n };
777
+ const r = _t(t == null ? void 0 : t.ipfs, "https://ipfs.io"), s = _t(t == null ? void 0 : t.arweave, "https://arweave.net"), a = e.match(vs), { protocol: o, subpath: i, target: u, subtarget: c = "" } = (a == null ? void 0 : a.groups) || {}, d = o === "ipns:/" || i === "ipns/", l = o === "ipfs:/" || i === "ipfs/" || Ts.test(e);
778
+ if (e.startsWith("http") && !d && !l) {
779
+ let f = e;
780
+ return t != null && t.arweave && (f = e.replace(/https:\/\/arweave.net/g, t == null ? void 0 : t.arweave)), { uri: f, isOnChain: !1, isEncoded: !1 };
781
+ }
782
+ if ((d || l) && u)
783
+ return {
784
+ uri: `${r}/${d ? "ipns" : "ipfs"}/${u}${c}`,
785
+ isOnChain: !1,
786
+ isEncoded: !1
787
+ };
788
+ if (o === "ar:/" && u)
789
+ return {
790
+ uri: `${s}/${u}${c || ""}`,
791
+ isOnChain: !1,
792
+ isEncoded: !1
793
+ };
794
+ let p = e.replace(xs, "");
795
+ if (p.startsWith("<svg") && (p = `data:image/svg+xml;base64,${btoa(p)}`), p.startsWith("data:") || p.startsWith("{"))
796
+ return {
797
+ uri: p,
798
+ isOnChain: !0,
799
+ isEncoded: !1
800
+ };
801
+ throw new nt({ uri: e });
802
+ }
803
+ function hn(e) {
804
+ if (typeof e != "object" || !("image" in e) && !("image_url" in e) && !("image_data" in e))
805
+ throw new ys({ data: e });
806
+ return e.image || e.image_url || e.image_data;
807
+ }
808
+ async function Es({ gatewayUrls: e, uri: t }) {
809
+ try {
810
+ const n = await fetch(t).then((s) => s.json());
811
+ return await rt({
812
+ gatewayUrls: e,
813
+ uri: hn(n)
814
+ });
815
+ } catch {
816
+ throw new nt({ uri: t });
817
+ }
818
+ }
819
+ async function rt({ gatewayUrls: e, uri: t }) {
820
+ const { uri: n, isOnChain: r } = pn({ uri: t, gatewayUrls: e });
821
+ if (r || await Cs(n))
822
+ return n;
823
+ throw new nt({ uri: t });
824
+ }
825
+ function ks(e) {
826
+ let t = e;
827
+ t.startsWith("did:nft:") && (t = t.replace("did:nft:", "").replace(/_/g, "/"));
828
+ const [n, r, s] = t.split("/"), [a, o] = n.split(":"), [i, u] = r.split(":");
829
+ if (!a || a.toLowerCase() !== "eip155")
830
+ throw new ne({ reason: "Only EIP-155 supported" });
831
+ if (!o)
832
+ throw new ne({ reason: "Chain ID not found" });
833
+ if (!u)
834
+ throw new ne({
835
+ reason: "Contract address not found"
836
+ });
837
+ if (!s)
838
+ throw new ne({ reason: "Token ID not found" });
839
+ if (!i)
840
+ throw new ne({ reason: "ERC namespace not found" });
841
+ return {
842
+ chainID: Number.parseInt(o),
843
+ namespace: i.toLowerCase(),
844
+ contractAddress: u,
845
+ tokenID: s
846
+ };
847
+ }
848
+ async function Is(e, { nft: t }) {
849
+ if (t.namespace === "erc721")
850
+ return U(e, {
851
+ address: t.contractAddress,
852
+ abi: [
853
+ {
854
+ name: "tokenURI",
855
+ type: "function",
856
+ stateMutability: "view",
857
+ inputs: [{ name: "tokenId", type: "uint256" }],
858
+ outputs: [{ name: "", type: "string" }]
859
+ }
860
+ ],
861
+ functionName: "tokenURI",
862
+ args: [BigInt(t.tokenID)]
863
+ });
864
+ if (t.namespace === "erc1155")
865
+ return U(e, {
866
+ address: t.contractAddress,
867
+ abi: [
868
+ {
869
+ name: "uri",
870
+ type: "function",
871
+ stateMutability: "view",
872
+ inputs: [{ name: "_id", type: "uint256" }],
873
+ outputs: [{ name: "", type: "string" }]
874
+ }
875
+ ],
876
+ functionName: "uri",
877
+ args: [BigInt(t.tokenID)]
878
+ });
879
+ throw new ws({ namespace: t.namespace });
880
+ }
881
+ async function Ns(e, { gatewayUrls: t, record: n }) {
882
+ return /eip155:/i.test(n) ? Rs(e, { gatewayUrls: t, record: n }) : rt({ uri: n, gatewayUrls: t });
883
+ }
884
+ async function Rs(e, { gatewayUrls: t, record: n }) {
885
+ const r = ks(n), s = await Is(e, { nft: r }), { uri: a, isOnChain: o, isEncoded: i } = pn({ uri: s, gatewayUrls: t });
886
+ if (o && (a.includes("data:application/json;base64,") || a.startsWith("{"))) {
887
+ const c = i ? (
888
+ // if it is encoded, decode it
889
+ atob(a.replace("data:application/json;base64,", ""))
890
+ ) : (
891
+ // if it isn't encoded assume it is a JSON string, but it could be anything (it will error if it is)
892
+ a
893
+ ), d = JSON.parse(c);
894
+ return rt({ uri: hn(d), gatewayUrls: t });
895
+ }
896
+ let u = r.tokenID;
897
+ return r.namespace === "erc1155" && (u = u.replace("0x", "").padStart(64, "0")), Es({
898
+ gatewayUrls: t,
899
+ uri: a.replace(/(?:0x)?{id}/, u)
900
+ });
901
+ }
902
+ async function mn(e, t) {
903
+ const { blockNumber: n, blockTag: r, key: s, name: a, gatewayUrls: o, strict: i } = t, { chain: u } = e, c = (() => {
904
+ if (t.universalResolverAddress)
905
+ return t.universalResolverAddress;
906
+ if (!u)
907
+ throw new Error("client chain not configured. universalResolverAddress is required.");
908
+ return ce({
909
+ blockNumber: n,
910
+ chain: u,
911
+ contract: "ensUniversalResolver"
912
+ });
913
+ })(), d = u == null ? void 0 : u.ensTlds;
914
+ if (d && !d.some((l) => a.endsWith(l)))
915
+ return null;
916
+ try {
917
+ const l = {
918
+ address: c,
919
+ abi: Lt,
920
+ functionName: "resolve",
921
+ args: [
922
+ G(xe(a)),
923
+ W({
924
+ abi: St,
925
+ functionName: "text",
926
+ args: [me(a), s]
927
+ }),
928
+ o ?? [an]
929
+ ],
930
+ blockNumber: n,
931
+ blockTag: r
932
+ }, f = await C(e, U, "readContract")(l);
933
+ if (f[0] === "0x")
934
+ return null;
935
+ const h = ve({
936
+ abi: St,
937
+ functionName: "text",
938
+ data: f[0]
939
+ });
940
+ return h === "" ? null : h;
941
+ } catch (l) {
942
+ if (i)
943
+ throw l;
944
+ if (tt(l, "resolve"))
945
+ return null;
946
+ throw l;
947
+ }
948
+ }
949
+ async function Ps(e, { blockNumber: t, blockTag: n, assetGatewayUrls: r, name: s, gatewayUrls: a, strict: o, universalResolverAddress: i }) {
950
+ const u = await C(e, mn, "getEnsText")({
951
+ blockNumber: t,
952
+ blockTag: n,
953
+ key: "avatar",
954
+ name: s,
955
+ universalResolverAddress: i,
956
+ gatewayUrls: a,
957
+ strict: o
958
+ });
959
+ if (!u)
960
+ return null;
961
+ try {
962
+ return await Ns(e, {
963
+ record: u,
964
+ gatewayUrls: r
965
+ });
966
+ } catch {
967
+ return null;
968
+ }
969
+ }
970
+ async function Ss(e, { address: t, blockNumber: n, blockTag: r, gatewayUrls: s, strict: a, universalResolverAddress: o }) {
971
+ let i = o;
972
+ if (!i) {
973
+ if (!e.chain)
974
+ throw new Error("client chain not configured. universalResolverAddress is required.");
975
+ i = ce({
976
+ blockNumber: n,
977
+ chain: e.chain,
978
+ contract: "ensUniversalResolver"
979
+ });
980
+ }
981
+ const u = `${t.toLowerCase().substring(2)}.addr.reverse`;
982
+ try {
983
+ const c = {
984
+ address: i,
985
+ abi: Yn,
986
+ functionName: "reverse",
987
+ args: [G(xe(u))],
988
+ blockNumber: n,
989
+ blockTag: r
990
+ }, d = C(e, U, "readContract"), [l, p] = s ? await d({
991
+ ...c,
992
+ args: [...c.args, s]
993
+ }) : await d(c);
994
+ return t.toLowerCase() !== p.toLowerCase() ? null : l;
995
+ } catch (c) {
996
+ if (a)
997
+ throw c;
998
+ if (tt(c, "reverse"))
999
+ return null;
1000
+ throw c;
1001
+ }
1002
+ }
1003
+ async function Bs(e, t) {
1004
+ const { blockNumber: n, blockTag: r, name: s } = t, { chain: a } = e, o = (() => {
1005
+ if (t.universalResolverAddress)
1006
+ return t.universalResolverAddress;
1007
+ if (!a)
1008
+ throw new Error("client chain not configured. universalResolverAddress is required.");
1009
+ return ce({
1010
+ blockNumber: n,
1011
+ chain: a,
1012
+ contract: "ensUniversalResolver"
1013
+ });
1014
+ })(), i = a == null ? void 0 : a.ensTlds;
1015
+ if (i && !i.some((c) => s.endsWith(c)))
1016
+ throw new Error(`${s} is not a valid ENS TLD (${i == null ? void 0 : i.join(", ")}) for chain "${a.name}" (id: ${a.id}).`);
1017
+ const [u] = await C(e, U, "readContract")({
1018
+ address: o,
1019
+ abi: [
1020
+ {
1021
+ inputs: [{ type: "bytes" }],
1022
+ name: "findResolver",
1023
+ outputs: [{ type: "address" }, { type: "bytes32" }],
1024
+ stateMutability: "view",
1025
+ type: "function"
1026
+ }
1027
+ ],
1028
+ functionName: "findResolver",
1029
+ args: [G(xe(s))],
1030
+ blockNumber: n,
1031
+ blockTag: r
1032
+ });
1033
+ return u;
1034
+ }
1035
+ async function gn(e, t) {
1036
+ var y, m, b;
1037
+ const { account: n = e.account, blockNumber: r, blockTag: s = "latest", blobs: a, data: o, gas: i, gasPrice: u, maxFeePerBlobGas: c, maxFeePerGas: d, maxPriorityFeePerGas: l, to: p, value: f, ...h } = t, g = n ? _(n) : void 0;
1038
+ try {
1039
+ Ge(t);
1040
+ const x = (typeof r == "bigint" ? R(r) : void 0) || s, T = (b = (m = (y = e.chain) == null ? void 0 : y.formatters) == null ? void 0 : m.transactionRequest) == null ? void 0 : b.format, v = (T || Ve)({
1041
+ // Pick out extra data that might exist on the chain's transaction request type.
1042
+ ...er(h, { format: T }),
1043
+ from: g == null ? void 0 : g.address,
1044
+ blobs: a,
1045
+ data: o,
1046
+ gas: i,
1047
+ gasPrice: u,
1048
+ maxFeePerBlobGas: c,
1049
+ maxFeePerGas: d,
1050
+ maxPriorityFeePerGas: l,
1051
+ to: p,
1052
+ value: f
1053
+ }), I = await e.request({
1054
+ method: "eth_createAccessList",
1055
+ params: [v, x]
1056
+ });
1057
+ return {
1058
+ accessList: I.accessList,
1059
+ gasUsed: BigInt(I.gasUsed)
1060
+ };
1061
+ } catch (w) {
1062
+ throw tr(w, {
1063
+ ...t,
1064
+ account: g,
1065
+ chain: e.chain
1066
+ });
1067
+ }
1068
+ }
1069
+ async function $s(e) {
1070
+ const t = Je(e, {
1071
+ method: "eth_newBlockFilter"
1072
+ }), n = await e.request({
1073
+ method: "eth_newBlockFilter"
1074
+ });
1075
+ return { id: n, request: t(n), type: "block" };
1076
+ }
1077
+ async function bn(e, { address: t, args: n, event: r, events: s, fromBlock: a, strict: o, toBlock: i } = {}) {
1078
+ const u = s ?? (r ? [r] : void 0), c = Je(e, {
1079
+ method: "eth_newFilter"
1080
+ });
1081
+ let d = [];
1082
+ u && (d = [u.flatMap((f) => Ut({
1083
+ abi: [f],
1084
+ eventName: f.name,
1085
+ args: n
1086
+ }))], r && (d = d[0]));
1087
+ const l = await e.request({
1088
+ method: "eth_newFilter",
1089
+ params: [
1090
+ {
1091
+ address: t,
1092
+ fromBlock: typeof a == "bigint" ? R(a) : a,
1093
+ toBlock: typeof i == "bigint" ? R(i) : i,
1094
+ ...d.length ? { topics: d } : {}
1095
+ }
1096
+ ]
1097
+ });
1098
+ return {
1099
+ abi: u,
1100
+ args: n,
1101
+ eventName: r ? r.name : void 0,
1102
+ fromBlock: a,
1103
+ id: l,
1104
+ request: c(l),
1105
+ strict: !!o,
1106
+ toBlock: i,
1107
+ type: "event"
1108
+ };
1109
+ }
1110
+ async function yn(e) {
1111
+ const t = Je(e, {
1112
+ method: "eth_newPendingTransactionFilter"
1113
+ }), n = await e.request({
1114
+ method: "eth_newPendingTransactionFilter"
1115
+ });
1116
+ return { id: n, request: t(n), type: "transaction" };
1117
+ }
1118
+ async function zs(e) {
1119
+ const t = await e.request({
1120
+ method: "eth_blobBaseFee"
1121
+ });
1122
+ return BigInt(t);
1123
+ }
1124
+ async function Ds(e, { blockHash: t, blockNumber: n, blockTag: r = "latest" } = {}) {
1125
+ const s = n !== void 0 ? R(n) : void 0;
1126
+ let a;
1127
+ return t ? a = await e.request({
1128
+ method: "eth_getBlockTransactionCountByHash",
1129
+ params: [t]
1130
+ }, { dedupe: !0 }) : a = await e.request({
1131
+ method: "eth_getBlockTransactionCountByNumber",
1132
+ params: [s || r]
1133
+ }, { dedupe: !!s }), be(a);
1134
+ }
1135
+ async function qt(e, { address: t, blockNumber: n, blockTag: r = "latest" }) {
1136
+ const s = n !== void 0 ? R(n) : void 0, a = await e.request({
1137
+ method: "eth_getCode",
1138
+ params: [t, s || r]
1139
+ }, { dedupe: !!s });
1140
+ if (a !== "0x")
1141
+ return a;
1142
+ }
1143
+ class Fs extends $ {
1144
+ constructor({ address: t }) {
1145
+ super(`No EIP-712 domain found on contract "${t}".`, {
1146
+ metaMessages: [
1147
+ "Ensure that:",
1148
+ `- The contract is deployed at the address "${t}".`,
1149
+ "- `eip712Domain()` function exists on the contract.",
1150
+ "- `eip712Domain()` function matches signature to ERC-5267 specification."
1151
+ ],
1152
+ name: "Eip712DomainNotFoundError"
1153
+ });
1154
+ }
1155
+ }
1156
+ async function _s(e, t) {
1157
+ const { address: n, factory: r, factoryData: s } = t;
1158
+ try {
1159
+ const [a, o, i, u, c, d, l] = await C(e, U, "readContract")({
1160
+ abi: qs,
1161
+ address: n,
1162
+ functionName: "eip712Domain",
1163
+ factory: r,
1164
+ factoryData: s
1165
+ });
1166
+ return {
1167
+ domain: {
1168
+ name: o,
1169
+ version: i,
1170
+ chainId: Number(u),
1171
+ verifyingContract: c,
1172
+ salt: d
1173
+ },
1174
+ extensions: l,
1175
+ fields: a
1176
+ };
1177
+ } catch (a) {
1178
+ const o = a;
1179
+ throw o.name === "ContractFunctionExecutionError" && o.cause.name === "ContractFunctionZeroDataError" ? new Fs({ address: n }) : o;
1180
+ }
1181
+ }
1182
+ const qs = [
1183
+ {
1184
+ inputs: [],
1185
+ name: "eip712Domain",
1186
+ outputs: [
1187
+ { name: "fields", type: "bytes1" },
1188
+ { name: "name", type: "string" },
1189
+ { name: "version", type: "string" },
1190
+ { name: "chainId", type: "uint256" },
1191
+ { name: "verifyingContract", type: "address" },
1192
+ { name: "salt", type: "bytes32" },
1193
+ { name: "extensions", type: "uint256[]" }
1194
+ ],
1195
+ stateMutability: "view",
1196
+ type: "function"
1197
+ }
1198
+ ];
1199
+ function Os(e) {
1200
+ var t;
1201
+ return {
1202
+ baseFeePerGas: e.baseFeePerGas.map((n) => BigInt(n)),
1203
+ gasUsedRatio: e.gasUsedRatio,
1204
+ oldestBlock: BigInt(e.oldestBlock),
1205
+ reward: (t = e.reward) == null ? void 0 : t.map((n) => n.map((r) => BigInt(r)))
1206
+ };
1207
+ }
1208
+ async function Ms(e, { blockCount: t, blockNumber: n, blockTag: r = "latest", rewardPercentiles: s }) {
1209
+ const a = typeof n == "bigint" ? R(n) : void 0, o = await e.request({
1210
+ method: "eth_feeHistory",
1211
+ params: [
1212
+ R(t),
1213
+ a || r,
1214
+ s
1215
+ ]
1216
+ }, { dedupe: !!a });
1217
+ return Os(o);
1218
+ }
1219
+ async function Ls(e, { filter: t }) {
1220
+ const n = t.strict ?? !1, s = (await t.request({
1221
+ method: "eth_getFilterLogs",
1222
+ params: [t.id]
1223
+ })).map((a) => we(a));
1224
+ return t.abi ? nr({
1225
+ abi: t.abi,
1226
+ logs: s,
1227
+ strict: n
1228
+ }) : s;
1229
+ }
1230
+ class Us extends $ {
1231
+ constructor({ domain: t }) {
1232
+ super(`Invalid domain "${F(t)}".`, {
1233
+ metaMessages: ["Must be a valid EIP-712 domain."]
1234
+ });
1235
+ }
1236
+ }
1237
+ class js extends $ {
1238
+ constructor({ primaryType: t, types: n }) {
1239
+ super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`, {
1240
+ docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
1241
+ metaMessages: ["Check that the primary type is a key in `types`."]
1242
+ });
1243
+ }
1244
+ }
1245
+ class Hs extends $ {
1246
+ constructor({ type: t }) {
1247
+ super(`Struct type "${t}" is invalid.`, {
1248
+ metaMessages: ["Struct type must not be a Solidity type."],
1249
+ name: "InvalidStructTypeError"
1250
+ });
1251
+ }
1252
+ }
1253
+ function Ws(e) {
1254
+ const { domain: t = {}, message: n, primaryType: r } = e, s = {
1255
+ EIP712Domain: Cn({ domain: t }),
1256
+ ...e.types
1257
+ };
1258
+ xn({
1259
+ domain: t,
1260
+ message: n,
1261
+ primaryType: r,
1262
+ types: s
1263
+ });
1264
+ const a = ["0x1901"];
1265
+ return t && a.push(Gs({
1266
+ domain: t,
1267
+ types: s
1268
+ })), r !== "EIP712Domain" && a.push(wn({
1269
+ data: n,
1270
+ primaryType: r,
1271
+ types: s
1272
+ })), q(Y(a));
1273
+ }
1274
+ function Gs({ domain: e, types: t }) {
1275
+ return wn({
1276
+ data: e,
1277
+ primaryType: "EIP712Domain",
1278
+ types: t
1279
+ });
1280
+ }
1281
+ function wn({ data: e, primaryType: t, types: n }) {
1282
+ const r = vn({
1283
+ data: e,
1284
+ primaryType: t,
1285
+ types: n
1286
+ });
1287
+ return q(r);
1288
+ }
1289
+ function vn({ data: e, primaryType: t, types: n }) {
1290
+ const r = [{ type: "bytes32" }], s = [Vs({ primaryType: t, types: n })];
1291
+ for (const a of n[t]) {
1292
+ const [o, i] = An({
1293
+ types: n,
1294
+ name: a.name,
1295
+ type: a.type,
1296
+ value: e[a.name]
1297
+ });
1298
+ r.push(o), s.push(i);
1299
+ }
1300
+ return Ze(r, s);
1301
+ }
1302
+ function Vs({ primaryType: e, types: t }) {
1303
+ const n = G(Js({ primaryType: e, types: t }));
1304
+ return q(n);
1305
+ }
1306
+ function Js({ primaryType: e, types: t }) {
1307
+ let n = "";
1308
+ const r = Tn({ primaryType: e, types: t });
1309
+ r.delete(e);
1310
+ const s = [e, ...Array.from(r).sort()];
1311
+ for (const a of s)
1312
+ n += `${a}(${t[a].map(({ name: o, type: i }) => `${i} ${o}`).join(",")})`;
1313
+ return n;
1314
+ }
1315
+ function Tn({ primaryType: e, types: t }, n = /* @__PURE__ */ new Set()) {
1316
+ const r = e.match(/^\w*/u), s = r == null ? void 0 : r[0];
1317
+ if (n.has(s) || t[s] === void 0)
1318
+ return n;
1319
+ n.add(s);
1320
+ for (const a of t[s])
1321
+ Tn({ primaryType: a.type, types: t }, n);
1322
+ return n;
1323
+ }
1324
+ function An({ types: e, name: t, type: n, value: r }) {
1325
+ if (e[n] !== void 0)
1326
+ return [
1327
+ { type: "bytes32" },
1328
+ q(vn({ data: r, primaryType: n, types: e }))
1329
+ ];
1330
+ if (n === "bytes")
1331
+ return r = `0x${(r.length % 2 ? "0" : "") + r.slice(2)}`, [{ type: "bytes32" }, q(r)];
1332
+ if (n === "string")
1333
+ return [{ type: "bytes32" }, q(G(r))];
1334
+ if (n.lastIndexOf("]") === n.length - 1) {
1335
+ const s = n.slice(0, n.lastIndexOf("[")), a = r.map((o) => An({
1336
+ name: t,
1337
+ type: s,
1338
+ types: e,
1339
+ value: o
1340
+ }));
1341
+ return [
1342
+ { type: "bytes32" },
1343
+ q(Ze(a.map(([o]) => o), a.map(([, o]) => o)))
1344
+ ];
1345
+ }
1346
+ return [{ type: n }, r];
1347
+ }
1348
+ function Zs(e) {
1349
+ const { domain: t, message: n, primaryType: r, types: s } = e, a = (u, c) => {
1350
+ const d = { ...c };
1351
+ for (const l of u) {
1352
+ const { name: p, type: f } = l;
1353
+ f === "address" && (d[p] = d[p].toLowerCase());
1354
+ }
1355
+ return d;
1356
+ }, o = s.EIP712Domain ? t ? a(s.EIP712Domain, t) : {} : {}, i = (() => {
1357
+ if (r !== "EIP712Domain")
1358
+ return a(s[r], n);
1359
+ })();
1360
+ return F({ domain: o, message: i, primaryType: r, types: s });
1361
+ }
1362
+ function xn(e) {
1363
+ const { domain: t, message: n, primaryType: r, types: s } = e, a = (o, i) => {
1364
+ for (const u of o) {
1365
+ const { name: c, type: d } = u, l = i[c], p = d.match(rr);
1366
+ if (p && (typeof l == "number" || typeof l == "bigint")) {
1367
+ const [g, y, m] = p;
1368
+ R(l, {
1369
+ signed: y === "int",
1370
+ size: Number.parseInt(m) / 8
1371
+ });
1372
+ }
1373
+ if (d === "address" && typeof l == "string" && !en(l))
1374
+ throw new _r({ address: l });
1375
+ const f = d.match(sr);
1376
+ if (f) {
1377
+ const [g, y] = f;
1378
+ if (y && Fe(l) !== Number.parseInt(y))
1379
+ throw new ar({
1380
+ expectedSize: Number.parseInt(y),
1381
+ givenSize: Fe(l)
1382
+ });
1383
+ }
1384
+ const h = s[d];
1385
+ h && (Ks(d), a(h, l));
1386
+ }
1387
+ };
1388
+ if (s.EIP712Domain && t) {
1389
+ if (typeof t != "object")
1390
+ throw new Us({ domain: t });
1391
+ a(s.EIP712Domain, t);
1392
+ }
1393
+ if (r !== "EIP712Domain")
1394
+ if (s[r])
1395
+ a(s[r], n);
1396
+ else
1397
+ throw new js({ primaryType: r, types: s });
1398
+ }
1399
+ function Cn({ domain: e }) {
1400
+ return [
1401
+ typeof (e == null ? void 0 : e.name) == "string" && { name: "name", type: "string" },
1402
+ (e == null ? void 0 : e.version) && { name: "version", type: "string" },
1403
+ (typeof (e == null ? void 0 : e.chainId) == "number" || typeof (e == null ? void 0 : e.chainId) == "bigint") && {
1404
+ name: "chainId",
1405
+ type: "uint256"
1406
+ },
1407
+ (e == null ? void 0 : e.verifyingContract) && {
1408
+ name: "verifyingContract",
1409
+ type: "address"
1410
+ },
1411
+ (e == null ? void 0 : e.salt) && { name: "salt", type: "bytes32" }
1412
+ ].filter(Boolean);
1413
+ }
1414
+ function Ks(e) {
1415
+ if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
1416
+ throw new Hs({ type: e });
1417
+ }
1418
+ const Qs = `Ethereum Signed Message:
1419
+ `;
1420
+ function Xs(e) {
1421
+ const t = typeof e == "string" ? ye(e) : typeof e.raw == "string" ? e.raw : oe(e.raw), n = ye(`${Qs}${Fe(t)}`);
1422
+ return Y([n, t]);
1423
+ }
1424
+ function En(e, t) {
1425
+ return q(Xs(e), t);
1426
+ }
1427
+ const kn = "0x6492649264926492649264926492649264926492649264926492649264926492";
1428
+ function Ys(e) {
1429
+ return De(e, -32) === kn;
1430
+ }
1431
+ function ea(e) {
1432
+ const { address: t, data: n, signature: r, to: s = "hex" } = e, a = qr([
1433
+ Ze([{ type: "address" }, { type: "bytes" }, { type: "bytes" }], [t, n, r]),
1434
+ kn
1435
+ ]);
1436
+ return s === "hex" ? a : tn(a);
1437
+ }
1438
+ function ta(e) {
1439
+ return e.map((t) => ({
1440
+ ...t,
1441
+ value: BigInt(t.value)
1442
+ }));
1443
+ }
1444
+ function na(e) {
1445
+ return {
1446
+ ...e,
1447
+ balance: e.balance ? BigInt(e.balance) : void 0,
1448
+ nonce: e.nonce ? be(e.nonce) : void 0,
1449
+ storageProof: e.storageProof ? ta(e.storageProof) : void 0
1450
+ };
1451
+ }
1452
+ async function ra(e, { address: t, blockNumber: n, blockTag: r, storageKeys: s }) {
1453
+ const a = r ?? "latest", o = n !== void 0 ? R(n) : void 0, i = await e.request({
1454
+ method: "eth_getProof",
1455
+ params: [t, s, o || a]
1456
+ });
1457
+ return na(i);
1458
+ }
1459
+ async function sa(e, { address: t, blockNumber: n, blockTag: r = "latest", slot: s }) {
1460
+ const a = n !== void 0 ? R(n) : void 0;
1461
+ return await e.request({
1462
+ method: "eth_getStorageAt",
1463
+ params: [t, s, a || r]
1464
+ });
1465
+ }
1466
+ async function st(e, { blockHash: t, blockNumber: n, blockTag: r, hash: s, index: a }) {
1467
+ var d, l, p;
1468
+ const o = r || "latest", i = n !== void 0 ? R(n) : void 0;
1469
+ let u = null;
1470
+ if (s ? u = await e.request({
1471
+ method: "eth_getTransactionByHash",
1472
+ params: [s]
1473
+ }, { dedupe: !0 }) : t ? u = await e.request({
1474
+ method: "eth_getTransactionByBlockHashAndIndex",
1475
+ params: [t, R(a)]
1476
+ }, { dedupe: !0 }) : u = await e.request({
1477
+ method: "eth_getTransactionByBlockNumberAndIndex",
1478
+ params: [i || o, R(a)]
1479
+ }, { dedupe: !!i }), !u)
1480
+ throw new nn({
1481
+ blockHash: t,
1482
+ blockNumber: n,
1483
+ blockTag: o,
1484
+ hash: s,
1485
+ index: a
1486
+ });
1487
+ return (((p = (l = (d = e.chain) == null ? void 0 : d.formatters) == null ? void 0 : l.transaction) == null ? void 0 : p.format) || Or)(u);
1488
+ }
1489
+ async function aa(e, { hash: t, transactionReceipt: n }) {
1490
+ const [r, s] = await Promise.all([
1491
+ C(e, Te, "getBlockNumber")({}),
1492
+ t ? C(e, st, "getTransaction")({ hash: t }) : void 0
1493
+ ]), a = (n == null ? void 0 : n.blockNumber) || (s == null ? void 0 : s.blockNumber);
1494
+ return a ? r - a + 1n : 0n;
1495
+ }
1496
+ async function ge(e, { hash: t }) {
1497
+ var s, a, o;
1498
+ const n = await e.request({
1499
+ method: "eth_getTransactionReceipt",
1500
+ params: [t]
1501
+ }, { dedupe: !0 });
1502
+ if (!n)
1503
+ throw new rn({ hash: t });
1504
+ return (((o = (a = (s = e.chain) == null ? void 0 : s.formatters) == null ? void 0 : a.transactionReceipt) == null ? void 0 : o.format) || Mr)(n);
1505
+ }
1506
+ async function oa(e, t) {
1507
+ var m;
1508
+ const { account: n, allowFailure: r = !0, batchSize: s, blockNumber: a, blockTag: o, multicallAddress: i, stateOverride: u } = t, c = t.contracts, d = s ?? (typeof ((m = e.batch) == null ? void 0 : m.multicall) == "object" && e.batch.multicall.batchSize || 1024);
1509
+ let l = i;
1510
+ if (!l) {
1511
+ if (!e.chain)
1512
+ throw new Error("client chain not configured. multicallAddress is required.");
1513
+ l = ce({
1514
+ blockNumber: a,
1515
+ chain: e.chain,
1516
+ contract: "multicall3"
1517
+ });
1518
+ }
1519
+ const p = [[]];
1520
+ let f = 0, h = 0;
1521
+ for (let b = 0; b < c.length; b++) {
1522
+ const { abi: w, address: x, args: T, functionName: k } = c[b];
1523
+ try {
1524
+ const v = W({ abi: w, args: T, functionName: k });
1525
+ h += (v.length - 2) / 2, // Check if batching is enabled.
1526
+ d > 0 && // Check if the current size of the batch exceeds the size limit.
1527
+ h > d && // Check if the current chunk is not already empty.
1528
+ p[f].length > 0 && (f++, h = (v.length - 2) / 2, p[f] = []), p[f] = [
1529
+ ...p[f],
1530
+ {
1531
+ allowFailure: !0,
1532
+ callData: v,
1533
+ target: x
1534
+ }
1535
+ ];
1536
+ } catch (v) {
1537
+ const I = $e(v, {
1538
+ abi: w,
1539
+ address: x,
1540
+ args: T,
1541
+ docsPath: "/docs/contract/multicall",
1542
+ functionName: k,
1543
+ sender: n
1544
+ });
1545
+ if (!r)
1546
+ throw I;
1547
+ p[f] = [
1548
+ ...p[f],
1549
+ {
1550
+ allowFailure: !0,
1551
+ callData: "0x",
1552
+ target: x
1553
+ }
1554
+ ];
1555
+ }
1556
+ }
1557
+ const g = await Promise.allSettled(p.map((b) => C(e, U, "readContract")({
1558
+ abi: or,
1559
+ account: n,
1560
+ address: l,
1561
+ args: [b],
1562
+ blockNumber: a,
1563
+ blockTag: o,
1564
+ functionName: "aggregate3",
1565
+ stateOverride: u
1566
+ }))), y = [];
1567
+ for (let b = 0; b < g.length; b++) {
1568
+ const w = g[b];
1569
+ if (w.status === "rejected") {
1570
+ if (!r)
1571
+ throw w.reason;
1572
+ for (let T = 0; T < p[b].length; T++)
1573
+ y.push({
1574
+ status: "failure",
1575
+ error: w.reason,
1576
+ result: void 0
1577
+ });
1578
+ continue;
1579
+ }
1580
+ const x = w.value;
1581
+ for (let T = 0; T < x.length; T++) {
1582
+ const { returnData: k, success: v } = x[T], { callData: I } = p[b][T], { abi: N, address: B, functionName: E, args: P } = c[y.length];
1583
+ try {
1584
+ if (I === "0x")
1585
+ throw new jt();
1586
+ if (!v)
1587
+ throw new Ht({ data: k });
1588
+ const S = ve({
1589
+ abi: N,
1590
+ args: P,
1591
+ data: k,
1592
+ functionName: E
1593
+ });
1594
+ y.push(r ? { result: S, status: "success" } : S);
1595
+ } catch (S) {
1596
+ const V = $e(S, {
1597
+ abi: N,
1598
+ address: B,
1599
+ args: P,
1600
+ docsPath: "/docs/contract/multicall",
1601
+ functionName: E
1602
+ });
1603
+ if (!r)
1604
+ throw V;
1605
+ y.push({ error: V, result: void 0, status: "failure" });
1606
+ }
1607
+ }
1608
+ }
1609
+ if (y.length !== c.length)
1610
+ throw new $("multicall results mismatch");
1611
+ return y;
1612
+ }
1613
+ async function Oe(e, t) {
1614
+ const { blockNumber: n, blockTag: r = e.experimental_blockTag ?? "latest", blocks: s, returnFullTransactions: a, traceTransfers: o, validation: i } = t;
1615
+ try {
1616
+ const u = [];
1617
+ for (const p of s) {
1618
+ const f = p.blockOverrides ? ir(p.blockOverrides) : void 0, h = p.calls.map((y) => {
1619
+ const m = y, b = m.account ? _(m.account) : void 0, w = m.abi ? W(m) : m.data, x = {
1620
+ ...m,
1621
+ data: m.dataSuffix ? Y([w || "0x", m.dataSuffix]) : w,
1622
+ from: m.from ?? (b == null ? void 0 : b.address)
1623
+ };
1624
+ return Ge(x), Ve(x);
1625
+ }), g = p.stateOverrides ? cr(p.stateOverrides) : void 0;
1626
+ u.push({
1627
+ blockOverrides: f,
1628
+ calls: h,
1629
+ stateOverrides: g
1630
+ });
1631
+ }
1632
+ const d = (typeof n == "bigint" ? R(n) : void 0) || r;
1633
+ return (await e.request({
1634
+ method: "eth_simulateV1",
1635
+ params: [
1636
+ { blockStateCalls: u, returnFullTransactions: a, traceTransfers: o, validation: i },
1637
+ d
1638
+ ]
1639
+ })).map((p, f) => ({
1640
+ ...Lr(p),
1641
+ calls: p.calls.map((h, g) => {
1642
+ var B, E;
1643
+ const { abi: y, args: m, functionName: b, to: w } = s[f].calls[g], x = ((B = h.error) == null ? void 0 : B.data) ?? h.returnData, T = BigInt(h.gasUsed), k = (E = h.logs) == null ? void 0 : E.map((P) => we(P)), v = h.status === "0x1" ? "success" : "failure", I = y && v === "success" && x !== "0x" ? ve({
1644
+ abi: y,
1645
+ data: x,
1646
+ functionName: b
1647
+ }) : null, N = (() => {
1648
+ var S;
1649
+ if (v === "success")
1650
+ return;
1651
+ let P;
1652
+ if (((S = h.error) == null ? void 0 : S.data) === "0x" ? P = new jt() : h.error && (P = new Ht(h.error)), !!P)
1653
+ return $e(P, {
1654
+ abi: y ?? [],
1655
+ address: w ?? "0x",
1656
+ args: m,
1657
+ functionName: b ?? "<unknown>"
1658
+ });
1659
+ })();
1660
+ return {
1661
+ data: x,
1662
+ gasUsed: T,
1663
+ logs: k,
1664
+ status: v,
1665
+ ...v === "success" ? {
1666
+ result: I
1667
+ } : {
1668
+ error: N
1669
+ }
1670
+ };
1671
+ })
1672
+ }));
1673
+ } catch (u) {
1674
+ const c = u, d = ur(c, {});
1675
+ throw d instanceof Ur ? c : d;
1676
+ }
1677
+ }
1678
+ function In(e, t = {}) {
1679
+ const { as: n = typeof e == "string" ? "Hex" : "Bytes" } = t, r = jr(Qr(e));
1680
+ return n === "Bytes" ? r : dr(r);
1681
+ }
1682
+ class ia extends Map {
1683
+ constructor(t) {
1684
+ super(), Object.defineProperty(this, "maxSize", {
1685
+ enumerable: !0,
1686
+ configurable: !0,
1687
+ writable: !0,
1688
+ value: void 0
1689
+ }), this.maxSize = t;
1690
+ }
1691
+ get(t) {
1692
+ const n = super.get(t);
1693
+ return super.has(t) && n !== void 0 && (this.delete(t), super.set(t, n)), n;
1694
+ }
1695
+ set(t, n) {
1696
+ if (super.set(t, n), this.maxSize && this.size > this.maxSize) {
1697
+ const r = this.keys().next().value;
1698
+ r && this.delete(r);
1699
+ }
1700
+ return this;
1701
+ }
1702
+ }
1703
+ const ca = {
1704
+ checksum: /* @__PURE__ */ new ia(8192)
1705
+ }, Ie = ca.checksum, ua = /^0x[a-fA-F0-9]{40}$/;
1706
+ function Ce(e, t = {}) {
1707
+ const { strict: n = !0 } = t;
1708
+ if (!ua.test(e))
1709
+ throw new Ot({
1710
+ address: e,
1711
+ cause: new fa()
1712
+ });
1713
+ if (n) {
1714
+ if (e.toLowerCase() === e)
1715
+ return;
1716
+ if (da(e) !== e)
1717
+ throw new Ot({
1718
+ address: e,
1719
+ cause: new la()
1720
+ });
1721
+ }
1722
+ }
1723
+ function da(e) {
1724
+ if (Ie.has(e))
1725
+ return Ie.get(e);
1726
+ Ce(e, { strict: !1 });
1727
+ const t = e.substring(2).toLowerCase(), n = In(es(t), { as: "Bytes" }), r = t.split("");
1728
+ for (let a = 0; a < 40; a += 2)
1729
+ n[a >> 1] >> 4 >= 8 && r[a] && (r[a] = r[a].toUpperCase()), (n[a >> 1] & 15) >= 8 && r[a + 1] && (r[a + 1] = r[a + 1].toUpperCase());
1730
+ const s = `0x${r.join("")}`;
1731
+ return Ie.set(e, s), s;
1732
+ }
1733
+ function Me(e, t = {}) {
1734
+ const { strict: n = !0 } = t ?? {};
1735
+ try {
1736
+ return Ce(e, { strict: n }), !0;
1737
+ } catch {
1738
+ return !1;
1739
+ }
1740
+ }
1741
+ class Ot extends D {
1742
+ constructor({ address: t, cause: n }) {
1743
+ super(`Address "${t}" is invalid.`, {
1744
+ cause: n
1745
+ }), Object.defineProperty(this, "name", {
1746
+ enumerable: !0,
1747
+ configurable: !0,
1748
+ writable: !0,
1749
+ value: "Address.InvalidAddressError"
1750
+ });
1751
+ }
1752
+ }
1753
+ class fa extends D {
1754
+ constructor() {
1755
+ super("Address is not a 20 byte (40 hexadecimal character) value."), Object.defineProperty(this, "name", {
1756
+ enumerable: !0,
1757
+ configurable: !0,
1758
+ writable: !0,
1759
+ value: "Address.InvalidInputError"
1760
+ });
1761
+ }
1762
+ }
1763
+ class la extends D {
1764
+ constructor() {
1765
+ super("Address does not match its checksum counterpart."), Object.defineProperty(this, "name", {
1766
+ enumerable: !0,
1767
+ configurable: !0,
1768
+ writable: !0,
1769
+ value: "Address.InvalidChecksumError"
1770
+ });
1771
+ }
1772
+ }
1773
+ function Le(e) {
1774
+ let t = !0, n = "", r = 0, s = "", a = !1;
1775
+ for (let o = 0; o < e.length; o++) {
1776
+ const i = e[o];
1777
+ if (["(", ")", ","].includes(i) && (t = !0), i === "(" && r++, i === ")" && r--, !!t) {
1778
+ if (r === 0) {
1779
+ if (i === " " && ["event", "function", "error", ""].includes(s))
1780
+ s = "";
1781
+ else if (s += i, i === ")") {
1782
+ a = !0;
1783
+ break;
1784
+ }
1785
+ continue;
1786
+ }
1787
+ if (i === " ") {
1788
+ e[o - 1] !== "," && n !== "," && n !== ",(" && (n = "", t = !1);
1789
+ continue;
1790
+ }
1791
+ s += i, n += i;
1792
+ }
1793
+ }
1794
+ if (!a)
1795
+ throw new D("Unable to normalize signature.");
1796
+ return s;
1797
+ }
1798
+ function Ue(e, t) {
1799
+ const n = typeof e, r = t.type;
1800
+ switch (r) {
1801
+ case "address":
1802
+ return Me(e, { strict: !1 });
1803
+ case "bool":
1804
+ return n === "boolean";
1805
+ case "function":
1806
+ return n === "string";
1807
+ case "string":
1808
+ return n === "string";
1809
+ default:
1810
+ return r === "tuple" && "components" in t ? Object.values(t.components).every((s, a) => Ue(Object.values(e)[a], s)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r) ? n === "number" || n === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r) ? n === "string" || e instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r) ? Array.isArray(e) && e.every((s) => Ue(s, {
1811
+ ...t,
1812
+ // Pop off `[]` or `[M]` from end of type
1813
+ type: r.replace(/(\[[0-9]{0,}\])$/, "")
1814
+ })) : !1;
1815
+ }
1816
+ }
1817
+ function Nn(e, t, n) {
1818
+ for (const r in e) {
1819
+ const s = e[r], a = t[r];
1820
+ if (s.type === "tuple" && a.type === "tuple" && "components" in s && "components" in a)
1821
+ return Nn(s.components, a.components, n[r]);
1822
+ const o = [s.type, a.type];
1823
+ if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? Me(n[r], {
1824
+ strict: !1
1825
+ }) : o.includes("address") && o.includes("bytes") ? Me(n[r], {
1826
+ strict: !1
1827
+ }) : !1)
1828
+ return o;
1829
+ }
1830
+ }
1831
+ function Rn(e, t = {}) {
1832
+ const { prepare: n = !0 } = t, r = Array.isArray(e) || typeof e == "string" ? $t(e) : e;
1833
+ return {
1834
+ ...r,
1835
+ ...n ? { hash: K(r) } : {}
1836
+ };
1837
+ }
1838
+ function pa(e, t, n) {
1839
+ const { args: r = [], prepare: s = !0 } = n ?? {}, a = fr(t, { strict: !1 }), o = e.filter((c) => a ? c.type === "function" || c.type === "error" ? Pn(c) === Ke(t, 0, 4) : c.type === "event" ? K(c) === t : !1 : "name" in c && c.name === t);
1840
+ if (o.length === 0)
1841
+ throw new je({ name: t });
1842
+ if (o.length === 1)
1843
+ return {
1844
+ ...o[0],
1845
+ ...s ? { hash: K(o[0]) } : {}
1846
+ };
1847
+ let i;
1848
+ for (const c of o) {
1849
+ if (!("inputs" in c))
1850
+ continue;
1851
+ if (!r || r.length === 0) {
1852
+ if (!c.inputs || c.inputs.length === 0)
1853
+ return {
1854
+ ...c,
1855
+ ...s ? { hash: K(c) } : {}
1856
+ };
1857
+ continue;
1858
+ }
1859
+ if (!c.inputs || c.inputs.length === 0 || c.inputs.length !== r.length)
1860
+ continue;
1861
+ if (r.every((l, p) => {
1862
+ const f = "inputs" in c && c.inputs[p];
1863
+ return f ? Ue(l, f) : !1;
1864
+ })) {
1865
+ if (i && "inputs" in i && i.inputs) {
1866
+ const l = Nn(c.inputs, i.inputs, r);
1867
+ if (l)
1868
+ throw new ma({
1869
+ abiItem: c,
1870
+ type: l[0]
1871
+ }, {
1872
+ abiItem: i,
1873
+ type: l[1]
1874
+ });
1875
+ }
1876
+ i = c;
1877
+ }
1878
+ }
1879
+ const u = (() => {
1880
+ if (i)
1881
+ return i;
1882
+ const [c, ...d] = o;
1883
+ return { ...c, overloads: d };
1884
+ })();
1885
+ if (!u)
1886
+ throw new je({ name: t });
1887
+ return {
1888
+ ...u,
1889
+ ...s ? { hash: K(u) } : {}
1890
+ };
1891
+ }
1892
+ function Pn(e) {
1893
+ return Ke(K(e), 0, 4);
1894
+ }
1895
+ function ha(e) {
1896
+ const t = typeof e == "string" ? e : ze(e);
1897
+ return Le(t);
1898
+ }
1899
+ function K(e) {
1900
+ return typeof e != "string" && "hash" in e && e.hash ? e.hash : In(Qe(ha(e)));
1901
+ }
1902
+ class ma extends D {
1903
+ constructor(t, n) {
1904
+ super("Found ambiguous types in overloaded ABI Items.", {
1905
+ metaMessages: [
1906
+ // TODO: abitype to add support for signature-formatted ABI items.
1907
+ `\`${t.type}\` in \`${Le(ze(t.abiItem))}\`, and`,
1908
+ `\`${n.type}\` in \`${Le(ze(n.abiItem))}\``,
1909
+ "",
1910
+ "These types encode differently and cannot be distinguished at runtime.",
1911
+ "Remove one of the ambiguous items in the ABI."
1912
+ ]
1913
+ }), Object.defineProperty(this, "name", {
1914
+ enumerable: !0,
1915
+ configurable: !0,
1916
+ writable: !0,
1917
+ value: "AbiItem.AmbiguityError"
1918
+ });
1919
+ }
1920
+ }
1921
+ class je extends D {
1922
+ constructor({ name: t, data: n, type: r = "item" }) {
1923
+ const s = t ? ` with name "${t}"` : n ? ` with data "${n}"` : "";
1924
+ super(`ABI ${r}${s} not found.`), Object.defineProperty(this, "name", {
1925
+ enumerable: !0,
1926
+ configurable: !0,
1927
+ writable: !0,
1928
+ value: "AbiItem.NotFoundError"
1929
+ });
1930
+ }
1931
+ }
1932
+ const ga = /^(.*)\[([0-9]*)\]$/, ba = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, Sn = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
1933
+ function ya({ checksumAddress: e, parameters: t, values: n }) {
1934
+ const r = [];
1935
+ for (let s = 0; s < t.length; s++)
1936
+ r.push(at({
1937
+ checksumAddress: e,
1938
+ parameter: t[s],
1939
+ value: n[s]
1940
+ }));
1941
+ return r;
1942
+ }
1943
+ function at({ checksumAddress: e = !1, parameter: t, value: n }) {
1944
+ const r = t, s = ka(r.type);
1945
+ if (s) {
1946
+ const [a, o] = s;
1947
+ return va(n, {
1948
+ checksumAddress: e,
1949
+ length: a,
1950
+ parameter: {
1951
+ ...r,
1952
+ type: o
1953
+ }
1954
+ });
1955
+ }
1956
+ if (r.type === "tuple")
1957
+ return Ea(n, {
1958
+ checksumAddress: e,
1959
+ parameter: r
1960
+ });
1961
+ if (r.type === "address")
1962
+ return wa(n, {
1963
+ checksum: e
1964
+ });
1965
+ if (r.type === "bool")
1966
+ return Aa(n);
1967
+ if (r.type.startsWith("uint") || r.type.startsWith("int")) {
1968
+ const a = r.type.startsWith("int"), [, , o = "256"] = Sn.exec(r.type) ?? [];
1969
+ return xa(n, {
1970
+ signed: a,
1971
+ size: Number(o)
1972
+ });
1973
+ }
1974
+ if (r.type.startsWith("bytes"))
1975
+ return Ta(n, { type: r.type });
1976
+ if (r.type === "string")
1977
+ return Ca(n);
1978
+ throw new Dn(r.type);
1979
+ }
1980
+ function ot(e) {
1981
+ let t = 0;
1982
+ for (let a = 0; a < e.length; a++) {
1983
+ const { dynamic: o, encoded: i } = e[a];
1984
+ o ? t += 32 : t += X(i);
1985
+ }
1986
+ const n = [], r = [];
1987
+ let s = 0;
1988
+ for (let a = 0; a < e.length; a++) {
1989
+ const { dynamic: o, encoded: i } = e[a];
1990
+ o ? (n.push(ee(t + s, { size: 32 })), r.push(i), s += X(i)) : n.push(i);
1991
+ }
1992
+ return M(...n, ...r);
1993
+ }
1994
+ function wa(e, t) {
1995
+ const { checksum: n = !1 } = t;
1996
+ return Ce(e, { strict: n }), {
1997
+ dynamic: !1,
1998
+ encoded: ae(e.toLowerCase())
1999
+ };
2000
+ }
2001
+ function va(e, t) {
2002
+ const { checksumAddress: n, length: r, parameter: s } = t, a = r === null;
2003
+ if (!Array.isArray(e))
2004
+ throw new Na(e);
2005
+ if (!a && e.length !== r)
2006
+ throw new Ia({
2007
+ expectedLength: r,
2008
+ givenLength: e.length,
2009
+ type: `${s.type}[${r}]`
2010
+ });
2011
+ let o = !1;
2012
+ const i = [];
2013
+ for (let u = 0; u < e.length; u++) {
2014
+ const c = at({
2015
+ checksumAddress: n,
2016
+ parameter: s,
2017
+ value: e[u]
2018
+ });
2019
+ c.dynamic && (o = !0), i.push(c);
2020
+ }
2021
+ if (a || o) {
2022
+ const u = ot(i);
2023
+ if (a) {
2024
+ const c = ee(i.length, { size: 32 });
2025
+ return {
2026
+ dynamic: !0,
2027
+ encoded: i.length > 0 ? M(c, u) : c
2028
+ };
2029
+ }
2030
+ if (o)
2031
+ return { dynamic: !0, encoded: u };
2032
+ }
2033
+ return {
2034
+ dynamic: !1,
2035
+ encoded: M(...i.map(({ encoded: u }) => u))
2036
+ };
2037
+ }
2038
+ function Ta(e, { type: t }) {
2039
+ const [, n] = t.split("bytes"), r = X(e);
2040
+ if (!n) {
2041
+ let s = e;
2042
+ return r % 32 !== 0 && (s = Q(s, Math.ceil((e.length - 2) / 2 / 32) * 32)), {
2043
+ dynamic: !0,
2044
+ encoded: M(ae(ee(r, { size: 32 })), s)
2045
+ };
2046
+ }
2047
+ if (r !== Number.parseInt(n))
2048
+ throw new $n({
2049
+ expectedSize: Number.parseInt(n),
2050
+ value: e
2051
+ });
2052
+ return { dynamic: !1, encoded: Q(e) };
2053
+ }
2054
+ function Aa(e) {
2055
+ if (typeof e != "boolean")
2056
+ throw new D(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
2057
+ return { dynamic: !1, encoded: ae(Wt(e)) };
2058
+ }
2059
+ function xa(e, { signed: t, size: n }) {
2060
+ if (typeof n == "number") {
2061
+ const r = 2n ** (BigInt(n) - (t ? 1n : 0n)) - 1n, s = t ? -r - 1n : 0n;
2062
+ if (e > r || e < s)
2063
+ throw new lr({
2064
+ max: r.toString(),
2065
+ min: s.toString(),
2066
+ signed: t,
2067
+ size: n / 8,
2068
+ value: e.toString()
2069
+ });
2070
+ }
2071
+ return {
2072
+ dynamic: !1,
2073
+ encoded: ee(e, {
2074
+ size: 32,
2075
+ signed: t
2076
+ })
2077
+ };
2078
+ }
2079
+ function Ca(e) {
2080
+ const t = Qe(e), n = Math.ceil(X(t) / 32), r = [];
2081
+ for (let s = 0; s < n; s++)
2082
+ r.push(Q(Ke(t, s * 32, (s + 1) * 32)));
2083
+ return {
2084
+ dynamic: !0,
2085
+ encoded: M(Q(ee(X(t), { size: 32 })), ...r)
2086
+ };
2087
+ }
2088
+ function Ea(e, t) {
2089
+ const { checksumAddress: n, parameter: r } = t;
2090
+ let s = !1;
2091
+ const a = [];
2092
+ for (let o = 0; o < r.components.length; o++) {
2093
+ const i = r.components[o], u = Array.isArray(e) ? o : i.name, c = at({
2094
+ checksumAddress: n,
2095
+ parameter: i,
2096
+ value: e[u]
2097
+ });
2098
+ a.push(c), c.dynamic && (s = !0);
2099
+ }
2100
+ return {
2101
+ dynamic: s,
2102
+ encoded: s ? ot(a) : M(...a.map(({ encoded: o }) => o))
2103
+ };
2104
+ }
2105
+ function ka(e) {
2106
+ const t = e.match(/^(.*)\[(\d+)?\]$/);
2107
+ return t ? (
2108
+ // Return `null` if the array is dynamic.
2109
+ [t[2] ? Number(t[2]) : null, t[1]]
2110
+ ) : void 0;
2111
+ }
2112
+ function Bn(e, t, n) {
2113
+ const { checksumAddress: r = !1 } = {};
2114
+ if (e.length !== t.length)
2115
+ throw new zn({
2116
+ expectedLength: e.length,
2117
+ givenLength: t.length
2118
+ });
2119
+ const s = ya({
2120
+ checksumAddress: r,
2121
+ parameters: e,
2122
+ values: t
2123
+ }), a = ot(s);
2124
+ return a.length === 0 ? "0x" : a;
2125
+ }
2126
+ function He(e, t) {
2127
+ if (e.length !== t.length)
2128
+ throw new zn({
2129
+ expectedLength: e.length,
2130
+ givenLength: t.length
2131
+ });
2132
+ const n = [];
2133
+ for (let r = 0; r < e.length; r++) {
2134
+ const s = e[r], a = t[r];
2135
+ n.push(He.encode(s, a));
2136
+ }
2137
+ return M(...n);
2138
+ }
2139
+ (function(e) {
2140
+ function t(n, r, s = !1) {
2141
+ if (n === "address") {
2142
+ const u = r;
2143
+ return Ce(u), ae(u.toLowerCase(), s ? 32 : 0);
2144
+ }
2145
+ if (n === "string")
2146
+ return Qe(r);
2147
+ if (n === "bytes")
2148
+ return r;
2149
+ if (n === "bool")
2150
+ return ae(Wt(r), s ? 32 : 1);
2151
+ const a = n.match(Sn);
2152
+ if (a) {
2153
+ const [u, c, d = "256"] = a, l = Number.parseInt(d) / 8;
2154
+ return ee(r, {
2155
+ size: s ? 32 : l,
2156
+ signed: c === "int"
2157
+ });
2158
+ }
2159
+ const o = n.match(ba);
2160
+ if (o) {
2161
+ const [u, c] = o;
2162
+ if (Number.parseInt(c) !== (r.length - 2) / 2)
2163
+ throw new $n({
2164
+ expectedSize: Number.parseInt(c),
2165
+ value: r
2166
+ });
2167
+ return Q(r, s ? 32 : 0);
2168
+ }
2169
+ const i = n.match(ga);
2170
+ if (i && Array.isArray(r)) {
2171
+ const [u, c] = i, d = [];
2172
+ for (let l = 0; l < r.length; l++)
2173
+ d.push(t(c, r[l], !0));
2174
+ return d.length === 0 ? "0x" : M(...d);
2175
+ }
2176
+ throw new Dn(n);
2177
+ }
2178
+ e.encode = t;
2179
+ })(He || (He = {}));
2180
+ class Ia extends D {
2181
+ constructor({ expectedLength: t, givenLength: n, type: r }) {
2182
+ super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`), Object.defineProperty(this, "name", {
2183
+ enumerable: !0,
2184
+ configurable: !0,
2185
+ writable: !0,
2186
+ value: "AbiParameters.ArrayLengthMismatchError"
2187
+ });
2188
+ }
2189
+ }
2190
+ class $n extends D {
2191
+ constructor({ expectedSize: t, value: n }) {
2192
+ super(`Size of bytes "${n}" (bytes${X(n)}) does not match expected size (bytes${t}).`), Object.defineProperty(this, "name", {
2193
+ enumerable: !0,
2194
+ configurable: !0,
2195
+ writable: !0,
2196
+ value: "AbiParameters.BytesSizeMismatchError"
2197
+ });
2198
+ }
2199
+ }
2200
+ class zn extends D {
2201
+ constructor({ expectedLength: t, givenLength: n }) {
2202
+ super([
2203
+ "ABI encoding parameters/values length mismatch.",
2204
+ `Expected length (parameters): ${t}`,
2205
+ `Given length (values): ${n}`
2206
+ ].join(`
2207
+ `)), Object.defineProperty(this, "name", {
2208
+ enumerable: !0,
2209
+ configurable: !0,
2210
+ writable: !0,
2211
+ value: "AbiParameters.LengthMismatchError"
2212
+ });
2213
+ }
2214
+ }
2215
+ class Na extends D {
2216
+ constructor(t) {
2217
+ super(`Value \`${t}\` is not a valid array.`), Object.defineProperty(this, "name", {
2218
+ enumerable: !0,
2219
+ configurable: !0,
2220
+ writable: !0,
2221
+ value: "AbiParameters.InvalidArrayError"
2222
+ });
2223
+ }
2224
+ }
2225
+ class Dn extends D {
2226
+ constructor(t) {
2227
+ super(`Type \`${t}\` is not a valid ABI Type.`), Object.defineProperty(this, "name", {
2228
+ enumerable: !0,
2229
+ configurable: !0,
2230
+ writable: !0,
2231
+ value: "AbiParameters.InvalidTypeError"
2232
+ });
2233
+ }
2234
+ }
2235
+ function Ra(e, t) {
2236
+ var s;
2237
+ const { bytecode: n, args: r } = t;
2238
+ return M(n, (s = e.inputs) != null && s.length && (r != null && r.length) ? Bn(e.inputs, r) : "0x");
2239
+ }
2240
+ function Pa(e) {
2241
+ return Rn(e);
2242
+ }
2243
+ function Sa(e, ...t) {
2244
+ const { overloads: n } = e, r = n ? Ba([e, ...n], e.name, {
2245
+ args: t[0]
2246
+ }) : e, s = $a(r), a = t.length > 0 ? Bn(r.inputs, t[0]) : void 0;
2247
+ return a ? M(s, a) : s;
2248
+ }
2249
+ function J(e, t = {}) {
2250
+ return Rn(e, t);
2251
+ }
2252
+ function Ba(e, t, n) {
2253
+ const r = pa(e, t, n);
2254
+ if (r.type !== "function")
2255
+ throw new je({ name: t, type: "function" });
2256
+ return r;
2257
+ }
2258
+ function $a(e) {
2259
+ return Pn(e);
2260
+ }
2261
+ const za = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", O = "0x0000000000000000000000000000000000000000", Da = "0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";
2262
+ async function Fa(e, t) {
2263
+ const { blockNumber: n, blockTag: r, calls: s, stateOverrides: a, traceAssetChanges: o, traceTransfers: i, validation: u } = t, c = t.account ? _(t.account) : void 0;
2264
+ if (o && !c)
2265
+ throw new $("`account` is required when `traceAssetChanges` is true");
2266
+ const d = c ? Ra(Pa("constructor(bytes, bytes)"), {
2267
+ bytecode: pr,
2268
+ args: [
2269
+ Da,
2270
+ Sa(J("function getBalance(address)"), [c.address])
2271
+ ]
2272
+ }) : void 0, l = o ? await Promise.all(t.calls.map(async (A) => {
2273
+ if (!A.data && !A.abi)
2274
+ return;
2275
+ const { accessList: z } = await gn(e, {
2276
+ account: c.address,
2277
+ ...A,
2278
+ data: A.abi ? W(A) : A.data
2279
+ });
2280
+ return z.map(({ address: te, storageKeys: de }) => de.length > 0 ? te : null);
2281
+ })).then((A) => A.flat().filter(Boolean)) : [], p = await Oe(e, {
2282
+ blockNumber: n,
2283
+ blockTag: r,
2284
+ blocks: [
2285
+ ...o ? [
2286
+ // ETH pre balances
2287
+ {
2288
+ calls: [{ data: d }],
2289
+ stateOverrides: a
2290
+ },
2291
+ // Asset pre balances
2292
+ {
2293
+ calls: l.map((A, z) => ({
2294
+ abi: [
2295
+ J("function balanceOf(address) returns (uint256)")
2296
+ ],
2297
+ functionName: "balanceOf",
2298
+ args: [c.address],
2299
+ to: A,
2300
+ from: O,
2301
+ nonce: z
2302
+ })),
2303
+ stateOverrides: [
2304
+ {
2305
+ address: O,
2306
+ nonce: 0
2307
+ }
2308
+ ]
2309
+ }
2310
+ ] : [],
2311
+ {
2312
+ calls: [...s, {}].map((A) => ({
2313
+ ...A,
2314
+ from: c == null ? void 0 : c.address
2315
+ })),
2316
+ stateOverrides: a
2317
+ },
2318
+ ...o ? [
2319
+ // ETH post balances
2320
+ {
2321
+ calls: [{ data: d }]
2322
+ },
2323
+ // Asset post balances
2324
+ {
2325
+ calls: l.map((A, z) => ({
2326
+ abi: [
2327
+ J("function balanceOf(address) returns (uint256)")
2328
+ ],
2329
+ functionName: "balanceOf",
2330
+ args: [c.address],
2331
+ to: A,
2332
+ from: O,
2333
+ nonce: z
2334
+ })),
2335
+ stateOverrides: [
2336
+ {
2337
+ address: O,
2338
+ nonce: 0
2339
+ }
2340
+ ]
2341
+ },
2342
+ // Decimals
2343
+ {
2344
+ calls: l.map((A, z) => ({
2345
+ to: A,
2346
+ abi: [
2347
+ J("function decimals() returns (uint256)")
2348
+ ],
2349
+ functionName: "decimals",
2350
+ from: O,
2351
+ nonce: z
2352
+ })),
2353
+ stateOverrides: [
2354
+ {
2355
+ address: O,
2356
+ nonce: 0
2357
+ }
2358
+ ]
2359
+ },
2360
+ // Token URI
2361
+ {
2362
+ calls: l.map((A, z) => ({
2363
+ to: A,
2364
+ abi: [
2365
+ J("function tokenURI(uint256) returns (string)")
2366
+ ],
2367
+ functionName: "tokenURI",
2368
+ args: [0n],
2369
+ from: O,
2370
+ nonce: z
2371
+ })),
2372
+ stateOverrides: [
2373
+ {
2374
+ address: O,
2375
+ nonce: 0
2376
+ }
2377
+ ]
2378
+ },
2379
+ // Symbols
2380
+ {
2381
+ calls: l.map((A, z) => ({
2382
+ to: A,
2383
+ abi: [J("function symbol() returns (string)")],
2384
+ functionName: "symbol",
2385
+ from: O,
2386
+ nonce: z
2387
+ })),
2388
+ stateOverrides: [
2389
+ {
2390
+ address: O,
2391
+ nonce: 0
2392
+ }
2393
+ ]
2394
+ }
2395
+ ] : []
2396
+ ],
2397
+ traceTransfers: i,
2398
+ validation: u
2399
+ }), f = o ? p[2] : p[0], [h, g, , y, m, b, w, x] = o ? p : [], { calls: T, ...k } = f, v = T.slice(0, -1) ?? [], I = (h == null ? void 0 : h.calls) ?? [], N = (g == null ? void 0 : g.calls) ?? [], B = [...I, ...N].map((A) => A.status === "success" ? j(A.data) : null), E = (y == null ? void 0 : y.calls) ?? [], P = (m == null ? void 0 : m.calls) ?? [], S = [...E, ...P].map((A) => A.status === "success" ? j(A.data) : null), V = ((b == null ? void 0 : b.calls) ?? []).map((A) => A.status === "success" ? A.result : null), qn = ((x == null ? void 0 : x.calls) ?? []).map((A) => A.status === "success" ? A.result : null), On = ((w == null ? void 0 : w.calls) ?? []).map((A) => A.status === "success" ? A.result : null), Ee = [];
2400
+ for (const [A, z] of S.entries()) {
2401
+ const te = B[A];
2402
+ if (typeof z != "bigint" || typeof te != "bigint")
2403
+ continue;
2404
+ const de = V[A - 1], Mn = qn[A - 1], Ln = On[A - 1], ct = A === 0 ? {
2405
+ address: za,
2406
+ decimals: 18,
2407
+ symbol: "ETH"
2408
+ } : {
2409
+ address: l[A - 1],
2410
+ decimals: Ln || de ? Number(de ?? 1) : void 0,
2411
+ symbol: Mn ?? void 0
2412
+ };
2413
+ Ee.some((Un) => Un.token.address === ct.address) || Ee.push({
2414
+ token: ct,
2415
+ value: {
2416
+ pre: te,
2417
+ post: z,
2418
+ diff: z - te
2419
+ }
2420
+ });
2421
+ }
2422
+ return {
2423
+ assetChanges: Ee,
2424
+ block: k,
2425
+ results: v
2426
+ };
2427
+ }
2428
+ function _a({ r: e, s: t, to: n = "hex", v: r, yParity: s }) {
2429
+ const a = (() => {
2430
+ if (s === 0 || s === 1)
2431
+ return s;
2432
+ if (r && (r === 27n || r === 28n || r >= 35n))
2433
+ return r % 2n === 0n ? 1 : 0;
2434
+ throw new Error("Invalid `v` or `yParity` value");
2435
+ })(), o = `0x${new Vr.Signature(j(e), j(t)).toCompactHex()}${a === 0 ? "1b" : "1c"}`;
2436
+ return n === "hex" ? o : tn(o);
2437
+ }
2438
+ async function it(e, t) {
2439
+ var l, p, f;
2440
+ const { address: n, factory: r, factoryData: s, hash: a, signature: o, universalSignatureVerifierAddress: i = (f = (p = (l = e.chain) == null ? void 0 : l.contracts) == null ? void 0 : p.universalSignatureVerifier) == null ? void 0 : f.address, ...u } = t, c = Yt(o) ? o : typeof o == "object" && "r" in o && "s" in o ? _a(o) : oe(o), d = await (async () => !r && !s || Ys(c) ? c : ea({
2441
+ address: r,
2442
+ data: s,
2443
+ signature: c
2444
+ }))();
2445
+ try {
2446
+ const h = i ? {
2447
+ to: i,
2448
+ data: W({
2449
+ abi: Bt,
2450
+ functionName: "isValidSig",
2451
+ args: [n, a, d]
2452
+ }),
2453
+ ...u
2454
+ } : {
2455
+ data: Gt({
2456
+ abi: Bt,
2457
+ args: [n, a, d],
2458
+ bytecode: hr
2459
+ }),
2460
+ ...u
2461
+ }, { data: g } = await C(e, Vt, "call")(h);
2462
+ return Hr(g ?? "0x0");
2463
+ } catch (h) {
2464
+ try {
2465
+ if (Xe(sn(n), await mr({ hash: a, signature: o })))
2466
+ return !0;
2467
+ } catch {
2468
+ }
2469
+ if (h instanceof gr)
2470
+ return !1;
2471
+ throw h;
2472
+ }
2473
+ }
2474
+ async function qa(e, { address: t, message: n, factory: r, factoryData: s, signature: a, ...o }) {
2475
+ const i = En(n);
2476
+ return it(e, {
2477
+ address: t,
2478
+ factory: r,
2479
+ factoryData: s,
2480
+ hash: i,
2481
+ signature: a,
2482
+ ...o
2483
+ });
2484
+ }
2485
+ async function Oa(e, t) {
2486
+ const { address: n, factory: r, factoryData: s, signature: a, message: o, primaryType: i, types: u, domain: c, ...d } = t, l = Ws({ message: o, primaryType: i, types: u, domain: c });
2487
+ return it(e, {
2488
+ address: n,
2489
+ factory: r,
2490
+ factoryData: s,
2491
+ hash: l,
2492
+ signature: a,
2493
+ ...d
2494
+ });
2495
+ }
2496
+ function Fn(e, { emitOnBegin: t = !1, emitMissed: n = !1, onBlockNumber: r, onError: s, poll: a, pollingInterval: o = e.pollingInterval }) {
2497
+ const i = typeof a < "u" ? a : !(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"));
2498
+ let u;
2499
+ return i ? (() => {
2500
+ const l = F([
2501
+ "watchBlockNumber",
2502
+ e.uid,
2503
+ t,
2504
+ n,
2505
+ o
2506
+ ]);
2507
+ return H(l, { onBlockNumber: r, onError: s }, (p) => ie(async () => {
2508
+ var f;
2509
+ try {
2510
+ const h = await C(e, Te, "getBlockNumber")({ cacheTime: 0 });
2511
+ if (u) {
2512
+ if (h === u)
2513
+ return;
2514
+ if (h - u > 1 && n)
2515
+ for (let g = u + 1n; g < h; g++)
2516
+ p.onBlockNumber(g, u), u = g;
2517
+ }
2518
+ (!u || h > u) && (p.onBlockNumber(h, u), u = h);
2519
+ } catch (h) {
2520
+ (f = p.onError) == null || f.call(p, h);
2521
+ }
2522
+ }, {
2523
+ emitOnBegin: t,
2524
+ interval: o
2525
+ }));
2526
+ })() : (() => {
2527
+ const l = F([
2528
+ "watchBlockNumber",
2529
+ e.uid,
2530
+ t,
2531
+ n
2532
+ ]);
2533
+ return H(l, { onBlockNumber: r, onError: s }, (p) => {
2534
+ let f = !0, h = () => f = !1;
2535
+ return (async () => {
2536
+ try {
2537
+ const g = (() => {
2538
+ if (e.transport.type === "fallback") {
2539
+ const m = e.transport.transports.find((b) => b.config.type === "webSocket" || b.config.type === "ipc");
2540
+ return m ? m.value : e.transport;
2541
+ }
2542
+ return e.transport;
2543
+ })(), { unsubscribe: y } = await g.subscribe({
2544
+ params: ["newHeads"],
2545
+ onData(m) {
2546
+ var w;
2547
+ if (!f)
2548
+ return;
2549
+ const b = j((w = m.result) == null ? void 0 : w.number);
2550
+ p.onBlockNumber(b, u), u = b;
2551
+ },
2552
+ onError(m) {
2553
+ var b;
2554
+ (b = p.onError) == null || b.call(p, m);
2555
+ }
2556
+ });
2557
+ h = y, f || h();
2558
+ } catch (g) {
2559
+ s == null || s(g);
2560
+ }
2561
+ })(), () => h();
2562
+ });
2563
+ })();
2564
+ }
2565
+ async function Ma(e, t) {
2566
+ const {
2567
+ checkReplacement: n = !0,
2568
+ confirmations: r = 1,
2569
+ hash: s,
2570
+ onReplaced: a,
2571
+ retryCount: o = 6,
2572
+ retryDelay: i = ({ count: T }) => ~~(1 << T) * 200,
2573
+ // exponential backoff
2574
+ timeout: u = 18e4
2575
+ } = t, c = F(["waitForTransactionReceipt", e.uid, s]), d = (() => {
2576
+ var T;
2577
+ return t.pollingInterval ? t.pollingInterval : (T = e.chain) != null && T.experimental_preconfirmationTime ? e.chain.experimental_preconfirmationTime : e.pollingInterval;
2578
+ })();
2579
+ let l, p, f, h = !1, g, y;
2580
+ const { promise: m, resolve: b, reject: w } = Mt(), x = u ? setTimeout(() => {
2581
+ y(), g(), w(new Wr({ hash: s }));
2582
+ }, u) : void 0;
2583
+ return g = H(c, { onReplaced: a, resolve: b, reject: w }, async (T) => {
2584
+ if (f = await C(e, ge, "getTransactionReceipt")({ hash: s }).catch(() => {
2585
+ }), f && r <= 1) {
2586
+ clearTimeout(x), T.resolve(f), g();
2587
+ return;
2588
+ }
2589
+ y = C(e, Fn, "watchBlockNumber")({
2590
+ emitMissed: !0,
2591
+ emitOnBegin: !0,
2592
+ poll: !0,
2593
+ pollingInterval: d,
2594
+ async onBlockNumber(k) {
2595
+ const v = (N) => {
2596
+ clearTimeout(x), y(), N(), g();
2597
+ };
2598
+ let I = k;
2599
+ if (!h)
2600
+ try {
2601
+ if (f) {
2602
+ if (r > 1 && (!f.blockNumber || I - f.blockNumber + 1n < r))
2603
+ return;
2604
+ v(() => T.resolve(f));
2605
+ return;
2606
+ }
2607
+ if (n && !l && (h = !0, await qe(async () => {
2608
+ l = await C(e, st, "getTransaction")({ hash: s }), l.blockNumber && (I = l.blockNumber);
2609
+ }, {
2610
+ delay: i,
2611
+ retryCount: o
2612
+ }), h = !1), f = await C(e, ge, "getTransactionReceipt")({ hash: s }), r > 1 && (!f.blockNumber || I - f.blockNumber + 1n < r))
2613
+ return;
2614
+ v(() => T.resolve(f));
2615
+ } catch (N) {
2616
+ if (N instanceof nn || N instanceof rn) {
2617
+ if (!l) {
2618
+ h = !1;
2619
+ return;
2620
+ }
2621
+ try {
2622
+ p = l, h = !0;
2623
+ const B = await qe(() => C(e, Z, "getBlock")({
2624
+ blockNumber: I,
2625
+ includeTransactions: !0
2626
+ }), {
2627
+ delay: i,
2628
+ retryCount: o,
2629
+ shouldRetry: ({ error: S }) => S instanceof br
2630
+ });
2631
+ h = !1;
2632
+ const E = B.transactions.find(({ from: S, nonce: V }) => S === p.from && V === p.nonce);
2633
+ if (!E || (f = await C(e, ge, "getTransactionReceipt")({
2634
+ hash: E.hash
2635
+ }), r > 1 && (!f.blockNumber || I - f.blockNumber + 1n < r)))
2636
+ return;
2637
+ let P = "replaced";
2638
+ E.to === p.to && E.value === p.value && E.input === p.input ? P = "repriced" : E.from === E.to && E.value === 0n && (P = "cancelled"), v(() => {
2639
+ var S;
2640
+ (S = T.onReplaced) == null || S.call(T, {
2641
+ reason: P,
2642
+ replacedTransaction: p,
2643
+ transaction: E,
2644
+ transactionReceipt: f
2645
+ }), T.resolve(f);
2646
+ });
2647
+ } catch (B) {
2648
+ v(() => T.reject(B));
2649
+ }
2650
+ } else
2651
+ v(() => T.reject(N));
2652
+ }
2653
+ }
2654
+ });
2655
+ }), m;
2656
+ }
2657
+ function La(e, { blockTag: t = e.experimental_blockTag ?? "latest", emitMissed: n = !1, emitOnBegin: r = !1, onBlock: s, onError: a, includeTransactions: o, poll: i, pollingInterval: u = e.pollingInterval }) {
2658
+ const c = typeof i < "u" ? i : !(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")), d = o ?? !1;
2659
+ let l;
2660
+ return c ? (() => {
2661
+ const h = F([
2662
+ "watchBlocks",
2663
+ e.uid,
2664
+ t,
2665
+ n,
2666
+ r,
2667
+ d,
2668
+ u
2669
+ ]);
2670
+ return H(h, { onBlock: s, onError: a }, (g) => ie(async () => {
2671
+ var y;
2672
+ try {
2673
+ const m = await C(e, Z, "getBlock")({
2674
+ blockTag: t,
2675
+ includeTransactions: d
2676
+ });
2677
+ if (m.number !== null && (l == null ? void 0 : l.number) != null) {
2678
+ if (m.number === l.number)
2679
+ return;
2680
+ if (m.number - l.number > 1 && n)
2681
+ for (let b = (l == null ? void 0 : l.number) + 1n; b < m.number; b++) {
2682
+ const w = await C(e, Z, "getBlock")({
2683
+ blockNumber: b,
2684
+ includeTransactions: d
2685
+ });
2686
+ g.onBlock(w, l), l = w;
2687
+ }
2688
+ }
2689
+ // If no previous block exists, emit.
2690
+ ((l == null ? void 0 : l.number) == null || // If the block tag is "pending" with no block number, emit.
2691
+ t === "pending" && (m == null ? void 0 : m.number) == null || // If the next block number is greater than the previous block number, emit.
2692
+ // We don't want to emit blocks in the past.
2693
+ m.number !== null && m.number > l.number) && (g.onBlock(m, l), l = m);
2694
+ } catch (m) {
2695
+ (y = g.onError) == null || y.call(g, m);
2696
+ }
2697
+ }, {
2698
+ emitOnBegin: r,
2699
+ interval: u
2700
+ }));
2701
+ })() : (() => {
2702
+ let h = !0, g = !0, y = () => h = !1;
2703
+ return (async () => {
2704
+ try {
2705
+ r && C(e, Z, "getBlock")({
2706
+ blockTag: t,
2707
+ includeTransactions: d
2708
+ }).then((w) => {
2709
+ h && g && (s(w, void 0), g = !1);
2710
+ }).catch(a);
2711
+ const m = (() => {
2712
+ if (e.transport.type === "fallback") {
2713
+ const w = e.transport.transports.find((x) => x.config.type === "webSocket" || x.config.type === "ipc");
2714
+ return w ? w.value : e.transport;
2715
+ }
2716
+ return e.transport;
2717
+ })(), { unsubscribe: b } = await m.subscribe({
2718
+ params: ["newHeads"],
2719
+ async onData(w) {
2720
+ var T;
2721
+ if (!h)
2722
+ return;
2723
+ const x = await C(e, Z, "getBlock")({
2724
+ blockNumber: (T = w.result) == null ? void 0 : T.number,
2725
+ includeTransactions: d
2726
+ }).catch(() => {
2727
+ });
2728
+ h && (s(x, l), g = !1, l = x);
2729
+ },
2730
+ onError(w) {
2731
+ a == null || a(w);
2732
+ }
2733
+ });
2734
+ y = b, h || y();
2735
+ } catch (m) {
2736
+ a == null || a(m);
2737
+ }
2738
+ })(), () => y();
2739
+ })();
2740
+ }
2741
+ function Ua(e, { address: t, args: n, batch: r = !0, event: s, events: a, fromBlock: o, onError: i, onLogs: u, poll: c, pollingInterval: d = e.pollingInterval, strict: l }) {
2742
+ const p = typeof c < "u" ? c : typeof o == "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")), f = l ?? !1;
2743
+ return p ? (() => {
2744
+ const y = F([
2745
+ "watchEvent",
2746
+ t,
2747
+ n,
2748
+ r,
2749
+ e.uid,
2750
+ s,
2751
+ d,
2752
+ o
2753
+ ]);
2754
+ return H(y, { onLogs: u, onError: i }, (m) => {
2755
+ let b;
2756
+ o !== void 0 && (b = o - 1n);
2757
+ let w, x = !1;
2758
+ const T = ie(async () => {
2759
+ var k;
2760
+ if (!x) {
2761
+ try {
2762
+ w = await C(e, bn, "createEventFilter")({
2763
+ address: t,
2764
+ args: n,
2765
+ event: s,
2766
+ events: a,
2767
+ strict: f,
2768
+ fromBlock: o
2769
+ });
2770
+ } catch {
2771
+ }
2772
+ x = !0;
2773
+ return;
2774
+ }
2775
+ try {
2776
+ let v;
2777
+ if (w)
2778
+ v = await C(e, Ye, "getFilterChanges")({ filter: w });
2779
+ else {
2780
+ const I = await C(e, Te, "getBlockNumber")({});
2781
+ b && b !== I ? v = await C(e, Jt, "getLogs")({
2782
+ address: t,
2783
+ args: n,
2784
+ event: s,
2785
+ events: a,
2786
+ fromBlock: b + 1n,
2787
+ toBlock: I
2788
+ }) : v = [], b = I;
2789
+ }
2790
+ if (v.length === 0)
2791
+ return;
2792
+ if (r)
2793
+ m.onLogs(v);
2794
+ else
2795
+ for (const I of v)
2796
+ m.onLogs([I]);
2797
+ } catch (v) {
2798
+ w && v instanceof Se && (x = !1), (k = m.onError) == null || k.call(m, v);
2799
+ }
2800
+ }, {
2801
+ emitOnBegin: !0,
2802
+ interval: d
2803
+ });
2804
+ return async () => {
2805
+ w && await C(e, et, "uninstallFilter")({ filter: w }), T();
2806
+ };
2807
+ });
2808
+ })() : (() => {
2809
+ let y = !0, m = () => y = !1;
2810
+ return (async () => {
2811
+ try {
2812
+ const b = (() => {
2813
+ if (e.transport.type === "fallback") {
2814
+ const k = e.transport.transports.find((v) => v.config.type === "webSocket" || v.config.type === "ipc");
2815
+ return k ? k.value : e.transport;
2816
+ }
2817
+ return e.transport;
2818
+ })(), w = a ?? (s ? [s] : void 0);
2819
+ let x = [];
2820
+ w && (x = [w.flatMap((v) => Ut({
2821
+ abi: [v],
2822
+ eventName: v.name,
2823
+ args: n
2824
+ }))], s && (x = x[0]));
2825
+ const { unsubscribe: T } = await b.subscribe({
2826
+ params: ["logs", { address: t, topics: x }],
2827
+ onData(k) {
2828
+ var I;
2829
+ if (!y)
2830
+ return;
2831
+ const v = k.result;
2832
+ try {
2833
+ const { eventName: N, args: B } = yr({
2834
+ abi: w ?? [],
2835
+ data: v.data,
2836
+ topics: v.topics,
2837
+ strict: f
2838
+ }), E = we(v, { args: B, eventName: N });
2839
+ u([E]);
2840
+ } catch (N) {
2841
+ let B, E;
2842
+ if (N instanceof wr || N instanceof vr) {
2843
+ if (l)
2844
+ return;
2845
+ B = N.abiItem.name, E = (I = N.abiItem.inputs) == null ? void 0 : I.some((S) => !("name" in S && S.name));
2846
+ }
2847
+ const P = we(v, {
2848
+ args: E ? [] : {},
2849
+ eventName: B
2850
+ });
2851
+ u([P]);
2852
+ }
2853
+ },
2854
+ onError(k) {
2855
+ i == null || i(k);
2856
+ }
2857
+ });
2858
+ m = T, y || m();
2859
+ } catch (b) {
2860
+ i == null || i(b);
2861
+ }
2862
+ })(), () => m();
2863
+ })();
2864
+ }
2865
+ function ja(e, { batch: t = !0, onError: n, onTransactions: r, poll: s, pollingInterval: a = e.pollingInterval }) {
2866
+ return (typeof s < "u" ? s : e.transport.type !== "webSocket" && e.transport.type !== "ipc") ? (() => {
2867
+ const c = F([
2868
+ "watchPendingTransactions",
2869
+ e.uid,
2870
+ t,
2871
+ a
2872
+ ]);
2873
+ return H(c, { onTransactions: r, onError: n }, (d) => {
2874
+ let l;
2875
+ const p = ie(async () => {
2876
+ var f;
2877
+ try {
2878
+ if (!l)
2879
+ try {
2880
+ l = await C(e, yn, "createPendingTransactionFilter")({});
2881
+ return;
2882
+ } catch (g) {
2883
+ throw p(), g;
2884
+ }
2885
+ const h = await C(e, Ye, "getFilterChanges")({ filter: l });
2886
+ if (h.length === 0)
2887
+ return;
2888
+ if (t)
2889
+ d.onTransactions(h);
2890
+ else
2891
+ for (const g of h)
2892
+ d.onTransactions([g]);
2893
+ } catch (h) {
2894
+ (f = d.onError) == null || f.call(d, h);
2895
+ }
2896
+ }, {
2897
+ emitOnBegin: !0,
2898
+ interval: a
2899
+ });
2900
+ return async () => {
2901
+ l && await C(e, et, "uninstallFilter")({ filter: l }), p();
2902
+ };
2903
+ });
2904
+ })() : (() => {
2905
+ let c = !0, d = () => c = !1;
2906
+ return (async () => {
2907
+ try {
2908
+ const { unsubscribe: l } = await e.transport.subscribe({
2909
+ params: ["newPendingTransactions"],
2910
+ onData(p) {
2911
+ if (!c)
2912
+ return;
2913
+ const f = p.result;
2914
+ r([f]);
2915
+ },
2916
+ onError(p) {
2917
+ n == null || n(p);
2918
+ }
2919
+ });
2920
+ d = l, c || d();
2921
+ } catch (l) {
2922
+ n == null || n(l);
2923
+ }
2924
+ })(), () => d();
2925
+ })();
2926
+ }
2927
+ function Ha(e) {
2928
+ var l, p, f;
2929
+ const { scheme: t, statement: n, ...r } = ((l = e.match(Wa)) == null ? void 0 : l.groups) ?? {}, { chainId: s, expirationTime: a, issuedAt: o, notBefore: i, requestId: u, ...c } = ((p = e.match(Ga)) == null ? void 0 : p.groups) ?? {}, d = (f = e.split("Resources:")[1]) == null ? void 0 : f.split(`
2930
+ - `).slice(1);
2931
+ return {
2932
+ ...r,
2933
+ ...c,
2934
+ ...s ? { chainId: Number(s) } : {},
2935
+ ...a ? { expirationTime: new Date(a) } : {},
2936
+ ...o ? { issuedAt: new Date(o) } : {},
2937
+ ...i ? { notBefore: new Date(i) } : {},
2938
+ ...u ? { requestId: u } : {},
2939
+ ...d ? { resources: d } : {},
2940
+ ...t ? { scheme: t } : {},
2941
+ ...n ? { statement: n } : {}
2942
+ };
2943
+ }
2944
+ const Wa = /^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/, Ga = /(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;
2945
+ function Va(e) {
2946
+ const { address: t, domain: n, message: r, nonce: s, scheme: a, time: o = /* @__PURE__ */ new Date() } = e;
2947
+ if (n && r.domain !== n || s && r.nonce !== s || a && r.scheme !== a || r.expirationTime && o >= r.expirationTime || r.notBefore && o < r.notBefore)
2948
+ return !1;
2949
+ try {
2950
+ if (!r.address || !en(r.address, { strict: !1 }) || t && !Xe(r.address, t))
2951
+ return !1;
2952
+ } catch {
2953
+ return !1;
2954
+ }
2955
+ return !0;
2956
+ }
2957
+ async function Ja(e, t) {
2958
+ const { address: n, domain: r, message: s, nonce: a, scheme: o, signature: i, time: u = /* @__PURE__ */ new Date(), ...c } = t, d = Ha(s);
2959
+ if (!d.address || !Va({
2960
+ address: n,
2961
+ domain: r,
2962
+ message: d,
2963
+ nonce: a,
2964
+ scheme: o,
2965
+ time: u
2966
+ }))
2967
+ return !1;
2968
+ const p = En(s);
2969
+ return it(e, {
2970
+ address: d.address,
2971
+ hash: p,
2972
+ signature: i,
2973
+ ...c
2974
+ });
2975
+ }
2976
+ function Za(e) {
2977
+ return {
2978
+ call: (t) => Vt(e, t),
2979
+ createAccessList: (t) => gn(e, t),
2980
+ createBlockFilter: () => $s(e),
2981
+ createContractEventFilter: (t) => Pr(e, t),
2982
+ createEventFilter: (t) => bn(e, t),
2983
+ createPendingTransactionFilter: () => yn(e),
2984
+ estimateContractGas: (t) => Rr(e, t),
2985
+ estimateGas: (t) => Nr(e, t),
2986
+ getBalance: (t) => Ir(e, t),
2987
+ getBlobBaseFee: () => zs(e),
2988
+ getBlock: (t) => Z(e, t),
2989
+ getBlockNumber: (t) => Te(e, t),
2990
+ getBlockTransactionCount: (t) => Ds(e, t),
2991
+ getBytecode: (t) => qt(e, t),
2992
+ getChainId: () => Ae(e),
2993
+ getCode: (t) => qt(e, t),
2994
+ getContractEvents: (t) => kr(e, t),
2995
+ getEip712Domain: (t) => _s(e, t),
2996
+ getEnsAddress: (t) => bs(e, t),
2997
+ getEnsAvatar: (t) => Ps(e, t),
2998
+ getEnsName: (t) => Ss(e, t),
2999
+ getEnsResolver: (t) => Bs(e, t),
3000
+ getEnsText: (t) => mn(e, t),
3001
+ getFeeHistory: (t) => Ms(e, t),
3002
+ estimateFeesPerGas: (t) => Er(e, t),
3003
+ getFilterChanges: (t) => Ye(e, t),
3004
+ getFilterLogs: (t) => Ls(e, t),
3005
+ getGasPrice: () => Cr(e),
3006
+ getLogs: (t) => Jt(e, t),
3007
+ getProof: (t) => ra(e, t),
3008
+ estimateMaxPriorityFeePerGas: (t) => xr(e, t),
3009
+ getStorageAt: (t) => sa(e, t),
3010
+ getTransaction: (t) => st(e, t),
3011
+ getTransactionConfirmations: (t) => aa(e, t),
3012
+ getTransactionCount: (t) => Qt(e, t),
3013
+ getTransactionReceipt: (t) => ge(e, t),
3014
+ multicall: (t) => oa(e, t),
3015
+ prepareTransactionRequest: (t) => Kt(e, t),
3016
+ readContract: (t) => U(e, t),
3017
+ sendRawTransaction: (t) => Zt(e, t),
3018
+ simulate: (t) => Oe(e, t),
3019
+ simulateBlocks: (t) => Oe(e, t),
3020
+ simulateCalls: (t) => Fa(e, t),
3021
+ simulateContract: (t) => Ar(e, t),
3022
+ verifyMessage: (t) => qa(e, t),
3023
+ verifySiweMessage: (t) => Ja(e, t),
3024
+ verifyTypedData: (t) => Oa(e, t),
3025
+ uninstallFilter: (t) => et(e, t),
3026
+ waitForTransactionReceipt: (t) => Ma(e, t),
3027
+ watchBlocks: (t) => La(e, t),
3028
+ watchBlockNumber: (t) => Fn(e, t),
3029
+ watchContractEvent: (t) => Tr(e, t),
3030
+ watchEvent: (t) => Ua(e, t),
3031
+ watchPendingTransactions: (t) => ja(e, t)
3032
+ };
3033
+ }
3034
+ function bo(e) {
3035
+ const { key: t = "public", name: n = "Public Client" } = e;
3036
+ return fn({
3037
+ ...e,
3038
+ key: t,
3039
+ name: n,
3040
+ type: "publicClient"
3041
+ }).extend(Za);
3042
+ }
3043
+ async function Ka(e, { chain: t }) {
3044
+ const { id: n, name: r, nativeCurrency: s, rpcUrls: a, blockExplorers: o } = t;
3045
+ await e.request({
3046
+ method: "wallet_addEthereumChain",
3047
+ params: [
3048
+ {
3049
+ chainId: R(n),
3050
+ chainName: r,
3051
+ nativeCurrency: s,
3052
+ rpcUrls: a.default.http,
3053
+ blockExplorerUrls: o ? Object.values(o).map(({ url: i }) => i) : void 0
3054
+ }
3055
+ ]
3056
+ }, { dedupe: !0, retryCount: 0 });
3057
+ }
3058
+ function Qa(e, t) {
3059
+ const { abi: n, args: r, bytecode: s, ...a } = t, o = Gt({ abi: n, args: r, bytecode: s });
3060
+ return We(e, {
3061
+ ...a,
3062
+ ...a.authorizationList ? { to: null } : {},
3063
+ data: o
3064
+ });
3065
+ }
3066
+ async function Xa(e) {
3067
+ var n;
3068
+ return ((n = e.account) == null ? void 0 : n.type) === "local" ? [e.account.address] : (await e.request({ method: "eth_accounts" }, { dedupe: !0 })).map((r) => Gr(r));
3069
+ }
3070
+ async function Ya(e, t = {}) {
3071
+ const { account: n = e.account, chainId: r } = t, s = n ? _(n) : void 0, a = r ? [s == null ? void 0 : s.address, [R(r)]] : [s == null ? void 0 : s.address], o = await e.request({
3072
+ method: "wallet_getCapabilities",
3073
+ params: a
3074
+ }), i = {};
3075
+ for (const [u, c] of Object.entries(o)) {
3076
+ i[Number(u)] = {};
3077
+ for (let [d, l] of Object.entries(c))
3078
+ d === "addSubAccount" && (d = "unstable_addSubAccount"), i[Number(u)][d] = l;
3079
+ }
3080
+ return typeof r == "number" ? i[r] : i;
3081
+ }
3082
+ async function eo(e) {
3083
+ return await e.request({ method: "wallet_getPermissions" }, { dedupe: !0 });
3084
+ }
3085
+ async function _n(e, t) {
3086
+ var u;
3087
+ const { account: n = e.account, chainId: r, nonce: s } = t;
3088
+ if (!n)
3089
+ throw new ue({
3090
+ docsPath: "/docs/eip7702/prepareAuthorization"
3091
+ });
3092
+ const a = _(n), o = (() => {
3093
+ if (t.executor)
3094
+ return t.executor === "self" ? t.executor : _(t.executor);
3095
+ })(), i = {
3096
+ address: t.contractAddress ?? t.address,
3097
+ chainId: r,
3098
+ nonce: s
3099
+ };
3100
+ return typeof i.chainId > "u" && (i.chainId = ((u = e.chain) == null ? void 0 : u.id) ?? await C(e, Ae, "getChainId")({})), typeof i.nonce > "u" && (i.nonce = await C(e, Qt, "getTransactionCount")({
3101
+ address: a.address,
3102
+ blockTag: "pending"
3103
+ }), (o === "self" || o != null && o.address && Xe(o.address, a.address)) && (i.nonce += 1)), i;
3104
+ }
3105
+ async function to(e) {
3106
+ return (await e.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((n) => sn(n));
3107
+ }
3108
+ async function no(e, t) {
3109
+ return e.request({
3110
+ method: "wallet_requestPermissions",
3111
+ params: [t]
3112
+ }, { retryCount: 0 });
3113
+ }
3114
+ async function ro(e, t) {
3115
+ const { id: n } = t;
3116
+ await e.request({
3117
+ method: "wallet_showCallsStatus",
3118
+ params: [n]
3119
+ });
3120
+ }
3121
+ async function so(e, t) {
3122
+ const { account: n = e.account } = t;
3123
+ if (!n)
3124
+ throw new ue({
3125
+ docsPath: "/docs/eip7702/signAuthorization"
3126
+ });
3127
+ const r = _(n);
3128
+ if (!r.signAuthorization)
3129
+ throw new Sr({
3130
+ docsPath: "/docs/eip7702/signAuthorization",
3131
+ metaMessages: [
3132
+ "The `signAuthorization` Action does not support JSON-RPC Accounts."
3133
+ ],
3134
+ type: r.type
3135
+ });
3136
+ const s = await _n(e, t);
3137
+ return r.signAuthorization(s);
3138
+ }
3139
+ async function ao(e, { account: t = e.account, message: n }) {
3140
+ if (!t)
3141
+ throw new ue({
3142
+ docsPath: "/docs/actions/wallet/signMessage"
3143
+ });
3144
+ const r = _(t);
3145
+ if (r.signMessage)
3146
+ return r.signMessage({ message: n });
3147
+ const s = typeof n == "string" ? ye(n) : n.raw instanceof Uint8Array ? G(n.raw) : n.raw;
3148
+ return e.request({
3149
+ method: "personal_sign",
3150
+ params: [s, r.address]
3151
+ }, { retryCount: 0 });
3152
+ }
3153
+ async function oo(e, t) {
3154
+ var c, d, l, p;
3155
+ const { account: n = e.account, chain: r = e.chain, ...s } = t;
3156
+ if (!n)
3157
+ throw new ue({
3158
+ docsPath: "/docs/actions/wallet/signTransaction"
3159
+ });
3160
+ const a = _(n);
3161
+ Ge({
3162
+ account: a,
3163
+ ...t
3164
+ });
3165
+ const o = await C(e, Ae, "getChainId")({});
3166
+ r !== null && Br({
3167
+ currentChainId: o,
3168
+ chain: r
3169
+ });
3170
+ const i = (r == null ? void 0 : r.formatters) || ((c = e.chain) == null ? void 0 : c.formatters), u = ((d = i == null ? void 0 : i.transactionRequest) == null ? void 0 : d.format) || Ve;
3171
+ return a.signTransaction ? a.signTransaction({
3172
+ ...s,
3173
+ chainId: o
3174
+ }, { serializer: (p = (l = e.chain) == null ? void 0 : l.serializers) == null ? void 0 : p.transaction }) : await e.request({
3175
+ method: "eth_signTransaction",
3176
+ params: [
3177
+ {
3178
+ ...u(s),
3179
+ chainId: R(o),
3180
+ from: a.address
3181
+ }
3182
+ ]
3183
+ }, { retryCount: 0 });
3184
+ }
3185
+ async function io(e, t) {
3186
+ const { account: n = e.account, domain: r, message: s, primaryType: a } = t;
3187
+ if (!n)
3188
+ throw new ue({
3189
+ docsPath: "/docs/actions/wallet/signTypedData"
3190
+ });
3191
+ const o = _(n), i = {
3192
+ EIP712Domain: Cn({ domain: r }),
3193
+ ...t.types
3194
+ };
3195
+ if (xn({ domain: r, message: s, primaryType: a, types: i }), o.signTypedData)
3196
+ return o.signTypedData({ domain: r, message: s, primaryType: a, types: i });
3197
+ const u = Zs({ domain: r, message: s, primaryType: a, types: i });
3198
+ return e.request({
3199
+ method: "eth_signTypedData_v4",
3200
+ params: [o.address, u]
3201
+ }, { retryCount: 0 });
3202
+ }
3203
+ async function co(e, { id: t }) {
3204
+ await e.request({
3205
+ method: "wallet_switchEthereumChain",
3206
+ params: [
3207
+ {
3208
+ chainId: R(t)
3209
+ }
3210
+ ]
3211
+ }, { retryCount: 0 });
3212
+ }
3213
+ async function uo(e, t) {
3214
+ return await e.request({
3215
+ method: "wallet_watchAsset",
3216
+ params: t
3217
+ }, { retryCount: 0 });
3218
+ }
3219
+ function fo(e) {
3220
+ return {
3221
+ addChain: (t) => Ka(e, t),
3222
+ deployContract: (t) => Qa(e, t),
3223
+ getAddresses: () => Xa(e),
3224
+ getCallsStatus: (t) => un(e, t),
3225
+ getCapabilities: (t) => Ya(e, t),
3226
+ getChainId: () => Ae(e),
3227
+ getPermissions: () => eo(e),
3228
+ prepareAuthorization: (t) => _n(e, t),
3229
+ prepareTransactionRequest: (t) => Kt(e, t),
3230
+ requestAddresses: () => to(e),
3231
+ requestPermissions: (t) => no(e, t),
3232
+ sendCalls: (t) => ss(e, t),
3233
+ sendRawTransaction: (t) => Zt(e, t),
3234
+ sendTransaction: (t) => We(e, t),
3235
+ showCallsStatus: (t) => ro(e, t),
3236
+ signAuthorization: (t) => so(e, t),
3237
+ signMessage: (t) => ao(e, t),
3238
+ signTransaction: (t) => oo(e, t),
3239
+ signTypedData: (t) => io(e, t),
3240
+ switchChain: (t) => co(e, t),
3241
+ waitForCallsStatus: (t) => as(e, t),
3242
+ watchAsset: (t) => uo(e, t),
3243
+ writeContract: (t) => $r(e, t)
3244
+ };
3245
+ }
3246
+ function yo(e) {
3247
+ const { key: t = "wallet", name: n = "Wallet Client", transport: r } = e;
3248
+ return fn({
3249
+ ...e,
3250
+ key: t,
3251
+ name: n,
3252
+ transport: r,
3253
+ type: "walletClient"
3254
+ }).extend(fo);
3255
+ }
3256
+ export {
3257
+ bo as a,
3258
+ ds as b,
3259
+ yo as c,
3260
+ go as h
3261
+ };
3262
+ //# sourceMappingURL=createWalletClient-CYva1_XM.js.map