@springmicro/auth 0.7.21 → 0.7.22

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.
@@ -0,0 +1,2035 @@
1
+ import { bL as P } from "./Web3Auth-CYZ2tXRd.js";
2
+ import { c as Tn, H as mn, g as ye, u as _n, s as Ae, e as be, t as Nn, f as Ie, k as Sn, a as Ze } from "./utils-DbgAoL44.js";
3
+ const W = /* @__PURE__ */ BigInt(2 ** 32 - 1), ve = /* @__PURE__ */ BigInt(32);
4
+ function On(e, n = !1) {
5
+ return n ? { h: Number(e & W), l: Number(e >> ve & W) } : { h: Number(e >> ve & W) | 0, l: Number(e & W) | 0 };
6
+ }
7
+ function Dn(e, n = !1) {
8
+ const t = e.length;
9
+ let r = new Uint32Array(t), s = new Uint32Array(t);
10
+ for (let i = 0; i < t; i++) {
11
+ const { h: o, l: c } = On(e[i], n);
12
+ [r[i], s[i]] = [o, c];
13
+ }
14
+ return [r, s];
15
+ }
16
+ const wn = (e, n, t) => e << t | n >>> 32 - t, Cn = (e, n, t) => n << t | e >>> 32 - t, Mn = (e, n, t) => n << t - 32 | e >>> 64 - t, xn = (e, n, t) => e << t - 32 | n >>> 64 - t;
17
+ var Pn = {}, B = {}, z = {}, ce = P && P.__awaiter || function(e, n, t, r) {
18
+ function s(i) {
19
+ return i instanceof t ? i : new t(function(o) {
20
+ o(i);
21
+ });
22
+ }
23
+ return new (t || (t = Promise))(function(i, o) {
24
+ function c(h) {
25
+ try {
26
+ E(r.next(h));
27
+ } catch (y) {
28
+ o(y);
29
+ }
30
+ }
31
+ function p(h) {
32
+ try {
33
+ E(r.throw(h));
34
+ } catch (y) {
35
+ o(y);
36
+ }
37
+ }
38
+ function E(h) {
39
+ h.done ? i(h.value) : s(h.value).then(c, p);
40
+ }
41
+ E((r = r.apply(e, n || [])).next());
42
+ });
43
+ };
44
+ Object.defineProperty(z, "__esModule", { value: !0 });
45
+ z.insertParams = $n;
46
+ z.stringifyQuery = Bn;
47
+ z.fetchData = zn;
48
+ z.getData = jn;
49
+ const Ln = (e) => typeof e == "object" && e !== null && ("code" in e || "statusCode" in e) && "message" in e;
50
+ function Rn(e, n, t) {
51
+ return e.replace(new RegExp(`\\{${n}\\}`, "g"), t);
52
+ }
53
+ function $n(e, n) {
54
+ return n ? Object.keys(n).reduce((t, r) => Rn(t, r, String(n[r])), e) : e;
55
+ }
56
+ function Bn(e) {
57
+ if (!e)
58
+ return "";
59
+ const n = new URLSearchParams();
60
+ Object.keys(e).forEach((r) => {
61
+ e[r] != null && n.append(r, String(e[r]));
62
+ });
63
+ const t = n.toString();
64
+ return t ? `?${t}` : "";
65
+ }
66
+ function et(e) {
67
+ return ce(this, void 0, void 0, function* () {
68
+ var n;
69
+ let t;
70
+ try {
71
+ t = yield e.json();
72
+ } catch {
73
+ t = {};
74
+ }
75
+ if (!e.ok) {
76
+ const r = Ln(t) ? `CGW error - ${(n = t.code) !== null && n !== void 0 ? n : t.statusCode}: ${t.message}` : `CGW error - status ${e.statusText}`;
77
+ throw new Error(r);
78
+ }
79
+ return t;
80
+ });
81
+ }
82
+ function zn(e, n, t, r, s) {
83
+ return ce(this, void 0, void 0, function* () {
84
+ const i = Object.assign({ "Content-Type": "application/json" }, r), o = {
85
+ method: n ?? "POST",
86
+ headers: i
87
+ };
88
+ s && (o.credentials = s), t != null && (o.body = typeof t == "string" ? t : JSON.stringify(t));
89
+ const c = yield fetch(e, o);
90
+ return et(c);
91
+ });
92
+ }
93
+ function jn(e, n, t) {
94
+ return ce(this, void 0, void 0, function* () {
95
+ const r = {
96
+ method: "GET"
97
+ };
98
+ n && (r.headers = Object.assign(Object.assign({}, n), { "Content-Type": "application/json" })), t && (r.credentials = t);
99
+ const s = yield fetch(e, r);
100
+ return et(s);
101
+ });
102
+ }
103
+ Object.defineProperty(B, "__esModule", { value: !0 });
104
+ B.postEndpoint = Un;
105
+ B.putEndpoint = Fn;
106
+ B.deleteEndpoint = Hn;
107
+ B.getEndpoint = Gn;
108
+ const M = z;
109
+ function X(e, n, t, r) {
110
+ const s = (0, M.insertParams)(n, t), i = (0, M.stringifyQuery)(r);
111
+ return `${e}${s}${i}`;
112
+ }
113
+ function Un(e, n, t) {
114
+ const r = X(e, n, t == null ? void 0 : t.path, t == null ? void 0 : t.query);
115
+ return (0, M.fetchData)(r, "POST", t == null ? void 0 : t.body, t == null ? void 0 : t.headers, t == null ? void 0 : t.credentials);
116
+ }
117
+ function Fn(e, n, t) {
118
+ const r = X(e, n, t == null ? void 0 : t.path, t == null ? void 0 : t.query);
119
+ return (0, M.fetchData)(r, "PUT", t == null ? void 0 : t.body, t == null ? void 0 : t.headers, t == null ? void 0 : t.credentials);
120
+ }
121
+ function Hn(e, n, t) {
122
+ const r = X(e, n, t == null ? void 0 : t.path, t == null ? void 0 : t.query);
123
+ return (0, M.fetchData)(r, "DELETE", t == null ? void 0 : t.body, t == null ? void 0 : t.headers, t == null ? void 0 : t.credentials);
124
+ }
125
+ function Gn(e, n, t, r) {
126
+ if (r)
127
+ return (0, M.getData)(r, void 0, t == null ? void 0 : t.credentials);
128
+ const s = X(e, n, t == null ? void 0 : t.path, t == null ? void 0 : t.query);
129
+ return (0, M.getData)(s, t == null ? void 0 : t.headers, t == null ? void 0 : t.credentials);
130
+ }
131
+ var q = {};
132
+ Object.defineProperty(q, "__esModule", { value: !0 });
133
+ q.DEFAULT_BASE_URL = void 0;
134
+ q.DEFAULT_BASE_URL = "https://safe-client.safe.global";
135
+ var Q = {};
136
+ Object.defineProperty(Q, "__esModule", { value: !0 });
137
+ Q.ImplementationVersionState = void 0;
138
+ var Te;
139
+ (function(e) {
140
+ e.UP_TO_DATE = "UP_TO_DATE", e.OUTDATED = "OUTDATED", e.UNKNOWN = "UNKNOWN";
141
+ })(Te || (Q.ImplementationVersionState = Te = {}));
142
+ var _ = {};
143
+ Object.defineProperty(_, "__esModule", { value: !0 });
144
+ _.SafeAppSocialPlatforms = _.SafeAppFeatures = _.SafeAppAccessPolicyTypes = void 0;
145
+ var me;
146
+ (function(e) {
147
+ e.NoRestrictions = "NO_RESTRICTIONS", e.DomainAllowlist = "DOMAIN_ALLOWLIST";
148
+ })(me || (_.SafeAppAccessPolicyTypes = me = {}));
149
+ var _e;
150
+ (function(e) {
151
+ e.BATCHED_TRANSACTIONS = "BATCHED_TRANSACTIONS";
152
+ })(_e || (_.SafeAppFeatures = _e = {}));
153
+ var Ne;
154
+ (function(e) {
155
+ e.TWITTER = "TWITTER", e.GITHUB = "GITHUB", e.DISCORD = "DISCORD", e.TELEGRAM = "TELEGRAM";
156
+ })(Ne || (_.SafeAppSocialPlatforms = Ne = {}));
157
+ var g = {};
158
+ Object.defineProperty(g, "__esModule", { value: !0 });
159
+ g.LabelValue = g.StartTimeValue = g.DurationType = g.DetailedExecutionInfoType = g.TransactionListItemType = g.ConflictType = g.TransactionInfoType = g.SettingsInfoType = g.TransactionTokenType = g.TransferDirection = g.TransactionStatus = g.Operation = void 0;
160
+ var Se;
161
+ (function(e) {
162
+ e[e.CALL = 0] = "CALL", e[e.DELEGATE = 1] = "DELEGATE";
163
+ })(Se || (g.Operation = Se = {}));
164
+ var Oe;
165
+ (function(e) {
166
+ e.AWAITING_CONFIRMATIONS = "AWAITING_CONFIRMATIONS", e.AWAITING_EXECUTION = "AWAITING_EXECUTION", e.CANCELLED = "CANCELLED", e.FAILED = "FAILED", e.SUCCESS = "SUCCESS";
167
+ })(Oe || (g.TransactionStatus = Oe = {}));
168
+ var De;
169
+ (function(e) {
170
+ e.INCOMING = "INCOMING", e.OUTGOING = "OUTGOING", e.UNKNOWN = "UNKNOWN";
171
+ })(De || (g.TransferDirection = De = {}));
172
+ var we;
173
+ (function(e) {
174
+ e.ERC20 = "ERC20", e.ERC721 = "ERC721", e.NATIVE_COIN = "NATIVE_COIN";
175
+ })(we || (g.TransactionTokenType = we = {}));
176
+ var Ce;
177
+ (function(e) {
178
+ e.SET_FALLBACK_HANDLER = "SET_FALLBACK_HANDLER", e.ADD_OWNER = "ADD_OWNER", e.REMOVE_OWNER = "REMOVE_OWNER", e.SWAP_OWNER = "SWAP_OWNER", e.CHANGE_THRESHOLD = "CHANGE_THRESHOLD", e.CHANGE_IMPLEMENTATION = "CHANGE_IMPLEMENTATION", e.ENABLE_MODULE = "ENABLE_MODULE", e.DISABLE_MODULE = "DISABLE_MODULE", e.SET_GUARD = "SET_GUARD", e.DELETE_GUARD = "DELETE_GUARD";
179
+ })(Ce || (g.SettingsInfoType = Ce = {}));
180
+ var Me;
181
+ (function(e) {
182
+ e.TRANSFER = "Transfer", e.SETTINGS_CHANGE = "SettingsChange", e.CUSTOM = "Custom", e.CREATION = "Creation", e.SWAP_ORDER = "SwapOrder", e.TWAP_ORDER = "TwapOrder", e.SWAP_TRANSFER = "SwapTransfer", e.NATIVE_STAKING_DEPOSIT = "NativeStakingDeposit", e.NATIVE_STAKING_VALIDATORS_EXIT = "NativeStakingValidatorsExit", e.NATIVE_STAKING_WITHDRAW = "NativeStakingWithdraw";
183
+ })(Me || (g.TransactionInfoType = Me = {}));
184
+ var xe;
185
+ (function(e) {
186
+ e.NONE = "None", e.HAS_NEXT = "HasNext", e.END = "End";
187
+ })(xe || (g.ConflictType = xe = {}));
188
+ var Pe;
189
+ (function(e) {
190
+ e.TRANSACTION = "TRANSACTION", e.LABEL = "LABEL", e.CONFLICT_HEADER = "CONFLICT_HEADER", e.DATE_LABEL = "DATE_LABEL";
191
+ })(Pe || (g.TransactionListItemType = Pe = {}));
192
+ var Le;
193
+ (function(e) {
194
+ e.MULTISIG = "MULTISIG", e.MODULE = "MODULE";
195
+ })(Le || (g.DetailedExecutionInfoType = Le = {}));
196
+ var Re;
197
+ (function(e) {
198
+ e.AUTO = "AUTO", e.LIMIT_DURATION = "LIMIT_DURATION";
199
+ })(Re || (g.DurationType = Re = {}));
200
+ var $e;
201
+ (function(e) {
202
+ e.AT_MINING_TIME = "AT_MINING_TIME", e.AT_EPOCH = "AT_EPOCH";
203
+ })($e || (g.StartTimeValue = $e = {}));
204
+ var Be;
205
+ (function(e) {
206
+ e.Queued = "Queued", e.Next = "Next";
207
+ })(Be || (g.LabelValue = Be = {}));
208
+ var N = {};
209
+ Object.defineProperty(N, "__esModule", { value: !0 });
210
+ N.FEATURES = N.GAS_PRICE_TYPE = N.RPC_AUTHENTICATION = void 0;
211
+ var ze;
212
+ (function(e) {
213
+ e.API_KEY_PATH = "API_KEY_PATH", e.NO_AUTHENTICATION = "NO_AUTHENTICATION", e.UNKNOWN = "UNKNOWN";
214
+ })(ze || (N.RPC_AUTHENTICATION = ze = {}));
215
+ var je;
216
+ (function(e) {
217
+ e.ORACLE = "ORACLE", e.FIXED = "FIXED", e.FIXED_1559 = "FIXED1559", e.UNKNOWN = "UNKNOWN";
218
+ })(je || (N.GAS_PRICE_TYPE = je = {}));
219
+ var Ue;
220
+ (function(e) {
221
+ e.ERC721 = "ERC721", e.SAFE_APPS = "SAFE_APPS", e.CONTRACT_INTERACTION = "CONTRACT_INTERACTION", e.DOMAIN_LOOKUP = "DOMAIN_LOOKUP", e.SPENDING_LIMIT = "SPENDING_LIMIT", e.EIP1559 = "EIP1559", e.SAFE_TX_GAS_OPTIONAL = "SAFE_TX_GAS_OPTIONAL", e.TX_SIMULATION = "TX_SIMULATION", e.EIP1271 = "EIP1271";
222
+ })(Ue || (N.FEATURES = Ue = {}));
223
+ var Y = {};
224
+ Object.defineProperty(Y, "__esModule", { value: !0 });
225
+ Y.TokenType = void 0;
226
+ var Fe;
227
+ (function(e) {
228
+ e.ERC20 = "ERC20", e.ERC721 = "ERC721", e.NATIVE_TOKEN = "NATIVE_TOKEN", e.UNKNOWN = "UNKNOWN";
229
+ })(Fe || (Y.TokenType = Fe = {}));
230
+ var tt = {};
231
+ Object.defineProperty(tt, "__esModule", { value: !0 });
232
+ var L = {};
233
+ Object.defineProperty(L, "__esModule", { value: !0 });
234
+ L.NativeStakingStatus = L.ConfirmationViewTypes = void 0;
235
+ var He;
236
+ (function(e) {
237
+ e.GENERIC = "GENERIC", e.COW_SWAP_ORDER = "COW_SWAP_ORDER", e.COW_SWAP_TWAP_ORDER = "COW_SWAP_TWAP_ORDER", e.KILN_NATIVE_STAKING_DEPOSIT = "KILN_NATIVE_STAKING_DEPOSIT", e.KILN_NATIVE_STAKING_VALIDATORS_EXIT = "KILN_NATIVE_STAKING_VALIDATORS_EXIT", e.KILN_NATIVE_STAKING_WITHDRAW = "KILN_NATIVE_STAKING_WITHDRAW";
238
+ })(He || (L.ConfirmationViewTypes = He = {}));
239
+ var Ge;
240
+ (function(e) {
241
+ e.NOT_STAKED = "NOT_STAKED", e.ACTIVATING = "ACTIVATING", e.DEPOSIT_IN_PROGRESS = "DEPOSIT_IN_PROGRESS", e.ACTIVE = "ACTIVE", e.EXIT_REQUESTED = "EXIT_REQUESTED", e.EXITING = "EXITING", e.EXITED = "EXITED", e.SLASHED = "SLASHED";
242
+ })(Ge || (L.NativeStakingStatus = Ge = {}));
243
+ var R = {};
244
+ Object.defineProperty(R, "__esModule", { value: !0 });
245
+ R.SafeMessageStatus = R.SafeMessageListItemType = void 0;
246
+ var We;
247
+ (function(e) {
248
+ e.DATE_LABEL = "DATE_LABEL", e.MESSAGE = "MESSAGE";
249
+ })(We || (R.SafeMessageListItemType = We = {}));
250
+ var ke;
251
+ (function(e) {
252
+ e.NEEDS_CONFIRMATION = "NEEDS_CONFIRMATION", e.CONFIRMED = "CONFIRMED";
253
+ })(ke || (R.SafeMessageStatus = ke = {}));
254
+ var J = {};
255
+ Object.defineProperty(J, "__esModule", { value: !0 });
256
+ J.DeviceType = void 0;
257
+ var Ve;
258
+ (function(e) {
259
+ e.ANDROID = "ANDROID", e.IOS = "IOS", e.WEB = "WEB";
260
+ })(Ve || (J.DeviceType = Ve = {}));
261
+ var nt = {};
262
+ Object.defineProperty(nt, "__esModule", { value: !0 });
263
+ (function(e) {
264
+ var n = P && P.__createBinding || (Object.create ? function(a, u, d, l) {
265
+ l === void 0 && (l = d);
266
+ var b = Object.getOwnPropertyDescriptor(u, d);
267
+ (!b || ("get" in b ? !u.__esModule : b.writable || b.configurable)) && (b = { enumerable: !0, get: function() {
268
+ return u[d];
269
+ } }), Object.defineProperty(a, l, b);
270
+ } : function(a, u, d, l) {
271
+ l === void 0 && (l = d), a[l] = u[d];
272
+ }), t = P && P.__exportStar || function(a, u) {
273
+ for (var d in a) d !== "default" && !Object.prototype.hasOwnProperty.call(u, d) && n(u, a, d);
274
+ };
275
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.setBaseUrl = void 0, e.relayTransaction = c, e.getRelayCount = p, e.getSafeInfo = E, e.getIncomingTransfers = h, e.getModuleTransactions = y, e.getMultisigTransactions = T, e.getBalances = I, e.getFiatCurrencies = G, e.getOwnedSafes = te, e.getAllOwnedSafes = C, e.getCollectibles = ne, e.getCollectiblesPage = xt, e.getTransactionHistory = Pt, e.getTransactionQueue = Lt, e.getTransactionDetails = Rt, e.deleteTransaction = $t, e.postSafeGasEstimation = Bt, e.getNonces = zt, e.proposeTransaction = jt, e.getConfirmationView = Ut, e.getTxPreview = Ft, e.getChainsConfig = Ht, e.getChainConfig = Gt, e.getSafeApps = Wt, e.getMasterCopies = kt, e.getDecodedData = Vt, e.getSafeMessages = Kt, e.getSafeMessage = Xt, e.proposeSafeMessage = qt, e.confirmSafeMessage = Qt, e.getDelegates = Yt, e.registerDevice = Jt, e.unregisterSafe = Zt, e.unregisterDevice = en, e.registerEmail = tn, e.changeEmail = nn, e.resendEmailVerificationCode = rn, e.verifyEmail = sn, e.getRegisteredEmail = on, e.deleteRegisteredEmail = an, e.registerRecoveryModule = cn, e.unsubscribeSingle = un, e.unsubscribeAll = dn, e.getSafeOverviews = fn, e.getContract = ln, e.getAuthNonce = hn, e.verifyAuth = gn, e.createAccount = pn, e.getAccount = En, e.deleteAccount = yn, e.getAccountDataTypes = An, e.getAccountDataSettings = bn, e.putAccountDataSettings = In, e.getIndexingStatus = vn;
276
+ const r = B, s = q;
277
+ t(Q, e), t(_, e), t(g, e), t(N, e), t(Y, e), t(tt, e), t(L, e), t(R, e), t(J, e), t(nt, e);
278
+ let i = s.DEFAULT_BASE_URL;
279
+ const o = (a) => {
280
+ i = a;
281
+ };
282
+ e.setBaseUrl = o;
283
+ function c(a, u) {
284
+ return (0, r.postEndpoint)(i, "/v1/chains/{chainId}/relay", { path: { chainId: a }, body: u });
285
+ }
286
+ function p(a, u) {
287
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/relay/{address}", { path: { chainId: a, address: u } });
288
+ }
289
+ function E(a, u) {
290
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{address}", { path: { chainId: a, address: u } });
291
+ }
292
+ function h(a, u, d, l) {
293
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{address}/incoming-transfers/", {
294
+ path: { chainId: a, address: u },
295
+ query: d
296
+ }, l);
297
+ }
298
+ function y(a, u, d, l) {
299
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{address}/module-transactions/", {
300
+ path: { chainId: a, address: u },
301
+ query: d
302
+ }, l);
303
+ }
304
+ function T(a, u, d, l) {
305
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{address}/multisig-transactions/", {
306
+ path: { chainId: a, address: u },
307
+ query: d
308
+ }, l);
309
+ }
310
+ function I(a, u, d = "usd", l = {}) {
311
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{address}/balances/{currency}", {
312
+ path: { chainId: a, address: u, currency: d },
313
+ query: l
314
+ });
315
+ }
316
+ function G() {
317
+ return (0, r.getEndpoint)(i, "/v1/balances/supported-fiat-codes");
318
+ }
319
+ function te(a, u) {
320
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/owners/{address}/safes", { path: { chainId: a, address: u } });
321
+ }
322
+ function C(a) {
323
+ return (0, r.getEndpoint)(i, "/v1/owners/{address}/safes", { path: { address: a } });
324
+ }
325
+ function ne(a, u, d = {}) {
326
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{address}/collectibles", {
327
+ path: { chainId: a, address: u },
328
+ query: d
329
+ });
330
+ }
331
+ function xt(a, u, d = {}, l) {
332
+ return (0, r.getEndpoint)(i, "/v2/chains/{chainId}/safes/{address}/collectibles", { path: { chainId: a, address: u }, query: d }, l);
333
+ }
334
+ function Pt(a, u, d = {}, l) {
335
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/transactions/history", { path: { chainId: a, safe_address: u }, query: d }, l);
336
+ }
337
+ function Lt(a, u, d = {}, l) {
338
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/transactions/queued", { path: { chainId: a, safe_address: u }, query: d }, l);
339
+ }
340
+ function Rt(a, u) {
341
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/transactions/{transactionId}", {
342
+ path: { chainId: a, transactionId: u }
343
+ });
344
+ }
345
+ function $t(a, u, d) {
346
+ return (0, r.deleteEndpoint)(i, "/v1/chains/{chainId}/transactions/{safeTxHash}", {
347
+ path: { chainId: a, safeTxHash: u },
348
+ body: { signature: d }
349
+ });
350
+ }
351
+ function Bt(a, u, d) {
352
+ return (0, r.postEndpoint)(i, "/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations", {
353
+ path: { chainId: a, safe_address: u },
354
+ body: d
355
+ });
356
+ }
357
+ function zt(a, u) {
358
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/nonces", {
359
+ path: { chainId: a, safe_address: u }
360
+ });
361
+ }
362
+ function jt(a, u, d) {
363
+ return (0, r.postEndpoint)(i, "/v1/chains/{chainId}/transactions/{safe_address}/propose", {
364
+ path: { chainId: a, safe_address: u },
365
+ body: d
366
+ });
367
+ }
368
+ function Ut(a, u, d, l, b, re) {
369
+ return (0, r.postEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation", {
370
+ path: { chainId: a, safe_address: u },
371
+ body: { operation: d, data: l, to: b, value: re }
372
+ });
373
+ }
374
+ function Ft(a, u, d, l, b, re) {
375
+ return (0, r.postEndpoint)(i, "/v1/chains/{chainId}/transactions/{safe_address}/preview", {
376
+ path: { chainId: a, safe_address: u },
377
+ body: { operation: d, data: l, to: b, value: re }
378
+ });
379
+ }
380
+ function Ht(a) {
381
+ return (0, r.getEndpoint)(i, "/v1/chains", {
382
+ query: a
383
+ });
384
+ }
385
+ function Gt(a) {
386
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}", {
387
+ path: { chainId: a }
388
+ });
389
+ }
390
+ function Wt(a, u = {}) {
391
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safe-apps", {
392
+ path: { chainId: a },
393
+ query: u
394
+ });
395
+ }
396
+ function kt(a) {
397
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/about/master-copies", {
398
+ path: { chainId: a }
399
+ });
400
+ }
401
+ function Vt(a, u, d, l) {
402
+ return (0, r.postEndpoint)(i, "/v1/chains/{chainId}/data-decoder", {
403
+ path: { chainId: a },
404
+ body: { operation: u, data: d, to: l }
405
+ });
406
+ }
407
+ function Kt(a, u, d) {
408
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/messages", { path: { chainId: a, safe_address: u }, query: {} }, d);
409
+ }
410
+ function Xt(a, u) {
411
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/messages/{message_hash}", {
412
+ path: { chainId: a, message_hash: u }
413
+ });
414
+ }
415
+ function qt(a, u, d) {
416
+ return (0, r.postEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/messages", {
417
+ path: { chainId: a, safe_address: u },
418
+ body: d
419
+ });
420
+ }
421
+ function Qt(a, u, d) {
422
+ return (0, r.postEndpoint)(i, "/v1/chains/{chainId}/messages/{message_hash}/signatures", {
423
+ path: { chainId: a, message_hash: u },
424
+ body: d
425
+ });
426
+ }
427
+ function Yt(a, u = {}) {
428
+ return (0, r.getEndpoint)(i, "/v2/chains/{chainId}/delegates", {
429
+ path: { chainId: a },
430
+ query: u
431
+ });
432
+ }
433
+ function Jt(a) {
434
+ return (0, r.postEndpoint)(i, "/v1/register/notifications", {
435
+ body: a
436
+ });
437
+ }
438
+ function Zt(a, u, d) {
439
+ return (0, r.deleteEndpoint)(i, "/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}", {
440
+ path: { chainId: a, safe_address: u, uuid: d }
441
+ });
442
+ }
443
+ function en(a, u) {
444
+ return (0, r.deleteEndpoint)(i, "/v1/chains/{chainId}/notifications/devices/{uuid}", {
445
+ path: { chainId: a, uuid: u }
446
+ });
447
+ }
448
+ function tn(a, u, d, l) {
449
+ return (0, r.postEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/emails", {
450
+ path: { chainId: a, safe_address: u },
451
+ body: d,
452
+ headers: l
453
+ });
454
+ }
455
+ function nn(a, u, d, l, b) {
456
+ return (0, r.putEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
457
+ path: { chainId: a, safe_address: u, signer: d },
458
+ body: l,
459
+ headers: b
460
+ });
461
+ }
462
+ function rn(a, u, d) {
463
+ return (0, r.postEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend", {
464
+ path: { chainId: a, safe_address: u, signer: d },
465
+ body: ""
466
+ });
467
+ }
468
+ function sn(a, u, d, l) {
469
+ return (0, r.putEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify", {
470
+ path: { chainId: a, safe_address: u, signer: d },
471
+ body: l
472
+ });
473
+ }
474
+ function on(a, u, d, l) {
475
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
476
+ path: { chainId: a, safe_address: u, signer: d },
477
+ headers: l
478
+ });
479
+ }
480
+ function an(a, u, d, l) {
481
+ return (0, r.deleteEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}", {
482
+ path: { chainId: a, safe_address: u, signer: d },
483
+ headers: l
484
+ });
485
+ }
486
+ function cn(a, u, d) {
487
+ return (0, r.postEndpoint)(i, "/v1/chains/{chainId}/safes/{safe_address}/recovery", {
488
+ path: { chainId: a, safe_address: u },
489
+ body: d
490
+ });
491
+ }
492
+ function un(a) {
493
+ return (0, r.deleteEndpoint)(i, "/v1/subscriptions", { query: a });
494
+ }
495
+ function dn(a) {
496
+ return (0, r.deleteEndpoint)(i, "/v1/subscriptions/all", { query: a });
497
+ }
498
+ function fn(a, u) {
499
+ return (0, r.getEndpoint)(i, "/v1/safes", {
500
+ query: Object.assign(Object.assign({}, u), { safes: a.join(",") })
501
+ });
502
+ }
503
+ function ln(a, u) {
504
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/contracts/{contractAddress}", {
505
+ path: {
506
+ chainId: a,
507
+ contractAddress: u
508
+ }
509
+ });
510
+ }
511
+ function hn() {
512
+ return (0, r.getEndpoint)(i, "/v1/auth/nonce", { credentials: "include" });
513
+ }
514
+ function gn(a) {
515
+ return (0, r.postEndpoint)(i, "/v1/auth/verify", {
516
+ body: a,
517
+ credentials: "include"
518
+ });
519
+ }
520
+ function pn(a) {
521
+ return (0, r.postEndpoint)(i, "/v1/accounts", {
522
+ body: a,
523
+ credentials: "include"
524
+ });
525
+ }
526
+ function En(a) {
527
+ return (0, r.getEndpoint)(i, "/v1/accounts/{address}", {
528
+ path: { address: a },
529
+ credentials: "include"
530
+ });
531
+ }
532
+ function yn(a) {
533
+ return (0, r.deleteEndpoint)(i, "/v1/accounts/{address}", {
534
+ path: { address: a },
535
+ credentials: "include"
536
+ });
537
+ }
538
+ function An() {
539
+ return (0, r.getEndpoint)(i, "/v1/accounts/data-types");
540
+ }
541
+ function bn(a) {
542
+ return (0, r.getEndpoint)(i, "/v1/accounts/{address}/data-settings", {
543
+ path: { address: a },
544
+ credentials: "include"
545
+ });
546
+ }
547
+ function In(a, u) {
548
+ return (0, r.putEndpoint)(i, "/v1/accounts/{address}/data-settings", {
549
+ path: { address: a },
550
+ body: u,
551
+ credentials: "include"
552
+ });
553
+ }
554
+ function vn(a) {
555
+ return (0, r.getEndpoint)(i, "/v1/chains/{chainId}/about/indexing", {
556
+ path: { chainId: a }
557
+ });
558
+ }
559
+ })(Pn);
560
+ function Wn(e, n) {
561
+ const t = e.exec(n);
562
+ return t == null ? void 0 : t.groups;
563
+ }
564
+ const es = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, ts = /^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)?$/, ns = /^\(.+?\).*?$/, Ke = /^tuple(?<array>(\[(\d*)\])*)$/;
565
+ function oe(e) {
566
+ let n = e.type;
567
+ if (Ke.test(e.type) && "components" in e) {
568
+ n = "(";
569
+ const t = e.components.length;
570
+ for (let s = 0; s < t; s++) {
571
+ const i = e.components[s];
572
+ n += oe(i), s < t - 1 && (n += ", ");
573
+ }
574
+ const r = Wn(Ke, e.type);
575
+ return n += `)${(r == null ? void 0 : r.array) || ""}`, oe({
576
+ ...e,
577
+ type: n
578
+ });
579
+ }
580
+ return "indexed" in e && e.indexed && (n = `${n} indexed`), e.name ? `${n} ${e.name}` : n;
581
+ }
582
+ function U(e) {
583
+ let n = "";
584
+ const t = e.length;
585
+ for (let r = 0; r < t; r++) {
586
+ const s = e[r];
587
+ n += oe(s), r !== t - 1 && (n += ", ");
588
+ }
589
+ return n;
590
+ }
591
+ function kn(e) {
592
+ var n;
593
+ return e.type === "function" ? `function ${e.name}(${U(e.inputs)})${e.stateMutability && e.stateMutability !== "nonpayable" ? ` ${e.stateMutability}` : ""}${(n = e.outputs) != null && n.length ? ` returns (${U(e.outputs)})` : ""}` : e.type === "event" ? `event ${e.name}(${U(e.inputs)})` : e.type === "error" ? `error ${e.name}(${U(e.inputs)})` : e.type === "constructor" ? `constructor(${U(e.inputs)})${e.stateMutability === "payable" ? " payable" : ""}` : e.type === "fallback" ? `fallback() external${e.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable";
594
+ }
595
+ function V(e, { includeName: n = !1 } = {}) {
596
+ if (e.type !== "function" && e.type !== "event" && e.type !== "error")
597
+ throw new er(e.type);
598
+ return `${e.name}(${Z(e.inputs, { includeName: n })})`;
599
+ }
600
+ function Z(e, { includeName: n = !1 } = {}) {
601
+ return e ? e.map((t) => Vn(t, { includeName: n })).join(n ? ", " : ",") : "";
602
+ }
603
+ function Vn(e, { includeName: n }) {
604
+ return e.type.startsWith("tuple") ? `(${Z(e.components, { includeName: n })})${e.type.slice(5)}` : e.type + (n && e.name ? ` ${e.name}` : "");
605
+ }
606
+ function H(e, { strict: n = !0 } = {}) {
607
+ return !e || typeof e != "string" ? !1 : n ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
608
+ }
609
+ function A(e) {
610
+ return H(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
611
+ }
612
+ const rt = "2.47.6";
613
+ let x = {
614
+ getDocsUrl: ({ docsBaseUrl: e, docsPath: n = "", docsSlug: t }) => n ? `${e ?? "https://viem.sh"}${n}${t ? `#${t}` : ""}` : void 0,
615
+ version: `viem@${rt}`
616
+ };
617
+ function rs(e) {
618
+ x = e;
619
+ }
620
+ class f extends Error {
621
+ constructor(n, t = {}) {
622
+ var c;
623
+ const r = (() => {
624
+ var p;
625
+ return t.cause instanceof f ? t.cause.details : (p = t.cause) != null && p.message ? t.cause.message : t.details;
626
+ })(), s = t.cause instanceof f && t.cause.docsPath || t.docsPath, i = (c = x.getDocsUrl) == null ? void 0 : c.call(x, { ...t, docsPath: s }), o = [
627
+ n || "An error occurred.",
628
+ "",
629
+ ...t.metaMessages ? [...t.metaMessages, ""] : [],
630
+ ...i ? [`Docs: ${i}`] : [],
631
+ ...r ? [`Details: ${r}`] : [],
632
+ ...x.version ? [`Version: ${x.version}`] : []
633
+ ].join(`
634
+ `);
635
+ super(o, t.cause ? { cause: t.cause } : void 0), Object.defineProperty(this, "details", {
636
+ enumerable: !0,
637
+ configurable: !0,
638
+ writable: !0,
639
+ value: void 0
640
+ }), Object.defineProperty(this, "docsPath", {
641
+ enumerable: !0,
642
+ configurable: !0,
643
+ writable: !0,
644
+ value: void 0
645
+ }), Object.defineProperty(this, "metaMessages", {
646
+ enumerable: !0,
647
+ configurable: !0,
648
+ writable: !0,
649
+ value: void 0
650
+ }), Object.defineProperty(this, "shortMessage", {
651
+ enumerable: !0,
652
+ configurable: !0,
653
+ writable: !0,
654
+ value: void 0
655
+ }), Object.defineProperty(this, "version", {
656
+ enumerable: !0,
657
+ configurable: !0,
658
+ writable: !0,
659
+ value: void 0
660
+ }), Object.defineProperty(this, "name", {
661
+ enumerable: !0,
662
+ configurable: !0,
663
+ writable: !0,
664
+ value: "BaseError"
665
+ }), this.details = r, this.docsPath = s, this.metaMessages = t.metaMessages, this.name = t.name ?? this.name, this.shortMessage = n, this.version = rt;
666
+ }
667
+ walk(n) {
668
+ return st(this, n);
669
+ }
670
+ }
671
+ function st(e, n) {
672
+ return n != null && n(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? st(e.cause, n) : n ? null : e;
673
+ }
674
+ class ss extends f {
675
+ constructor({ docsPath: n }) {
676
+ super([
677
+ "A constructor was not found on the ABI.",
678
+ "Make sure you are using the correct ABI and that the constructor exists on it."
679
+ ].join(`
680
+ `), {
681
+ docsPath: n,
682
+ name: "AbiConstructorNotFoundError"
683
+ });
684
+ }
685
+ }
686
+ class is extends f {
687
+ constructor({ docsPath: n }) {
688
+ super([
689
+ "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
690
+ "Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
691
+ ].join(`
692
+ `), {
693
+ docsPath: n,
694
+ name: "AbiConstructorParamsNotFoundError"
695
+ });
696
+ }
697
+ }
698
+ class os extends f {
699
+ constructor({ data: n, size: t }) {
700
+ super([
701
+ `Data size of ${t} bytes is invalid.`,
702
+ "Size must be in increments of 32 bytes (size % 32 === 0)."
703
+ ].join(`
704
+ `), {
705
+ metaMessages: [`Data: ${n} (${t} bytes)`],
706
+ name: "AbiDecodingDataSizeInvalidError"
707
+ });
708
+ }
709
+ }
710
+ class as extends f {
711
+ constructor({ data: n, params: t, size: r }) {
712
+ super([`Data size of ${r} bytes is too small for given parameters.`].join(`
713
+ `), {
714
+ metaMessages: [
715
+ `Params: (${Z(t, { includeName: !0 })})`,
716
+ `Data: ${n} (${r} bytes)`
717
+ ],
718
+ name: "AbiDecodingDataSizeTooSmallError"
719
+ }), Object.defineProperty(this, "data", {
720
+ enumerable: !0,
721
+ configurable: !0,
722
+ writable: !0,
723
+ value: void 0
724
+ }), Object.defineProperty(this, "params", {
725
+ enumerable: !0,
726
+ configurable: !0,
727
+ writable: !0,
728
+ value: void 0
729
+ }), Object.defineProperty(this, "size", {
730
+ enumerable: !0,
731
+ configurable: !0,
732
+ writable: !0,
733
+ value: void 0
734
+ }), this.data = n, this.params = t, this.size = r;
735
+ }
736
+ }
737
+ class cs extends f {
738
+ constructor({ cause: n } = {}) {
739
+ super('Cannot decode zero data ("0x") with ABI parameters.', {
740
+ name: "AbiDecodingZeroDataError",
741
+ cause: n
742
+ });
743
+ }
744
+ }
745
+ class Kn extends f {
746
+ constructor({ expectedLength: n, givenLength: t, type: r }) {
747
+ super([
748
+ `ABI encoding array length mismatch for type ${r}.`,
749
+ `Expected length: ${n}`,
750
+ `Given length: ${t}`
751
+ ].join(`
752
+ `), { name: "AbiEncodingArrayLengthMismatchError" });
753
+ }
754
+ }
755
+ class Xn extends f {
756
+ constructor({ expectedSize: n, value: t }) {
757
+ super(`Size of bytes "${t}" (bytes${A(t)}) does not match expected size (bytes${n}).`, { name: "AbiEncodingBytesSizeMismatchError" });
758
+ }
759
+ }
760
+ class qn extends f {
761
+ constructor({ expectedLength: n, givenLength: t }) {
762
+ super([
763
+ "ABI encoding params/values length mismatch.",
764
+ `Expected length (params): ${n}`,
765
+ `Given length (values): ${t}`
766
+ ].join(`
767
+ `), { name: "AbiEncodingLengthMismatchError" });
768
+ }
769
+ }
770
+ class us extends f {
771
+ constructor(n, { docsPath: t }) {
772
+ super([
773
+ `Arguments (\`args\`) were provided to "${n}", but "${n}" on the ABI does not contain any parameters (\`inputs\`).`,
774
+ "Cannot encode error result without knowing what the parameter types are.",
775
+ "Make sure you are using the correct ABI and that the inputs exist on it."
776
+ ].join(`
777
+ `), {
778
+ docsPath: t,
779
+ name: "AbiErrorInputsNotFoundError"
780
+ });
781
+ }
782
+ }
783
+ class ds extends f {
784
+ constructor(n, { docsPath: t } = {}) {
785
+ super([
786
+ `Error ${n ? `"${n}" ` : ""}not found on ABI.`,
787
+ "Make sure you are using the correct ABI and that the error exists on it."
788
+ ].join(`
789
+ `), {
790
+ docsPath: t,
791
+ name: "AbiErrorNotFoundError"
792
+ });
793
+ }
794
+ }
795
+ class fs extends f {
796
+ constructor(n, { docsPath: t, cause: r }) {
797
+ super([
798
+ `Encoded error signature "${n}" not found on ABI.`,
799
+ "Make sure you are using the correct ABI and that the error exists on it.",
800
+ `You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${n}.`
801
+ ].join(`
802
+ `), {
803
+ docsPath: t,
804
+ name: "AbiErrorSignatureNotFoundError",
805
+ cause: r
806
+ }), Object.defineProperty(this, "signature", {
807
+ enumerable: !0,
808
+ configurable: !0,
809
+ writable: !0,
810
+ value: void 0
811
+ }), this.signature = n;
812
+ }
813
+ }
814
+ class ls extends f {
815
+ constructor({ docsPath: n }) {
816
+ super("Cannot extract event signature from empty topics.", {
817
+ docsPath: n,
818
+ name: "AbiEventSignatureEmptyTopicsError"
819
+ });
820
+ }
821
+ }
822
+ class hs extends f {
823
+ constructor(n, { docsPath: t }) {
824
+ super([
825
+ `Encoded event signature "${n}" not found on ABI.`,
826
+ "Make sure you are using the correct ABI and that the event exists on it.",
827
+ `You can look up the signature here: https://4byte.sourcify.dev/?q=${n}.`
828
+ ].join(`
829
+ `), {
830
+ docsPath: t,
831
+ name: "AbiEventSignatureNotFoundError"
832
+ });
833
+ }
834
+ }
835
+ class gs extends f {
836
+ constructor(n, { docsPath: t } = {}) {
837
+ super([
838
+ `Event ${n ? `"${n}" ` : ""}not found on ABI.`,
839
+ "Make sure you are using the correct ABI and that the event exists on it."
840
+ ].join(`
841
+ `), {
842
+ docsPath: t,
843
+ name: "AbiEventNotFoundError"
844
+ });
845
+ }
846
+ }
847
+ class Xe extends f {
848
+ constructor(n, { docsPath: t } = {}) {
849
+ super([
850
+ `Function ${n ? `"${n}" ` : ""}not found on ABI.`,
851
+ "Make sure you are using the correct ABI and that the function exists on it."
852
+ ].join(`
853
+ `), {
854
+ docsPath: t,
855
+ name: "AbiFunctionNotFoundError"
856
+ });
857
+ }
858
+ }
859
+ class ps extends f {
860
+ constructor(n, { docsPath: t }) {
861
+ super([
862
+ `Function "${n}" does not contain any \`outputs\` on ABI.`,
863
+ "Cannot decode function result without knowing what the parameter types are.",
864
+ "Make sure you are using the correct ABI and that the function exists on it."
865
+ ].join(`
866
+ `), {
867
+ docsPath: t,
868
+ name: "AbiFunctionOutputsNotFoundError"
869
+ });
870
+ }
871
+ }
872
+ class Es extends f {
873
+ constructor(n, { docsPath: t }) {
874
+ super([
875
+ `Encoded function signature "${n}" not found on ABI.`,
876
+ "Make sure you are using the correct ABI and that the function exists on it.",
877
+ `You can look up the signature here: https://4byte.sourcify.dev/?q=${n}.`
878
+ ].join(`
879
+ `), {
880
+ docsPath: t,
881
+ name: "AbiFunctionSignatureNotFoundError"
882
+ });
883
+ }
884
+ }
885
+ class Qn extends f {
886
+ constructor(n, t) {
887
+ super("Found ambiguous types in overloaded ABI items.", {
888
+ metaMessages: [
889
+ `\`${n.type}\` in \`${V(n.abiItem)}\`, and`,
890
+ `\`${t.type}\` in \`${V(t.abiItem)}\``,
891
+ "",
892
+ "These types encode differently and cannot be distinguished at runtime.",
893
+ "Remove one of the ambiguous items in the ABI."
894
+ ],
895
+ name: "AbiItemAmbiguityError"
896
+ });
897
+ }
898
+ }
899
+ class Yn extends f {
900
+ constructor({ expectedSize: n, givenSize: t }) {
901
+ super(`Expected bytes${n}, got bytes${t}.`, {
902
+ name: "BytesSizeMismatchError"
903
+ });
904
+ }
905
+ }
906
+ class ys extends f {
907
+ constructor({ abiItem: n, data: t, params: r, size: s }) {
908
+ super([
909
+ `Data size of ${s} bytes is too small for non-indexed event parameters.`
910
+ ].join(`
911
+ `), {
912
+ metaMessages: [
913
+ `Params: (${Z(r, { includeName: !0 })})`,
914
+ `Data: ${t} (${s} bytes)`
915
+ ],
916
+ name: "DecodeLogDataMismatch"
917
+ }), Object.defineProperty(this, "abiItem", {
918
+ enumerable: !0,
919
+ configurable: !0,
920
+ writable: !0,
921
+ value: void 0
922
+ }), Object.defineProperty(this, "data", {
923
+ enumerable: !0,
924
+ configurable: !0,
925
+ writable: !0,
926
+ value: void 0
927
+ }), Object.defineProperty(this, "params", {
928
+ enumerable: !0,
929
+ configurable: !0,
930
+ writable: !0,
931
+ value: void 0
932
+ }), Object.defineProperty(this, "size", {
933
+ enumerable: !0,
934
+ configurable: !0,
935
+ writable: !0,
936
+ value: void 0
937
+ }), this.abiItem = n, this.data = t, this.params = r, this.size = s;
938
+ }
939
+ }
940
+ class As extends f {
941
+ constructor({ abiItem: n, param: t }) {
942
+ super([
943
+ `Expected a topic for indexed event parameter${t.name ? ` "${t.name}"` : ""} on event "${V(n, { includeName: !0 })}".`
944
+ ].join(`
945
+ `), { name: "DecodeLogTopicsMismatch" }), Object.defineProperty(this, "abiItem", {
946
+ enumerable: !0,
947
+ configurable: !0,
948
+ writable: !0,
949
+ value: void 0
950
+ }), this.abiItem = n;
951
+ }
952
+ }
953
+ class Jn extends f {
954
+ constructor(n, { docsPath: t }) {
955
+ super([
956
+ `Type "${n}" is not a valid encoding type.`,
957
+ "Please provide a valid ABI type."
958
+ ].join(`
959
+ `), { docsPath: t, name: "InvalidAbiEncodingType" });
960
+ }
961
+ }
962
+ class bs extends f {
963
+ constructor(n, { docsPath: t }) {
964
+ super([
965
+ `Type "${n}" is not a valid decoding type.`,
966
+ "Please provide a valid ABI type."
967
+ ].join(`
968
+ `), { docsPath: t, name: "InvalidAbiDecodingType" });
969
+ }
970
+ }
971
+ class Zn extends f {
972
+ constructor(n) {
973
+ super([`Value "${n}" is not a valid array.`].join(`
974
+ `), {
975
+ name: "InvalidArrayError"
976
+ });
977
+ }
978
+ }
979
+ class er extends f {
980
+ constructor(n) {
981
+ super([
982
+ `"${n}" is not a valid definition type.`,
983
+ 'Valid types: "function", "event", "error"'
984
+ ].join(`
985
+ `), { name: "InvalidDefinitionTypeError" });
986
+ }
987
+ }
988
+ class Is extends f {
989
+ constructor(n) {
990
+ super(`Type "${n}" is not supported for packed encoding.`, {
991
+ name: "UnsupportedPackedAbiType"
992
+ });
993
+ }
994
+ }
995
+ class it extends f {
996
+ constructor({ offset: n, position: t, size: r }) {
997
+ super(`Slice ${t === "start" ? "starting" : "ending"} at offset "${n}" is out-of-bounds (size: ${r}).`, { name: "SliceOffsetOutOfBoundsError" });
998
+ }
999
+ }
1000
+ class ot extends f {
1001
+ constructor({ size: n, targetSize: t, type: r }) {
1002
+ super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${n}) exceeds padding size (${t}).`, { name: "SizeExceedsPaddingSizeError" });
1003
+ }
1004
+ }
1005
+ class vs extends f {
1006
+ constructor({ size: n, targetSize: t, type: r }) {
1007
+ super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${t} ${r} long, but is ${n} ${r} long.`, { name: "InvalidBytesLengthError" });
1008
+ }
1009
+ }
1010
+ function j(e, { dir: n, size: t = 32 } = {}) {
1011
+ return typeof e == "string" ? S(e, { dir: n, size: t }) : tr(e, { dir: n, size: t });
1012
+ }
1013
+ function S(e, { dir: n, size: t = 32 } = {}) {
1014
+ if (t === null)
1015
+ return e;
1016
+ const r = e.replace("0x", "");
1017
+ if (r.length > t * 2)
1018
+ throw new ot({
1019
+ size: Math.ceil(r.length / 2),
1020
+ targetSize: t,
1021
+ type: "hex"
1022
+ });
1023
+ return `0x${r[n === "right" ? "padEnd" : "padStart"](t * 2, "0")}`;
1024
+ }
1025
+ function tr(e, { dir: n, size: t = 32 } = {}) {
1026
+ if (t === null)
1027
+ return e;
1028
+ if (e.length > t)
1029
+ throw new ot({
1030
+ size: e.length,
1031
+ targetSize: t,
1032
+ type: "bytes"
1033
+ });
1034
+ const r = new Uint8Array(t);
1035
+ for (let s = 0; s < t; s++) {
1036
+ const i = n === "right";
1037
+ r[i ? s : t - s - 1] = e[i ? s : e.length - s - 1];
1038
+ }
1039
+ return r;
1040
+ }
1041
+ class ue extends f {
1042
+ constructor({ max: n, min: t, signed: r, size: s, value: i }) {
1043
+ super(`Number "${i}" is not in safe ${s ? `${s * 8}-bit ${r ? "signed" : "unsigned"} ` : ""}integer range ${n ? `(${t} to ${n})` : `(above ${t})`}`, { name: "IntegerOutOfRangeError" });
1044
+ }
1045
+ }
1046
+ class Ts extends f {
1047
+ constructor(n) {
1048
+ super(`Bytes value "${n}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
1049
+ name: "InvalidBytesBooleanError"
1050
+ });
1051
+ }
1052
+ }
1053
+ class nr extends f {
1054
+ constructor(n) {
1055
+ super(`Hex value "${n}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`, { name: "InvalidHexBooleanError" });
1056
+ }
1057
+ }
1058
+ class ms extends f {
1059
+ constructor(n) {
1060
+ super(`Hex value "${n}" is an odd length (${n.length}). It must be an even length.`, { name: "InvalidHexValueError" });
1061
+ }
1062
+ }
1063
+ class rr extends f {
1064
+ constructor({ givenSize: n, maxSize: t }) {
1065
+ super(`Size cannot exceed ${t} bytes. Given size: ${n} bytes.`, { name: "SizeOverflowError" });
1066
+ }
1067
+ }
1068
+ function k(e, { dir: n = "left" } = {}) {
1069
+ let t = typeof e == "string" ? e.replace("0x", "") : e, r = 0;
1070
+ for (let s = 0; s < t.length - 1 && t[n === "left" ? s : t.length - s - 1].toString() === "0"; s++)
1071
+ r++;
1072
+ return t = n === "left" ? t.slice(r) : t.slice(0, t.length - r), typeof e == "string" ? (t.length === 1 && n === "right" && (t = `${t}0`), `0x${t.length % 2 === 1 ? `0${t}` : t}`) : t;
1073
+ }
1074
+ function D(e, { size: n }) {
1075
+ if (A(e) > n)
1076
+ throw new rr({
1077
+ givenSize: A(e),
1078
+ maxSize: n
1079
+ });
1080
+ }
1081
+ function _s(e, n) {
1082
+ const t = typeof n == "string" ? { to: n } : n, r = t.to;
1083
+ return r === "number" ? ir(e, t) : r === "bigint" ? at(e, t) : r === "string" ? or(e, t) : r === "boolean" ? sr(e, t) : ee(e, t);
1084
+ }
1085
+ function at(e, n = {}) {
1086
+ const { signed: t } = n;
1087
+ n.size && D(e, { size: n.size });
1088
+ const r = BigInt(e);
1089
+ if (!t)
1090
+ return r;
1091
+ const s = (e.length - 2) / 2, i = (1n << BigInt(s) * 8n - 1n) - 1n;
1092
+ return r <= i ? r : r - BigInt(`0x${"f".padStart(s * 2, "f")}`) - 1n;
1093
+ }
1094
+ function sr(e, n = {}) {
1095
+ let t = e;
1096
+ if (n.size && (D(t, { size: n.size }), t = k(t)), k(t) === "0x00")
1097
+ return !1;
1098
+ if (k(t) === "0x01")
1099
+ return !0;
1100
+ throw new nr(t);
1101
+ }
1102
+ function ir(e, n = {}) {
1103
+ const t = at(e, n), r = Number(t);
1104
+ if (!Number.isSafeInteger(r))
1105
+ throw new ue({
1106
+ max: `${Number.MAX_SAFE_INTEGER}`,
1107
+ min: `${Number.MIN_SAFE_INTEGER}`,
1108
+ signed: n.signed,
1109
+ size: n.size,
1110
+ value: `${t}n`
1111
+ });
1112
+ return r;
1113
+ }
1114
+ function or(e, n = {}) {
1115
+ let t = ee(e);
1116
+ return n.size && (D(t, { size: n.size }), t = k(t, { dir: "right" })), new TextDecoder().decode(t);
1117
+ }
1118
+ const ar = /* @__PURE__ */ Array.from({ length: 256 }, (e, n) => n.toString(16).padStart(2, "0"));
1119
+ function de(e, n = {}) {
1120
+ return typeof e == "number" || typeof e == "bigint" ? w(e, n) : typeof e == "string" ? K(e, n) : typeof e == "boolean" ? ct(e, n) : fe(e, n);
1121
+ }
1122
+ function ct(e, n = {}) {
1123
+ const t = `0x${Number(e)}`;
1124
+ return typeof n.size == "number" ? (D(t, { size: n.size }), j(t, { size: n.size })) : t;
1125
+ }
1126
+ function fe(e, n = {}) {
1127
+ let t = "";
1128
+ for (let s = 0; s < e.length; s++)
1129
+ t += ar[e[s]];
1130
+ const r = `0x${t}`;
1131
+ return typeof n.size == "number" ? (D(r, { size: n.size }), j(r, { dir: "right", size: n.size })) : r;
1132
+ }
1133
+ function w(e, n = {}) {
1134
+ const { signed: t, size: r } = n, s = BigInt(e);
1135
+ let i;
1136
+ r ? t ? i = (1n << BigInt(r) * 8n - 1n) - 1n : i = 2n ** (BigInt(r) * 8n) - 1n : typeof e == "number" && (i = BigInt(Number.MAX_SAFE_INTEGER));
1137
+ const o = typeof i == "bigint" && t ? -i - 1n : 0;
1138
+ if (i && s > i || s < o) {
1139
+ const p = typeof e == "bigint" ? "n" : "";
1140
+ throw new ue({
1141
+ max: i ? `${i}${p}` : void 0,
1142
+ min: `${o}${p}`,
1143
+ signed: t,
1144
+ size: r,
1145
+ value: `${e}${p}`
1146
+ });
1147
+ }
1148
+ const c = `0x${(t && s < 0 ? (1n << BigInt(r * 8)) + BigInt(s) : s).toString(16)}`;
1149
+ return r ? j(c, { size: r }) : c;
1150
+ }
1151
+ const cr = /* @__PURE__ */ new TextEncoder();
1152
+ function K(e, n = {}) {
1153
+ const t = cr.encode(e);
1154
+ return fe(t, n);
1155
+ }
1156
+ const ur = /* @__PURE__ */ new TextEncoder();
1157
+ function ut(e, n = {}) {
1158
+ return typeof e == "number" || typeof e == "bigint" ? fr(e, n) : typeof e == "boolean" ? dr(e, n) : H(e) ? ee(e, n) : dt(e, n);
1159
+ }
1160
+ function dr(e, n = {}) {
1161
+ const t = new Uint8Array(1);
1162
+ return t[0] = Number(e), typeof n.size == "number" ? (D(t, { size: n.size }), j(t, { size: n.size })) : t;
1163
+ }
1164
+ const m = {
1165
+ zero: 48,
1166
+ nine: 57,
1167
+ A: 65,
1168
+ F: 70,
1169
+ a: 97,
1170
+ f: 102
1171
+ };
1172
+ function qe(e) {
1173
+ if (e >= m.zero && e <= m.nine)
1174
+ return e - m.zero;
1175
+ if (e >= m.A && e <= m.F)
1176
+ return e - (m.A - 10);
1177
+ if (e >= m.a && e <= m.f)
1178
+ return e - (m.a - 10);
1179
+ }
1180
+ function ee(e, n = {}) {
1181
+ let t = e;
1182
+ n.size && (D(t, { size: n.size }), t = j(t, { dir: "right", size: n.size }));
1183
+ let r = t.slice(2);
1184
+ r.length % 2 && (r = `0${r}`);
1185
+ const s = r.length / 2, i = new Uint8Array(s);
1186
+ for (let o = 0, c = 0; o < s; o++) {
1187
+ const p = qe(r.charCodeAt(c++)), E = qe(r.charCodeAt(c++));
1188
+ if (p === void 0 || E === void 0)
1189
+ throw new f(`Invalid byte sequence ("${r[c - 2]}${r[c - 1]}" in "${r}").`);
1190
+ i[o] = p * 16 + E;
1191
+ }
1192
+ return i;
1193
+ }
1194
+ function fr(e, n) {
1195
+ const t = w(e, n);
1196
+ return ee(t);
1197
+ }
1198
+ function dt(e, n = {}) {
1199
+ const t = ur.encode(e);
1200
+ return typeof n.size == "number" ? (D(t, { size: n.size }), j(t, { dir: "right", size: n.size })) : t;
1201
+ }
1202
+ const lr = BigInt(0), F = BigInt(1), hr = BigInt(2), gr = BigInt(7), pr = BigInt(256), Er = BigInt(113), ft = [], lt = [], ht = [];
1203
+ for (let e = 0, n = F, t = 1, r = 0; e < 24; e++) {
1204
+ [t, r] = [r, (2 * t + 3 * r) % 5], ft.push(2 * (5 * r + t)), lt.push((e + 1) * (e + 2) / 2 % 64);
1205
+ let s = lr;
1206
+ for (let i = 0; i < 7; i++)
1207
+ n = (n << F ^ (n >> gr) * Er) % pr, n & hr && (s ^= F << (F << /* @__PURE__ */ BigInt(i)) - F);
1208
+ ht.push(s);
1209
+ }
1210
+ const gt = Dn(ht, !0), yr = gt[0], Ar = gt[1], Qe = (e, n, t) => t > 32 ? Mn(e, n, t) : wn(e, n, t), Ye = (e, n, t) => t > 32 ? xn(e, n, t) : Cn(e, n, t);
1211
+ function br(e, n = 24) {
1212
+ const t = new Uint32Array(10);
1213
+ for (let r = 24 - n; r < 24; r++) {
1214
+ for (let o = 0; o < 10; o++)
1215
+ t[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
1216
+ for (let o = 0; o < 10; o += 2) {
1217
+ const c = (o + 8) % 10, p = (o + 2) % 10, E = t[p], h = t[p + 1], y = Qe(E, h, 1) ^ t[c], T = Ye(E, h, 1) ^ t[c + 1];
1218
+ for (let I = 0; I < 50; I += 10)
1219
+ e[o + I] ^= y, e[o + I + 1] ^= T;
1220
+ }
1221
+ let s = e[2], i = e[3];
1222
+ for (let o = 0; o < 24; o++) {
1223
+ const c = lt[o], p = Qe(s, i, c), E = Ye(s, i, c), h = ft[o];
1224
+ s = e[h], i = e[h + 1], e[h] = p, e[h + 1] = E;
1225
+ }
1226
+ for (let o = 0; o < 50; o += 10) {
1227
+ for (let c = 0; c < 10; c++)
1228
+ t[c] = e[o + c];
1229
+ for (let c = 0; c < 10; c++)
1230
+ e[o + c] ^= ~t[(c + 2) % 10] & t[(c + 4) % 10];
1231
+ }
1232
+ e[0] ^= yr[r], e[1] ^= Ar[r];
1233
+ }
1234
+ Ze(t);
1235
+ }
1236
+ class le extends mn {
1237
+ // NOTE: we accept arguments in bytes instead of bits here.
1238
+ constructor(n, t, r, s = !1, i = 24) {
1239
+ if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = n, this.suffix = t, this.outputLen = r, this.enableXOF = s, this.rounds = i, ye(r), !(0 < n && n < 200))
1240
+ throw new Error("only keccak-f1600 function is supported");
1241
+ this.state = new Uint8Array(200), this.state32 = _n(this.state);
1242
+ }
1243
+ clone() {
1244
+ return this._cloneInto();
1245
+ }
1246
+ keccak() {
1247
+ Ae(this.state32), br(this.state32, this.rounds), Ae(this.state32), this.posOut = 0, this.pos = 0;
1248
+ }
1249
+ update(n) {
1250
+ be(this), n = Nn(n), Ie(n);
1251
+ const { blockLen: t, state: r } = this, s = n.length;
1252
+ for (let i = 0; i < s; ) {
1253
+ const o = Math.min(t - this.pos, s - i);
1254
+ for (let c = 0; c < o; c++)
1255
+ r[this.pos++] ^= n[i++];
1256
+ this.pos === t && this.keccak();
1257
+ }
1258
+ return this;
1259
+ }
1260
+ finish() {
1261
+ if (this.finished)
1262
+ return;
1263
+ this.finished = !0;
1264
+ const { state: n, suffix: t, pos: r, blockLen: s } = this;
1265
+ n[r] ^= t, t & 128 && r === s - 1 && this.keccak(), n[s - 1] ^= 128, this.keccak();
1266
+ }
1267
+ writeInto(n) {
1268
+ be(this, !1), Ie(n), this.finish();
1269
+ const t = this.state, { blockLen: r } = this;
1270
+ for (let s = 0, i = n.length; s < i; ) {
1271
+ this.posOut >= r && this.keccak();
1272
+ const o = Math.min(r - this.posOut, i - s);
1273
+ n.set(t.subarray(this.posOut, this.posOut + o), s), this.posOut += o, s += o;
1274
+ }
1275
+ return n;
1276
+ }
1277
+ xofInto(n) {
1278
+ if (!this.enableXOF)
1279
+ throw new Error("XOF is not possible for this instance");
1280
+ return this.writeInto(n);
1281
+ }
1282
+ xof(n) {
1283
+ return ye(n), this.xofInto(new Uint8Array(n));
1284
+ }
1285
+ digestInto(n) {
1286
+ if (Sn(n, this), this.finished)
1287
+ throw new Error("digest() was already called");
1288
+ return this.writeInto(n), this.destroy(), n;
1289
+ }
1290
+ digest() {
1291
+ return this.digestInto(new Uint8Array(this.outputLen));
1292
+ }
1293
+ destroy() {
1294
+ this.destroyed = !0, Ze(this.state);
1295
+ }
1296
+ _cloneInto(n) {
1297
+ const { blockLen: t, suffix: r, outputLen: s, rounds: i, enableXOF: o } = this;
1298
+ return n || (n = new le(t, r, s, o, i)), n.state32.set(this.state32), n.pos = this.pos, n.posOut = this.posOut, n.finished = this.finished, n.rounds = i, n.suffix = r, n.outputLen = s, n.enableXOF = o, n.destroyed = this.destroyed, n;
1299
+ }
1300
+ }
1301
+ const Ir = (e, n, t) => Tn(() => new le(n, e, t)), vr = Ir(1, 136, 256 / 8);
1302
+ function v(e, n) {
1303
+ const t = n || "hex", r = vr(H(e, { strict: !1 }) ? ut(e) : e);
1304
+ return t === "bytes" ? r : de(r);
1305
+ }
1306
+ const Tr = (e) => v(ut(e));
1307
+ function mr(e) {
1308
+ return Tr(e);
1309
+ }
1310
+ function _r(e) {
1311
+ let n = !0, t = "", r = 0, s = "", i = !1;
1312
+ for (let o = 0; o < e.length; o++) {
1313
+ const c = e[o];
1314
+ if (["(", ")", ","].includes(c) && (n = !0), c === "(" && r++, c === ")" && r--, !!n) {
1315
+ if (r === 0) {
1316
+ if (c === " " && ["event", "function", ""].includes(s))
1317
+ s = "";
1318
+ else if (s += c, c === ")") {
1319
+ i = !0;
1320
+ break;
1321
+ }
1322
+ continue;
1323
+ }
1324
+ if (c === " ") {
1325
+ e[o - 1] !== "," && t !== "," && t !== ",(" && (t = "", n = !1);
1326
+ continue;
1327
+ }
1328
+ s += c, t += c;
1329
+ }
1330
+ }
1331
+ if (!i)
1332
+ throw new f("Unable to normalize signature.");
1333
+ return s;
1334
+ }
1335
+ const Nr = (e) => {
1336
+ const n = typeof e == "string" ? e : kn(e);
1337
+ return _r(n);
1338
+ };
1339
+ function pt(e) {
1340
+ return mr(Nr(e));
1341
+ }
1342
+ const Sr = pt;
1343
+ class he extends f {
1344
+ constructor({ address: n }) {
1345
+ super(`Address "${n}" is invalid.`, {
1346
+ metaMessages: [
1347
+ "- Address must be a hex value of 20 bytes (40 hex characters).",
1348
+ "- Address must match its checksum counterpart."
1349
+ ],
1350
+ name: "InvalidAddressError"
1351
+ });
1352
+ }
1353
+ }
1354
+ class Et extends Map {
1355
+ constructor(n) {
1356
+ super(), Object.defineProperty(this, "maxSize", {
1357
+ enumerable: !0,
1358
+ configurable: !0,
1359
+ writable: !0,
1360
+ value: void 0
1361
+ }), this.maxSize = n;
1362
+ }
1363
+ get(n) {
1364
+ const t = super.get(n);
1365
+ return super.has(n) && (super.delete(n), super.set(n, t)), t;
1366
+ }
1367
+ set(n, t) {
1368
+ if (super.has(n) && super.delete(n), super.set(n, t), this.maxSize && this.size > this.maxSize) {
1369
+ const r = super.keys().next().value;
1370
+ r !== void 0 && super.delete(r);
1371
+ }
1372
+ return this;
1373
+ }
1374
+ }
1375
+ const se = /* @__PURE__ */ new Et(8192);
1376
+ function yt(e, n) {
1377
+ if (se.has(`${e}.${n}`))
1378
+ return se.get(`${e}.${n}`);
1379
+ const t = n ? `${n}${e.toLowerCase()}` : e.substring(2).toLowerCase(), r = v(dt(t), "bytes"), s = (n ? t.substring(`${n}0x`.length) : t).split("");
1380
+ for (let o = 0; o < 40; o += 2)
1381
+ r[o >> 1] >> 4 >= 8 && s[o] && (s[o] = s[o].toUpperCase()), (r[o >> 1] & 15) >= 8 && s[o + 1] && (s[o + 1] = s[o + 1].toUpperCase());
1382
+ const i = `0x${s.join("")}`;
1383
+ return se.set(`${e}.${n}`, i), i;
1384
+ }
1385
+ function Ns(e, n) {
1386
+ if (!$(e, { strict: !1 }))
1387
+ throw new he({ address: e });
1388
+ return yt(e, n);
1389
+ }
1390
+ const Or = /^0x[a-fA-F0-9]{40}$/, ie = /* @__PURE__ */ new Et(8192);
1391
+ function $(e, n) {
1392
+ const { strict: t = !0 } = n ?? {}, r = `${e}.${t}`;
1393
+ if (ie.has(r))
1394
+ return ie.get(r);
1395
+ const s = Or.test(e) ? e.toLowerCase() === e ? !0 : t ? yt(e) === e : !0 : !1;
1396
+ return ie.set(r, s), s;
1397
+ }
1398
+ function O(e) {
1399
+ return typeof e[0] == "string" ? At(e) : Dr(e);
1400
+ }
1401
+ function Dr(e) {
1402
+ let n = 0;
1403
+ for (const s of e)
1404
+ n += s.length;
1405
+ const t = new Uint8Array(n);
1406
+ let r = 0;
1407
+ for (const s of e)
1408
+ t.set(s, r), r += s.length;
1409
+ return t;
1410
+ }
1411
+ function At(e) {
1412
+ return `0x${e.reduce((n, t) => n + t.replace("0x", ""), "")}`;
1413
+ }
1414
+ function bt(e, n, t, { strict: r } = {}) {
1415
+ return H(e, { strict: !1 }) ? Cr(e, n, t, {
1416
+ strict: r
1417
+ }) : wr(e, n, t, {
1418
+ strict: r
1419
+ });
1420
+ }
1421
+ function It(e, n) {
1422
+ if (typeof n == "number" && n > 0 && n > A(e) - 1)
1423
+ throw new it({
1424
+ offset: n,
1425
+ position: "start",
1426
+ size: A(e)
1427
+ });
1428
+ }
1429
+ function vt(e, n, t) {
1430
+ if (typeof n == "number" && typeof t == "number" && A(e) !== t - n)
1431
+ throw new it({
1432
+ offset: t,
1433
+ position: "end",
1434
+ size: A(e)
1435
+ });
1436
+ }
1437
+ function wr(e, n, t, { strict: r } = {}) {
1438
+ It(e, n);
1439
+ const s = e.slice(n, t);
1440
+ return r && vt(s, n, t), s;
1441
+ }
1442
+ function Cr(e, n, t, { strict: r } = {}) {
1443
+ It(e, n);
1444
+ const s = `0x${e.replace("0x", "").slice((n ?? 0) * 2, (t ?? e.length) * 2)}`;
1445
+ return r && vt(s, n, t), s;
1446
+ }
1447
+ const Ss = /^(.*)\[([0-9]*)\]$/, Mr = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, Tt = /^(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)?$/;
1448
+ function ge(e, n) {
1449
+ if (e.length !== n.length)
1450
+ throw new qn({
1451
+ expectedLength: e.length,
1452
+ givenLength: n.length
1453
+ });
1454
+ const t = xr({
1455
+ params: e,
1456
+ values: n
1457
+ }), r = Ee(t);
1458
+ return r.length === 0 ? "0x" : r;
1459
+ }
1460
+ function xr({ params: e, values: n }) {
1461
+ const t = [];
1462
+ for (let r = 0; r < e.length; r++)
1463
+ t.push(pe({ param: e[r], value: n[r] }));
1464
+ return t;
1465
+ }
1466
+ function pe({ param: e, value: n }) {
1467
+ const t = Ur(e.type);
1468
+ if (t) {
1469
+ const [r, s] = t;
1470
+ return Lr(n, { length: r, param: { ...e, type: s } });
1471
+ }
1472
+ if (e.type === "tuple")
1473
+ return jr(n, {
1474
+ param: e
1475
+ });
1476
+ if (e.type === "address")
1477
+ return Pr(n);
1478
+ if (e.type === "bool")
1479
+ return $r(n);
1480
+ if (e.type.startsWith("uint") || e.type.startsWith("int")) {
1481
+ const r = e.type.startsWith("int"), [, , s = "256"] = Tt.exec(e.type) ?? [];
1482
+ return Br(n, {
1483
+ signed: r,
1484
+ size: Number(s)
1485
+ });
1486
+ }
1487
+ if (e.type.startsWith("bytes"))
1488
+ return Rr(n, { param: e });
1489
+ if (e.type === "string")
1490
+ return zr(n);
1491
+ throw new Jn(e.type, {
1492
+ docsPath: "/docs/contract/encodeAbiParameters"
1493
+ });
1494
+ }
1495
+ function Ee(e) {
1496
+ let n = 0;
1497
+ for (let i = 0; i < e.length; i++) {
1498
+ const { dynamic: o, encoded: c } = e[i];
1499
+ o ? n += 32 : n += A(c);
1500
+ }
1501
+ const t = [], r = [];
1502
+ let s = 0;
1503
+ for (let i = 0; i < e.length; i++) {
1504
+ const { dynamic: o, encoded: c } = e[i];
1505
+ o ? (t.push(w(n + s, { size: 32 })), r.push(c), s += A(c)) : t.push(c);
1506
+ }
1507
+ return O([...t, ...r]);
1508
+ }
1509
+ function Pr(e) {
1510
+ if (!$(e))
1511
+ throw new he({ address: e });
1512
+ return { dynamic: !1, encoded: S(e.toLowerCase()) };
1513
+ }
1514
+ function Lr(e, { length: n, param: t }) {
1515
+ const r = n === null;
1516
+ if (!Array.isArray(e))
1517
+ throw new Zn(e);
1518
+ if (!r && e.length !== n)
1519
+ throw new Kn({
1520
+ expectedLength: n,
1521
+ givenLength: e.length,
1522
+ type: `${t.type}[${n}]`
1523
+ });
1524
+ let s = !1;
1525
+ const i = [];
1526
+ for (let o = 0; o < e.length; o++) {
1527
+ const c = pe({ param: t, value: e[o] });
1528
+ c.dynamic && (s = !0), i.push(c);
1529
+ }
1530
+ if (r || s) {
1531
+ const o = Ee(i);
1532
+ if (r) {
1533
+ const c = w(i.length, { size: 32 });
1534
+ return {
1535
+ dynamic: !0,
1536
+ encoded: i.length > 0 ? O([c, o]) : c
1537
+ };
1538
+ }
1539
+ if (s)
1540
+ return { dynamic: !0, encoded: o };
1541
+ }
1542
+ return {
1543
+ dynamic: !1,
1544
+ encoded: O(i.map(({ encoded: o }) => o))
1545
+ };
1546
+ }
1547
+ function Rr(e, { param: n }) {
1548
+ const [, t] = n.type.split("bytes"), r = A(e);
1549
+ if (!t) {
1550
+ let s = e;
1551
+ return r % 32 !== 0 && (s = S(s, {
1552
+ dir: "right",
1553
+ size: Math.ceil((e.length - 2) / 2 / 32) * 32
1554
+ })), {
1555
+ dynamic: !0,
1556
+ encoded: O([S(w(r, { size: 32 })), s])
1557
+ };
1558
+ }
1559
+ if (r !== Number.parseInt(t, 10))
1560
+ throw new Xn({
1561
+ expectedSize: Number.parseInt(t, 10),
1562
+ value: e
1563
+ });
1564
+ return { dynamic: !1, encoded: S(e, { dir: "right" }) };
1565
+ }
1566
+ function $r(e) {
1567
+ if (typeof e != "boolean")
1568
+ throw new f(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
1569
+ return { dynamic: !1, encoded: S(ct(e)) };
1570
+ }
1571
+ function Br(e, { signed: n, size: t = 256 }) {
1572
+ if (typeof t == "number") {
1573
+ const r = 2n ** (BigInt(t) - (n ? 1n : 0n)) - 1n, s = n ? -r - 1n : 0n;
1574
+ if (e > r || e < s)
1575
+ throw new ue({
1576
+ max: r.toString(),
1577
+ min: s.toString(),
1578
+ signed: n,
1579
+ size: t / 8,
1580
+ value: e.toString()
1581
+ });
1582
+ }
1583
+ return {
1584
+ dynamic: !1,
1585
+ encoded: w(e, {
1586
+ size: 32,
1587
+ signed: n
1588
+ })
1589
+ };
1590
+ }
1591
+ function zr(e) {
1592
+ const n = K(e), t = Math.ceil(A(n) / 32), r = [];
1593
+ for (let s = 0; s < t; s++)
1594
+ r.push(S(bt(n, s * 32, (s + 1) * 32), {
1595
+ dir: "right"
1596
+ }));
1597
+ return {
1598
+ dynamic: !0,
1599
+ encoded: O([
1600
+ S(w(A(n), { size: 32 })),
1601
+ ...r
1602
+ ])
1603
+ };
1604
+ }
1605
+ function jr(e, { param: n }) {
1606
+ let t = !1;
1607
+ const r = [];
1608
+ for (let s = 0; s < n.components.length; s++) {
1609
+ const i = n.components[s], o = Array.isArray(e) ? s : i.name, c = pe({
1610
+ param: i,
1611
+ value: e[o]
1612
+ });
1613
+ r.push(c), c.dynamic && (t = !0);
1614
+ }
1615
+ return {
1616
+ dynamic: t,
1617
+ encoded: t ? Ee(r) : O(r.map(({ encoded: s }) => s))
1618
+ };
1619
+ }
1620
+ function Ur(e) {
1621
+ const n = e.match(/^(.*)\[(\d+)?\]$/);
1622
+ return n ? (
1623
+ // Return `null` if the array is dynamic.
1624
+ [n[2] ? Number(n[2]) : null, n[1]]
1625
+ ) : void 0;
1626
+ }
1627
+ const mt = (e) => bt(pt(e), 0, 4);
1628
+ function Fr(e) {
1629
+ const { abi: n, args: t = [], name: r } = e, s = H(r, { strict: !1 }), i = n.filter((c) => s ? c.type === "function" ? mt(c) === r : c.type === "event" ? Sr(c) === r : !1 : "name" in c && c.name === r);
1630
+ if (i.length === 0)
1631
+ return;
1632
+ if (i.length === 1)
1633
+ return i[0];
1634
+ let o;
1635
+ for (const c of i) {
1636
+ if (!("inputs" in c))
1637
+ continue;
1638
+ if (!t || t.length === 0) {
1639
+ if (!c.inputs || c.inputs.length === 0)
1640
+ return c;
1641
+ continue;
1642
+ }
1643
+ if (!c.inputs || c.inputs.length === 0 || c.inputs.length !== t.length)
1644
+ continue;
1645
+ if (t.every((E, h) => {
1646
+ const y = "inputs" in c && c.inputs[h];
1647
+ return y ? ae(E, y) : !1;
1648
+ })) {
1649
+ if (o && "inputs" in o && o.inputs) {
1650
+ const E = _t(c.inputs, o.inputs, t);
1651
+ if (E)
1652
+ throw new Qn({
1653
+ abiItem: c,
1654
+ type: E[0]
1655
+ }, {
1656
+ abiItem: o,
1657
+ type: E[1]
1658
+ });
1659
+ }
1660
+ o = c;
1661
+ }
1662
+ }
1663
+ return o || i[0];
1664
+ }
1665
+ function ae(e, n) {
1666
+ const t = typeof e, r = n.type;
1667
+ switch (r) {
1668
+ case "address":
1669
+ return $(e, { strict: !1 });
1670
+ case "bool":
1671
+ return t === "boolean";
1672
+ case "function":
1673
+ return t === "string";
1674
+ case "string":
1675
+ return t === "string";
1676
+ default:
1677
+ return r === "tuple" && "components" in n ? Object.values(n.components).every((s, i) => t === "object" && ae(Object.values(e)[i], 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) ? t === "number" || t === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r) ? t === "string" || e instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r) ? Array.isArray(e) && e.every((s) => ae(s, {
1678
+ ...n,
1679
+ // Pop off `[]` or `[M]` from end of type
1680
+ type: r.replace(/(\[[0-9]{0,}\])$/, "")
1681
+ })) : !1;
1682
+ }
1683
+ }
1684
+ function _t(e, n, t) {
1685
+ for (const r in e) {
1686
+ const s = e[r], i = n[r];
1687
+ if (s.type === "tuple" && i.type === "tuple" && "components" in s && "components" in i)
1688
+ return _t(s.components, i.components, t[r]);
1689
+ const o = [s.type, i.type];
1690
+ if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? $(t[r], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? $(t[r], { strict: !1 }) : !1)
1691
+ return o;
1692
+ }
1693
+ }
1694
+ const Je = "/docs/contract/encodeFunctionData";
1695
+ function Hr(e) {
1696
+ const { abi: n, args: t, functionName: r } = e;
1697
+ let s = n[0];
1698
+ if (r) {
1699
+ const i = Fr({
1700
+ abi: n,
1701
+ args: t,
1702
+ name: r
1703
+ });
1704
+ if (!i)
1705
+ throw new Xe(r, { docsPath: Je });
1706
+ s = i;
1707
+ }
1708
+ if (s.type !== "function")
1709
+ throw new Xe(void 0, { docsPath: Je });
1710
+ return {
1711
+ abi: [s],
1712
+ functionName: mt(V(s))
1713
+ };
1714
+ }
1715
+ function Os(e) {
1716
+ const { args: n } = e, { abi: t, functionName: r } = (() => {
1717
+ var c;
1718
+ return e.abi.length === 1 && ((c = e.functionName) != null && c.startsWith("0x")) ? e : Hr(e);
1719
+ })(), s = t[0], i = r, o = "inputs" in s && s.inputs ? ge(s.inputs, n ?? []) : void 0;
1720
+ return At([i, o ?? "0x"]);
1721
+ }
1722
+ const Nt = (e, n, t) => JSON.stringify(e, (r, s) => {
1723
+ const i = typeof s == "bigint" ? s.toString() : s;
1724
+ return typeof n == "function" ? n(r, i) : i;
1725
+ }, t), Gr = `Ethereum Signed Message:
1726
+ `;
1727
+ function Wr(e) {
1728
+ const n = typeof e == "string" ? K(e) : typeof e.raw == "string" ? e.raw : fe(e.raw), t = K(`${Gr}${A(n)}`);
1729
+ return O([t, n]);
1730
+ }
1731
+ function Ds(e, n) {
1732
+ return v(Wr(e), n);
1733
+ }
1734
+ class kr extends f {
1735
+ constructor({ domain: n }) {
1736
+ super(`Invalid domain "${Nt(n)}".`, {
1737
+ metaMessages: ["Must be a valid EIP-712 domain."]
1738
+ });
1739
+ }
1740
+ }
1741
+ class Vr extends f {
1742
+ constructor({ primaryType: n, types: t }) {
1743
+ super(`Invalid primary type \`${n}\` must be one of \`${JSON.stringify(Object.keys(t))}\`.`, {
1744
+ docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
1745
+ metaMessages: ["Check that the primary type is a key in `types`."]
1746
+ });
1747
+ }
1748
+ }
1749
+ class Kr extends f {
1750
+ constructor({ type: n }) {
1751
+ super(`Struct type "${n}" is invalid.`, {
1752
+ metaMessages: ["Struct type must not be a Solidity type."],
1753
+ name: "InvalidStructTypeError"
1754
+ });
1755
+ }
1756
+ }
1757
+ function ws(e) {
1758
+ const { domain: n, message: t, primaryType: r, types: s } = e, i = (p, E) => {
1759
+ const h = { ...E };
1760
+ for (const y of p) {
1761
+ const { name: T, type: I } = y;
1762
+ I === "address" && (h[T] = h[T].toLowerCase());
1763
+ }
1764
+ return h;
1765
+ }, o = s.EIP712Domain ? n ? i(s.EIP712Domain, n) : {} : {}, c = (() => {
1766
+ if (r !== "EIP712Domain")
1767
+ return i(s[r], t);
1768
+ })();
1769
+ return Nt({ domain: o, message: c, primaryType: r, types: s });
1770
+ }
1771
+ function Xr(e) {
1772
+ const { domain: n, message: t, primaryType: r, types: s } = e, i = (o, c) => {
1773
+ for (const p of o) {
1774
+ const { name: E, type: h } = p, y = c[E], T = h.match(Tt);
1775
+ if (T && (typeof y == "number" || typeof y == "bigint")) {
1776
+ const [te, C, ne] = T;
1777
+ w(y, {
1778
+ signed: C === "int",
1779
+ size: Number.parseInt(ne, 10) / 8
1780
+ });
1781
+ }
1782
+ if (h === "address" && typeof y == "string" && !$(y))
1783
+ throw new he({ address: y });
1784
+ const I = h.match(Mr);
1785
+ if (I) {
1786
+ const [te, C] = I;
1787
+ if (C && A(y) !== Number.parseInt(C, 10))
1788
+ throw new Yn({
1789
+ expectedSize: Number.parseInt(C, 10),
1790
+ givenSize: A(y)
1791
+ });
1792
+ }
1793
+ const G = s[h];
1794
+ G && (qr(h), i(G, y));
1795
+ }
1796
+ };
1797
+ if (s.EIP712Domain && n) {
1798
+ if (typeof n != "object")
1799
+ throw new kr({ domain: n });
1800
+ i(s.EIP712Domain, n);
1801
+ }
1802
+ if (r !== "EIP712Domain")
1803
+ if (s[r])
1804
+ i(s[r], t);
1805
+ else
1806
+ throw new Vr({ primaryType: r, types: s });
1807
+ }
1808
+ function St({ domain: e }) {
1809
+ return [
1810
+ typeof (e == null ? void 0 : e.name) == "string" && { name: "name", type: "string" },
1811
+ (e == null ? void 0 : e.version) && { name: "version", type: "string" },
1812
+ (typeof (e == null ? void 0 : e.chainId) == "number" || typeof (e == null ? void 0 : e.chainId) == "bigint") && {
1813
+ name: "chainId",
1814
+ type: "uint256"
1815
+ },
1816
+ (e == null ? void 0 : e.verifyingContract) && {
1817
+ name: "verifyingContract",
1818
+ type: "address"
1819
+ },
1820
+ (e == null ? void 0 : e.salt) && { name: "salt", type: "bytes32" }
1821
+ ].filter(Boolean);
1822
+ }
1823
+ function Cs({ domain: e }) {
1824
+ return Ot({
1825
+ domain: e,
1826
+ types: {
1827
+ EIP712Domain: St({ domain: e })
1828
+ }
1829
+ });
1830
+ }
1831
+ function qr(e) {
1832
+ if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
1833
+ throw new Kr({ type: e });
1834
+ }
1835
+ function Ms(e) {
1836
+ const { domain: n = {}, message: t, primaryType: r } = e, s = {
1837
+ EIP712Domain: St({ domain: n }),
1838
+ ...e.types
1839
+ };
1840
+ Xr({
1841
+ domain: n,
1842
+ message: t,
1843
+ primaryType: r,
1844
+ types: s
1845
+ });
1846
+ const i = ["0x1901"];
1847
+ return n && i.push(Ot({
1848
+ domain: n,
1849
+ types: s
1850
+ })), r !== "EIP712Domain" && i.push(Dt({
1851
+ data: t,
1852
+ primaryType: r,
1853
+ types: s
1854
+ })), v(O(i));
1855
+ }
1856
+ function Ot({ domain: e, types: n }) {
1857
+ return Dt({
1858
+ data: e,
1859
+ primaryType: "EIP712Domain",
1860
+ types: n
1861
+ });
1862
+ }
1863
+ function Dt({ data: e, primaryType: n, types: t }) {
1864
+ const r = wt({
1865
+ data: e,
1866
+ primaryType: n,
1867
+ types: t
1868
+ });
1869
+ return v(r);
1870
+ }
1871
+ function wt({ data: e, primaryType: n, types: t }) {
1872
+ const r = [{ type: "bytes32" }], s = [Qr({ primaryType: n, types: t })];
1873
+ for (const i of t[n]) {
1874
+ const [o, c] = Mt({
1875
+ types: t,
1876
+ name: i.name,
1877
+ type: i.type,
1878
+ value: e[i.name]
1879
+ });
1880
+ r.push(o), s.push(c);
1881
+ }
1882
+ return ge(r, s);
1883
+ }
1884
+ function Qr({ primaryType: e, types: n }) {
1885
+ const t = de(Yr({ primaryType: e, types: n }));
1886
+ return v(t);
1887
+ }
1888
+ function Yr({ primaryType: e, types: n }) {
1889
+ let t = "";
1890
+ const r = Ct({ primaryType: e, types: n });
1891
+ r.delete(e);
1892
+ const s = [e, ...Array.from(r).sort()];
1893
+ for (const i of s)
1894
+ t += `${i}(${n[i].map(({ name: o, type: c }) => `${c} ${o}`).join(",")})`;
1895
+ return t;
1896
+ }
1897
+ function Ct({ primaryType: e, types: n }, t = /* @__PURE__ */ new Set()) {
1898
+ const r = e.match(/^\w*/u), s = r == null ? void 0 : r[0];
1899
+ if (t.has(s) || n[s] === void 0)
1900
+ return t;
1901
+ t.add(s);
1902
+ for (const i of n[s])
1903
+ Ct({ primaryType: i.type, types: n }, t);
1904
+ return t;
1905
+ }
1906
+ function Mt({ types: e, name: n, type: t, value: r }) {
1907
+ if (e[t] !== void 0)
1908
+ return [
1909
+ { type: "bytes32" },
1910
+ v(wt({ data: r, primaryType: t, types: e }))
1911
+ ];
1912
+ if (t === "bytes")
1913
+ return [{ type: "bytes32" }, v(r)];
1914
+ if (t === "string")
1915
+ return [{ type: "bytes32" }, v(de(r))];
1916
+ if (t.lastIndexOf("]") === t.length - 1) {
1917
+ const s = t.slice(0, t.lastIndexOf("[")), i = r.map((o) => Mt({
1918
+ name: n,
1919
+ type: s,
1920
+ types: e,
1921
+ value: o
1922
+ }));
1923
+ return [
1924
+ { type: "bytes32" },
1925
+ v(ge(i.map(([o]) => o), i.map(([, o]) => o)))
1926
+ ];
1927
+ }
1928
+ return [{ type: t }, r];
1929
+ }
1930
+ export {
1931
+ us as $,
1932
+ gs as A,
1933
+ f as B,
1934
+ wr as C,
1935
+ bt as D,
1936
+ mt as E,
1937
+ fs as F,
1938
+ Nt as G,
1939
+ H,
1940
+ Ts as I,
1941
+ de as J,
1942
+ At as K,
1943
+ $ as L,
1944
+ he as M,
1945
+ vs as N,
1946
+ Et as O,
1947
+ ls as P,
1948
+ hs as Q,
1949
+ As as R,
1950
+ ys as S,
1951
+ Xe as T,
1952
+ ps as U,
1953
+ ss as V,
1954
+ is as W,
1955
+ O as X,
1956
+ Cr as Y,
1957
+ Es as Z,
1958
+ ds as _,
1959
+ Ms as a,
1960
+ Zn as a0,
1961
+ dt as a1,
1962
+ Ns as a2,
1963
+ qn as a3,
1964
+ j as a4,
1965
+ K as a5,
1966
+ ct as a6,
1967
+ Tt as a7,
1968
+ Mr as a8,
1969
+ Yn as a9,
1970
+ Cs as aA,
1971
+ _s as aB,
1972
+ Nr as aC,
1973
+ Ot as aD,
1974
+ Dt as aE,
1975
+ or as aF,
1976
+ fr as aG,
1977
+ tr as aH,
1978
+ Hr as aI,
1979
+ Gr as aJ,
1980
+ rs as aK,
1981
+ pt as aL,
1982
+ Wr as aM,
1983
+ Pn as aN,
1984
+ Ss as aa,
1985
+ Is as ab,
1986
+ ms as ac,
1987
+ vr as ad,
1988
+ U as ae,
1989
+ S as af,
1990
+ kn as ag,
1991
+ sr as ah,
1992
+ St as ai,
1993
+ Xr as aj,
1994
+ ws as ak,
1995
+ os as al,
1996
+ Kn as am,
1997
+ Xn as an,
1998
+ ue as ao,
1999
+ Jn as ap,
2000
+ er as aq,
2001
+ kr as ar,
2002
+ nr as as,
2003
+ Vr as at,
2004
+ Kr as au,
2005
+ ot as av,
2006
+ rr as aw,
2007
+ it as ax,
2008
+ dr as ay,
2009
+ Dr as az,
2010
+ Wn as b,
2011
+ es as c,
2012
+ ts as d,
2013
+ Os as e,
2014
+ V as f,
2015
+ Fr as g,
2016
+ Ds as h,
2017
+ ns as i,
2018
+ ut as j,
2019
+ v as k,
2020
+ ge as l,
2021
+ D as m,
2022
+ w as n,
2023
+ fe as o,
2024
+ at as p,
2025
+ k as q,
2026
+ ir as r,
2027
+ ee as s,
2028
+ Sr as t,
2029
+ A as u,
2030
+ cs as v,
2031
+ as as w,
2032
+ Ur as x,
2033
+ bs as y,
2034
+ yt as z
2035
+ };