@springmicro/auth 0.7.2 → 0.7.4

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