@argent/x-shared 1.34.4 → 1.34.6
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.
- package/dist/features/simulation/activity/schema.d.ts +858 -96
- package/dist/index.js +2 -2
- package/dist/index.mjs +844 -855
- package/dist/nfts/BackendNftService.d.ts +2 -4
- package/dist/nfts/INFTService.d.ts +1 -1
- package/dist/simulation.js +1 -1
- package/dist/simulation.mjs +42 -42
- package/dist/tokens/service/implementation.d.ts +3 -3
- package/dist/tokens/service/interface.d.ts +2 -2
- package/dist/tokens/service/types/defiPosition.model.d.ts +117 -0
- package/dist/tokens/service/types/index.d.ts +1 -0
- package/dist/tokens/service/types/{token.model.d.ts → webToken.model.d.ts} +27 -18
- package/dist/transactionVersion-CKz-zi84.js +1 -0
- package/dist/{transactionVersion-tQTwHiJA.mjs → transactionVersion-cwkr7wat.mjs} +544 -532
- package/package.json +2 -2
- package/dist/transactionVersion-FKKSXkzh.js +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import F, { z as f } from "zod";
|
|
2
|
-
import { p as xt, H as K, a as
|
|
3
|
-
import { am as Cd,
|
|
4
|
-
import { constants as Z, starknetId as
|
|
5
|
-
import { useEffect as Ft, useRef as
|
|
6
|
-
import { isFunction as
|
|
7
|
-
import
|
|
8
|
-
import { hex as
|
|
2
|
+
import { p as xt, H as K, a as Qe, u as k, N as Un, c as Lr, C as jn, A as St, i as Dr, b as Hr, n as Ln, d as Vr, e as Mr, f as Gr, g as qr, s as Q, h as nt, j as tn, k as Wr, S as zr, l as en, M as nn, m as Kr, o as Zr, q as Pe, r as Yr, t as re, B as rn, v as se, w as Pt, x as Xr, y as Jr, z as Qr, D as ts, E as es, F as ns, T as rs, G as Re, I as Dn, J as ss, K as we, L as os, O as as, P as is, Q as cs, R as _t } from "./transactionVersion-cwkr7wat.mjs";
|
|
3
|
+
import { am as Cd, b2 as Od, bX as kd, b4 as Pd, b0 as Rd, an as $d, af as Fd, ah as Ud, ag as jd, ai as Ld, bC as Dd, bK as Hd, bq as Vd, bu as Md, a9 as Gd, aa as qd, a5 as Wd, a4 as zd, Z as Kd, W as Zd, X as Yd, Y as Xd, aM as Jd, az as Qd, au as tf, av as ef, as as nf, at as rf, ax as sf, aw as of, ay as af, ar as cf, aq as lf, ap as uf, ao as df, aA as ff, aj as hf, ab as pf, ba as mf, be as gf, bc as wf, bx as bf, bM as yf, bH as Sf, bS as Ef, ae as Af, bm as xf, bg as vf, bo as If, bt as Tf, aD as Bf, aE as _f, aF as Nf, bU as Cf, bT as Of, bQ as kf, bA as Pf, aB as Rf, aC as $f, by as Ff, aK as Uf, aG as jf, aL as Lf, aI as Df, aJ as Hf, b9 as Vf, bz as Mf, bp as Gf, bJ as qf, bF as Wf, bw as zf, bn as Kf, b5 as Zf, $ as Yf, _ as Xf, a1 as Jf, a2 as Qf, bE as th, bD as eh, a$ as nh, b6 as rh, bb as sh, a0 as oh, aY as ah, ac as ih, a7 as ch, ak as lh, a6 as uh, aZ as dh, bL as fh, bG as hh, bl as ph, b1 as mh, bi as gh, a8 as wh, ad as bh, al as yh, aX as Sh, aH as Eh, bB as Ah, bR as xh, bh as vh, bj as Ih, bk as Th, br as Bh, bv as _h, bs as Nh, bO as Ch, bP as Oh, bN as kh, a3 as Ph, bd as Rh, bI as $h, b3 as Fh, b7 as Uh, a_ as jh, b8 as Lh, bf as Dh, aN as Hh, bZ as Vh, bY as Mh, bV as Gh, b_ as qh, bW as Wh, U as zh, V as Kh, aO as Zh, aP as Yh, aW as Xh, aV as Jh, aQ as Qh, aT as tp, aR as ep, aS as np, aU as rp } from "./transactionVersion-cwkr7wat.mjs";
|
|
4
|
+
import { constants as Z, starknetId as Hn, CallData as mt, CairoOption as sn, CairoOptionVariant as on, hash as Vn, num as O, encode as $t, uint256 as Ht, ec as ls, isSierra as us, TransactionType as an } from "starknet";
|
|
5
|
+
import { useEffect as Ft, useRef as cn, useState as Mn, useMemo as vt, useCallback as Gn, createContext as ds } from "react";
|
|
6
|
+
import { isFunction as Wt, isString as qn, upperCase as $e, isNil as fs, upperFirst as hs, lowerCase as Wn, isUndefined as ps, isEmpty as ln, isArray as ms } from "lodash-es";
|
|
7
|
+
import oe, { useSWRConfig as gs } from "swr";
|
|
8
|
+
import { hex as zn, base58 as Kn, stringToBytes as ws } from "@scure/base";
|
|
9
9
|
import { UAParser as bs } from "ua-parser-js";
|
|
10
|
-
import { validateMnemonic as
|
|
11
|
-
import { wordlist as
|
|
12
|
-
import
|
|
13
|
-
import { jsx as
|
|
14
|
-
const
|
|
10
|
+
import { validateMnemonic as ys } from "@scure/bip39";
|
|
11
|
+
import { wordlist as Ss } from "@scure/bip39/wordlists/english";
|
|
12
|
+
import Es from "object-hash";
|
|
13
|
+
import { jsx as As } from "react/jsx-runtime";
|
|
14
|
+
const xs = f.object({
|
|
15
15
|
name: f.string().optional(),
|
|
16
16
|
address: f.string(),
|
|
17
17
|
ownerAddress: f.string(),
|
|
@@ -39,7 +39,7 @@ const vs = f.object({
|
|
|
39
39
|
}), kl = f.object({
|
|
40
40
|
address: f.string(),
|
|
41
41
|
guardianAddress: f.string().optional(),
|
|
42
|
-
account:
|
|
42
|
+
account: xs
|
|
43
43
|
}), Pl = f.object({
|
|
44
44
|
ownerAddress: f.string(),
|
|
45
45
|
signature: f.object({
|
|
@@ -59,17 +59,17 @@ function $l(t) {
|
|
|
59
59
|
function Fl(t) {
|
|
60
60
|
return !("simulateTransaction" in t);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const vs = f.object({
|
|
63
63
|
value: f.string(),
|
|
64
64
|
platform: f.enum(["ios", "argentx", "android", "webwallet"]).nullable()
|
|
65
65
|
}), Ul = f.object({
|
|
66
|
-
preferences: f.record(
|
|
67
|
-
}),
|
|
66
|
+
preferences: f.record(vs)
|
|
67
|
+
}), Is = f.enum(["mainnet-alpha", "sepolia-alpha"]), Ts = f.enum(["mainnet", "sepolia"]);
|
|
68
68
|
function jl(t) {
|
|
69
|
-
return
|
|
69
|
+
return Is.safeParse(t).success;
|
|
70
70
|
}
|
|
71
71
|
function Ll(t) {
|
|
72
|
-
return
|
|
72
|
+
return Ts.safeParse(t).success;
|
|
73
73
|
}
|
|
74
74
|
const Vt = 18;
|
|
75
75
|
function Mt({ value: t, decimals: e }) {
|
|
@@ -80,98 +80,98 @@ function Mt({ value: t, decimals: e }) {
|
|
|
80
80
|
const r = t.toString().padStart(e, "0"), s = r.slice(0, -e) || "0", o = r.slice(-e).replace(/0+$/, "");
|
|
81
81
|
return `${n ? "-" : ""}${s}${o ? `.${o}` : ""}`;
|
|
82
82
|
}
|
|
83
|
-
const
|
|
83
|
+
const Fe = (t, e) => ({
|
|
84
84
|
decimals: e,
|
|
85
85
|
value: e >= t.decimals ? t.value * BigInt(10) ** BigInt(e - t.decimals) : t.value / BigInt(10) ** BigInt(t.decimals - e)
|
|
86
|
-
}),
|
|
86
|
+
}), Zn = (t) => {
|
|
87
87
|
const e = t.value.toString().split("").reverse();
|
|
88
88
|
let n = 0;
|
|
89
89
|
for (let s = 0; s < e.length && e[s] === "0"; s++)
|
|
90
90
|
n++;
|
|
91
91
|
const r = t.decimals - n;
|
|
92
|
-
return
|
|
93
|
-
},
|
|
94
|
-
const n = Math.max(t.decimals, e.decimals), [r, s] = [t, e].map((o) =>
|
|
92
|
+
return Fe(t, r);
|
|
93
|
+
}, Yn = (t, e) => {
|
|
94
|
+
const n = Math.max(t.decimals, e.decimals), [r, s] = [t, e].map((o) => Fe(o, n));
|
|
95
95
|
return [r.value, s.value, n];
|
|
96
|
-
},
|
|
97
|
-
const [r, s, o] =
|
|
96
|
+
}, ae = (t) => (e, n) => {
|
|
97
|
+
const [r, s, o] = Yn(e, n);
|
|
98
98
|
return {
|
|
99
99
|
decimals: o,
|
|
100
100
|
value: t(r, s, o)
|
|
101
101
|
};
|
|
102
102
|
}, Gt = (t) => (e, n) => {
|
|
103
|
-
const [r, s] =
|
|
103
|
+
const [r, s] = Yn(e, n);
|
|
104
104
|
return t(r, s);
|
|
105
|
-
},
|
|
105
|
+
}, Bs = ae((t, e) => t + e), _s = ae((t, e) => t - e), Ns = ae((t, e, n) => {
|
|
106
106
|
if (e === BigInt(0))
|
|
107
107
|
throw new Error("Division by zero is not allowed");
|
|
108
108
|
return t * BigInt(10) ** BigInt(n) / e;
|
|
109
|
-
}),
|
|
109
|
+
}), Cs = (t, e) => Zn({
|
|
110
110
|
decimals: t.decimals + e.decimals,
|
|
111
111
|
value: t.value * e.value
|
|
112
|
-
}),
|
|
112
|
+
}), Os = ae((t, e) => {
|
|
113
113
|
if (e === BigInt(0))
|
|
114
114
|
throw new Error("Modulus by zero is not allowed");
|
|
115
115
|
return t % e;
|
|
116
|
-
}),
|
|
116
|
+
}), Ue = (t) => ({
|
|
117
117
|
decimals: t.decimals,
|
|
118
118
|
value: t.value >= BigInt(0) ? t.value : -t.value
|
|
119
|
-
}),
|
|
120
|
-
function
|
|
119
|
+
}), Xn = Gt((t, e) => t === e), ks = Gt((t, e) => t < e), Ps = Gt((t, e) => t > e), Rs = Gt((t, e) => t <= e), $s = Gt((t, e) => t >= e), Fs = (t, e) => !Xn(t, e);
|
|
120
|
+
function Us(t) {
|
|
121
121
|
return Mt({ value: t, decimals: Vt });
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function js(t) {
|
|
124
124
|
return xt(t, Vt);
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function Ls(t) {
|
|
127
127
|
return Mt({ value: t, decimals: Vt });
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function je(t) {
|
|
130
130
|
return xt(t, Vt);
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
return
|
|
132
|
+
function Ds(t) {
|
|
133
|
+
return Ue({ value: t, decimals: 0 }).value;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
return je(
|
|
135
|
+
function Hs(t) {
|
|
136
|
+
return Ue(je(t));
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Vs(t, e) {
|
|
139
139
|
return {
|
|
140
140
|
value: BigInt(t),
|
|
141
141
|
decimals: e
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
function
|
|
144
|
+
const Ms = { value: 1n, decimals: 0 };
|
|
145
|
+
function Gs(t) {
|
|
146
146
|
return f.string().refine((e) => /^-?\d+(\.\d+)?$/.test(e), { message: "Invalid number format" }).transform((e) => xt(e, t));
|
|
147
147
|
}
|
|
148
148
|
const Dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
149
149
|
__proto__: null,
|
|
150
|
-
ONE:
|
|
151
|
-
abs:
|
|
152
|
-
absBigInt:
|
|
153
|
-
add:
|
|
154
|
-
createUnitsSchema:
|
|
155
|
-
div:
|
|
156
|
-
eq:
|
|
157
|
-
formatCurrency:
|
|
158
|
-
formatEther:
|
|
150
|
+
ONE: Ms,
|
|
151
|
+
abs: Ue,
|
|
152
|
+
absBigInt: Ds,
|
|
153
|
+
add: Bs,
|
|
154
|
+
createUnitsSchema: Gs,
|
|
155
|
+
div: Ns,
|
|
156
|
+
eq: Xn,
|
|
157
|
+
formatCurrency: Ls,
|
|
158
|
+
formatEther: Us,
|
|
159
159
|
formatUnits: Mt,
|
|
160
|
-
gt:
|
|
161
|
-
gte:
|
|
162
|
-
lt:
|
|
163
|
-
lte:
|
|
164
|
-
mod:
|
|
165
|
-
mul:
|
|
166
|
-
not:
|
|
167
|
-
parseCurrency:
|
|
168
|
-
parseCurrencyAbs:
|
|
169
|
-
parseEther:
|
|
160
|
+
gt: Ps,
|
|
161
|
+
gte: $s,
|
|
162
|
+
lt: ks,
|
|
163
|
+
lte: Rs,
|
|
164
|
+
mod: Os,
|
|
165
|
+
mul: Cs,
|
|
166
|
+
not: Fs,
|
|
167
|
+
parseCurrency: je,
|
|
168
|
+
parseCurrencyAbs: Hs,
|
|
169
|
+
parseEther: js,
|
|
170
170
|
parseUnits: xt,
|
|
171
|
-
sub:
|
|
172
|
-
toBigDecimal:
|
|
173
|
-
toFixedDecimals:
|
|
174
|
-
toTiniestPossibleDecimal:
|
|
171
|
+
sub: _s,
|
|
172
|
+
toBigDecimal: Vs,
|
|
173
|
+
toFixedDecimals: Fe,
|
|
174
|
+
toTiniestPossibleDecimal: Zn
|
|
175
175
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
176
176
|
class Hl {
|
|
177
177
|
constructor(e, n) {
|
|
@@ -221,12 +221,12 @@ class Vl {
|
|
|
221
221
|
this.offsetInS = r;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
class
|
|
224
|
+
class Jn {
|
|
225
225
|
constructor(e, n = "json") {
|
|
226
226
|
this.requestInit = e, this.responseType = n;
|
|
227
227
|
}
|
|
228
228
|
async get(e, n) {
|
|
229
|
-
const r =
|
|
229
|
+
const r = Wt(this.requestInit) ? await this.requestInit() : this.requestInit, s = {
|
|
230
230
|
...r,
|
|
231
231
|
...n,
|
|
232
232
|
method: "GET",
|
|
@@ -236,7 +236,7 @@ class De {
|
|
|
236
236
|
...n == null ? void 0 : n.headers
|
|
237
237
|
}
|
|
238
238
|
}, o = await fetch(e, s).catch(() => {
|
|
239
|
-
throw new K(
|
|
239
|
+
throw new K(Qe.FAILED_TO_FETCH_URL, 0);
|
|
240
240
|
});
|
|
241
241
|
if (this.responseType === "json") {
|
|
242
242
|
if (!o.ok)
|
|
@@ -246,7 +246,7 @@ class De {
|
|
|
246
246
|
return o;
|
|
247
247
|
}
|
|
248
248
|
async post(e, n, r) {
|
|
249
|
-
const s =
|
|
249
|
+
const s = Wt(this.requestInit) ? await this.requestInit() : this.requestInit, o = {
|
|
250
250
|
...s,
|
|
251
251
|
...n,
|
|
252
252
|
method: "POST",
|
|
@@ -256,7 +256,7 @@ class De {
|
|
|
256
256
|
...n == null ? void 0 : n.headers
|
|
257
257
|
}
|
|
258
258
|
}, a = await fetch(e, o).catch(() => {
|
|
259
|
-
throw new K(
|
|
259
|
+
throw new K(Qe.FAILED_TO_POST_URL, 0);
|
|
260
260
|
});
|
|
261
261
|
if (!a.ok)
|
|
262
262
|
throw new K(a.statusText, a.status, await a.json());
|
|
@@ -272,7 +272,7 @@ class De {
|
|
|
272
272
|
return i;
|
|
273
273
|
}
|
|
274
274
|
async put(e, n) {
|
|
275
|
-
const r =
|
|
275
|
+
const r = Wt(this.requestInit) ? await this.requestInit() : this.requestInit, s = {
|
|
276
276
|
...r,
|
|
277
277
|
...n,
|
|
278
278
|
method: "PUT",
|
|
@@ -289,7 +289,7 @@ class De {
|
|
|
289
289
|
return await o.json();
|
|
290
290
|
}
|
|
291
291
|
async delete(e, n) {
|
|
292
|
-
const r =
|
|
292
|
+
const r = Wt(this.requestInit) ? await this.requestInit() : this.requestInit, s = {
|
|
293
293
|
...r,
|
|
294
294
|
...n,
|
|
295
295
|
method: "DELETE",
|
|
@@ -305,7 +305,7 @@ class De {
|
|
|
305
305
|
throw new K(o.statusText, o.status);
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
const
|
|
308
|
+
const zt = (t) => {
|
|
309
309
|
process.env.NODE_ENV;
|
|
310
310
|
};
|
|
311
311
|
function qs(t, e) {
|
|
@@ -326,14 +326,14 @@ class Ml {
|
|
|
326
326
|
try {
|
|
327
327
|
const r = await this.cacheService.get(e), s = await this.dateService.now(), o = new Date(r.headers.get("date") || ""), a = s.getTime() - o.getTime();
|
|
328
328
|
if (a < this.options.freshFor)
|
|
329
|
-
return
|
|
329
|
+
return zt("🟢 [SWR] Using fresh cache"), r;
|
|
330
330
|
if (a < this.options.staleFor)
|
|
331
|
-
return this.fetchAndCache(e, n),
|
|
331
|
+
return this.fetchAndCache(e, n), zt("🟠 [SWR] Revalidating cache"), r;
|
|
332
332
|
throw new Error("Cache too old");
|
|
333
333
|
} catch (r) {
|
|
334
334
|
if (r instanceof K)
|
|
335
335
|
throw r;
|
|
336
|
-
return
|
|
336
|
+
return zt(), await this.fetchAndCache(e, n);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
async get(e, n) {
|
|
@@ -353,7 +353,7 @@ class Ml {
|
|
|
353
353
|
});
|
|
354
354
|
return this.inFlightRequests.set(e, s), s;
|
|
355
355
|
}
|
|
356
|
-
return
|
|
356
|
+
return zt(), r;
|
|
357
357
|
}
|
|
358
358
|
parseResponse(e) {
|
|
359
359
|
if (e.ok)
|
|
@@ -370,7 +370,7 @@ const Xt = (t, e, n) => {
|
|
|
370
370
|
} catch {
|
|
371
371
|
}
|
|
372
372
|
return r;
|
|
373
|
-
},
|
|
373
|
+
}, Qn = async (t, e) => {
|
|
374
374
|
const n = await fetch(t, e), r = await n.text();
|
|
375
375
|
if (!n.ok)
|
|
376
376
|
throw Xt("An error occurred while fetching", n, r);
|
|
@@ -391,27 +391,27 @@ const Xt = (t, e, n) => {
|
|
|
391
391
|
} catch {
|
|
392
392
|
throw Xt("An error occurred while parsing", n, r);
|
|
393
393
|
}
|
|
394
|
-
},
|
|
394
|
+
}, ql = (t) => ({
|
|
395
395
|
refreshInterval: t,
|
|
396
396
|
dedupingInterval: t
|
|
397
|
-
}),
|
|
397
|
+
}), Wl = (t) => `${t.networkId}::${t.address}`, Ws = () => {
|
|
398
398
|
};
|
|
399
|
-
function
|
|
400
|
-
const { cache: s } =
|
|
399
|
+
function zs(t, e, n, r) {
|
|
400
|
+
const { cache: s } = gs(), o = oe(t && e, t ? n : Ws, r);
|
|
401
401
|
return Ft(() => {
|
|
402
402
|
t || (o.mutate(), s.delete(e));
|
|
403
403
|
}, [t]), o;
|
|
404
404
|
}
|
|
405
|
-
const
|
|
405
|
+
const zl = {
|
|
406
406
|
revalidateOnFocus: !1,
|
|
407
407
|
revalidateOnMount: !0,
|
|
408
408
|
revalidateOnReconnect: !1,
|
|
409
409
|
refreshWhenOffline: !1,
|
|
410
410
|
refreshWhenHidden: !1,
|
|
411
411
|
refreshInterval: 0
|
|
412
|
-
},
|
|
412
|
+
}, Ks = async (t, e) => {
|
|
413
413
|
try {
|
|
414
|
-
const { time: n } = await
|
|
414
|
+
const { time: n } = await Qn(k(t, "time"), {
|
|
415
415
|
headers: e
|
|
416
416
|
});
|
|
417
417
|
return n;
|
|
@@ -419,10 +419,10 @@ const Wl = {
|
|
|
419
419
|
throw new Error("failed to request time");
|
|
420
420
|
}
|
|
421
421
|
}, Kl = async (t, e) => {
|
|
422
|
-
const n = await
|
|
422
|
+
const n = await Ks(t, e);
|
|
423
423
|
return Math.floor(n);
|
|
424
424
|
};
|
|
425
|
-
function
|
|
425
|
+
function Zs(t) {
|
|
426
426
|
switch (t) {
|
|
427
427
|
case "mainnet-alpha":
|
|
428
428
|
case Z.NetworkName.SN_MAIN:
|
|
@@ -431,45 +431,45 @@ function Ys(t) {
|
|
|
431
431
|
case Z.NetworkName.SN_SEPOLIA:
|
|
432
432
|
return Z.StarknetChainId.SN_SEPOLIA;
|
|
433
433
|
default:
|
|
434
|
-
throw new
|
|
434
|
+
throw new Un({
|
|
435
435
|
code: "NOT_FOUND",
|
|
436
436
|
message: `Unknown networkId: ${t}`
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
function
|
|
441
|
-
return t.replace(".stark", "").split(".").map((r) =>
|
|
440
|
+
function Ys(t) {
|
|
441
|
+
return t.replace(".stark", "").split(".").map((r) => Hn.useEncoded(r).toString(10));
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
const e =
|
|
445
|
-
return
|
|
443
|
+
function Xs(t) {
|
|
444
|
+
const e = Zs(t);
|
|
445
|
+
return Hn.getStarknetIdContract(e);
|
|
446
446
|
}
|
|
447
|
-
function
|
|
448
|
-
const n =
|
|
447
|
+
function Js(t, e) {
|
|
448
|
+
const n = Xs(e), r = Ys(t);
|
|
449
449
|
try {
|
|
450
450
|
const o = { domain: r, hint: [] };
|
|
451
|
-
return
|
|
451
|
+
return Lr.parse({
|
|
452
452
|
contractAddress: n,
|
|
453
453
|
entrypoint: "domain_to_address",
|
|
454
454
|
calldata: o
|
|
455
455
|
});
|
|
456
456
|
} catch (s) {
|
|
457
|
-
throw new
|
|
457
|
+
throw new jn({
|
|
458
458
|
code: "NOT_VALID",
|
|
459
459
|
options: { error: s }
|
|
460
460
|
});
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
async function
|
|
463
|
+
async function Qs(t, e, n) {
|
|
464
464
|
if (!e || !n)
|
|
465
|
-
throw new
|
|
465
|
+
throw new Un({
|
|
466
466
|
code: "NO_NETWORK_OR_MULTICALL"
|
|
467
467
|
});
|
|
468
468
|
let r = null;
|
|
469
469
|
try {
|
|
470
|
-
r =
|
|
470
|
+
r = Js(t, e);
|
|
471
471
|
} catch (i) {
|
|
472
|
-
throw new
|
|
472
|
+
throw new jn({
|
|
473
473
|
code: "NOT_VALID",
|
|
474
474
|
options: { error: i }
|
|
475
475
|
});
|
|
@@ -482,25 +482,25 @@ async function to(t, e, n) {
|
|
|
482
482
|
code: "STARKNAME_ERROR"
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
|
-
if (
|
|
485
|
+
if (Dr(o))
|
|
486
486
|
throw new St({
|
|
487
487
|
code: "STARKNAME_NOT_FOUND",
|
|
488
488
|
message: `${t} not found`
|
|
489
489
|
});
|
|
490
|
-
if (!
|
|
490
|
+
if (!Hr(o))
|
|
491
491
|
throw new St({
|
|
492
492
|
code: "STARKNAME_INVALID_ADDRESS",
|
|
493
493
|
message: `${t} resolved to an invalid address (${o})`
|
|
494
494
|
});
|
|
495
|
-
return
|
|
495
|
+
return Ln(o);
|
|
496
496
|
}
|
|
497
497
|
class Zl {
|
|
498
498
|
constructor(e, n, r) {
|
|
499
499
|
this.httpService = e, this.baseUrl = n, this.allowedArgentNameNetworkId = r;
|
|
500
500
|
}
|
|
501
501
|
async parseAddressOrDomain(e, n, r) {
|
|
502
|
-
if (
|
|
503
|
-
return
|
|
502
|
+
if (Vr(e))
|
|
503
|
+
return Ln(e);
|
|
504
504
|
try {
|
|
505
505
|
return await this.getAddressFromDomainName(e, n, r);
|
|
506
506
|
} catch {
|
|
@@ -508,9 +508,9 @@ class Zl {
|
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
async getAddressFromDomainName(e, n, r) {
|
|
511
|
-
if (
|
|
512
|
-
return
|
|
513
|
-
if (
|
|
511
|
+
if (Mr(e))
|
|
512
|
+
return Qs(e, n, r);
|
|
513
|
+
if (Gr(e)) {
|
|
514
514
|
if (n !== this.allowedArgentNameNetworkId)
|
|
515
515
|
throw new St({
|
|
516
516
|
code: "ARGENT_NAME_INVALID_NETWORK",
|
|
@@ -523,7 +523,7 @@ class Zl {
|
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
const
|
|
526
|
+
const to = [
|
|
527
527
|
"0x25ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918"
|
|
528
528
|
], tt = {
|
|
529
529
|
// CAIRO_0
|
|
@@ -540,48 +540,48 @@ const eo = [
|
|
|
540
540
|
"0.1.1": "0x6e150953b26271a740bf2b6e9bca17cc52c68d765f761295de51ceb8526ee72",
|
|
541
541
|
"0.1.0": "0x737ee2f87ce571a58c6c8da558ec18a07ceb64a6172d5ec46171fbc80077a48"
|
|
542
542
|
};
|
|
543
|
-
var
|
|
544
|
-
function
|
|
545
|
-
var e =
|
|
543
|
+
var eo = typeof global == "object" && global && global.Object === Object && global, no = typeof self == "object" && self && self.Object === Object && self, ie = eo || no || Function("return this")(), Qt = ie.Symbol, tr = Object.prototype, ro = tr.hasOwnProperty, so = tr.toString, Nt = Qt ? Qt.toStringTag : void 0;
|
|
544
|
+
function oo(t) {
|
|
545
|
+
var e = ro.call(t, Nt), n = t[Nt];
|
|
546
546
|
try {
|
|
547
547
|
t[Nt] = void 0;
|
|
548
548
|
var r = !0;
|
|
549
549
|
} catch {
|
|
550
550
|
}
|
|
551
|
-
var s =
|
|
551
|
+
var s = so.call(t);
|
|
552
552
|
return r && (e ? t[Nt] = n : delete t[Nt]), s;
|
|
553
553
|
}
|
|
554
|
-
var
|
|
555
|
-
function
|
|
556
|
-
return
|
|
554
|
+
var ao = Object.prototype, io = ao.toString;
|
|
555
|
+
function co(t) {
|
|
556
|
+
return io.call(t);
|
|
557
557
|
}
|
|
558
|
-
var
|
|
559
|
-
function
|
|
560
|
-
return t == null ? t === void 0 ?
|
|
558
|
+
var lo = "[object Null]", uo = "[object Undefined]", un = Qt ? Qt.toStringTag : void 0;
|
|
559
|
+
function fo(t) {
|
|
560
|
+
return t == null ? t === void 0 ? uo : lo : un && un in Object(t) ? oo(t) : co(t);
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function er(t) {
|
|
563
563
|
var e = typeof t;
|
|
564
564
|
return t != null && (e == "object" || e == "function");
|
|
565
565
|
}
|
|
566
|
-
var
|
|
567
|
-
function
|
|
568
|
-
if (!
|
|
566
|
+
var ho = "[object AsyncFunction]", po = "[object Function]", mo = "[object GeneratorFunction]", go = "[object Proxy]";
|
|
567
|
+
function wo(t) {
|
|
568
|
+
if (!er(t))
|
|
569
569
|
return !1;
|
|
570
|
-
var e =
|
|
571
|
-
return e ==
|
|
570
|
+
var e = fo(t);
|
|
571
|
+
return e == po || e == mo || e == ho || e == go;
|
|
572
572
|
}
|
|
573
|
-
var be =
|
|
573
|
+
var be = ie["__core-js_shared__"], dn = function() {
|
|
574
574
|
var t = /[^.]+$/.exec(be && be.keys && be.keys.IE_PROTO || "");
|
|
575
575
|
return t ? "Symbol(src)_1." + t : "";
|
|
576
576
|
}();
|
|
577
577
|
function bo(t) {
|
|
578
|
-
return !!
|
|
578
|
+
return !!dn && dn in t;
|
|
579
579
|
}
|
|
580
|
-
var
|
|
581
|
-
function
|
|
580
|
+
var yo = Function.prototype, So = yo.toString;
|
|
581
|
+
function Eo(t) {
|
|
582
582
|
if (t != null) {
|
|
583
583
|
try {
|
|
584
|
-
return
|
|
584
|
+
return So.call(t);
|
|
585
585
|
} catch {
|
|
586
586
|
}
|
|
587
587
|
try {
|
|
@@ -591,48 +591,48 @@ function Ao(t) {
|
|
|
591
591
|
}
|
|
592
592
|
return "";
|
|
593
593
|
}
|
|
594
|
-
var
|
|
595
|
-
"^" +
|
|
594
|
+
var Ao = /[\\^$.*+?()[\]{}|]/g, xo = /^\[object .+?Constructor\]$/, vo = Function.prototype, Io = Object.prototype, To = vo.toString, Bo = Io.hasOwnProperty, _o = RegExp(
|
|
595
|
+
"^" + To.call(Bo).replace(Ao, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
596
596
|
);
|
|
597
|
-
function
|
|
598
|
-
if (!
|
|
597
|
+
function No(t) {
|
|
598
|
+
if (!er(t) || bo(t))
|
|
599
599
|
return !1;
|
|
600
|
-
var e =
|
|
601
|
-
return e.test(
|
|
600
|
+
var e = wo(t) ? _o : xo;
|
|
601
|
+
return e.test(Eo(t));
|
|
602
602
|
}
|
|
603
|
-
function
|
|
603
|
+
function Co(t, e) {
|
|
604
604
|
return t == null ? void 0 : t[e];
|
|
605
605
|
}
|
|
606
|
-
function
|
|
607
|
-
var n =
|
|
608
|
-
return
|
|
606
|
+
function Le(t, e) {
|
|
607
|
+
var n = Co(t, e);
|
|
608
|
+
return No(n) ? n : void 0;
|
|
609
609
|
}
|
|
610
|
-
var Ut =
|
|
611
|
-
function
|
|
610
|
+
var Ut = Le(Object, "create");
|
|
611
|
+
function Oo() {
|
|
612
612
|
this.__data__ = Ut ? Ut(null) : {}, this.size = 0;
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function ko(t) {
|
|
615
615
|
var e = this.has(t) && delete this.__data__[t];
|
|
616
616
|
return this.size -= e ? 1 : 0, e;
|
|
617
617
|
}
|
|
618
|
-
var
|
|
619
|
-
function
|
|
618
|
+
var Po = "__lodash_hash_undefined__", Ro = Object.prototype, $o = Ro.hasOwnProperty;
|
|
619
|
+
function Fo(t) {
|
|
620
620
|
var e = this.__data__;
|
|
621
621
|
if (Ut) {
|
|
622
622
|
var n = e[t];
|
|
623
|
-
return n ===
|
|
623
|
+
return n === Po ? void 0 : n;
|
|
624
624
|
}
|
|
625
|
-
return
|
|
625
|
+
return $o.call(e, t) ? e[t] : void 0;
|
|
626
626
|
}
|
|
627
|
-
var
|
|
628
|
-
function
|
|
627
|
+
var Uo = Object.prototype, jo = Uo.hasOwnProperty;
|
|
628
|
+
function Lo(t) {
|
|
629
629
|
var e = this.__data__;
|
|
630
|
-
return Ut ? e[t] !== void 0 :
|
|
630
|
+
return Ut ? e[t] !== void 0 : jo.call(e, t);
|
|
631
631
|
}
|
|
632
|
-
var
|
|
633
|
-
function
|
|
632
|
+
var Do = "__lodash_hash_undefined__";
|
|
633
|
+
function Ho(t, e) {
|
|
634
634
|
var n = this.__data__;
|
|
635
|
-
return this.size += this.has(t) ? 0 : 1, n[t] = Ut && e === void 0 ?
|
|
635
|
+
return this.size += this.has(t) ? 0 : 1, n[t] = Ut && e === void 0 ? Do : e, this;
|
|
636
636
|
}
|
|
637
637
|
function ft(t) {
|
|
638
638
|
var e = -1, n = t == null ? 0 : t.length;
|
|
@@ -641,40 +641,40 @@ function ft(t) {
|
|
|
641
641
|
this.set(r[0], r[1]);
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
|
-
ft.prototype.clear =
|
|
645
|
-
ft.prototype.delete =
|
|
646
|
-
ft.prototype.get =
|
|
647
|
-
ft.prototype.has =
|
|
648
|
-
ft.prototype.set =
|
|
649
|
-
function
|
|
644
|
+
ft.prototype.clear = Oo;
|
|
645
|
+
ft.prototype.delete = ko;
|
|
646
|
+
ft.prototype.get = Fo;
|
|
647
|
+
ft.prototype.has = Lo;
|
|
648
|
+
ft.prototype.set = Ho;
|
|
649
|
+
function Vo() {
|
|
650
650
|
this.__data__ = [], this.size = 0;
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function Mo(t, e) {
|
|
653
653
|
return t === e || t !== t && e !== e;
|
|
654
654
|
}
|
|
655
|
-
function
|
|
655
|
+
function ce(t, e) {
|
|
656
656
|
for (var n = t.length; n--; )
|
|
657
|
-
if (
|
|
657
|
+
if (Mo(t[n][0], e))
|
|
658
658
|
return n;
|
|
659
659
|
return -1;
|
|
660
660
|
}
|
|
661
|
-
var
|
|
661
|
+
var Go = Array.prototype, qo = Go.splice;
|
|
662
662
|
function Wo(t) {
|
|
663
|
-
var e = this.__data__, n =
|
|
663
|
+
var e = this.__data__, n = ce(e, t);
|
|
664
664
|
if (n < 0)
|
|
665
665
|
return !1;
|
|
666
666
|
var r = e.length - 1;
|
|
667
667
|
return n == r ? e.pop() : qo.call(e, n, 1), --this.size, !0;
|
|
668
668
|
}
|
|
669
|
-
function
|
|
670
|
-
var e = this.__data__, n =
|
|
669
|
+
function zo(t) {
|
|
670
|
+
var e = this.__data__, n = ce(e, t);
|
|
671
671
|
return n < 0 ? void 0 : e[n][1];
|
|
672
672
|
}
|
|
673
|
-
function
|
|
674
|
-
return
|
|
673
|
+
function Ko(t) {
|
|
674
|
+
return ce(this.__data__, t) > -1;
|
|
675
675
|
}
|
|
676
|
-
function
|
|
677
|
-
var n = this.__data__, r =
|
|
676
|
+
function Zo(t, e) {
|
|
677
|
+
var n = this.__data__, r = ce(n, t);
|
|
678
678
|
return r < 0 ? (++this.size, n.push([t, e])) : n[r][1] = e, this;
|
|
679
679
|
}
|
|
680
680
|
function It(t) {
|
|
@@ -684,39 +684,39 @@ function It(t) {
|
|
|
684
684
|
this.set(r[0], r[1]);
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
|
-
It.prototype.clear =
|
|
687
|
+
It.prototype.clear = Vo;
|
|
688
688
|
It.prototype.delete = Wo;
|
|
689
|
-
It.prototype.get =
|
|
690
|
-
It.prototype.has =
|
|
691
|
-
It.prototype.set =
|
|
692
|
-
var
|
|
693
|
-
function
|
|
689
|
+
It.prototype.get = zo;
|
|
690
|
+
It.prototype.has = Ko;
|
|
691
|
+
It.prototype.set = Zo;
|
|
692
|
+
var Yo = Le(ie, "Map");
|
|
693
|
+
function Xo() {
|
|
694
694
|
this.size = 0, this.__data__ = {
|
|
695
695
|
hash: new ft(),
|
|
696
|
-
map: new (
|
|
696
|
+
map: new (Yo || It)(),
|
|
697
697
|
string: new ft()
|
|
698
698
|
};
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function Jo(t) {
|
|
701
701
|
var e = typeof t;
|
|
702
702
|
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function le(t, e) {
|
|
705
705
|
var n = t.__data__;
|
|
706
|
-
return
|
|
706
|
+
return Jo(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
|
|
707
707
|
}
|
|
708
|
-
function
|
|
709
|
-
var e =
|
|
708
|
+
function Qo(t) {
|
|
709
|
+
var e = le(this, t).delete(t);
|
|
710
710
|
return this.size -= e ? 1 : 0, e;
|
|
711
711
|
}
|
|
712
|
-
function
|
|
713
|
-
return
|
|
712
|
+
function ta(t) {
|
|
713
|
+
return le(this, t).get(t);
|
|
714
714
|
}
|
|
715
|
-
function
|
|
716
|
-
return
|
|
715
|
+
function ea(t) {
|
|
716
|
+
return le(this, t).has(t);
|
|
717
717
|
}
|
|
718
|
-
function
|
|
719
|
-
var n =
|
|
718
|
+
function na(t, e) {
|
|
719
|
+
var n = le(this, t), r = n.size;
|
|
720
720
|
return n.set(t, e), this.size += n.size == r ? 0 : 1, this;
|
|
721
721
|
}
|
|
722
722
|
function Tt(t) {
|
|
@@ -726,16 +726,16 @@ function Tt(t) {
|
|
|
726
726
|
this.set(r[0], r[1]);
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
|
-
Tt.prototype.clear =
|
|
730
|
-
Tt.prototype.delete =
|
|
731
|
-
Tt.prototype.get =
|
|
732
|
-
Tt.prototype.has =
|
|
733
|
-
Tt.prototype.set =
|
|
734
|
-
var
|
|
735
|
-
function
|
|
736
|
-
return this.__data__.set(t,
|
|
729
|
+
Tt.prototype.clear = Xo;
|
|
730
|
+
Tt.prototype.delete = Qo;
|
|
731
|
+
Tt.prototype.get = ta;
|
|
732
|
+
Tt.prototype.has = ea;
|
|
733
|
+
Tt.prototype.set = na;
|
|
734
|
+
var ra = "__lodash_hash_undefined__";
|
|
735
|
+
function sa(t) {
|
|
736
|
+
return this.__data__.set(t, ra), this;
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function oa(t) {
|
|
739
739
|
return this.__data__.has(t);
|
|
740
740
|
}
|
|
741
741
|
function te(t) {
|
|
@@ -743,68 +743,68 @@ function te(t) {
|
|
|
743
743
|
for (this.__data__ = new Tt(); ++e < n; )
|
|
744
744
|
this.add(t[e]);
|
|
745
745
|
}
|
|
746
|
-
te.prototype.add = te.prototype.push =
|
|
747
|
-
te.prototype.has =
|
|
748
|
-
function
|
|
746
|
+
te.prototype.add = te.prototype.push = sa;
|
|
747
|
+
te.prototype.has = oa;
|
|
748
|
+
function aa(t, e, n, r) {
|
|
749
749
|
for (var s = t.length, o = n + -1; ++o < s; )
|
|
750
750
|
if (e(t[o], o, t))
|
|
751
751
|
return o;
|
|
752
752
|
return -1;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function ia(t) {
|
|
755
755
|
return t !== t;
|
|
756
756
|
}
|
|
757
|
-
function
|
|
757
|
+
function ca(t, e, n) {
|
|
758
758
|
for (var r = n - 1, s = t.length; ++r < s; )
|
|
759
759
|
if (t[r] === e)
|
|
760
760
|
return r;
|
|
761
761
|
return -1;
|
|
762
762
|
}
|
|
763
|
-
function
|
|
764
|
-
return e === e ?
|
|
763
|
+
function la(t, e, n) {
|
|
764
|
+
return e === e ? ca(t, e, n) : aa(t, ia, n);
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function ua(t, e) {
|
|
767
767
|
var n = t == null ? 0 : t.length;
|
|
768
|
-
return !!n &&
|
|
768
|
+
return !!n && la(t, e, 0) > -1;
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function da(t, e, n) {
|
|
771
771
|
for (var r = -1, s = t == null ? 0 : t.length; ++r < s; )
|
|
772
772
|
if (n(e, t[r]))
|
|
773
773
|
return !0;
|
|
774
774
|
return !1;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function fa(t, e) {
|
|
777
777
|
return t.has(e);
|
|
778
778
|
}
|
|
779
|
-
var
|
|
780
|
-
function
|
|
779
|
+
var ye = Le(ie, "Set");
|
|
780
|
+
function ha() {
|
|
781
781
|
}
|
|
782
|
-
function
|
|
782
|
+
function nr(t) {
|
|
783
783
|
var e = -1, n = Array(t.size);
|
|
784
784
|
return t.forEach(function(r) {
|
|
785
785
|
n[++e] = r;
|
|
786
786
|
}), n;
|
|
787
787
|
}
|
|
788
|
-
var
|
|
789
|
-
return new
|
|
790
|
-
} :
|
|
791
|
-
function
|
|
792
|
-
var r = -1, s =
|
|
788
|
+
var pa = 1 / 0, ma = ye && 1 / nr(new ye([, -0]))[1] == pa ? function(t) {
|
|
789
|
+
return new ye(t);
|
|
790
|
+
} : ha, ga = 200;
|
|
791
|
+
function wa(t, e, n) {
|
|
792
|
+
var r = -1, s = ua, o = t.length, a = !0, i = [], c = i;
|
|
793
793
|
if (n)
|
|
794
|
-
a = !1, s =
|
|
795
|
-
else if (o >=
|
|
796
|
-
var l =
|
|
794
|
+
a = !1, s = da;
|
|
795
|
+
else if (o >= ga) {
|
|
796
|
+
var l = ma(t);
|
|
797
797
|
if (l)
|
|
798
|
-
return
|
|
799
|
-
a = !1, s =
|
|
798
|
+
return nr(l);
|
|
799
|
+
a = !1, s = fa, c = new te();
|
|
800
800
|
} else
|
|
801
801
|
c = i;
|
|
802
802
|
t:
|
|
803
803
|
for (; ++r < o; ) {
|
|
804
804
|
var d = t[r], u = d;
|
|
805
805
|
if (d = n || d !== 0 ? d : 0, a && u === u) {
|
|
806
|
-
for (var
|
|
807
|
-
if (c[
|
|
806
|
+
for (var b = c.length; b--; )
|
|
807
|
+
if (c[b] === u)
|
|
808
808
|
continue t;
|
|
809
809
|
i.push(d);
|
|
810
810
|
} else s(c, u, n) || (c !== i && c.push(u), i.push(d));
|
|
@@ -812,9 +812,9 @@ function ya(t, e, n) {
|
|
|
812
812
|
return i;
|
|
813
813
|
}
|
|
814
814
|
function ba(t, e) {
|
|
815
|
-
return e = typeof e == "function" ? e : void 0, t && t.length ?
|
|
815
|
+
return e = typeof e == "function" ? e : void 0, t && t.length ? wa(t, void 0, e) : [];
|
|
816
816
|
}
|
|
817
|
-
function
|
|
817
|
+
function fn(t) {
|
|
818
818
|
const e = Object.entries(tt), n = Object.entries(Jt);
|
|
819
819
|
switch (t) {
|
|
820
820
|
case "cairo0":
|
|
@@ -827,7 +827,7 @@ function pn(t) {
|
|
|
827
827
|
return e.map(([, r]) => r);
|
|
828
828
|
}
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function ya() {
|
|
831
831
|
const t = Q.maxSatisfying(Object.keys(tt), "*");
|
|
832
832
|
if (!t)
|
|
833
833
|
throw new Error(`No argent account contract found: v${t} `);
|
|
@@ -839,7 +839,7 @@ function Yl() {
|
|
|
839
839
|
throw new Error(`No argent multisig contract found: v${t} `);
|
|
840
840
|
return Jt[t];
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function Sa() {
|
|
843
843
|
return Object.entries(tt).filter(([t]) => Q.gte(t, "0.4.0")).map(([, t]) => t);
|
|
844
844
|
}
|
|
845
845
|
function Xl() {
|
|
@@ -848,7 +848,7 @@ function Xl() {
|
|
|
848
848
|
throw new Error(`No argent account contract found: v${t} `);
|
|
849
849
|
return tt[t];
|
|
850
850
|
}
|
|
851
|
-
function
|
|
851
|
+
function Ea() {
|
|
852
852
|
const t = Object.entries(tt).filter(([n]) => Q.gte(n, "0.3.1")).map(([, n]) => n), e = Object.entries(Jt).filter(([n]) => Q.gte(n, "0.1.1")).map(([, n]) => n);
|
|
853
853
|
return [...t, ...e];
|
|
854
854
|
}
|
|
@@ -861,60 +861,60 @@ function Ql() {
|
|
|
861
861
|
throw new Error(`No ledger account contract found: v${t}`);
|
|
862
862
|
return tt[t];
|
|
863
863
|
}
|
|
864
|
-
const
|
|
864
|
+
const Aa = (t, e) => t.cairoVersion === e.cairoVersion && nt(t.accountClassHash, e.accountClassHash);
|
|
865
865
|
function tu(t, e, n = []) {
|
|
866
866
|
if (e.type === "imported")
|
|
867
867
|
throw new Error("Cannot find implementation for imported account");
|
|
868
|
-
const r =
|
|
868
|
+
const r = tn.parse({
|
|
869
869
|
cairoVersion: e.cairoVersion ?? "1",
|
|
870
|
-
accountClassHash: e.classHash ??
|
|
871
|
-
}), s = f.array(
|
|
872
|
-
...
|
|
873
|
-
...
|
|
870
|
+
accountClassHash: e.classHash ?? ya()
|
|
871
|
+
}), s = f.array(tn).parse(n), o = [
|
|
872
|
+
...fn("cairo0").map((l) => ({ cairoVersion: "0", accountClassHash: l })),
|
|
873
|
+
...fn("cairo1").map((l) => ({ cairoVersion: "1", accountClassHash: l }))
|
|
874
874
|
], c = ba([
|
|
875
875
|
r,
|
|
876
876
|
...s,
|
|
877
877
|
...o
|
|
878
|
-
],
|
|
878
|
+
], Aa).map((l) => ({
|
|
879
879
|
implementation: l,
|
|
880
|
-
address:
|
|
880
|
+
address: Ia(l.cairoVersion, l.accountClassHash, t, e.guardian, e.salt)
|
|
881
881
|
})).find((l) => nt(l.address, e.address));
|
|
882
882
|
if (!c)
|
|
883
883
|
throw new Wr({ code: "CALCULATED_ADDRESS_NO_MATCH" });
|
|
884
884
|
return c.implementation;
|
|
885
885
|
}
|
|
886
|
-
function
|
|
887
|
-
const a =
|
|
886
|
+
function xa(t, e, n, r, s, o = to[0]) {
|
|
887
|
+
const a = va(t, e, n, r);
|
|
888
888
|
return {
|
|
889
889
|
classHash: t === "0" ? o : e,
|
|
890
890
|
constructorCalldata: mt.compile(a),
|
|
891
891
|
addressSalt: s || n
|
|
892
892
|
};
|
|
893
893
|
}
|
|
894
|
-
function
|
|
895
|
-
const s = t !== "0" && nt(
|
|
894
|
+
function va(t, e, n, r) {
|
|
895
|
+
const s = t !== "0" && nt(zr, e), o = {
|
|
896
896
|
pubkey: n,
|
|
897
897
|
...s ? {} : { guardian: r || "0" }
|
|
898
898
|
};
|
|
899
|
-
if (
|
|
900
|
-
const i =
|
|
899
|
+
if (Sa().some((i) => nt(i, e))) {
|
|
900
|
+
const i = en(n, nn.Starknet), c = r ? new sn(on.Some, en(r, nn.Starknet)) : new sn(on.None, null);
|
|
901
901
|
return { ownerSigner: i, guardianAsOption: c };
|
|
902
902
|
}
|
|
903
|
-
return t === "0" ?
|
|
903
|
+
return t === "0" ? Kr.parse({
|
|
904
904
|
implementation: e,
|
|
905
|
-
selector:
|
|
905
|
+
selector: Vn.getSelectorFromName("initialize"),
|
|
906
906
|
calldata: mt.compile(o)
|
|
907
|
-
}) :
|
|
907
|
+
}) : Zr.parse({
|
|
908
908
|
owner: n,
|
|
909
909
|
guardian: r
|
|
910
910
|
});
|
|
911
911
|
}
|
|
912
|
-
function
|
|
913
|
-
const o =
|
|
914
|
-
return
|
|
912
|
+
function Ia(t, e, n, r, s) {
|
|
913
|
+
const o = xa(t, e, n, r, s);
|
|
914
|
+
return Vn.calculateContractAddressFromHash(o.addressSalt, o.classHash, o.constructorCalldata, 0);
|
|
915
915
|
}
|
|
916
916
|
function eu(t, e) {
|
|
917
|
-
const n =
|
|
917
|
+
const n = cn(t), r = cn();
|
|
918
918
|
return Ft(() => {
|
|
919
919
|
n.current = t;
|
|
920
920
|
}, [t]), Ft(() => () => {
|
|
@@ -924,7 +924,7 @@ function eu(t, e) {
|
|
|
924
924
|
};
|
|
925
925
|
}
|
|
926
926
|
function nu(t, e) {
|
|
927
|
-
const [n, r] =
|
|
927
|
+
const [n, r] = Mn(t);
|
|
928
928
|
return Ft(() => {
|
|
929
929
|
const s = setTimeout(() => {
|
|
930
930
|
r(t);
|
|
@@ -934,7 +934,7 @@ function nu(t, e) {
|
|
|
934
934
|
};
|
|
935
935
|
}, [t, e]), n;
|
|
936
936
|
}
|
|
937
|
-
const
|
|
937
|
+
const Ta = f.object({
|
|
938
938
|
name: f.enum([
|
|
939
939
|
"dappland",
|
|
940
940
|
"discord",
|
|
@@ -945,16 +945,16 @@ const Ba = f.object({
|
|
|
945
945
|
]),
|
|
946
946
|
url: f.string(),
|
|
947
947
|
position: f.number()
|
|
948
|
-
}),
|
|
949
|
-
address:
|
|
948
|
+
}), Ba = f.object({
|
|
949
|
+
address: Pe,
|
|
950
950
|
chain: f.enum(["ethereum", "starknet"])
|
|
951
|
-
}),
|
|
951
|
+
}), _a = f.object({
|
|
952
952
|
maxExpiryDays: f.number().positive(),
|
|
953
953
|
allowList: f.array(f.object({
|
|
954
|
-
contractAddress:
|
|
954
|
+
contractAddress: Pe,
|
|
955
955
|
methods: f.array(f.string())
|
|
956
956
|
}))
|
|
957
|
-
}),
|
|
957
|
+
}), Na = f.object({
|
|
958
958
|
dappId: f.string(),
|
|
959
959
|
name: f.string(),
|
|
960
960
|
description: f.string().optional(),
|
|
@@ -962,61 +962,61 @@ const Ba = f.object({
|
|
|
962
962
|
dappUrl: f.string().optional(),
|
|
963
963
|
inAppBrowserCompatible: f.boolean(),
|
|
964
964
|
argentVerified: f.boolean(),
|
|
965
|
-
links: f.array(
|
|
966
|
-
contracts: f.array(
|
|
965
|
+
links: f.array(Ta).optional(),
|
|
966
|
+
contracts: f.array(Ba).optional(),
|
|
967
967
|
categories: f.array(f.string()).optional(),
|
|
968
968
|
supportedApps: f.array(f.string()).optional(),
|
|
969
969
|
brandColor: f.string().optional(),
|
|
970
970
|
executeFromOutsideAllowed: f.boolean().default(!1).optional(),
|
|
971
|
-
sessionConfig: f.union([
|
|
972
|
-
}),
|
|
971
|
+
sessionConfig: f.union([_a, f.object({})]).nullable().optional()
|
|
972
|
+
}), Ca = f.array(Na);
|
|
973
973
|
class ru {
|
|
974
974
|
constructor(e, n) {
|
|
975
|
-
this.apiBase = e, this.httpService = new
|
|
975
|
+
this.apiBase = e, this.httpService = new Jn(n, "json");
|
|
976
976
|
}
|
|
977
977
|
async getAll() {
|
|
978
|
-
const e = await this.httpService.get(`${this.apiBase}/tokens/dapps`), n =
|
|
978
|
+
const e = await this.httpService.get(`${this.apiBase}/tokens/dapps`), n = Ca.safeParse(e);
|
|
979
979
|
if (!n.success)
|
|
980
980
|
throw new Error("Failed to parse known dapps");
|
|
981
981
|
return n.data;
|
|
982
982
|
}
|
|
983
983
|
}
|
|
984
|
-
function
|
|
984
|
+
function Oa(t) {
|
|
985
985
|
var e;
|
|
986
986
|
return (e = t == null ? void 0 : t.links) == null ? void 0 : e.find((n) => n.name === "dappland");
|
|
987
987
|
}
|
|
988
988
|
function su(t) {
|
|
989
989
|
var e;
|
|
990
|
-
return (e =
|
|
990
|
+
return (e = Oa(t)) == null ? void 0 : e.url;
|
|
991
991
|
}
|
|
992
|
-
const
|
|
993
|
-
domain:
|
|
994
|
-
address:
|
|
992
|
+
const rr = F.object({
|
|
993
|
+
domain: Yr,
|
|
994
|
+
address: re.optional(),
|
|
995
995
|
avatar: F.string().optional(),
|
|
996
996
|
status: F.union([F.literal("KNOWN"), F.literal("UNKNOWN")])
|
|
997
|
-
}),
|
|
997
|
+
}), ka = F.array(rr), Pa = F.object({
|
|
998
998
|
provider: F.string(),
|
|
999
999
|
name: F.string(),
|
|
1000
1000
|
avatar: F.string().optional()
|
|
1001
|
-
}),
|
|
1002
|
-
address:
|
|
1001
|
+
}), Ra = F.object({
|
|
1002
|
+
address: re,
|
|
1003
1003
|
status: F.union([F.literal("KNOWN"), F.literal("UNKNOWN")]),
|
|
1004
|
-
resolutions: F.array(
|
|
1005
|
-
}),
|
|
1004
|
+
resolutions: F.array(Pa).optional()
|
|
1005
|
+
}), $a = F.array(F.string()), Fa = Ra.array();
|
|
1006
1006
|
class ou {
|
|
1007
1007
|
constructor(e, n) {
|
|
1008
|
-
this.apiBase = e, this.headers = n, this.httpService = new
|
|
1008
|
+
this.apiBase = e, this.headers = n, this.httpService = new Jn(this.headers, "json");
|
|
1009
1009
|
}
|
|
1010
1010
|
async getAddressFromMultipleStarknetId(e, n, r) {
|
|
1011
1011
|
const s = new URLSearchParams(n.map((c) => ["domain", c]));
|
|
1012
1012
|
r && s.set("includeAvatar", "true");
|
|
1013
|
-
const o = k(this.apiBase, e, "starknet.id", `?${s}`), a = await this.httpService.get(o), i =
|
|
1013
|
+
const o = k(this.apiBase, e, "starknet.id", `?${s}`), a = await this.httpService.get(o), i = ka.safeParse(a);
|
|
1014
1014
|
if (!i.success)
|
|
1015
1015
|
throw new Error("Failed to parse name resolution");
|
|
1016
1016
|
return i.data;
|
|
1017
1017
|
}
|
|
1018
1018
|
async getAddressFromStarknetId(e, n, r) {
|
|
1019
|
-
const s = k(this.apiBase, e, "starknet.id", n, r ? "?includeAvatar=true" : ""), o = await this.httpService.get(s), a =
|
|
1019
|
+
const s = k(this.apiBase, e, "starknet.id", n, r ? "?includeAvatar=true" : ""), o = await this.httpService.get(s), a = rr.safeParse(o);
|
|
1020
1020
|
if (!a.success)
|
|
1021
1021
|
throw new Error("Failed to parse name resolution");
|
|
1022
1022
|
return a.data;
|
|
@@ -1027,111 +1027,111 @@ class ou {
|
|
|
1027
1027
|
async getStarknetIdFromAddress(e, n, r) {
|
|
1028
1028
|
const s = new URLSearchParams(n.map((c) => ["address", c]));
|
|
1029
1029
|
r && s.set("includeAvatar", "true");
|
|
1030
|
-
const o = k(this.apiBase, e, "addresses", `?${s}`), a = await this.httpService.get(o), i =
|
|
1030
|
+
const o = k(this.apiBase, e, "addresses", `?${s}`), a = await this.httpService.get(o), i = Fa.safeParse(a);
|
|
1031
1031
|
if (!i.success)
|
|
1032
1032
|
throw new Error("Failed to parse name resolution");
|
|
1033
1033
|
return i.data;
|
|
1034
1034
|
}
|
|
1035
1035
|
async getProvidersNames(e) {
|
|
1036
|
-
const n = k(this.apiBase, e, "providers", "name"), r = await this.httpService.get(n), s =
|
|
1036
|
+
const n = k(this.apiBase, e, "providers", "name"), r = await this.httpService.get(n), s = $a.safeParse(r);
|
|
1037
1037
|
if (!s.success)
|
|
1038
1038
|
throw new Error("Failed to parse name resolution");
|
|
1039
1039
|
return s.data;
|
|
1040
1040
|
}
|
|
1041
1041
|
}
|
|
1042
|
-
const
|
|
1043
|
-
function
|
|
1042
|
+
const sr = (t) => t.slice(0, 6) + "..." + t.slice(-4);
|
|
1043
|
+
function hn(t) {
|
|
1044
1044
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
1045
1045
|
throw new Error(`positive integer expected, not ${t}`);
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1047
|
+
function Ua(t) {
|
|
1048
1048
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1049
1049
|
}
|
|
1050
|
-
function
|
|
1051
|
-
if (!
|
|
1050
|
+
function ue(t, ...e) {
|
|
1051
|
+
if (!Ua(t))
|
|
1052
1052
|
throw new Error("Uint8Array expected");
|
|
1053
1053
|
if (e.length > 0 && !e.includes(t.length))
|
|
1054
1054
|
throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`);
|
|
1055
1055
|
}
|
|
1056
|
-
function
|
|
1056
|
+
function pn(t, e = !0) {
|
|
1057
1057
|
if (t.destroyed)
|
|
1058
1058
|
throw new Error("Hash instance has been destroyed");
|
|
1059
1059
|
if (e && t.finished)
|
|
1060
1060
|
throw new Error("Hash#digest() has already been called");
|
|
1061
1061
|
}
|
|
1062
|
-
function
|
|
1063
|
-
|
|
1062
|
+
function ja(t, e) {
|
|
1063
|
+
ue(t);
|
|
1064
1064
|
const n = e.outputLen;
|
|
1065
1065
|
if (t.length < n)
|
|
1066
1066
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
1067
1067
|
}
|
|
1068
|
-
const Kt = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
1069
|
-
function
|
|
1070
|
-
return e ? { h: Number(t & Kt), l: Number(t >>
|
|
1068
|
+
const Kt = /* @__PURE__ */ BigInt(2 ** 32 - 1), mn = /* @__PURE__ */ BigInt(32);
|
|
1069
|
+
function La(t, e = !1) {
|
|
1070
|
+
return e ? { h: Number(t & Kt), l: Number(t >> mn & Kt) } : { h: Number(t >> mn & Kt) | 0, l: Number(t & Kt) | 0 };
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function Da(t, e = !1) {
|
|
1073
1073
|
let n = new Uint32Array(t.length), r = new Uint32Array(t.length);
|
|
1074
1074
|
for (let s = 0; s < t.length; s++) {
|
|
1075
|
-
const { h: o, l: a } =
|
|
1075
|
+
const { h: o, l: a } = La(t[s], e);
|
|
1076
1076
|
[n[s], r[s]] = [o, a];
|
|
1077
1077
|
}
|
|
1078
1078
|
return [n, r];
|
|
1079
1079
|
}
|
|
1080
|
-
const
|
|
1080
|
+
const Ha = (t, e, n) => t << n | e >>> 32 - n, Va = (t, e, n) => e << n | t >>> 32 - n, Ma = (t, e, n) => e << n - 32 | t >>> 64 - n, Ga = (t, e, n) => t << n - 32 | e >>> 64 - n;
|
|
1081
1081
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1082
|
-
const qa = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)),
|
|
1083
|
-
function
|
|
1082
|
+
const qa = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), gn = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, Wa = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
1083
|
+
function wn(t) {
|
|
1084
1084
|
for (let e = 0; e < t.length; e++)
|
|
1085
1085
|
t[e] = Wa(t[e]);
|
|
1086
1086
|
}
|
|
1087
|
-
const
|
|
1088
|
-
function
|
|
1089
|
-
|
|
1087
|
+
const za = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
1088
|
+
function Ka(t) {
|
|
1089
|
+
ue(t);
|
|
1090
1090
|
let e = "";
|
|
1091
1091
|
for (let n = 0; n < t.length; n++)
|
|
1092
|
-
e +=
|
|
1092
|
+
e += za[t[n]];
|
|
1093
1093
|
return e;
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function or(t) {
|
|
1096
1096
|
if (typeof t != "string")
|
|
1097
1097
|
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1098
1098
|
return new Uint8Array(new TextEncoder().encode(t));
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1101
|
-
return typeof t == "string" && (t =
|
|
1100
|
+
function ar(t) {
|
|
1101
|
+
return typeof t == "string" && (t = or(t)), ue(t), t;
|
|
1102
1102
|
}
|
|
1103
|
-
let
|
|
1103
|
+
let Za = class {
|
|
1104
1104
|
// Safe version that clones internal state
|
|
1105
1105
|
clone() {
|
|
1106
1106
|
return this._cloneInto();
|
|
1107
1107
|
}
|
|
1108
1108
|
};
|
|
1109
|
-
function
|
|
1110
|
-
const e = (r) => t().update(
|
|
1109
|
+
function Ya(t) {
|
|
1110
|
+
const e = (r) => t().update(ar(r)).digest(), n = t();
|
|
1111
1111
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1112
1112
|
}
|
|
1113
|
-
const
|
|
1113
|
+
const ir = [], cr = [], lr = [], Xa = /* @__PURE__ */ BigInt(0), Ct = /* @__PURE__ */ BigInt(1), Ja = /* @__PURE__ */ BigInt(2), Qa = /* @__PURE__ */ BigInt(7), ti = /* @__PURE__ */ BigInt(256), ei = /* @__PURE__ */ BigInt(113);
|
|
1114
1114
|
for (let t = 0, e = Ct, n = 1, r = 0; t < 24; t++) {
|
|
1115
|
-
[n, r] = [r, (2 * n + 3 * r) % 5],
|
|
1116
|
-
let s =
|
|
1115
|
+
[n, r] = [r, (2 * n + 3 * r) % 5], ir.push(2 * (5 * r + n)), cr.push((t + 1) * (t + 2) / 2 % 64);
|
|
1116
|
+
let s = Xa;
|
|
1117
1117
|
for (let o = 0; o < 7; o++)
|
|
1118
|
-
e = (e << Ct ^ (e >>
|
|
1119
|
-
|
|
1118
|
+
e = (e << Ct ^ (e >> Qa) * ei) % ti, e & Ja && (s ^= Ct << (Ct << /* @__PURE__ */ BigInt(o)) - Ct);
|
|
1119
|
+
lr.push(s);
|
|
1120
1120
|
}
|
|
1121
|
-
const [
|
|
1122
|
-
function
|
|
1121
|
+
const [ni, ri] = /* @__PURE__ */ Da(lr, !0), bn = (t, e, n) => n > 32 ? Ma(t, e, n) : Ha(t, e, n), yn = (t, e, n) => n > 32 ? Ga(t, e, n) : Va(t, e, n);
|
|
1122
|
+
function si(t, e = 24) {
|
|
1123
1123
|
const n = new Uint32Array(10);
|
|
1124
1124
|
for (let r = 24 - e; r < 24; r++) {
|
|
1125
1125
|
for (let a = 0; a < 10; a++)
|
|
1126
1126
|
n[a] = t[a] ^ t[a + 10] ^ t[a + 20] ^ t[a + 30] ^ t[a + 40];
|
|
1127
1127
|
for (let a = 0; a < 10; a += 2) {
|
|
1128
|
-
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u =
|
|
1128
|
+
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u = bn(l, d, 1) ^ n[i], b = yn(l, d, 1) ^ n[i + 1];
|
|
1129
1129
|
for (let m = 0; m < 50; m += 10)
|
|
1130
|
-
t[a + m] ^= u, t[a + m + 1] ^=
|
|
1130
|
+
t[a + m] ^= u, t[a + m + 1] ^= b;
|
|
1131
1131
|
}
|
|
1132
1132
|
let s = t[2], o = t[3];
|
|
1133
1133
|
for (let a = 0; a < 24; a++) {
|
|
1134
|
-
const i =
|
|
1134
|
+
const i = cr[a], c = bn(s, o, i), l = yn(s, o, i), d = ir[a];
|
|
1135
1135
|
s = t[d], o = t[d + 1], t[d] = c, t[d + 1] = l;
|
|
1136
1136
|
}
|
|
1137
1137
|
for (let a = 0; a < 50; a += 10) {
|
|
@@ -1140,24 +1140,24 @@ function oi(t, e = 24) {
|
|
|
1140
1140
|
for (let i = 0; i < 10; i++)
|
|
1141
1141
|
t[a + i] ^= ~n[(i + 2) % 10] & n[(i + 4) % 10];
|
|
1142
1142
|
}
|
|
1143
|
-
t[0] ^=
|
|
1143
|
+
t[0] ^= ni[r], t[1] ^= ri[r];
|
|
1144
1144
|
}
|
|
1145
1145
|
n.fill(0);
|
|
1146
1146
|
}
|
|
1147
|
-
let
|
|
1147
|
+
let oi = class ur extends Za {
|
|
1148
1148
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1149
1149
|
constructor(e, n, r, s = !1, o = 24) {
|
|
1150
|
-
if (super(), this.blockLen = e, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = o, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1,
|
|
1150
|
+
if (super(), this.blockLen = e, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = o, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, hn(r), 0 >= this.blockLen || this.blockLen >= 200)
|
|
1151
1151
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1152
1152
|
this.state = new Uint8Array(200), this.state32 = qa(this.state);
|
|
1153
1153
|
}
|
|
1154
1154
|
keccak() {
|
|
1155
|
-
|
|
1155
|
+
gn || wn(this.state32), si(this.state32, this.rounds), gn || wn(this.state32), this.posOut = 0, this.pos = 0;
|
|
1156
1156
|
}
|
|
1157
1157
|
update(e) {
|
|
1158
|
-
|
|
1158
|
+
pn(this);
|
|
1159
1159
|
const { blockLen: n, state: r } = this;
|
|
1160
|
-
e =
|
|
1160
|
+
e = ar(e);
|
|
1161
1161
|
const s = e.length;
|
|
1162
1162
|
for (let o = 0; o < s; ) {
|
|
1163
1163
|
const a = Math.min(n - this.pos, s - o);
|
|
@@ -1175,7 +1175,7 @@ let ai = class dr extends Ya {
|
|
|
1175
1175
|
e[r] ^= n, n & 128 && r === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
1176
1176
|
}
|
|
1177
1177
|
writeInto(e) {
|
|
1178
|
-
|
|
1178
|
+
pn(this, !1), ue(e), this.finish();
|
|
1179
1179
|
const n = this.state, { blockLen: r } = this;
|
|
1180
1180
|
for (let s = 0, o = e.length; s < o; ) {
|
|
1181
1181
|
this.posOut >= r && this.keccak();
|
|
@@ -1190,10 +1190,10 @@ let ai = class dr extends Ya {
|
|
|
1190
1190
|
return this.writeInto(e);
|
|
1191
1191
|
}
|
|
1192
1192
|
xof(e) {
|
|
1193
|
-
return
|
|
1193
|
+
return hn(e), this.xofInto(new Uint8Array(e));
|
|
1194
1194
|
}
|
|
1195
1195
|
digestInto(e) {
|
|
1196
|
-
if (
|
|
1196
|
+
if (ja(e, this), this.finished)
|
|
1197
1197
|
throw new Error("digest() was already called");
|
|
1198
1198
|
return this.writeInto(e), this.destroy(), e;
|
|
1199
1199
|
}
|
|
@@ -1205,36 +1205,36 @@ let ai = class dr extends Ya {
|
|
|
1205
1205
|
}
|
|
1206
1206
|
_cloneInto(e) {
|
|
1207
1207
|
const { blockLen: n, suffix: r, outputLen: s, rounds: o, enableXOF: a } = this;
|
|
1208
|
-
return e || (e = new
|
|
1208
|
+
return e || (e = new ur(n, r, s, a, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = r, e.outputLen = s, e.enableXOF = a, e.destroyed = this.destroyed, e;
|
|
1209
1209
|
}
|
|
1210
1210
|
};
|
|
1211
|
-
const
|
|
1212
|
-
function
|
|
1213
|
-
return `0x${
|
|
1211
|
+
const ai = (t, e, n) => Ya(() => new oi(e, t, n)), ii = /* @__PURE__ */ ai(1, 136, 256 / 8);
|
|
1212
|
+
function ci(t) {
|
|
1213
|
+
return `0x${Ka(ii(or(t)))}`;
|
|
1214
1214
|
}
|
|
1215
|
-
const
|
|
1216
|
-
if (!
|
|
1215
|
+
const li = (t) => {
|
|
1216
|
+
if (!qn(t))
|
|
1217
1217
|
return;
|
|
1218
1218
|
const e = /(\d+)$/, n = t.match(e);
|
|
1219
1219
|
if (n)
|
|
1220
1220
|
return n[1];
|
|
1221
|
-
},
|
|
1222
|
-
if (!
|
|
1221
|
+
}, ui = (t, e = !1) => {
|
|
1222
|
+
if (!qn(t))
|
|
1223
1223
|
return "";
|
|
1224
|
-
const n = e ? t.replace(/[^0-9a-z ]/gi, "") : t, s =
|
|
1224
|
+
const n = e ? t.replace(/[^0-9a-z ]/gi, "") : t, s = $e(n).split(" "), o = li(n), a = s.map((i) => i[0]);
|
|
1225
1225
|
return o && o.length > 1 && o.length < n.length ? [a[0], o.substring(0, 2)].join("") : s.length === 1 ? s[0].substring(0, 2) : [a[0], a[a.length - 1]].join("");
|
|
1226
|
-
}, { toBigInt:
|
|
1226
|
+
}, { toBigInt: di } = O, Sn = (t) => {
|
|
1227
1227
|
const e = t.replace("#", "");
|
|
1228
1228
|
if (!/^[0-9A-F]{6}$/i.test(e))
|
|
1229
1229
|
throw new Error(`Invalid color ${t}`);
|
|
1230
1230
|
return `#${e}`;
|
|
1231
|
-
},
|
|
1232
|
-
const n =
|
|
1231
|
+
}, fi = (t, e) => {
|
|
1232
|
+
const n = Sn(e.background), r = Sn(e.color ?? "#ffffff"), s = ui(t, !0), o = `<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
|
|
1233
1233
|
<rect width="48" height="48" fill="${n}" />
|
|
1234
1234
|
<text x="50%" y="54%" dominant-baseline="middle" text-anchor="middle" font-size="16" font-family="Barlow, Helvetica, Arial, sans-serif" fill="${r}">${s}</text>
|
|
1235
1235
|
</svg>`;
|
|
1236
1236
|
return `data:image/svg+xml;base64,${btoa(o)}`;
|
|
1237
|
-
},
|
|
1237
|
+
}, En = [
|
|
1238
1238
|
"02BBA8",
|
|
1239
1239
|
"29C5FF",
|
|
1240
1240
|
"0078A4",
|
|
@@ -1244,23 +1244,23 @@ const ui = (t) => {
|
|
|
1244
1244
|
"FF675C",
|
|
1245
1245
|
"FF5C72"
|
|
1246
1246
|
], hi = (t) => {
|
|
1247
|
-
const e =
|
|
1248
|
-
return
|
|
1247
|
+
const e = ci(t).slice(-2), n = parseInt(e, 16) % En.length;
|
|
1248
|
+
return En[n];
|
|
1249
1249
|
}, pi = (t) => {
|
|
1250
1250
|
try {
|
|
1251
|
-
return O.toHex(
|
|
1251
|
+
return O.toHex(di(O.hexToDecimalString(t)));
|
|
1252
1252
|
} catch {
|
|
1253
1253
|
}
|
|
1254
1254
|
return "";
|
|
1255
1255
|
}, iu = ({ accountName: t, networkId: e, accountAddress: n, backgroundColor: r }) => {
|
|
1256
1256
|
const s = pi(n), o = `${e}::${s}`, a = r || hi(o);
|
|
1257
|
-
return
|
|
1257
|
+
return fi(t, { background: a });
|
|
1258
1258
|
}, mi = (t) => {
|
|
1259
|
-
const e = $t.removeHexPrefix($t.sanitizeHex(O.toHex(t))), n =
|
|
1260
|
-
return
|
|
1259
|
+
const e = $t.removeHexPrefix($t.sanitizeHex(O.toHex(t))), n = zn.decode(e);
|
|
1260
|
+
return Kn.encode(n);
|
|
1261
1261
|
}, cu = (t) => t.map(mi), gi = (t) => {
|
|
1262
|
-
const e =
|
|
1263
|
-
return $t.sanitizeHex(
|
|
1262
|
+
const e = Kn.decode(t);
|
|
1263
|
+
return $t.sanitizeHex(zn.encode(e));
|
|
1264
1264
|
}, lu = (t) => t.map(gi);
|
|
1265
1265
|
function uu(t, e) {
|
|
1266
1266
|
const n = t.getTime(), r = e.getTime(), s = Math.abs(n - r);
|
|
@@ -1274,7 +1274,7 @@ const du = (t) => (t || "false") === "true", fu = async (t, e) => {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
};
|
|
1276
1276
|
function hu(t) {
|
|
1277
|
-
return !
|
|
1277
|
+
return !fs(t);
|
|
1278
1278
|
}
|
|
1279
1279
|
const pu = (t) => {
|
|
1280
1280
|
const e = /^(0|0x([a-f0-9A-F]+)?)$/;
|
|
@@ -1282,7 +1282,7 @@ const pu = (t) => {
|
|
|
1282
1282
|
}, Y = (t) => !isNaN(parseFloat(t)) && isFinite(Number(t)), mu = (t, e = 16) => {
|
|
1283
1283
|
const n = new RegExp(`^[0-9]*.?[0-9]{0,${e}}$`);
|
|
1284
1284
|
return t === "" ? !0 : Y(t) ? !!n.test(t) : !1;
|
|
1285
|
-
},
|
|
1285
|
+
}, De = {
|
|
1286
1286
|
CURRENCY: {
|
|
1287
1287
|
minDecimalPlaces: 2,
|
|
1288
1288
|
maxDecimalPlaces: 10,
|
|
@@ -1297,19 +1297,19 @@ const pu = (t) => {
|
|
|
1297
1297
|
decimalPlacesWhenZero: 1,
|
|
1298
1298
|
allowLeadingZerosInDecimalPart: !0
|
|
1299
1299
|
}
|
|
1300
|
-
}, wi = (t, e) =>
|
|
1301
|
-
...
|
|
1300
|
+
}, wi = (t, e) => dr(t, {
|
|
1301
|
+
...De.CURRENCY,
|
|
1302
1302
|
...e || {}
|
|
1303
|
-
}),
|
|
1304
|
-
...
|
|
1303
|
+
}), bi = (t, e) => dr(t, {
|
|
1304
|
+
...De.TOKEN,
|
|
1305
1305
|
...e || {}
|
|
1306
|
-
}),
|
|
1306
|
+
}), dr = (t, { minDecimalPlaces: e, maxDecimalPlaces: n, minDecimalSignificantDigits: r, decimalPlacesWhenZero: s, allowLeadingZerosInDecimalPart: o } = De.CURRENCY) => {
|
|
1307
1307
|
if (!Y(t))
|
|
1308
1308
|
return null;
|
|
1309
|
-
const a = new
|
|
1309
|
+
const a = new rn(typeof t == "bigint" ? t.toString() : t);
|
|
1310
1310
|
let i;
|
|
1311
1311
|
const c = `0.${"".padStart(s - 1, "0")}1`;
|
|
1312
|
-
if (a.lt(new
|
|
1312
|
+
if (a.lt(new rn(c)) && !o)
|
|
1313
1313
|
i = `0.${"".padStart(s, "0")}`;
|
|
1314
1314
|
else if (a.gte(1))
|
|
1315
1315
|
i = a.toFormat(e);
|
|
@@ -1320,7 +1320,7 @@ const pu = (t) => {
|
|
|
1320
1320
|
let l = i.replace(/0+$/, "");
|
|
1321
1321
|
const d = 1 + i.indexOf(".") + s;
|
|
1322
1322
|
return l.length < d && (l = i.substring(0, d)), l;
|
|
1323
|
-
},
|
|
1323
|
+
}, yi = (t, e = 18) => {
|
|
1324
1324
|
const n = t.replace(",", ".");
|
|
1325
1325
|
return !t || !Y(n) ? 0n : xt(n, Number(e)).value;
|
|
1326
1326
|
};
|
|
@@ -1334,18 +1334,18 @@ const gu = (t, e) => `${t} ${e}${t === 1 ? "" : "s"}`, wu = (t) => new Promise((
|
|
|
1334
1334
|
return r.result ? e((s = r.result) == null ? void 0 : s.toString()) : n(new Error("Could not read file"));
|
|
1335
1335
|
}, r.onerror = n, r.onabort = n.bind(null, new Error("User aborted")), r.readAsText(t);
|
|
1336
1336
|
});
|
|
1337
|
-
function
|
|
1337
|
+
function bu(t) {
|
|
1338
1338
|
try {
|
|
1339
|
-
return
|
|
1339
|
+
return hs(Wn(t));
|
|
1340
1340
|
} catch {
|
|
1341
1341
|
return t;
|
|
1342
1342
|
}
|
|
1343
1343
|
}
|
|
1344
1344
|
const Si = (t, e) => {
|
|
1345
1345
|
const n = new URLSearchParams(e), r = n.size ? `?${n}` : "";
|
|
1346
|
-
return k(...
|
|
1346
|
+
return k(...se(t), r);
|
|
1347
1347
|
};
|
|
1348
|
-
function
|
|
1348
|
+
function yu(t) {
|
|
1349
1349
|
return (...e) => {
|
|
1350
1350
|
t(...e);
|
|
1351
1351
|
};
|
|
@@ -1355,18 +1355,18 @@ class Ei extends Error {
|
|
|
1355
1355
|
super(`${e}::${n}`), this.name = e, this.code = n, this.name = e;
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
1358
|
-
class
|
|
1358
|
+
class An extends Ei {
|
|
1359
1359
|
constructor(e) {
|
|
1360
1360
|
super("BackendPaginationError", e);
|
|
1361
1361
|
}
|
|
1362
1362
|
}
|
|
1363
|
-
const
|
|
1363
|
+
const xn = 32;
|
|
1364
1364
|
class Su {
|
|
1365
|
-
constructor(e, n
|
|
1366
|
-
this.apiBase = e, this.
|
|
1365
|
+
constructor(e, n) {
|
|
1366
|
+
this.apiBase = e, this.httpService = n;
|
|
1367
1367
|
}
|
|
1368
1368
|
async getNfts(e, n, r, s = 1) {
|
|
1369
|
-
const o = this.normalizeAddress(r), a = k(this.apiBase, "pandora", e, n), i = this.pageToPageIndex(s), l = `${k(a, "profile", o, "nfts")}?page=${i}&size=${
|
|
1369
|
+
const o = this.normalizeAddress(r), a = k(this.apiBase, "pandora", e, n), i = this.pageToPageIndex(s), l = `${k(a, "profile", o, "nfts")}?page=${i}&size=${xn}`, d = await this.httpService.get(l), u = d.content.map((b) => this.mapItem(b, r));
|
|
1370
1370
|
return {
|
|
1371
1371
|
totalPages: d.totalPages,
|
|
1372
1372
|
page: d.number + 1,
|
|
@@ -1378,7 +1378,7 @@ class Su {
|
|
|
1378
1378
|
const s = this.normalizeAddress(r), o = k(this.apiBase, "pandora", e, n), a = k(o, "collection", s), i = `${o}/collection/${s}`, [c, l] = await Promise.all([
|
|
1379
1379
|
this.httpService.get(a),
|
|
1380
1380
|
this.httpService.get(i)
|
|
1381
|
-
]), d =
|
|
1381
|
+
]), d = Se(c), u = l.content.map((b) => this.mapItem(b));
|
|
1382
1382
|
return {
|
|
1383
1383
|
...d,
|
|
1384
1384
|
nfts: {
|
|
@@ -1394,13 +1394,13 @@ class Su {
|
|
|
1394
1394
|
return this.mapItem(c);
|
|
1395
1395
|
}
|
|
1396
1396
|
async getProfileCollections(e, n, r, s = 1, o = !1) {
|
|
1397
|
-
const a = this.pageToPageIndex(s), i = this.normalizeAddress(r), c = k(this.apiBase, "pandora", e, n), l = k(c, "profile", i, "collections", `?page=${a}&size=${
|
|
1398
|
-
for (const
|
|
1397
|
+
const a = this.pageToPageIndex(s), i = this.normalizeAddress(r), c = k(this.apiBase, "pandora", e, n), l = k(c, "profile", i, "collections", `?page=${a}&size=${xn}`), d = await this.httpService.get(l), u = [];
|
|
1398
|
+
for (const b of d.content)
|
|
1399
1399
|
if (o) {
|
|
1400
|
-
const m = await this.getCollectionMetrics(e, n,
|
|
1401
|
-
u.push(
|
|
1400
|
+
const m = await this.getCollectionMetrics(e, n, b.contractAddress);
|
|
1401
|
+
u.push(Se(b, m));
|
|
1402
1402
|
} else
|
|
1403
|
-
u.push(
|
|
1403
|
+
u.push(Se(b));
|
|
1404
1404
|
return {
|
|
1405
1405
|
totalPages: d.totalPages,
|
|
1406
1406
|
page: d.number + 1,
|
|
@@ -1413,26 +1413,16 @@ class Su {
|
|
|
1413
1413
|
return this.httpService.get(a);
|
|
1414
1414
|
}
|
|
1415
1415
|
normalizeAddress(e) {
|
|
1416
|
-
return
|
|
1416
|
+
return Pe.parse(e);
|
|
1417
1417
|
}
|
|
1418
1418
|
pageToPageIndex(e) {
|
|
1419
1419
|
if (!Number.isInteger(e))
|
|
1420
|
-
throw new
|
|
1420
|
+
throw new An("notANumber");
|
|
1421
1421
|
const n = e - 1;
|
|
1422
1422
|
if (n < 0)
|
|
1423
|
-
throw new
|
|
1423
|
+
throw new An("tooLow");
|
|
1424
1424
|
return n;
|
|
1425
1425
|
}
|
|
1426
|
-
optimizeImage(e, n, r) {
|
|
1427
|
-
if (!e)
|
|
1428
|
-
return;
|
|
1429
|
-
const s = new URLSearchParams({
|
|
1430
|
-
url: e,
|
|
1431
|
-
w: (n ?? 400).toString(),
|
|
1432
|
-
h: (r ?? 400).toString()
|
|
1433
|
-
});
|
|
1434
|
-
return `${this.imageOptimizationUrl}?${s.toString()}`;
|
|
1435
|
-
}
|
|
1436
1426
|
mapItem(e, n) {
|
|
1437
1427
|
var s;
|
|
1438
1428
|
const r = e.name ?? e.tokenId;
|
|
@@ -1446,18 +1436,12 @@ class Su {
|
|
|
1446
1436
|
payment_amount: "bestListPrice" in e ? BigInt(e.bestListPrice) : void 0
|
|
1447
1437
|
},
|
|
1448
1438
|
properties: "properties" in e && e.properties.map((o) => ({ key: o.key, value: o.value })) || [],
|
|
1449
|
-
image_uri:
|
|
1450
|
-
|
|
1451
|
-
color: "#ffffff"
|
|
1452
|
-
}),
|
|
1453
|
-
image_url_copy: this.optimizeImage(e.imageUrls.full) ?? ee(r, {
|
|
1454
|
-
background: "#15192A",
|
|
1455
|
-
color: "#ffffff"
|
|
1456
|
-
}),
|
|
1439
|
+
image_uri: e.imageUrls.preview,
|
|
1440
|
+
image_url_copy: e.imageUrls.full,
|
|
1457
1441
|
owner: {
|
|
1458
1442
|
account_address: ((s = e.owner) == null ? void 0 : s.address) || n
|
|
1459
1443
|
},
|
|
1460
|
-
contract_name:
|
|
1444
|
+
contract_name: sr(e.contractAddress)
|
|
1461
1445
|
};
|
|
1462
1446
|
}
|
|
1463
1447
|
}
|
|
@@ -1471,31 +1455,27 @@ function Ai(t) {
|
|
|
1471
1455
|
return "ERC1155";
|
|
1472
1456
|
}
|
|
1473
1457
|
}
|
|
1474
|
-
function
|
|
1458
|
+
function Se(t, e) {
|
|
1475
1459
|
return {
|
|
1476
|
-
contractAddress:
|
|
1477
|
-
name: t.name ||
|
|
1460
|
+
contractAddress: re.parse(t.contractAddress),
|
|
1461
|
+
name: t.name || sr(t.contractAddress),
|
|
1478
1462
|
description: t.description ?? "",
|
|
1479
|
-
imageUri: t.imageUrls.preview
|
|
1480
|
-
background: "#15192A",
|
|
1481
|
-
color: "#ffffff"
|
|
1482
|
-
}),
|
|
1463
|
+
imageUri: t.imageUrls.preview,
|
|
1483
1464
|
...e && {
|
|
1484
1465
|
owners: {
|
|
1485
1466
|
total: e.numberOfItems,
|
|
1486
1467
|
unique: e.uniqueOwners
|
|
1487
1468
|
},
|
|
1488
1469
|
...e.floorPrice && {
|
|
1489
|
-
//floorPrice: getEthTokenPrice(BigInt(metrics.floorPrice)),
|
|
1490
1470
|
floorPrice: BigInt(e.floorPrice)
|
|
1491
1471
|
}
|
|
1492
1472
|
}
|
|
1493
1473
|
};
|
|
1494
1474
|
}
|
|
1495
|
-
const
|
|
1475
|
+
const fr = async (t, e, n, r, s = 1) => {
|
|
1496
1476
|
const o = await t.getNfts(e, n, r, s);
|
|
1497
1477
|
if (s < o.totalPages) {
|
|
1498
|
-
const a = await
|
|
1478
|
+
const a = await fr(t, e, n, r, o.page + 1);
|
|
1499
1479
|
return {
|
|
1500
1480
|
...o,
|
|
1501
1481
|
nfts: o.nfts.concat(a.nfts)
|
|
@@ -1503,19 +1483,19 @@ const hr = async (t, e, n, r, s = 1) => {
|
|
|
1503
1483
|
}
|
|
1504
1484
|
return o;
|
|
1505
1485
|
}, Eu = (t, e, n, r, s) => {
|
|
1506
|
-
const { data: o, ...a } =
|
|
1486
|
+
const { data: o, ...a } = oe(r && [r, "nfts"], () => r && fr(t, e, n, r), {
|
|
1507
1487
|
refreshInterval: 3e5,
|
|
1508
1488
|
...s
|
|
1509
1489
|
});
|
|
1510
1490
|
return { nfts: o == null ? void 0 : o.nfts, ...a };
|
|
1511
1491
|
}, Au = (t, e, n, r, s) => {
|
|
1512
|
-
const { data: o, ...a } =
|
|
1492
|
+
const { data: o, ...a } = oe(r && [`${r}`, "nfts-collection"], () => r && t.getCollection(e, n, r), {
|
|
1513
1493
|
refreshInterval: 6e4,
|
|
1514
1494
|
...s
|
|
1515
1495
|
});
|
|
1516
1496
|
return { collection: o, ...a };
|
|
1517
1497
|
}, xu = (t, e, n, r, s, o) => {
|
|
1518
|
-
const { data: a, ...i } =
|
|
1498
|
+
const { data: a, ...i } = oe(s && r && [`${r}:${s}`, "nft"], () => s && r ? t.getNft(e, n, r, s) : void 0, {
|
|
1519
1499
|
refreshInterval: 6e4,
|
|
1520
1500
|
revalidateOnFocus: !1,
|
|
1521
1501
|
revalidateOnMount: !1,
|
|
@@ -1531,34 +1511,34 @@ const hr = async (t, e, n, r, s = 1) => {
|
|
|
1531
1511
|
}
|
|
1532
1512
|
return e || t;
|
|
1533
1513
|
}, Iu = (t, e) => t.token_id === e.token_id && nt(t.contract_address, e.contract_address);
|
|
1534
|
-
function
|
|
1514
|
+
function vn(t) {
|
|
1535
1515
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
1536
1516
|
throw new Error(`Wrong positive integer: ${t}`);
|
|
1537
1517
|
}
|
|
1538
1518
|
function xi(t) {
|
|
1539
1519
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1540
1520
|
}
|
|
1541
|
-
function
|
|
1521
|
+
function hr(t, ...e) {
|
|
1542
1522
|
if (!xi(t))
|
|
1543
1523
|
throw new Error("Expected Uint8Array");
|
|
1544
1524
|
if (e.length > 0 && !e.includes(t.length))
|
|
1545
1525
|
throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`);
|
|
1546
1526
|
}
|
|
1547
|
-
function
|
|
1527
|
+
function ee(t, e = !0) {
|
|
1548
1528
|
if (t.destroyed)
|
|
1549
1529
|
throw new Error("Hash instance has been destroyed");
|
|
1550
1530
|
if (e && t.finished)
|
|
1551
1531
|
throw new Error("Hash#digest() has already been called");
|
|
1552
1532
|
}
|
|
1553
|
-
function
|
|
1554
|
-
|
|
1533
|
+
function pr(t, e) {
|
|
1534
|
+
hr(t);
|
|
1555
1535
|
const n = e.outputLen;
|
|
1556
1536
|
if (t.length < n)
|
|
1557
1537
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
1558
1538
|
}
|
|
1559
|
-
const Zt = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
1539
|
+
const Zt = /* @__PURE__ */ BigInt(2 ** 32 - 1), In = /* @__PURE__ */ BigInt(32);
|
|
1560
1540
|
function vi(t, e = !1) {
|
|
1561
|
-
return e ? { h: Number(t & Zt), l: Number(t >>
|
|
1541
|
+
return e ? { h: Number(t & Zt), l: Number(t >> In & Zt) } : { h: Number(t >> In & Zt) | 0, l: Number(t & Zt) | 0 };
|
|
1562
1542
|
}
|
|
1563
1543
|
function Ii(t, e = !1) {
|
|
1564
1544
|
let n = new Uint32Array(t.length), r = new Uint32Array(t.length);
|
|
@@ -1574,51 +1554,51 @@ const Ci = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLengt
|
|
|
1574
1554
|
function Oi(t) {
|
|
1575
1555
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1576
1556
|
}
|
|
1577
|
-
const
|
|
1557
|
+
const Ee = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), J = (t, e) => t << 32 - e | t >>> e, ki = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
1578
1558
|
if (!ki)
|
|
1579
1559
|
throw new Error("Non little-endian hardware is not supported");
|
|
1580
|
-
function
|
|
1560
|
+
function mr(t) {
|
|
1581
1561
|
if (typeof t != "string")
|
|
1582
1562
|
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1583
1563
|
return new Uint8Array(new TextEncoder().encode(t));
|
|
1584
1564
|
}
|
|
1585
|
-
function
|
|
1586
|
-
if (typeof t == "string" && (t =
|
|
1565
|
+
function He(t) {
|
|
1566
|
+
if (typeof t == "string" && (t = mr(t)), !Oi(t))
|
|
1587
1567
|
throw new Error(`expected Uint8Array, got ${typeof t}`);
|
|
1588
1568
|
return t;
|
|
1589
1569
|
}
|
|
1590
|
-
let
|
|
1570
|
+
let gr = class {
|
|
1591
1571
|
// Safe version that clones internal state
|
|
1592
1572
|
clone() {
|
|
1593
1573
|
return this._cloneInto();
|
|
1594
1574
|
}
|
|
1595
1575
|
};
|
|
1596
|
-
function
|
|
1597
|
-
const e = (r) => t().update(
|
|
1576
|
+
function wr(t) {
|
|
1577
|
+
const e = (r) => t().update(He(r)).digest(), n = t();
|
|
1598
1578
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1599
1579
|
}
|
|
1600
|
-
const [br,
|
|
1580
|
+
const [br, yr, Sr] = [[], [], []], Pi = /* @__PURE__ */ BigInt(0), Ot = /* @__PURE__ */ BigInt(1), Ri = /* @__PURE__ */ BigInt(2), $i = /* @__PURE__ */ BigInt(7), Fi = /* @__PURE__ */ BigInt(256), Ui = /* @__PURE__ */ BigInt(113);
|
|
1601
1581
|
for (let t = 0, e = Ot, n = 1, r = 0; t < 24; t++) {
|
|
1602
|
-
[n, r] = [r, (2 * n + 3 * r) % 5], br.push(2 * (5 * r + n)),
|
|
1582
|
+
[n, r] = [r, (2 * n + 3 * r) % 5], br.push(2 * (5 * r + n)), yr.push((t + 1) * (t + 2) / 2 % 64);
|
|
1603
1583
|
let s = Pi;
|
|
1604
1584
|
for (let o = 0; o < 7; o++)
|
|
1605
1585
|
e = (e << Ot ^ (e >> $i) * Ui) % Fi, e & Ri && (s ^= Ot << (Ot << /* @__PURE__ */ BigInt(o)) - Ot);
|
|
1606
|
-
|
|
1586
|
+
Sr.push(s);
|
|
1607
1587
|
}
|
|
1608
|
-
const [ji, Li] = /* @__PURE__ */ Ii(
|
|
1588
|
+
const [ji, Li] = /* @__PURE__ */ Ii(Sr, !0), Tn = (t, e, n) => n > 32 ? _i(t, e, n) : Ti(t, e, n), Bn = (t, e, n) => n > 32 ? Ni(t, e, n) : Bi(t, e, n);
|
|
1609
1589
|
function Di(t, e = 24) {
|
|
1610
1590
|
const n = new Uint32Array(10);
|
|
1611
1591
|
for (let r = 24 - e; r < 24; r++) {
|
|
1612
1592
|
for (let a = 0; a < 10; a++)
|
|
1613
1593
|
n[a] = t[a] ^ t[a + 10] ^ t[a + 20] ^ t[a + 30] ^ t[a + 40];
|
|
1614
1594
|
for (let a = 0; a < 10; a += 2) {
|
|
1615
|
-
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u =
|
|
1595
|
+
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u = Tn(l, d, 1) ^ n[i], b = Bn(l, d, 1) ^ n[i + 1];
|
|
1616
1596
|
for (let m = 0; m < 50; m += 10)
|
|
1617
|
-
t[a + m] ^= u, t[a + m + 1] ^=
|
|
1597
|
+
t[a + m] ^= u, t[a + m + 1] ^= b;
|
|
1618
1598
|
}
|
|
1619
1599
|
let s = t[2], o = t[3];
|
|
1620
1600
|
for (let a = 0; a < 24; a++) {
|
|
1621
|
-
const i =
|
|
1601
|
+
const i = yr[a], c = Tn(s, o, i), l = Bn(s, o, i), d = br[a];
|
|
1622
1602
|
s = t[d], o = t[d + 1], t[d] = c, t[d + 1] = l;
|
|
1623
1603
|
}
|
|
1624
1604
|
for (let a = 0; a < 50; a += 10) {
|
|
@@ -1631,10 +1611,10 @@ function Di(t, e = 24) {
|
|
|
1631
1611
|
}
|
|
1632
1612
|
n.fill(0);
|
|
1633
1613
|
}
|
|
1634
|
-
class
|
|
1614
|
+
class Ve extends gr {
|
|
1635
1615
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1636
1616
|
constructor(e, n, r, s = !1, o = 24) {
|
|
1637
|
-
if (super(), this.blockLen = e, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = o, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1,
|
|
1617
|
+
if (super(), this.blockLen = e, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = o, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, vn(r), 0 >= this.blockLen || this.blockLen >= 200)
|
|
1638
1618
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1639
1619
|
this.state = new Uint8Array(200), this.state32 = Ci(this.state);
|
|
1640
1620
|
}
|
|
@@ -1642,9 +1622,9 @@ class Ge extends wr {
|
|
|
1642
1622
|
Di(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
|
|
1643
1623
|
}
|
|
1644
1624
|
update(e) {
|
|
1645
|
-
|
|
1625
|
+
ee(this);
|
|
1646
1626
|
const { blockLen: n, state: r } = this;
|
|
1647
|
-
e =
|
|
1627
|
+
e = He(e);
|
|
1648
1628
|
const s = e.length;
|
|
1649
1629
|
for (let o = 0; o < s; ) {
|
|
1650
1630
|
const a = Math.min(n - this.pos, s - o);
|
|
@@ -1662,7 +1642,7 @@ class Ge extends wr {
|
|
|
1662
1642
|
e[r] ^= n, n & 128 && r === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
1663
1643
|
}
|
|
1664
1644
|
writeInto(e) {
|
|
1665
|
-
|
|
1645
|
+
ee(this, !1), hr(e), this.finish();
|
|
1666
1646
|
const n = this.state, { blockLen: r } = this;
|
|
1667
1647
|
for (let s = 0, o = e.length; s < o; ) {
|
|
1668
1648
|
this.posOut >= r && this.keccak();
|
|
@@ -1677,10 +1657,10 @@ class Ge extends wr {
|
|
|
1677
1657
|
return this.writeInto(e);
|
|
1678
1658
|
}
|
|
1679
1659
|
xof(e) {
|
|
1680
|
-
return
|
|
1660
|
+
return vn(e), this.xofInto(new Uint8Array(e));
|
|
1681
1661
|
}
|
|
1682
1662
|
digestInto(e) {
|
|
1683
|
-
if (
|
|
1663
|
+
if (pr(e, this), this.finished)
|
|
1684
1664
|
throw new Error("digest() was already called");
|
|
1685
1665
|
return this.writeInto(e), this.destroy(), e;
|
|
1686
1666
|
}
|
|
@@ -1692,29 +1672,29 @@ class Ge extends wr {
|
|
|
1692
1672
|
}
|
|
1693
1673
|
_cloneInto(e) {
|
|
1694
1674
|
const { blockLen: n, suffix: r, outputLen: s, rounds: o, enableXOF: a } = this;
|
|
1695
|
-
return e || (e = new
|
|
1675
|
+
return e || (e = new Ve(n, r, s, a, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = r, e.outputLen = s, e.enableXOF = a, e.destroyed = this.destroyed, e;
|
|
1696
1676
|
}
|
|
1697
1677
|
}
|
|
1698
|
-
const Hi = (t, e, n) =>
|
|
1678
|
+
const Hi = (t, e, n) => wr(() => new Ve(e, t, n)), Vi = /* @__PURE__ */ Hi(1, 136, 256 / 8);
|
|
1699
1679
|
function Mi(t, e, n, r) {
|
|
1700
1680
|
if (typeof t.setBigUint64 == "function")
|
|
1701
1681
|
return t.setBigUint64(e, n, r);
|
|
1702
1682
|
const s = BigInt(32), o = BigInt(4294967295), a = Number(n >> s & o), i = Number(n & o), c = r ? 4 : 0, l = r ? 0 : 4;
|
|
1703
1683
|
t.setUint32(e + c, a, r), t.setUint32(e + l, i, r);
|
|
1704
1684
|
}
|
|
1705
|
-
class Gi extends
|
|
1685
|
+
class Gi extends gr {
|
|
1706
1686
|
constructor(e, n, r, s) {
|
|
1707
|
-
super(), this.blockLen = e, this.outputLen = n, this.padOffset = r, this.isLE = s, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view =
|
|
1687
|
+
super(), this.blockLen = e, this.outputLen = n, this.padOffset = r, this.isLE = s, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = Ee(this.buffer);
|
|
1708
1688
|
}
|
|
1709
1689
|
update(e) {
|
|
1710
|
-
|
|
1690
|
+
ee(this);
|
|
1711
1691
|
const { view: n, buffer: r, blockLen: s } = this;
|
|
1712
|
-
e =
|
|
1692
|
+
e = He(e);
|
|
1713
1693
|
const o = e.length;
|
|
1714
1694
|
for (let a = 0; a < o; ) {
|
|
1715
1695
|
const i = Math.min(s - this.pos, o - a);
|
|
1716
1696
|
if (i === s) {
|
|
1717
|
-
const c =
|
|
1697
|
+
const c = Ee(e);
|
|
1718
1698
|
for (; s <= o - a; a += s)
|
|
1719
1699
|
this.process(c, a);
|
|
1720
1700
|
continue;
|
|
@@ -1724,14 +1704,14 @@ class Gi extends wr {
|
|
|
1724
1704
|
return this.length += e.length, this.roundClean(), this;
|
|
1725
1705
|
}
|
|
1726
1706
|
digestInto(e) {
|
|
1727
|
-
|
|
1707
|
+
ee(this), pr(e, this), this.finished = !0;
|
|
1728
1708
|
const { buffer: n, view: r, blockLen: s, isLE: o } = this;
|
|
1729
1709
|
let { pos: a } = this;
|
|
1730
1710
|
n[a++] = 128, this.buffer.subarray(a).fill(0), this.padOffset > s - a && (this.process(r, 0), a = 0);
|
|
1731
1711
|
for (let u = a; u < s; u++)
|
|
1732
1712
|
n[u] = 0;
|
|
1733
1713
|
Mi(r, s - 8, BigInt(this.length * 8), o), this.process(r, 0);
|
|
1734
|
-
const i =
|
|
1714
|
+
const i = Ee(e), c = this.outputLen;
|
|
1735
1715
|
if (c % 4)
|
|
1736
1716
|
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
1737
1717
|
const l = c / 4, d = this.get();
|
|
@@ -1752,7 +1732,7 @@ class Gi extends wr {
|
|
|
1752
1732
|
return e.length = s, e.pos = i, e.finished = o, e.destroyed = a, s % n && e.buffer.set(r), e;
|
|
1753
1733
|
}
|
|
1754
1734
|
}
|
|
1755
|
-
const
|
|
1735
|
+
const qi = (t, e, n) => t & e ^ ~t & n, Wi = (t, e, n) => t & e ^ t & n ^ e & n, zi = /* @__PURE__ */ new Uint32Array([
|
|
1756
1736
|
1116352408,
|
|
1757
1737
|
1899447441,
|
|
1758
1738
|
3049323471,
|
|
@@ -1843,12 +1823,12 @@ class Ki extends Gi {
|
|
|
1843
1823
|
for (let u = 0; u < 16; u++, n += 4)
|
|
1844
1824
|
ct[u] = e.getUint32(n, !1);
|
|
1845
1825
|
for (let u = 16; u < 64; u++) {
|
|
1846
|
-
const
|
|
1826
|
+
const b = ct[u - 15], m = ct[u - 2], S = J(b, 7) ^ J(b, 18) ^ b >>> 3, h = J(m, 17) ^ J(m, 19) ^ m >>> 10;
|
|
1847
1827
|
ct[u] = h + ct[u - 7] + S + ct[u - 16] | 0;
|
|
1848
1828
|
}
|
|
1849
1829
|
let { A: r, B: s, C: o, D: a, E: i, F: c, G: l, H: d } = this;
|
|
1850
1830
|
for (let u = 0; u < 64; u++) {
|
|
1851
|
-
const
|
|
1831
|
+
const b = J(i, 6) ^ J(i, 11) ^ J(i, 25), m = d + b + qi(i, c, l) + zi[u] + ct[u] | 0, h = (J(r, 2) ^ J(r, 13) ^ J(r, 22)) + Wi(r, s, o) | 0;
|
|
1852
1832
|
d = l, l = c, c = i, i = a + m | 0, a = o, o = s, s = r, r = m + h | 0;
|
|
1853
1833
|
}
|
|
1854
1834
|
r = r + this.A | 0, s = s + this.B | 0, o = o + this.C | 0, a = a + this.D | 0, i = i + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(r, s, o, a, i, c, l, d);
|
|
@@ -1860,22 +1840,22 @@ class Ki extends Gi {
|
|
|
1860
1840
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
|
|
1861
1841
|
}
|
|
1862
1842
|
}
|
|
1863
|
-
const
|
|
1843
|
+
const Er = /* @__PURE__ */ wr(() => new Ki());
|
|
1864
1844
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1865
|
-
const
|
|
1845
|
+
const Ar = BigInt(0), de = BigInt(1), Zi = BigInt(2), fe = (t) => t instanceof Uint8Array, Yi = Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
1866
1846
|
function ht(t) {
|
|
1867
|
-
if (!
|
|
1847
|
+
if (!fe(t))
|
|
1868
1848
|
throw new Error("Uint8Array expected");
|
|
1869
1849
|
let e = "";
|
|
1870
1850
|
for (let n = 0; n < t.length; n++)
|
|
1871
1851
|
e += Yi[t[n]];
|
|
1872
1852
|
return e;
|
|
1873
1853
|
}
|
|
1874
|
-
function
|
|
1854
|
+
function xr(t) {
|
|
1875
1855
|
const e = t.toString(16);
|
|
1876
1856
|
return e.length & 1 ? `0${e}` : e;
|
|
1877
1857
|
}
|
|
1878
|
-
function
|
|
1858
|
+
function Me(t) {
|
|
1879
1859
|
if (typeof t != "string")
|
|
1880
1860
|
throw new Error("hex string expected, got " + typeof t);
|
|
1881
1861
|
return BigInt(t === "" ? "0" : `0x${t}`);
|
|
@@ -1895,14 +1875,14 @@ function pt(t) {
|
|
|
1895
1875
|
return e;
|
|
1896
1876
|
}
|
|
1897
1877
|
function X(t) {
|
|
1898
|
-
return
|
|
1878
|
+
return Me(ht(t));
|
|
1899
1879
|
}
|
|
1900
|
-
function
|
|
1901
|
-
if (!
|
|
1880
|
+
function Ge(t) {
|
|
1881
|
+
if (!fe(t))
|
|
1902
1882
|
throw new Error("Uint8Array expected");
|
|
1903
|
-
return
|
|
1883
|
+
return Me(ht(Uint8Array.from(t).reverse()));
|
|
1904
1884
|
}
|
|
1905
|
-
const Et = (t, e) => pt(t.toString(16).padStart(e * 2, "0")),
|
|
1885
|
+
const Et = (t, e) => pt(t.toString(16).padStart(e * 2, "0")), vr = (t, e) => Et(t, e).reverse(), Xi = (t) => pt(xr(t));
|
|
1906
1886
|
function V(t, e, n) {
|
|
1907
1887
|
let r;
|
|
1908
1888
|
if (typeof e == "string")
|
|
@@ -1911,7 +1891,7 @@ function V(t, e, n) {
|
|
|
1911
1891
|
} catch (o) {
|
|
1912
1892
|
throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`);
|
|
1913
1893
|
}
|
|
1914
|
-
else if (
|
|
1894
|
+
else if (fe(e))
|
|
1915
1895
|
r = Uint8Array.from(e);
|
|
1916
1896
|
else
|
|
1917
1897
|
throw new Error(`${t} must be hex string or Uint8Array`);
|
|
@@ -1924,7 +1904,7 @@ function Lt(...t) {
|
|
|
1924
1904
|
const e = new Uint8Array(t.reduce((r, s) => r + s.length, 0));
|
|
1925
1905
|
let n = 0;
|
|
1926
1906
|
return t.forEach((r) => {
|
|
1927
|
-
if (!
|
|
1907
|
+
if (!fe(r))
|
|
1928
1908
|
throw new Error("Uint8Array expected");
|
|
1929
1909
|
e.set(r, n), n += r.length;
|
|
1930
1910
|
}), e;
|
|
@@ -1944,39 +1924,39 @@ function Qi(t) {
|
|
|
1944
1924
|
}
|
|
1945
1925
|
function tc(t) {
|
|
1946
1926
|
let e;
|
|
1947
|
-
for (e = 0; t >
|
|
1927
|
+
for (e = 0; t > Ar; t >>= de, e += 1)
|
|
1948
1928
|
;
|
|
1949
1929
|
return e;
|
|
1950
1930
|
}
|
|
1951
|
-
const ec = (t, e) => t >> BigInt(e) &
|
|
1952
|
-
function
|
|
1931
|
+
const ec = (t, e) => t >> BigInt(e) & de, nc = (t, e, n) => t | (n ? de : Ar) << BigInt(e), he = (t) => (Zi << BigInt(t - 1)) - de, Ae = (t) => new Uint8Array(t), _n = (t) => Uint8Array.from(t);
|
|
1932
|
+
function Ir(t, e, n) {
|
|
1953
1933
|
if (typeof t != "number" || t < 2)
|
|
1954
1934
|
throw new Error("hashLen must be a number");
|
|
1955
1935
|
if (typeof e != "number" || e < 2)
|
|
1956
1936
|
throw new Error("qByteLen must be a number");
|
|
1957
1937
|
if (typeof n != "function")
|
|
1958
1938
|
throw new Error("hmacFn must be a function");
|
|
1959
|
-
let r =
|
|
1939
|
+
let r = Ae(t), s = Ae(t), o = 0;
|
|
1960
1940
|
const a = () => {
|
|
1961
1941
|
r.fill(1), s.fill(0), o = 0;
|
|
1962
|
-
}, i = (...u) => n(s, r, ...u), c = (u =
|
|
1963
|
-
s = i(
|
|
1942
|
+
}, i = (...u) => n(s, r, ...u), c = (u = Ae()) => {
|
|
1943
|
+
s = i(_n([0]), u), r = i(), u.length !== 0 && (s = i(_n([1]), u), r = i());
|
|
1964
1944
|
}, l = () => {
|
|
1965
1945
|
if (o++ >= 1e3)
|
|
1966
1946
|
throw new Error("drbg: tried 1000 values");
|
|
1967
1947
|
let u = 0;
|
|
1968
|
-
const
|
|
1948
|
+
const b = [];
|
|
1969
1949
|
for (; u < e; ) {
|
|
1970
1950
|
r = i();
|
|
1971
1951
|
const m = r.slice();
|
|
1972
|
-
|
|
1952
|
+
b.push(m), u += r.length;
|
|
1973
1953
|
}
|
|
1974
|
-
return Lt(...
|
|
1954
|
+
return Lt(...b);
|
|
1975
1955
|
};
|
|
1976
|
-
return (u,
|
|
1956
|
+
return (u, b) => {
|
|
1977
1957
|
a(), c(u);
|
|
1978
1958
|
let m;
|
|
1979
|
-
for (; !(m =
|
|
1959
|
+
for (; !(m = b(l())); )
|
|
1980
1960
|
c();
|
|
1981
1961
|
return a(), m;
|
|
1982
1962
|
};
|
|
@@ -1991,7 +1971,7 @@ const rc = {
|
|
|
1991
1971
|
field: (t, e) => e.Fp.isValid(t),
|
|
1992
1972
|
hash: (t) => typeof t == "function" && Number.isSafeInteger(t.outputLen)
|
|
1993
1973
|
};
|
|
1994
|
-
function
|
|
1974
|
+
function qt(t, e, n = {}) {
|
|
1995
1975
|
const r = (s, o, a) => {
|
|
1996
1976
|
const i = rc[o];
|
|
1997
1977
|
if (typeof i != "function")
|
|
@@ -2010,26 +1990,26 @@ const sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2010
1990
|
__proto__: null,
|
|
2011
1991
|
bitGet: ec,
|
|
2012
1992
|
bitLen: tc,
|
|
2013
|
-
bitMask:
|
|
1993
|
+
bitMask: he,
|
|
2014
1994
|
bitSet: nc,
|
|
2015
1995
|
bytesToHex: ht,
|
|
2016
1996
|
bytesToNumberBE: X,
|
|
2017
|
-
bytesToNumberLE:
|
|
1997
|
+
bytesToNumberLE: Ge,
|
|
2018
1998
|
concatBytes: Lt,
|
|
2019
|
-
createHmacDrbg:
|
|
1999
|
+
createHmacDrbg: Ir,
|
|
2020
2000
|
ensureBytes: V,
|
|
2021
2001
|
equalBytes: Ji,
|
|
2022
2002
|
hexToBytes: pt,
|
|
2023
|
-
hexToNumber:
|
|
2003
|
+
hexToNumber: Me,
|
|
2024
2004
|
numberToBytesBE: Et,
|
|
2025
|
-
numberToBytesLE:
|
|
2026
|
-
numberToHexUnpadded:
|
|
2005
|
+
numberToBytesLE: vr,
|
|
2006
|
+
numberToHexUnpadded: xr,
|
|
2027
2007
|
numberToVarBytesBE: Xi,
|
|
2028
2008
|
utf8ToBytes: Qi,
|
|
2029
|
-
validateObject:
|
|
2009
|
+
validateObject: qt
|
|
2030
2010
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2031
2011
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2032
|
-
const U = BigInt(0), $ = BigInt(1), ut = BigInt(2), oc = BigInt(3),
|
|
2012
|
+
const U = BigInt(0), $ = BigInt(1), ut = BigInt(2), oc = BigInt(3), Be = BigInt(4), Nn = BigInt(5), Cn = BigInt(8);
|
|
2033
2013
|
BigInt(9);
|
|
2034
2014
|
BigInt(16);
|
|
2035
2015
|
function M(t, e) {
|
|
@@ -2046,7 +2026,7 @@ function ac(t, e, n) {
|
|
|
2046
2026
|
e & $ && (r = r * t % n), t = t * t % n, e >>= $;
|
|
2047
2027
|
return r;
|
|
2048
2028
|
}
|
|
2049
|
-
function
|
|
2029
|
+
function _e(t, e) {
|
|
2050
2030
|
if (t === U || e <= U)
|
|
2051
2031
|
throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);
|
|
2052
2032
|
let n = M(t, e), r = e, s = U, o = $;
|
|
@@ -2066,7 +2046,7 @@ function ic(t) {
|
|
|
2066
2046
|
for (s = ut; s < t && ac(s, e, t) !== t - $; s++)
|
|
2067
2047
|
;
|
|
2068
2048
|
if (r === 1) {
|
|
2069
|
-
const a = (t + $) /
|
|
2049
|
+
const a = (t + $) / Be;
|
|
2070
2050
|
return function(c, l) {
|
|
2071
2051
|
const d = c.pow(l, a);
|
|
2072
2052
|
if (!c.eql(c.sqr(d), l))
|
|
@@ -2078,22 +2058,22 @@ function ic(t) {
|
|
|
2078
2058
|
return function(i, c) {
|
|
2079
2059
|
if (i.pow(c, e) === i.neg(i.ONE))
|
|
2080
2060
|
throw new Error("Cannot find square root");
|
|
2081
|
-
let l = r, d = i.pow(i.mul(i.ONE, s), n), u = i.pow(c, o),
|
|
2082
|
-
for (; !i.eql(
|
|
2083
|
-
if (i.eql(
|
|
2061
|
+
let l = r, d = i.pow(i.mul(i.ONE, s), n), u = i.pow(c, o), b = i.pow(c, n);
|
|
2062
|
+
for (; !i.eql(b, i.ONE); ) {
|
|
2063
|
+
if (i.eql(b, i.ZERO))
|
|
2084
2064
|
return i.ZERO;
|
|
2085
2065
|
let m = 1;
|
|
2086
|
-
for (let h = i.sqr(
|
|
2066
|
+
for (let h = i.sqr(b); m < l && !i.eql(h, i.ONE); m++)
|
|
2087
2067
|
h = i.sqr(h);
|
|
2088
2068
|
const S = i.pow(d, $ << BigInt(l - m - 1));
|
|
2089
|
-
d = i.sqr(S), u = i.mul(u, S),
|
|
2069
|
+
d = i.sqr(S), u = i.mul(u, S), b = i.mul(b, d), l = m;
|
|
2090
2070
|
}
|
|
2091
2071
|
return u;
|
|
2092
2072
|
};
|
|
2093
2073
|
}
|
|
2094
2074
|
function cc(t) {
|
|
2095
|
-
if (t %
|
|
2096
|
-
const e = (t + $) /
|
|
2075
|
+
if (t % Be === oc) {
|
|
2076
|
+
const e = (t + $) / Be;
|
|
2097
2077
|
return function(r, s) {
|
|
2098
2078
|
const o = r.pow(s, e);
|
|
2099
2079
|
if (!r.eql(r.sqr(o), s))
|
|
@@ -2101,8 +2081,8 @@ function cc(t) {
|
|
|
2101
2081
|
return o;
|
|
2102
2082
|
};
|
|
2103
2083
|
}
|
|
2104
|
-
if (t %
|
|
2105
|
-
const e = (t -
|
|
2084
|
+
if (t % Cn === Nn) {
|
|
2085
|
+
const e = (t - Nn) / Cn;
|
|
2106
2086
|
return function(r, s) {
|
|
2107
2087
|
const o = r.mul(s, ut), a = r.pow(o, e), i = r.mul(s, a), c = r.mul(r.mul(i, ut), a), l = r.mul(i, r.sub(c, r.ONE));
|
|
2108
2088
|
if (!r.eql(r.sqr(l), s))
|
|
@@ -2131,16 +2111,16 @@ const lc = [
|
|
|
2131
2111
|
"mulN",
|
|
2132
2112
|
"sqrN"
|
|
2133
2113
|
];
|
|
2134
|
-
function
|
|
2114
|
+
function qe(t) {
|
|
2135
2115
|
const e = {
|
|
2136
2116
|
ORDER: "bigint",
|
|
2137
2117
|
MASK: "bigint",
|
|
2138
2118
|
BYTES: "isSafeInteger",
|
|
2139
2119
|
BITS: "isSafeInteger"
|
|
2140
2120
|
}, n = lc.reduce((r, s) => (r[s] = "function", r), e);
|
|
2141
|
-
return
|
|
2121
|
+
return qt(t, n);
|
|
2142
2122
|
}
|
|
2143
|
-
function
|
|
2123
|
+
function Tr(t, e, n) {
|
|
2144
2124
|
if (n < U)
|
|
2145
2125
|
throw new Error("Expected power > 0");
|
|
2146
2126
|
if (n === U)
|
|
@@ -2156,21 +2136,21 @@ function uc(t, e) {
|
|
|
2156
2136
|
const n = new Array(e.length), r = e.reduce((o, a, i) => t.is0(a) ? o : (n[i] = o, t.mul(o, a)), t.ONE), s = t.inv(r);
|
|
2157
2137
|
return e.reduceRight((o, a, i) => t.is0(a) ? o : (n[i] = t.mul(o, n[i]), t.mul(o, a)), s), n;
|
|
2158
2138
|
}
|
|
2159
|
-
function
|
|
2139
|
+
function We(t, e) {
|
|
2160
2140
|
const n = e !== void 0 ? e : t.toString(2).length, r = Math.ceil(n / 8);
|
|
2161
2141
|
return { nBitLength: n, nByteLength: r };
|
|
2162
2142
|
}
|
|
2163
|
-
function
|
|
2143
|
+
function ze(t, e, n = !1, r = {}) {
|
|
2164
2144
|
if (t <= U)
|
|
2165
2145
|
throw new Error(`Expected Fp ORDER > 0, got ${t}`);
|
|
2166
|
-
const { nBitLength: s, nByteLength: o } =
|
|
2146
|
+
const { nBitLength: s, nByteLength: o } = We(t, e);
|
|
2167
2147
|
if (o > 2048)
|
|
2168
2148
|
throw new Error("Field lengths over 2048 bytes are not supported");
|
|
2169
2149
|
const a = cc(t), i = Object.freeze({
|
|
2170
2150
|
ORDER: t,
|
|
2171
2151
|
BITS: s,
|
|
2172
2152
|
BYTES: o,
|
|
2173
|
-
MASK:
|
|
2153
|
+
MASK: he(s),
|
|
2174
2154
|
ZERO: U,
|
|
2175
2155
|
ONE: $,
|
|
2176
2156
|
create: (c) => M(c, t),
|
|
@@ -2187,40 +2167,40 @@ function Ze(t, e, n = !1, r = {}) {
|
|
|
2187
2167
|
add: (c, l) => M(c + l, t),
|
|
2188
2168
|
sub: (c, l) => M(c - l, t),
|
|
2189
2169
|
mul: (c, l) => M(c * l, t),
|
|
2190
|
-
pow: (c, l) =>
|
|
2191
|
-
div: (c, l) => M(c *
|
|
2170
|
+
pow: (c, l) => Tr(i, c, l),
|
|
2171
|
+
div: (c, l) => M(c * _e(l, t), t),
|
|
2192
2172
|
// Same as above, but doesn't normalize
|
|
2193
2173
|
sqrN: (c) => c * c,
|
|
2194
2174
|
addN: (c, l) => c + l,
|
|
2195
2175
|
subN: (c, l) => c - l,
|
|
2196
2176
|
mulN: (c, l) => c * l,
|
|
2197
|
-
inv: (c) =>
|
|
2177
|
+
inv: (c) => _e(c, t),
|
|
2198
2178
|
sqrt: r.sqrt || ((c) => a(i, c)),
|
|
2199
2179
|
invertBatch: (c) => uc(i, c),
|
|
2200
2180
|
// TODO: do we really need constant cmov?
|
|
2201
2181
|
// We don't have const-time bigints anyway, so probably will be not very useful
|
|
2202
2182
|
cmov: (c, l, d) => d ? l : c,
|
|
2203
|
-
toBytes: (c) => n ?
|
|
2183
|
+
toBytes: (c) => n ? vr(c, o) : Et(c, o),
|
|
2204
2184
|
fromBytes: (c) => {
|
|
2205
2185
|
if (c.length !== o)
|
|
2206
2186
|
throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);
|
|
2207
|
-
return n ?
|
|
2187
|
+
return n ? Ge(c) : X(c);
|
|
2208
2188
|
}
|
|
2209
2189
|
});
|
|
2210
2190
|
return Object.freeze(i);
|
|
2211
2191
|
}
|
|
2212
2192
|
function dc(t, e, n = !1) {
|
|
2213
2193
|
t = V("privateHash", t);
|
|
2214
|
-
const r = t.length, s =
|
|
2194
|
+
const r = t.length, s = We(e).nByteLength + 8;
|
|
2215
2195
|
if (s < 24 || r < s || r > 1024)
|
|
2216
2196
|
throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${r}`);
|
|
2217
|
-
const o = n ?
|
|
2197
|
+
const o = n ? Ge(t) : X(t);
|
|
2218
2198
|
return M(o, e - $) + $;
|
|
2219
2199
|
}
|
|
2220
2200
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2221
2201
|
function fc(t) {
|
|
2222
2202
|
const { Fp: e } = t;
|
|
2223
|
-
|
|
2203
|
+
qe(e);
|
|
2224
2204
|
for (const c of ["t", "roundsFull", "roundsPartial"])
|
|
2225
2205
|
if (typeof t[c] != "number" || !Number.isSafeInteger(t[c]))
|
|
2226
2206
|
throw new Error(`Poseidon: invalid param ${c}=${t[c]} (${typeof t[c]})`);
|
|
@@ -2230,7 +2210,7 @@ function fc(t) {
|
|
|
2230
2210
|
if (n === void 0 && (n = 5), typeof n != "number" || !Number.isSafeInteger(n))
|
|
2231
2211
|
throw new Error(`Poseidon wrong sboxPower=${n}`);
|
|
2232
2212
|
const r = BigInt(n);
|
|
2233
|
-
let s = (c) =>
|
|
2213
|
+
let s = (c) => Tr(e, c, r);
|
|
2234
2214
|
if (n === 3 ? s = (c) => e.mul(e.sqrN(c), c) : n === 5 && (s = (c) => e.mul(e.sqrN(e.sqrN(c)), c)), t.roundsFull % 2 !== 0)
|
|
2235
2215
|
throw new Error(`Poseidon roundsFull is not even: ${t.roundsFull}`);
|
|
2236
2216
|
const o = t.roundsFull + t.roundsPartial;
|
|
@@ -2259,7 +2239,7 @@ function fc(t) {
|
|
|
2259
2239
|
return Object.freeze({ ...t, rounds: o, sboxFn: s, roundConstants: a, mds: i });
|
|
2260
2240
|
}
|
|
2261
2241
|
function hc(t) {
|
|
2262
|
-
const { t: e, Fp: n, rounds: r, sboxFn: s, reversePartialPowIdx: o } = fc(t), a = Math.floor(t.roundsFull / 2), i = o ? e - 1 : 0, c = (d, u,
|
|
2242
|
+
const { t: e, Fp: n, rounds: r, sboxFn: s, reversePartialPowIdx: o } = fc(t), a = Math.floor(t.roundsFull / 2), i = o ? e - 1 : 0, c = (d, u, b) => (d = d.map((m, S) => n.add(m, t.roundConstants[b][S])), u ? d = d.map((m) => s(m)) : d[i] = s(d[i]), d = t.mds.map((m) => m.reduce((S, h, g) => n.add(S, n.mulN(h, d[g])), n.ZERO)), d), l = function(u) {
|
|
2263
2243
|
if (!Array.isArray(u) || u.length !== e)
|
|
2264
2244
|
throw new Error(`Poseidon: wrong values (expected array of bigints with length ${e})`);
|
|
2265
2245
|
u = u.map((m) => {
|
|
@@ -2267,21 +2247,21 @@ function hc(t) {
|
|
|
2267
2247
|
throw new Error(`Poseidon: wrong value=${m} (${typeof m})`);
|
|
2268
2248
|
return n.create(m);
|
|
2269
2249
|
});
|
|
2270
|
-
let
|
|
2250
|
+
let b = 0;
|
|
2271
2251
|
for (let m = 0; m < a; m++)
|
|
2272
|
-
u = c(u, !0,
|
|
2252
|
+
u = c(u, !0, b++);
|
|
2273
2253
|
for (let m = 0; m < t.roundsPartial; m++)
|
|
2274
|
-
u = c(u, !1,
|
|
2254
|
+
u = c(u, !1, b++);
|
|
2275
2255
|
for (let m = 0; m < a; m++)
|
|
2276
|
-
u = c(u, !0,
|
|
2277
|
-
if (
|
|
2278
|
-
throw new Error(`Poseidon: wrong number of rounds: last round=${
|
|
2256
|
+
u = c(u, !0, b++);
|
|
2257
|
+
if (b !== r)
|
|
2258
|
+
throw new Error(`Poseidon: wrong number of rounds: last round=${b}, total=${r}`);
|
|
2279
2259
|
return u;
|
|
2280
2260
|
};
|
|
2281
2261
|
return l.roundConstants = t.roundConstants, l;
|
|
2282
2262
|
}
|
|
2283
2263
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2284
|
-
const pc = BigInt(0),
|
|
2264
|
+
const pc = BigInt(0), xe = BigInt(1);
|
|
2285
2265
|
function mc(t, e) {
|
|
2286
2266
|
const n = (s, o) => {
|
|
2287
2267
|
const a = o.negate();
|
|
@@ -2296,7 +2276,7 @@ function mc(t, e) {
|
|
|
2296
2276
|
unsafeLadder(s, o) {
|
|
2297
2277
|
let a = t.ZERO, i = s;
|
|
2298
2278
|
for (; o > pc; )
|
|
2299
|
-
o &
|
|
2279
|
+
o & xe && (a = a.add(i)), i = i.double(), o >>= xe;
|
|
2300
2280
|
return a;
|
|
2301
2281
|
},
|
|
2302
2282
|
/**
|
|
@@ -2314,7 +2294,7 @@ function mc(t, e) {
|
|
|
2314
2294
|
let l = s, d = l;
|
|
2315
2295
|
for (let u = 0; u < a; u++) {
|
|
2316
2296
|
d = l, c.push(d);
|
|
2317
|
-
for (let
|
|
2297
|
+
for (let b = 1; b < i; b++)
|
|
2318
2298
|
d = d.add(l), c.push(d);
|
|
2319
2299
|
l = d.double();
|
|
2320
2300
|
}
|
|
@@ -2330,11 +2310,11 @@ function mc(t, e) {
|
|
|
2330
2310
|
wNAF(s, o, a) {
|
|
2331
2311
|
const { windows: i, windowSize: c } = r(s);
|
|
2332
2312
|
let l = t.ZERO, d = t.BASE;
|
|
2333
|
-
const u = BigInt(2 ** s - 1),
|
|
2313
|
+
const u = BigInt(2 ** s - 1), b = 2 ** s, m = BigInt(s);
|
|
2334
2314
|
for (let S = 0; S < i; S++) {
|
|
2335
2315
|
const h = S * c;
|
|
2336
2316
|
let g = Number(a & u);
|
|
2337
|
-
a >>= m, g > c && (g -=
|
|
2317
|
+
a >>= m, g > c && (g -= b, a += xe);
|
|
2338
2318
|
const w = h, E = h + Math.abs(g) - 1, x = S % 2 !== 0, _ = g < 0;
|
|
2339
2319
|
g === 0 ? d = d.add(n(x, o[w])) : l = l.add(n(_, o[E]));
|
|
2340
2320
|
}
|
|
@@ -2347,8 +2327,8 @@ function mc(t, e) {
|
|
|
2347
2327
|
}
|
|
2348
2328
|
};
|
|
2349
2329
|
}
|
|
2350
|
-
function
|
|
2351
|
-
return
|
|
2330
|
+
function Br(t) {
|
|
2331
|
+
return qe(t.Fp), qt(t, {
|
|
2352
2332
|
n: "bigint",
|
|
2353
2333
|
h: "bigint",
|
|
2354
2334
|
Gx: "field",
|
|
@@ -2357,15 +2337,15 @@ function _r(t) {
|
|
|
2357
2337
|
nBitLength: "isSafeInteger",
|
|
2358
2338
|
nByteLength: "isSafeInteger"
|
|
2359
2339
|
}), Object.freeze({
|
|
2360
|
-
...
|
|
2340
|
+
...We(t.n, t.nBitLength),
|
|
2361
2341
|
...t,
|
|
2362
2342
|
p: t.Fp.ORDER
|
|
2363
2343
|
});
|
|
2364
2344
|
}
|
|
2365
2345
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2366
2346
|
function gc(t) {
|
|
2367
|
-
const e =
|
|
2368
|
-
|
|
2347
|
+
const e = Br(t);
|
|
2348
|
+
qt(e, {
|
|
2369
2349
|
a: "field",
|
|
2370
2350
|
b: "field"
|
|
2371
2351
|
}, {
|
|
@@ -2386,7 +2366,7 @@ function gc(t) {
|
|
|
2386
2366
|
}
|
|
2387
2367
|
return Object.freeze({ ...e });
|
|
2388
2368
|
}
|
|
2389
|
-
const { bytesToNumberBE: wc, hexToBytes:
|
|
2369
|
+
const { bytesToNumberBE: wc, hexToBytes: bc } = sc, dt = {
|
|
2390
2370
|
// asn.1 DER encoding utils
|
|
2391
2371
|
Err: class extends Error {
|
|
2392
2372
|
constructor(e = "") {
|
|
@@ -2407,7 +2387,7 @@ const { bytesToNumberBE: wc, hexToBytes: yc } = sc, dt = {
|
|
|
2407
2387
|
return { d: wc(r), l: t.subarray(n + 2) };
|
|
2408
2388
|
},
|
|
2409
2389
|
toSig(t) {
|
|
2410
|
-
const { Err: e } = dt, n = typeof t == "string" ?
|
|
2390
|
+
const { Err: e } = dt, n = typeof t == "string" ? bc(t) : t;
|
|
2411
2391
|
if (!(n instanceof Uint8Array))
|
|
2412
2392
|
throw new Error("ui8a expected");
|
|
2413
2393
|
let r = n.length;
|
|
@@ -2427,11 +2407,11 @@ const { bytesToNumberBE: wc, hexToBytes: yc } = sc, dt = {
|
|
|
2427
2407
|
}, r = e(n(t.s)), s = e(n(t.r)), o = r.length / 2, a = s.length / 2, i = n(o), c = n(a);
|
|
2428
2408
|
return `30${n(a + o + 4)}02${c}${s}02${i}${r}`;
|
|
2429
2409
|
}
|
|
2430
|
-
}, et = BigInt(0),
|
|
2410
|
+
}, et = BigInt(0), W = BigInt(1);
|
|
2431
2411
|
BigInt(2);
|
|
2432
|
-
const
|
|
2412
|
+
const On = BigInt(3);
|
|
2433
2413
|
BigInt(4);
|
|
2434
|
-
function
|
|
2414
|
+
function yc(t) {
|
|
2435
2415
|
const e = gc(t), { Fp: n } = e, r = e.toBytes || ((S, h, g) => {
|
|
2436
2416
|
const w = h.toAffine();
|
|
2437
2417
|
return Lt(Uint8Array.from([4]), n.toBytes(w.x), n.toBytes(w.y));
|
|
@@ -2565,7 +2545,7 @@ function bc(t) {
|
|
|
2565
2545
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
2566
2546
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
2567
2547
|
double() {
|
|
2568
|
-
const { a: h, b: g } = e, w = n.mul(g,
|
|
2548
|
+
const { a: h, b: g } = e, w = n.mul(g, On), { px: E, py: x, pz: _ } = this;
|
|
2569
2549
|
let B = n.ZERO, A = n.ZERO, v = n.ZERO, T = n.mul(E, E), G = n.mul(x, x), R = n.mul(_, _), N = n.mul(E, x);
|
|
2570
2550
|
return N = n.add(N, N), v = n.mul(E, _), v = n.add(v, v), B = n.mul(h, v), A = n.mul(w, R), A = n.add(B, A), B = n.sub(G, A), A = n.add(G, A), A = n.mul(B, A), B = n.mul(N, B), v = n.mul(w, v), R = n.mul(h, R), N = n.sub(T, R), N = n.mul(h, N), N = n.add(N, v), v = n.add(T, T), T = n.add(v, T), T = n.add(T, R), T = n.mul(T, N), A = n.add(A, T), R = n.mul(x, _), R = n.add(R, R), T = n.mul(R, N), B = n.sub(B, T), v = n.mul(R, G), v = n.add(v, v), v = n.add(v, v), new u(B, A, v);
|
|
2571
2551
|
}
|
|
@@ -2577,11 +2557,11 @@ function bc(t) {
|
|
|
2577
2557
|
d(h);
|
|
2578
2558
|
const { px: g, py: w, pz: E } = this, { px: x, py: _, pz: B } = h;
|
|
2579
2559
|
let A = n.ZERO, v = n.ZERO, T = n.ZERO;
|
|
2580
|
-
const G = e.a, R = n.mul(e.b,
|
|
2560
|
+
const G = e.a, R = n.mul(e.b, On);
|
|
2581
2561
|
let N = n.mul(g, x), L = n.mul(w, _), D = n.mul(E, B), rt = n.add(g, w), p = n.add(x, _);
|
|
2582
2562
|
rt = n.mul(rt, p), p = n.add(N, L), rt = n.sub(rt, p), p = n.add(g, E);
|
|
2583
|
-
let
|
|
2584
|
-
return p = n.mul(p,
|
|
2563
|
+
let y = n.add(x, B);
|
|
2564
|
+
return p = n.mul(p, y), y = n.add(N, D), p = n.sub(p, y), y = n.add(w, E), A = n.add(_, B), y = n.mul(y, A), A = n.add(L, D), y = n.sub(y, A), T = n.mul(G, p), A = n.mul(R, D), T = n.add(A, T), A = n.sub(L, T), T = n.add(L, T), v = n.mul(A, T), L = n.add(N, N), L = n.add(L, N), D = n.mul(G, D), p = n.mul(R, p), L = n.add(L, D), D = n.sub(N, D), D = n.mul(G, D), p = n.add(p, D), N = n.mul(L, p), v = n.add(v, N), N = n.mul(y, p), A = n.mul(rt, A), A = n.sub(A, N), N = n.mul(rt, L), T = n.mul(y, T), T = n.add(T, N), new u(A, v, T);
|
|
2585
2565
|
}
|
|
2586
2566
|
subtract(h) {
|
|
2587
2567
|
return this.add(h.negate());
|
|
@@ -2604,14 +2584,14 @@ function bc(t) {
|
|
|
2604
2584
|
const g = u.ZERO;
|
|
2605
2585
|
if (h === et)
|
|
2606
2586
|
return g;
|
|
2607
|
-
if (i(h), h ===
|
|
2587
|
+
if (i(h), h === W)
|
|
2608
2588
|
return this;
|
|
2609
2589
|
const { endo: w } = e;
|
|
2610
2590
|
if (!w)
|
|
2611
2591
|
return m.unsafeLadder(this, h);
|
|
2612
2592
|
let { k1neg: E, k1: x, k2neg: _, k2: B } = w.splitScalar(h), A = g, v = g, T = this;
|
|
2613
2593
|
for (; x > et || B > et; )
|
|
2614
|
-
x &
|
|
2594
|
+
x & W && (A = A.add(T)), B & W && (v = v.add(T)), T = T.double(), x >>= W, B >>= W;
|
|
2615
2595
|
return E && (A = A.negate()), _ && (v = v.negate()), v = new u(n.mul(v.px, w.beta), v.py, v.pz), A.add(v);
|
|
2616
2596
|
}
|
|
2617
2597
|
/**
|
|
@@ -2644,7 +2624,7 @@ function bc(t) {
|
|
|
2644
2624
|
* @returns non-zero affine point
|
|
2645
2625
|
*/
|
|
2646
2626
|
multiplyAndAddUnsafe(h, g, w) {
|
|
2647
|
-
const E = u.BASE, x = (B, A) => A === et || A ===
|
|
2627
|
+
const E = u.BASE, x = (B, A) => A === et || A === W || !B.equals(E) ? B.multiplyUnsafe(A) : B.multiply(A), _ = x(this, g).add(x(h, w));
|
|
2648
2628
|
return _.is0() ? void 0 : _;
|
|
2649
2629
|
}
|
|
2650
2630
|
// Converts Projective point to affine (x, y) coordinates.
|
|
@@ -2662,7 +2642,7 @@ function bc(t) {
|
|
|
2662
2642
|
}
|
|
2663
2643
|
isTorsionFree() {
|
|
2664
2644
|
const { h, isTorsionFree: g } = e;
|
|
2665
|
-
if (h ===
|
|
2645
|
+
if (h === W)
|
|
2666
2646
|
return !0;
|
|
2667
2647
|
if (g)
|
|
2668
2648
|
return g(u, this);
|
|
@@ -2670,7 +2650,7 @@ function bc(t) {
|
|
|
2670
2650
|
}
|
|
2671
2651
|
clearCofactor() {
|
|
2672
2652
|
const { h, clearCofactor: g } = e;
|
|
2673
|
-
return h ===
|
|
2653
|
+
return h === W ? this : g ? g(u, this) : this.multiplyUnsafe(e.h);
|
|
2674
2654
|
}
|
|
2675
2655
|
toRawBytes(h = !0) {
|
|
2676
2656
|
return this.assertValidity(), r(u, this, h);
|
|
@@ -2680,7 +2660,7 @@ function bc(t) {
|
|
|
2680
2660
|
}
|
|
2681
2661
|
}
|
|
2682
2662
|
u.BASE = new u(e.Gx, e.Gy, n.ONE), u.ZERO = new u(n.ZERO, n.ONE, n.ZERO);
|
|
2683
|
-
const
|
|
2663
|
+
const b = e.nBitLength, m = mc(u, e.endo ? Math.ceil(b / 2) : b);
|
|
2684
2664
|
return {
|
|
2685
2665
|
CURVE: e,
|
|
2686
2666
|
ProjectivePoint: u,
|
|
@@ -2690,8 +2670,8 @@ function bc(t) {
|
|
|
2690
2670
|
};
|
|
2691
2671
|
}
|
|
2692
2672
|
function Sc(t) {
|
|
2693
|
-
const e =
|
|
2694
|
-
return
|
|
2673
|
+
const e = Br(t);
|
|
2674
|
+
return qt(e, {
|
|
2695
2675
|
hash: "hash",
|
|
2696
2676
|
hmac: "function",
|
|
2697
2677
|
randomBytes: "function"
|
|
@@ -2710,71 +2690,71 @@ function Ec(t) {
|
|
|
2710
2690
|
return M(p, r);
|
|
2711
2691
|
}
|
|
2712
2692
|
function c(p) {
|
|
2713
|
-
return
|
|
2693
|
+
return _e(p, r);
|
|
2714
2694
|
}
|
|
2715
|
-
const { ProjectivePoint: l, normPrivateKeyToScalar: d, weierstrassEquation: u, isWithinCurveOrder:
|
|
2695
|
+
const { ProjectivePoint: l, normPrivateKeyToScalar: d, weierstrassEquation: u, isWithinCurveOrder: b } = yc({
|
|
2716
2696
|
...e,
|
|
2717
|
-
toBytes(p,
|
|
2718
|
-
const P =
|
|
2719
|
-
return I ? j(Uint8Array.from([
|
|
2697
|
+
toBytes(p, y, I) {
|
|
2698
|
+
const P = y.toAffine(), C = n.toBytes(P.x), j = Lt;
|
|
2699
|
+
return I ? j(Uint8Array.from([y.hasEvenY() ? 2 : 3]), C) : j(Uint8Array.from([4]), C, n.toBytes(P.y));
|
|
2720
2700
|
},
|
|
2721
2701
|
fromBytes(p) {
|
|
2722
|
-
const
|
|
2723
|
-
if (
|
|
2702
|
+
const y = p.length, I = p[0], P = p.subarray(1);
|
|
2703
|
+
if (y === s && (I === 2 || I === 3)) {
|
|
2724
2704
|
const C = X(P);
|
|
2725
2705
|
if (!a(C))
|
|
2726
2706
|
throw new Error("Point is not on curve");
|
|
2727
2707
|
const j = u(C);
|
|
2728
|
-
let
|
|
2729
|
-
const H = (
|
|
2730
|
-
return (I & 1) === 1 !== H && (
|
|
2731
|
-
} else if (
|
|
2708
|
+
let q = n.sqrt(j);
|
|
2709
|
+
const H = (q & W) === W;
|
|
2710
|
+
return (I & 1) === 1 !== H && (q = n.neg(q)), { x: C, y: q };
|
|
2711
|
+
} else if (y === o && I === 4) {
|
|
2732
2712
|
const C = n.fromBytes(P.subarray(0, n.BYTES)), j = n.fromBytes(P.subarray(n.BYTES, 2 * n.BYTES));
|
|
2733
2713
|
return { x: C, y: j };
|
|
2734
2714
|
} else
|
|
2735
|
-
throw new Error(`Point of length ${
|
|
2715
|
+
throw new Error(`Point of length ${y} was invalid. Expected ${s} compressed bytes or ${o} uncompressed bytes`);
|
|
2736
2716
|
}
|
|
2737
2717
|
}), m = (p) => ht(Et(p, e.nByteLength));
|
|
2738
2718
|
function S(p) {
|
|
2739
|
-
const
|
|
2740
|
-
return p >
|
|
2719
|
+
const y = r >> W;
|
|
2720
|
+
return p > y;
|
|
2741
2721
|
}
|
|
2742
2722
|
function h(p) {
|
|
2743
2723
|
return S(p) ? i(-p) : p;
|
|
2744
2724
|
}
|
|
2745
|
-
const g = (p,
|
|
2725
|
+
const g = (p, y, I) => X(p.slice(y, I));
|
|
2746
2726
|
class w {
|
|
2747
|
-
constructor(
|
|
2748
|
-
this.r =
|
|
2727
|
+
constructor(y, I, P) {
|
|
2728
|
+
this.r = y, this.s = I, this.recovery = P, this.assertValidity();
|
|
2749
2729
|
}
|
|
2750
2730
|
// pair (bytes of r, bytes of s)
|
|
2751
|
-
static fromCompact(
|
|
2731
|
+
static fromCompact(y) {
|
|
2752
2732
|
const I = e.nByteLength;
|
|
2753
|
-
return
|
|
2733
|
+
return y = V("compactSignature", y, I * 2), new w(g(y, 0, I), g(y, I, 2 * I));
|
|
2754
2734
|
}
|
|
2755
2735
|
// DER encoded ECDSA signature
|
|
2756
2736
|
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
|
|
2757
|
-
static fromDER(
|
|
2758
|
-
const { r: I, s: P } = dt.toSig(V("DER",
|
|
2737
|
+
static fromDER(y) {
|
|
2738
|
+
const { r: I, s: P } = dt.toSig(V("DER", y));
|
|
2759
2739
|
return new w(I, P);
|
|
2760
2740
|
}
|
|
2761
2741
|
assertValidity() {
|
|
2762
|
-
if (!
|
|
2742
|
+
if (!b(this.r))
|
|
2763
2743
|
throw new Error("r must be 0 < r < CURVE.n");
|
|
2764
|
-
if (!
|
|
2744
|
+
if (!b(this.s))
|
|
2765
2745
|
throw new Error("s must be 0 < s < CURVE.n");
|
|
2766
2746
|
}
|
|
2767
|
-
addRecoveryBit(
|
|
2768
|
-
return new w(this.r, this.s,
|
|
2747
|
+
addRecoveryBit(y) {
|
|
2748
|
+
return new w(this.r, this.s, y);
|
|
2769
2749
|
}
|
|
2770
|
-
recoverPublicKey(
|
|
2771
|
-
const { r: I, s: P, recovery: C } = this, j = v(V("msgHash",
|
|
2750
|
+
recoverPublicKey(y) {
|
|
2751
|
+
const { r: I, s: P, recovery: C } = this, j = v(V("msgHash", y));
|
|
2772
2752
|
if (C == null || ![0, 1, 2, 3].includes(C))
|
|
2773
2753
|
throw new Error("recovery id invalid");
|
|
2774
|
-
const
|
|
2775
|
-
if (
|
|
2754
|
+
const q = C === 2 || C === 3 ? I + e.n : I;
|
|
2755
|
+
if (q >= n.ORDER)
|
|
2776
2756
|
throw new Error("recovery id 2 or 3 invalid");
|
|
2777
|
-
const H = C & 1 ? "03" : "02", st = l.fromHex(H + m(
|
|
2757
|
+
const H = C & 1 ? "03" : "02", st = l.fromHex(H + m(q)), ot = c(q), gt = i(-j * ot), Bt = i(P * ot), at = l.BASE.multiplyAndAddUnsafe(st, gt, Bt);
|
|
2778
2758
|
if (!at)
|
|
2779
2759
|
throw new Error("point at infinify");
|
|
2780
2760
|
return at.assertValidity(), at;
|
|
@@ -2815,8 +2795,8 @@ function Ec(t) {
|
|
|
2815
2795
|
* as per FIPS 186 B.4.1 with modulo bias being neglible.
|
|
2816
2796
|
*/
|
|
2817
2797
|
randomPrivateKey: () => {
|
|
2818
|
-
const p = e.randomBytes(n.BYTES + 8),
|
|
2819
|
-
return Et(
|
|
2798
|
+
const p = e.randomBytes(n.BYTES + 8), y = dc(p, r);
|
|
2799
|
+
return Et(y, e.nByteLength);
|
|
2820
2800
|
},
|
|
2821
2801
|
/**
|
|
2822
2802
|
* Creates precompute table for an arbitrary EC point. Makes point "cached".
|
|
@@ -2826,30 +2806,30 @@ function Ec(t) {
|
|
|
2826
2806
|
* const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));
|
|
2827
2807
|
* fast.multiply(privKey); // much faster ECDH now
|
|
2828
2808
|
*/
|
|
2829
|
-
precompute(p = 8,
|
|
2830
|
-
return
|
|
2809
|
+
precompute(p = 8, y = l.BASE) {
|
|
2810
|
+
return y._setWindowSize(p), y.multiply(BigInt(3)), y;
|
|
2831
2811
|
}
|
|
2832
2812
|
};
|
|
2833
|
-
function x(p,
|
|
2834
|
-
return l.fromPrivateKey(p).toRawBytes(
|
|
2813
|
+
function x(p, y = !0) {
|
|
2814
|
+
return l.fromPrivateKey(p).toRawBytes(y);
|
|
2835
2815
|
}
|
|
2836
2816
|
function _(p) {
|
|
2837
|
-
const
|
|
2838
|
-
return
|
|
2817
|
+
const y = p instanceof Uint8Array, I = typeof p == "string", P = (y || I) && p.length;
|
|
2818
|
+
return y ? P === s || P === o : I ? P === 2 * s || P === 2 * o : p instanceof l;
|
|
2839
2819
|
}
|
|
2840
|
-
function B(p,
|
|
2820
|
+
function B(p, y, I = !0) {
|
|
2841
2821
|
if (_(p))
|
|
2842
2822
|
throw new Error("first arg must be private key");
|
|
2843
|
-
if (!_(
|
|
2823
|
+
if (!_(y))
|
|
2844
2824
|
throw new Error("second arg must be public key");
|
|
2845
|
-
return l.fromHex(
|
|
2825
|
+
return l.fromHex(y).multiply(d(p)).toRawBytes(I);
|
|
2846
2826
|
}
|
|
2847
2827
|
const A = e.bits2int || function(p) {
|
|
2848
|
-
const
|
|
2849
|
-
return I > 0 ?
|
|
2828
|
+
const y = X(p), I = p.length * 8 - e.nBitLength;
|
|
2829
|
+
return I > 0 ? y >> BigInt(I) : y;
|
|
2850
2830
|
}, v = e.bits2int_modN || function(p) {
|
|
2851
2831
|
return i(A(p));
|
|
2852
|
-
}, T =
|
|
2832
|
+
}, T = he(e.nBitLength);
|
|
2853
2833
|
function G(p) {
|
|
2854
2834
|
if (typeof p != "bigint")
|
|
2855
2835
|
throw new Error("bigint expected");
|
|
@@ -2857,70 +2837,70 @@ function Ec(t) {
|
|
|
2857
2837
|
throw new Error(`bigint expected < 2^${e.nBitLength}`);
|
|
2858
2838
|
return Et(p, e.nByteLength);
|
|
2859
2839
|
}
|
|
2860
|
-
function R(p,
|
|
2840
|
+
function R(p, y, I = N) {
|
|
2861
2841
|
if (["recovered", "canonical"].some((lt) => lt in I))
|
|
2862
2842
|
throw new Error("sign() legacy options not supported");
|
|
2863
2843
|
const { hash: P, randomBytes: C } = e;
|
|
2864
|
-
let { lowS: j, prehash:
|
|
2865
|
-
j == null && (j = !0), p = V("msgHash", p),
|
|
2866
|
-
const st = v(p), ot = d(
|
|
2844
|
+
let { lowS: j, prehash: q, extraEntropy: H } = I;
|
|
2845
|
+
j == null && (j = !0), p = V("msgHash", p), q && (p = V("prehashed msgHash", P(p)));
|
|
2846
|
+
const st = v(p), ot = d(y), gt = [G(ot), G(st)];
|
|
2867
2847
|
if (H != null) {
|
|
2868
2848
|
const lt = H === !0 ? C(n.BYTES) : H;
|
|
2869
2849
|
gt.push(V("extraEntropy", lt, n.BYTES));
|
|
2870
2850
|
}
|
|
2871
2851
|
const Bt = Lt(...gt), at = st;
|
|
2872
|
-
function
|
|
2852
|
+
function ge(lt) {
|
|
2873
2853
|
const wt = A(lt);
|
|
2874
|
-
if (!
|
|
2854
|
+
if (!b(wt))
|
|
2875
2855
|
return;
|
|
2876
|
-
const
|
|
2877
|
-
if (
|
|
2856
|
+
const Ye = c(wt), bt = l.BASE.multiply(wt).toAffine(), z = i(bt.x);
|
|
2857
|
+
if (z === et)
|
|
2878
2858
|
return;
|
|
2879
|
-
const
|
|
2880
|
-
if (
|
|
2859
|
+
const yt = i(Ye * i(at + z * ot));
|
|
2860
|
+
if (yt === et)
|
|
2881
2861
|
return;
|
|
2882
|
-
let
|
|
2883
|
-
return j && S(
|
|
2862
|
+
let Xe = (bt.x === z ? 0 : 2) | Number(bt.y & W), Je = yt;
|
|
2863
|
+
return j && S(yt) && (Je = h(yt), Xe ^= 1), new w(z, Je, Xe);
|
|
2884
2864
|
}
|
|
2885
|
-
return { seed: Bt, k2sig:
|
|
2865
|
+
return { seed: Bt, k2sig: ge };
|
|
2886
2866
|
}
|
|
2887
2867
|
const N = { lowS: e.lowS, prehash: !1 }, L = { lowS: e.lowS, prehash: !1 };
|
|
2888
|
-
function D(p,
|
|
2889
|
-
const { seed: P, k2sig: C } = R(p,
|
|
2890
|
-
return
|
|
2868
|
+
function D(p, y, I = N) {
|
|
2869
|
+
const { seed: P, k2sig: C } = R(p, y, I);
|
|
2870
|
+
return Ir(e.hash.outputLen, e.nByteLength, e.hmac)(P, C);
|
|
2891
2871
|
}
|
|
2892
2872
|
l.BASE._setWindowSize(8);
|
|
2893
|
-
function rt(p,
|
|
2894
|
-
var
|
|
2873
|
+
function rt(p, y, I, P = L) {
|
|
2874
|
+
var bt;
|
|
2895
2875
|
const C = p;
|
|
2896
|
-
if (
|
|
2876
|
+
if (y = V("msgHash", y), I = V("publicKey", I), "strict" in P)
|
|
2897
2877
|
throw new Error("options.strict was renamed to lowS");
|
|
2898
|
-
const { lowS: j, prehash:
|
|
2878
|
+
const { lowS: j, prehash: q } = P;
|
|
2899
2879
|
let H, st;
|
|
2900
2880
|
try {
|
|
2901
2881
|
if (typeof C == "string" || C instanceof Uint8Array)
|
|
2902
2882
|
try {
|
|
2903
2883
|
H = w.fromDER(C);
|
|
2904
|
-
} catch (
|
|
2905
|
-
if (!(
|
|
2906
|
-
throw
|
|
2884
|
+
} catch (z) {
|
|
2885
|
+
if (!(z instanceof dt.Err))
|
|
2886
|
+
throw z;
|
|
2907
2887
|
H = w.fromCompact(C);
|
|
2908
2888
|
}
|
|
2909
2889
|
else if (typeof C == "object" && typeof C.r == "bigint" && typeof C.s == "bigint") {
|
|
2910
|
-
const { r:
|
|
2911
|
-
H = new w(
|
|
2890
|
+
const { r: z, s: yt } = C;
|
|
2891
|
+
H = new w(z, yt);
|
|
2912
2892
|
} else
|
|
2913
2893
|
throw new Error("PARSE");
|
|
2914
2894
|
st = l.fromHex(I);
|
|
2915
|
-
} catch (
|
|
2916
|
-
if (
|
|
2895
|
+
} catch (z) {
|
|
2896
|
+
if (z.message === "PARSE")
|
|
2917
2897
|
throw new Error("signature must be Signature instance, Uint8Array or hex string");
|
|
2918
2898
|
return !1;
|
|
2919
2899
|
}
|
|
2920
2900
|
if (j && H.hasHighS())
|
|
2921
2901
|
return !1;
|
|
2922
|
-
|
|
2923
|
-
const { r: ot, s: gt } = H, Bt = v(
|
|
2902
|
+
q && (y = e.hash(y));
|
|
2903
|
+
const { r: ot, s: gt } = H, Bt = v(y), at = c(gt), ge = i(Bt * at), lt = i(ot * at), wt = (bt = l.BASE.multiplyAndAddUnsafe(st, ge, lt)) == null ? void 0 : bt.toAffine();
|
|
2924
2904
|
return wt ? i(wt.x) === ot : !1;
|
|
2925
2905
|
}
|
|
2926
2906
|
return {
|
|
@@ -2934,7 +2914,7 @@ function Ec(t) {
|
|
|
2934
2914
|
utils: E
|
|
2935
2915
|
};
|
|
2936
2916
|
}
|
|
2937
|
-
function
|
|
2917
|
+
function Ne(t) {
|
|
2938
2918
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
2939
2919
|
throw new Error(`Wrong positive integer: ${t}`);
|
|
2940
2920
|
}
|
|
@@ -2942,7 +2922,7 @@ function Ac(t) {
|
|
|
2942
2922
|
if (typeof t != "boolean")
|
|
2943
2923
|
throw new Error(`Expected boolean, not ${t}`);
|
|
2944
2924
|
}
|
|
2945
|
-
function
|
|
2925
|
+
function _r(t, ...e) {
|
|
2946
2926
|
if (!(t instanceof Uint8Array))
|
|
2947
2927
|
throw new TypeError("Expected Uint8Array");
|
|
2948
2928
|
if (e.length > 0 && !e.includes(t.length))
|
|
@@ -2951,7 +2931,7 @@ function Nr(t, ...e) {
|
|
|
2951
2931
|
function xc(t) {
|
|
2952
2932
|
if (typeof t != "function" || typeof t.create != "function")
|
|
2953
2933
|
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
|
2954
|
-
|
|
2934
|
+
Ne(t.outputLen), Ne(t.blockLen);
|
|
2955
2935
|
}
|
|
2956
2936
|
function vc(t, e = !0) {
|
|
2957
2937
|
if (t.destroyed)
|
|
@@ -2960,19 +2940,19 @@ function vc(t, e = !0) {
|
|
|
2960
2940
|
throw new Error("Hash#digest() has already been called");
|
|
2961
2941
|
}
|
|
2962
2942
|
function Ic(t, e) {
|
|
2963
|
-
|
|
2943
|
+
_r(t);
|
|
2964
2944
|
const n = e.outputLen;
|
|
2965
2945
|
if (t.length < n)
|
|
2966
2946
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
2967
2947
|
}
|
|
2968
2948
|
const Yt = {
|
|
2969
|
-
number:
|
|
2949
|
+
number: Ne,
|
|
2970
2950
|
bool: Ac,
|
|
2971
|
-
bytes:
|
|
2951
|
+
bytes: _r,
|
|
2972
2952
|
hash: xc,
|
|
2973
2953
|
exists: vc,
|
|
2974
2954
|
output: Ic
|
|
2975
|
-
},
|
|
2955
|
+
}, ve = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
2976
2956
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2977
2957
|
const Tc = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
2978
2958
|
if (!Tc)
|
|
@@ -3007,11 +2987,11 @@ class Cc {
|
|
|
3007
2987
|
}
|
|
3008
2988
|
}
|
|
3009
2989
|
function Oc(t = 32) {
|
|
3010
|
-
if (
|
|
3011
|
-
return
|
|
2990
|
+
if (ve && typeof ve.getRandomValues == "function")
|
|
2991
|
+
return ve.getRandomValues(new Uint8Array(t));
|
|
3012
2992
|
throw new Error("crypto.getRandomValues must be defined");
|
|
3013
2993
|
}
|
|
3014
|
-
class
|
|
2994
|
+
class Nr extends Cc {
|
|
3015
2995
|
constructor(e, n) {
|
|
3016
2996
|
super(), this.finished = !1, this.destroyed = !1, Yt.hash(e);
|
|
3017
2997
|
const r = _c(n);
|
|
@@ -3046,47 +3026,47 @@ class Cr extends Cc {
|
|
|
3046
3026
|
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
3047
3027
|
}
|
|
3048
3028
|
}
|
|
3049
|
-
const
|
|
3050
|
-
|
|
3029
|
+
const Cr = (t, e, n) => new Nr(t, e).update(n).digest();
|
|
3030
|
+
Cr.create = (t, e) => new Nr(t, e);
|
|
3051
3031
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3052
3032
|
function kc(t) {
|
|
3053
3033
|
return {
|
|
3054
3034
|
hash: t,
|
|
3055
|
-
hmac: (e, ...n) =>
|
|
3035
|
+
hmac: (e, ...n) => Cr(t, e, Nc(...n)),
|
|
3056
3036
|
randomBytes: Oc
|
|
3057
3037
|
};
|
|
3058
3038
|
}
|
|
3059
|
-
const
|
|
3060
|
-
function
|
|
3039
|
+
const kn = BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"), Or = 252;
|
|
3040
|
+
function Pn(t) {
|
|
3061
3041
|
for (; t[0] === 0; )
|
|
3062
3042
|
t = t.subarray(1);
|
|
3063
|
-
const e = t.length * 8 -
|
|
3043
|
+
const e = t.length * 8 - Or, n = X(t);
|
|
3064
3044
|
return e > 0 ? n >> BigInt(e) : n;
|
|
3065
3045
|
}
|
|
3066
|
-
function
|
|
3046
|
+
function kr(t) {
|
|
3067
3047
|
return typeof t == "string" && (t = $c(t), t.length & 1 && (t = "0" + t)), pt(t);
|
|
3068
3048
|
}
|
|
3069
|
-
const
|
|
3049
|
+
const Pr = Ec({
|
|
3070
3050
|
a: BigInt(1),
|
|
3071
3051
|
b: BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),
|
|
3072
|
-
Fp:
|
|
3073
|
-
n:
|
|
3074
|
-
nBitLength:
|
|
3052
|
+
Fp: ze(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),
|
|
3053
|
+
n: kn,
|
|
3054
|
+
nBitLength: Or,
|
|
3075
3055
|
Gx: BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),
|
|
3076
3056
|
Gy: BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),
|
|
3077
3057
|
h: BigInt(1),
|
|
3078
3058
|
lowS: !1,
|
|
3079
|
-
...kc(
|
|
3080
|
-
bits2int:
|
|
3059
|
+
...kc(Er),
|
|
3060
|
+
bits2int: Pn,
|
|
3081
3061
|
bits2int_modN: (t) => {
|
|
3082
3062
|
const e = X(t).toString(16);
|
|
3083
|
-
return e.length === 63 && (t =
|
|
3063
|
+
return e.length === 63 && (t = kr(e + "0")), M(Pn(t), kn);
|
|
3084
3064
|
}
|
|
3085
3065
|
});
|
|
3086
3066
|
function Pc(t) {
|
|
3087
|
-
return V("", typeof t == "string" ?
|
|
3067
|
+
return V("", typeof t == "string" ? kr(t) : t);
|
|
3088
3068
|
}
|
|
3089
|
-
const { CURVE: _u, ProjectivePoint: kt, Signature: Nu, utils: Cu } =
|
|
3069
|
+
const { CURVE: _u, ProjectivePoint: kt, Signature: Nu, utils: Cu } = Pr;
|
|
3090
3070
|
function Rc(t) {
|
|
3091
3071
|
return `0x${ht(t.subarray(1)).replace(/^0+/gm, "")}`;
|
|
3092
3072
|
}
|
|
@@ -3100,7 +3080,7 @@ const Dt = [
|
|
|
3100
3080
|
new kt(2138414695194151160943305727036575959195309218611738193261179310511854807447n, 113410276730064486255102093846540133784865286929052426931474106396135072156n, 1n),
|
|
3101
3081
|
new kt(2379962749567351885752724891227938183011949129833673362440656643086021394946n, 776496453633298175483985398648758586525933812536653089401905292063708816422n, 1n)
|
|
3102
3082
|
];
|
|
3103
|
-
function
|
|
3083
|
+
function Rr(t, e) {
|
|
3104
3084
|
const n = [];
|
|
3105
3085
|
let r = t;
|
|
3106
3086
|
for (let s = 0; s < 248; s++)
|
|
@@ -3110,7 +3090,7 @@ function $r(t, e) {
|
|
|
3110
3090
|
n.push(r), r = r.double();
|
|
3111
3091
|
return n;
|
|
3112
3092
|
}
|
|
3113
|
-
const Fc =
|
|
3093
|
+
const Fc = Rr(Dt[1], Dt[2]), Uc = Rr(Dt[3], Dt[4]);
|
|
3114
3094
|
function jc(t) {
|
|
3115
3095
|
let e;
|
|
3116
3096
|
if (typeof t == "bigint")
|
|
@@ -3121,11 +3101,11 @@ function jc(t) {
|
|
|
3121
3101
|
e = BigInt(t);
|
|
3122
3102
|
} else
|
|
3123
3103
|
e = X(Pc(t));
|
|
3124
|
-
if (!(0n <= e && e <
|
|
3104
|
+
if (!(0n <= e && e < Pr.CURVE.Fp.ORDER))
|
|
3125
3105
|
throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${e}`);
|
|
3126
3106
|
return e;
|
|
3127
3107
|
}
|
|
3128
|
-
function
|
|
3108
|
+
function Rn(t, e, n) {
|
|
3129
3109
|
let r = jc(e);
|
|
3130
3110
|
for (let s = 0; s < 252; s++) {
|
|
3131
3111
|
const o = n[s];
|
|
@@ -3137,13 +3117,13 @@ function Fn(t, e, n) {
|
|
|
3137
3117
|
}
|
|
3138
3118
|
function Lc(t, e) {
|
|
3139
3119
|
let n = Dt[0];
|
|
3140
|
-
return n =
|
|
3120
|
+
return n = Rn(n, t, Fc), n = Rn(n, e, Uc), Rc(n.toRawBytes(!0));
|
|
3141
3121
|
}
|
|
3142
|
-
const Dc =
|
|
3143
|
-
|
|
3144
|
-
const Vc =
|
|
3122
|
+
const Dc = he(250), Hc = (t) => X(Vi(t)) & Dc;
|
|
3123
|
+
ze(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));
|
|
3124
|
+
const Vc = ze(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));
|
|
3145
3125
|
function Mc(t, e, n) {
|
|
3146
|
-
const r = t.fromBytes(
|
|
3126
|
+
const r = t.fromBytes(Er(mr(`${e}${n}`)));
|
|
3147
3127
|
return t.create(r);
|
|
3148
3128
|
}
|
|
3149
3129
|
const Gc = [
|
|
@@ -3151,8 +3131,8 @@ const Gc = [
|
|
|
3151
3131
|
[1, -1, 1],
|
|
3152
3132
|
[1, 1, -2]
|
|
3153
3133
|
].map((t) => t.map(BigInt));
|
|
3154
|
-
function
|
|
3155
|
-
if (
|
|
3134
|
+
function qc(t, e) {
|
|
3135
|
+
if (qe(t.Fp), !Number.isSafeInteger(t.rate) || !Number.isSafeInteger(t.capacity))
|
|
3156
3136
|
throw new Error(`Wrong poseidon opts: ${t}`);
|
|
3157
3137
|
const n = t.rate + t.capacity, r = t.roundsFull + t.roundsPartial, s = [];
|
|
3158
3138
|
for (let a = 0; a < r; a++) {
|
|
@@ -3171,15 +3151,15 @@ function zc(t, e) {
|
|
|
3171
3151
|
});
|
|
3172
3152
|
return o.m = n, o.rate = t.rate, o.capacity = t.capacity, o;
|
|
3173
3153
|
}
|
|
3174
|
-
|
|
3175
|
-
var
|
|
3154
|
+
qc({ Fp: Vc, rate: 2, capacity: 1, roundsFull: 8, roundsPartial: 83 }, Gc);
|
|
3155
|
+
var Ce;
|
|
3176
3156
|
(function(t) {
|
|
3177
3157
|
t.NOT_STARTED = "NOT_STARTED", t.ONGOING = "ONGOING", t.AWAITING_FUNDS = "AWAITING_FUNDS", t.AWAITING_COMPLETION = "AWAITING_COMPLETION", t.COMPLETED = "COMPLETED", t.CANCELLED = "CANCELLED", t.ERROR = "ERROR";
|
|
3178
|
-
})(
|
|
3179
|
-
const
|
|
3158
|
+
})(Ce || (Ce = {}));
|
|
3159
|
+
const Wc = f.object({
|
|
3180
3160
|
recoveryId: f.number()
|
|
3181
3161
|
}), Ou = f.object({
|
|
3182
|
-
feeToken:
|
|
3162
|
+
feeToken: re,
|
|
3183
3163
|
signerSignature: f.object({
|
|
3184
3164
|
type: f.literal("StarknetKey"),
|
|
3185
3165
|
signer: f.object({
|
|
@@ -3188,22 +3168,22 @@ const qc = f.object({
|
|
|
3188
3168
|
s: Pt
|
|
3189
3169
|
})
|
|
3190
3170
|
})
|
|
3191
|
-
}),
|
|
3171
|
+
}), zc = f.nativeEnum(Ce), $r = f.object({
|
|
3192
3172
|
recoveryId: f.number(),
|
|
3193
|
-
status:
|
|
3173
|
+
status: zc,
|
|
3194
3174
|
completionTime: f.array(f.number()).optional()
|
|
3195
3175
|
}), Kc = f.object({
|
|
3196
|
-
activeRecovery:
|
|
3176
|
+
activeRecovery: $r.optional().or(f.null()).optional(),
|
|
3197
3177
|
minFees: f.record(f.number()).optional()
|
|
3198
3178
|
}), Zc = f.object({
|
|
3199
|
-
recovery:
|
|
3179
|
+
recovery: $r.optional().or(f.null()).optional(),
|
|
3200
3180
|
minFees: f.record(f.number()).optional()
|
|
3201
3181
|
});
|
|
3202
|
-
var
|
|
3182
|
+
var Oe;
|
|
3203
3183
|
(function(t) {
|
|
3204
3184
|
t.UNDEPLOYED_ACCOUNT = "undeployedAccount", t.NOT_ENOUGH_TO_PAY_FEES = "notEnoughToPayFees", t.RECOVERY_ALREADY_EXISTS = "recoveryAlreadyExists";
|
|
3205
|
-
})(
|
|
3206
|
-
const Yc = f.nativeEnum(
|
|
3185
|
+
})(Oe || (Oe = {}));
|
|
3186
|
+
const Yc = f.nativeEnum(Oe), ku = f.object({
|
|
3207
3187
|
status: Yc
|
|
3208
3188
|
});
|
|
3209
3189
|
class Pu {
|
|
@@ -3240,7 +3220,7 @@ class Pu {
|
|
|
3240
3220
|
* @returns A promise that resolves to the recovery details.
|
|
3241
3221
|
*/
|
|
3242
3222
|
async startRecovery(e, n, r, s) {
|
|
3243
|
-
const { r: o, s: a } =
|
|
3223
|
+
const { r: o, s: a } = ls.starkCurve.sign(Lc(Hc(ws("utf8", "starknet:recovery")), r), s), i = {
|
|
3244
3224
|
feeToken: n,
|
|
3245
3225
|
signerSignature: {
|
|
3246
3226
|
type: "StarknetKey",
|
|
@@ -3253,7 +3233,7 @@ class Pu {
|
|
|
3253
3233
|
};
|
|
3254
3234
|
return await this.httpService.post(`${this.apiBase}/accounts/starknet/${e}/recovery`, {
|
|
3255
3235
|
body: JSON.stringify(i)
|
|
3256
|
-
},
|
|
3236
|
+
}, Wc);
|
|
3257
3237
|
}
|
|
3258
3238
|
/**
|
|
3259
3239
|
* Completes the recovery process for a given address and recovery ID.
|
|
@@ -3275,26 +3255,26 @@ async function Ru() {
|
|
|
3275
3255
|
}
|
|
3276
3256
|
return !1;
|
|
3277
3257
|
}
|
|
3278
|
-
let
|
|
3258
|
+
let Ie;
|
|
3279
3259
|
function Xc() {
|
|
3280
|
-
return
|
|
3260
|
+
return Ie || (Ie = new bs(navigator.userAgent).getResult()), Ie;
|
|
3281
3261
|
}
|
|
3282
|
-
function
|
|
3262
|
+
function pe(t) {
|
|
3283
3263
|
return Xc().browser.name === t;
|
|
3284
3264
|
}
|
|
3285
3265
|
function $u() {
|
|
3286
|
-
return
|
|
3266
|
+
return pe("Firefox");
|
|
3287
3267
|
}
|
|
3288
3268
|
function Fu() {
|
|
3289
|
-
return
|
|
3269
|
+
return pe("Chrome");
|
|
3290
3270
|
}
|
|
3291
3271
|
function Uu() {
|
|
3292
|
-
return
|
|
3272
|
+
return pe("Safari");
|
|
3293
3273
|
}
|
|
3294
3274
|
function ju() {
|
|
3295
|
-
return
|
|
3275
|
+
return pe("Edge");
|
|
3296
3276
|
}
|
|
3297
|
-
const Lu = f.string().refine((t) =>
|
|
3277
|
+
const Lu = f.string().refine((t) => ys(t, Ss), "Invalid seedphrase"), Ke = [
|
|
3298
3278
|
{
|
|
3299
3279
|
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
3300
3280
|
name: "Ether",
|
|
@@ -3482,13 +3462,13 @@ const Lu = f.string().refine((t) => Ss(t, Es), "Invalid seedphrase"), Ye = [
|
|
|
3482
3462
|
high: r[1]
|
|
3483
3463
|
})));
|
|
3484
3464
|
}, Du = async (t, e, n) => {
|
|
3485
|
-
const r =
|
|
3465
|
+
const r = Ke.filter((o) => o.networkId === t);
|
|
3486
3466
|
return (await Promise.allSettled(r.map((o) => e.callContract({
|
|
3487
3467
|
contractAddress: o.address,
|
|
3488
3468
|
entrypoint: "balanceOf",
|
|
3489
3469
|
calldata: [n]
|
|
3490
3470
|
})))).reduce((o, a, i) => {
|
|
3491
|
-
if (a.status === "fulfilled" &&
|
|
3471
|
+
if (a.status === "fulfilled" && ps(a.value) || a.status === "rejected" || a.value[0] === "0x0" && a.value[1] === "0x0")
|
|
3492
3472
|
return o;
|
|
3493
3473
|
const c = BigInt(O.toHex(Ht.uint256ToBN({
|
|
3494
3474
|
low: a.value[0],
|
|
@@ -3499,10 +3479,10 @@ const Lu = f.string().refine((t) => Ss(t, Es), "Invalid seedphrase"), Ye = [
|
|
|
3499
3479
|
};
|
|
3500
3480
|
return o.push(l), o;
|
|
3501
3481
|
}, []);
|
|
3502
|
-
}, Hu = async () =>
|
|
3482
|
+
}, Hu = async () => Ke, Vu = ({ address: t, networkId: e }) => Ke.find((r) => r.address === t && r.networkId === e), Mu = ({ amount: t, decimals: e, unitCurrencyValue: n }) => {
|
|
3503
3483
|
if (!Y(t) || !Y(e) || !Y(n))
|
|
3504
3484
|
return;
|
|
3505
|
-
const r = Number(e), s = BigInt(t) *
|
|
3485
|
+
const r = Number(e), s = BigInt(t) * je(n.toString()).value;
|
|
3506
3486
|
return Mt({
|
|
3507
3487
|
value: s,
|
|
3508
3488
|
decimals: r + Vt
|
|
@@ -3512,12 +3492,12 @@ const Lu = f.string().refine((t) => Ss(t, Es), "Invalid seedphrase"), Ye = [
|
|
|
3512
3492
|
return;
|
|
3513
3493
|
const n = Number(e);
|
|
3514
3494
|
return xt(t.toString(), n).value.toString();
|
|
3515
|
-
},
|
|
3495
|
+
}, qu = (t) => Y(t) ? Number(t) : 18, { UINT_256_MAX: Qc } = Ht, tl = (t) => String(t) === String(Qc), Wu = (t, e = "$", n) => {
|
|
3516
3496
|
if (t === void 0 || !Y(t))
|
|
3517
3497
|
return null;
|
|
3518
3498
|
const r = wi(t, n);
|
|
3519
3499
|
return [e, r].filter(Boolean).join("");
|
|
3520
|
-
}, el = "Unlimited",
|
|
3500
|
+
}, el = "Unlimited", zu = ({ amount: t, decimals: e, symbol: n, showPlusSign: r = !1, withSymbol: s = !0, unlimitedText: o = el, prettyConfigOverrides: a }) => {
|
|
3521
3501
|
if (!Y(t))
|
|
3522
3502
|
return null;
|
|
3523
3503
|
let i, c = !1;
|
|
@@ -3526,13 +3506,13 @@ const Lu = f.string().refine((t) => Ss(t, Es), "Invalid seedphrase"), Ye = [
|
|
|
3526
3506
|
else {
|
|
3527
3507
|
const d = Number(e), u = BigInt(t);
|
|
3528
3508
|
c = u > 0n;
|
|
3529
|
-
const
|
|
3530
|
-
i = d > 0 ?
|
|
3509
|
+
const b = d > 0 ? Mt({ value: u, decimals: d }) : u.toString();
|
|
3510
|
+
i = d > 0 ? bi(b, a) : b;
|
|
3531
3511
|
}
|
|
3532
3512
|
const l = [i, s && n].filter(Boolean).join(" ");
|
|
3533
3513
|
return r && c ? `+${l}` : l;
|
|
3534
3514
|
};
|
|
3535
|
-
var nl =
|
|
3515
|
+
var nl = Xr, rl = nl;
|
|
3536
3516
|
function sl(t, e) {
|
|
3537
3517
|
function n(r, s) {
|
|
3538
3518
|
var o = e || {}, a;
|
|
@@ -3551,8 +3531,8 @@ function sl(t, e) {
|
|
|
3551
3531
|
var u;
|
|
3552
3532
|
try {
|
|
3553
3533
|
u = t(i, d);
|
|
3554
|
-
} catch (
|
|
3555
|
-
c(
|
|
3534
|
+
} catch (b) {
|
|
3535
|
+
c(b, d);
|
|
3556
3536
|
return;
|
|
3557
3537
|
}
|
|
3558
3538
|
Promise.resolve(u).then(r).catch(function(m) {
|
|
@@ -3564,7 +3544,7 @@ function sl(t, e) {
|
|
|
3564
3544
|
return new Promise(n);
|
|
3565
3545
|
}
|
|
3566
3546
|
var ol = sl;
|
|
3567
|
-
const al = /* @__PURE__ */
|
|
3547
|
+
const al = /* @__PURE__ */ Jr(ol);
|
|
3568
3548
|
class Ku {
|
|
3569
3549
|
constructor(e, n) {
|
|
3570
3550
|
this.apiBase = e, this.httpService = n, this.TOKENS_INFO_URL = "/tokens/info", this.TOKENS_DEFI_DECOMPOSITION_URL = "/tokens/defi/decomposition";
|
|
@@ -3575,17 +3555,17 @@ class Ku {
|
|
|
3575
3555
|
* @returns {Promise<ApiTokenInfo[]>} - The fetched tokens or undefined if there was an error or not default network
|
|
3576
3556
|
*/
|
|
3577
3557
|
async fetchTokensInfoFromBackend(e) {
|
|
3578
|
-
const n = k(this.apiBase, this.TOKENS_INFO_URL, e ?? "", "?chain=starknet"), r = await this.httpService.get(n), s =
|
|
3558
|
+
const n = k(this.apiBase, this.TOKENS_INFO_URL, e ?? "", "?chain=starknet"), r = await this.httpService.get(n), s = Qr.safeParse(r);
|
|
3579
3559
|
if (s.success)
|
|
3580
3560
|
return s.data.tokens;
|
|
3581
|
-
const o =
|
|
3561
|
+
const o = ts.safeParse(r);
|
|
3582
3562
|
if (o.success)
|
|
3583
3563
|
return [o.data];
|
|
3584
3564
|
}
|
|
3585
3565
|
/**
|
|
3586
3566
|
* Fetch list of tokens and balances for given account from backend
|
|
3587
3567
|
* @param {Address} address - The account address.
|
|
3588
|
-
* @returns {Promise<
|
|
3568
|
+
* @returns {Promise<WebBaseTokenWithBalance[]>} - The fetched balances for the account address.
|
|
3589
3569
|
*/
|
|
3590
3570
|
async fetchAddressTokenBalancesFromBackend(e, n, r) {
|
|
3591
3571
|
const s = k(this.apiBase, "activity", "starknet", n, "account", e, "balance");
|
|
@@ -3598,7 +3578,7 @@ class Ku {
|
|
|
3598
3578
|
} catch {
|
|
3599
3579
|
return i(new Error("Error fetching")), [];
|
|
3600
3580
|
}
|
|
3601
|
-
const l =
|
|
3581
|
+
const l = es.safeParse(c);
|
|
3602
3582
|
if (!l.success)
|
|
3603
3583
|
return i(new Error("Error parsing response")), [];
|
|
3604
3584
|
if (l.data.status !== "initialised")
|
|
@@ -3619,8 +3599,8 @@ class Ku {
|
|
|
3619
3599
|
}
|
|
3620
3600
|
async fetchDefiDecomposition(e) {
|
|
3621
3601
|
const n = k(this.apiBase, this.TOKENS_DEFI_DECOMPOSITION_URL, e, "?chain=starknet"), r = await this.httpService.get(n);
|
|
3622
|
-
if (!
|
|
3623
|
-
throw new
|
|
3602
|
+
if (!ns.safeParse(r).success)
|
|
3603
|
+
throw new rs({ code: "TOKEN_DEFI_DECOMPOSITION_PARSING_ERROR" });
|
|
3624
3604
|
return r.dapps;
|
|
3625
3605
|
}
|
|
3626
3606
|
}
|
|
@@ -3629,7 +3609,7 @@ const Zu = (t, e, n, r) => ({
|
|
|
3629
3609
|
entrypoint: "transfer",
|
|
3630
3610
|
calldata: mt.compile({
|
|
3631
3611
|
recipient: e,
|
|
3632
|
-
amount: jt(
|
|
3612
|
+
amount: jt(yi(n, r))
|
|
3633
3613
|
})
|
|
3634
3614
|
}), Yu = (t, e, n, r) => ({
|
|
3635
3615
|
contractAddress: t,
|
|
@@ -3651,14 +3631,14 @@ const Zu = (t, e, n, r) => ({
|
|
|
3651
3631
|
data_len: "0"
|
|
3652
3632
|
})
|
|
3653
3633
|
});
|
|
3654
|
-
function
|
|
3655
|
-
return
|
|
3634
|
+
function Fr(t) {
|
|
3635
|
+
return $e(t.unit) === "WEI";
|
|
3656
3636
|
}
|
|
3657
3637
|
function il(t) {
|
|
3658
|
-
return
|
|
3638
|
+
return $e(t.unit) === "FRI";
|
|
3659
3639
|
}
|
|
3660
3640
|
function At(t, e) {
|
|
3661
|
-
return
|
|
3641
|
+
return Fr(t) ? {
|
|
3662
3642
|
...t,
|
|
3663
3643
|
maxFee: e(t.maxFee),
|
|
3664
3644
|
overallFee: e(t.overallFee),
|
|
@@ -3674,21 +3654,21 @@ function At(t, e) {
|
|
|
3674
3654
|
};
|
|
3675
3655
|
}
|
|
3676
3656
|
function Rt(t) {
|
|
3677
|
-
return
|
|
3657
|
+
return Fr(t) ? {
|
|
3678
3658
|
maxFee: t.maxFee
|
|
3679
3659
|
} : {
|
|
3680
3660
|
amount: t.maxAmount,
|
|
3681
3661
|
pricePerUnit: t.maxPricePerUnit
|
|
3682
3662
|
};
|
|
3683
3663
|
}
|
|
3684
|
-
function
|
|
3685
|
-
return il({ unit: t }) ?
|
|
3664
|
+
function Te(t) {
|
|
3665
|
+
return il({ unit: t }) ? Re : Dn;
|
|
3686
3666
|
}
|
|
3687
3667
|
function Ju(t, e, n = 2) {
|
|
3688
3668
|
const r = BigInt(10 ** n), s = BigInt(Math.round(e * 10 ** n));
|
|
3689
3669
|
return t * s / r;
|
|
3690
3670
|
}
|
|
3691
|
-
const Qu = [
|
|
3671
|
+
const Qu = [Re], Ur = (t, e = fl) => {
|
|
3692
3672
|
if (t.max && "amount" in t.max)
|
|
3693
3673
|
return {
|
|
3694
3674
|
...t,
|
|
@@ -3697,7 +3677,7 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3697
3677
|
const n = 10000n, { amount: r, pricePerUnit: s, dataGasConsumed: o = 0n, dataGasPrice: a = 0n } = t, i = r * s + o * a;
|
|
3698
3678
|
if (i < 0)
|
|
3699
3679
|
throw Error("Cannot calculate max fee for negative fee");
|
|
3700
|
-
const c = O.toBigInt(
|
|
3680
|
+
const c = O.toBigInt(as({ estimatedFee: i })), l = Number(c) / Number(i), d = e(l), u = BigInt(Math.trunc(d * Number(n)));
|
|
3701
3681
|
return {
|
|
3702
3682
|
...t,
|
|
3703
3683
|
amount: r * u / n,
|
|
@@ -3705,30 +3685,30 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3705
3685
|
dataGasConsumed: o * u / n,
|
|
3706
3686
|
dataGasPrice: a * u / n
|
|
3707
3687
|
};
|
|
3708
|
-
},
|
|
3688
|
+
}, ne = (t) => {
|
|
3709
3689
|
const { amount: e, pricePerUnit: n, dataGasConsumed: r = 0n, dataGasPrice: s = 0n } = t;
|
|
3710
3690
|
return e * n + r * s;
|
|
3711
3691
|
}, cl = (t) => {
|
|
3712
3692
|
if (t.max)
|
|
3713
|
-
return "maxFee" in t.max ? t.max.maxFee :
|
|
3714
|
-
},
|
|
3693
|
+
return "maxFee" in t.max ? t.max.maxFee : ne(t.max);
|
|
3694
|
+
}, ke = (t) => {
|
|
3715
3695
|
const e = cl(t);
|
|
3716
|
-
return e ||
|
|
3696
|
+
return e || ne(Ur(t));
|
|
3717
3697
|
}, td = (t) => {
|
|
3718
3698
|
if (t.deployment && !nt(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
3719
3699
|
throw Error("Cannot calculate estimated fees for different tokens");
|
|
3720
|
-
const e =
|
|
3700
|
+
const e = ne(t.transactions), n = t.deployment ? ne(t.deployment) : 0n;
|
|
3721
3701
|
return e + n;
|
|
3722
3702
|
}, ed = (t) => {
|
|
3723
3703
|
if (t.deployment && !nt(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
3724
3704
|
throw Error("Cannot calculate estimated fees for different tokens");
|
|
3725
|
-
const e = t.deployment ?
|
|
3705
|
+
const e = t.deployment ? ke(t.deployment) : 0n, n = ke(t.transactions);
|
|
3726
3706
|
return e + n;
|
|
3727
3707
|
}, nd = (t, e) => [
|
|
3728
3708
|
{
|
|
3729
3709
|
contractAddress: t,
|
|
3730
3710
|
entrypoint: "transfer",
|
|
3731
|
-
calldata: mt.compile(
|
|
3711
|
+
calldata: mt.compile(ss.parse({
|
|
3732
3712
|
// We are using a dummy address (ETH here) as recipient to estimate the fee given we don't have a receipient yet
|
|
3733
3713
|
recipient: e,
|
|
3734
3714
|
// We are using the smallest possible amount to make sure this doesn't throw an error
|
|
@@ -3739,7 +3719,7 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3739
3719
|
if (!t)
|
|
3740
3720
|
return {
|
|
3741
3721
|
transactions: {
|
|
3742
|
-
feeTokenAddress: e ??
|
|
3722
|
+
feeTokenAddress: e ?? Dn,
|
|
3743
3723
|
amount: 0n,
|
|
3744
3724
|
pricePerUnit: 0n,
|
|
3745
3725
|
dataGasConsumed: 0n,
|
|
@@ -3749,10 +3729,10 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3749
3729
|
if (!Array.isArray(t))
|
|
3750
3730
|
throw Error(`Unexpected simulation response. Expected array. Got ${typeof t}`);
|
|
3751
3731
|
if (t.length === 1) {
|
|
3752
|
-
const n =
|
|
3732
|
+
const n = we.parse(t[0].feeEstimation);
|
|
3753
3733
|
return {
|
|
3754
3734
|
transactions: {
|
|
3755
|
-
feeTokenAddress:
|
|
3735
|
+
feeTokenAddress: Te(n.unit),
|
|
3756
3736
|
amount: O.toBigInt(n.gasUsage),
|
|
3757
3737
|
pricePerUnit: O.toBigInt(n.gasPrice),
|
|
3758
3738
|
max: Rt(At(n, O.toBigInt)),
|
|
@@ -3762,10 +3742,10 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3762
3742
|
};
|
|
3763
3743
|
}
|
|
3764
3744
|
if (t.length === 2) {
|
|
3765
|
-
const n =
|
|
3745
|
+
const n = we.parse(t[0].feeEstimation), r = we.parse(t[1].feeEstimation);
|
|
3766
3746
|
return {
|
|
3767
3747
|
deployment: {
|
|
3768
|
-
feeTokenAddress:
|
|
3748
|
+
feeTokenAddress: Te(n.unit),
|
|
3769
3749
|
amount: O.toBigInt(n.gasUsage),
|
|
3770
3750
|
pricePerUnit: O.toBigInt(n.gasPrice),
|
|
3771
3751
|
max: Rt(At(n, O.toBigInt)),
|
|
@@ -3773,7 +3753,7 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3773
3753
|
dataGasPrice: n.dataGasPrice ? O.toBigInt(n.dataGasPrice) : 0n
|
|
3774
3754
|
},
|
|
3775
3755
|
transactions: {
|
|
3776
|
-
feeTokenAddress:
|
|
3756
|
+
feeTokenAddress: Te(r.unit),
|
|
3777
3757
|
amount: O.toBigInt(r.gasUsage),
|
|
3778
3758
|
pricePerUnit: O.toBigInt(r.gasPrice),
|
|
3779
3759
|
max: Rt(At(r, O.toBigInt)),
|
|
@@ -3786,7 +3766,7 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3786
3766
|
}, ul = ({ transaction: t, nonce: e, chainId: n, version: r, isDeploymentTransaction: s, cairoVersion: o, address: a, appDomain: i }) => {
|
|
3787
3767
|
let c = e;
|
|
3788
3768
|
s && t.type !== "DEPLOY_ACCOUNT" && (c = O.toHex(1));
|
|
3789
|
-
const l =
|
|
3769
|
+
const l = se(t.calls);
|
|
3790
3770
|
return {
|
|
3791
3771
|
type: t.type,
|
|
3792
3772
|
chainId: n,
|
|
@@ -3805,7 +3785,7 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3805
3785
|
}, dl = (t, e) => {
|
|
3806
3786
|
const { transactions: n } = t, r = n.map((c) => {
|
|
3807
3787
|
if (!c.simulation)
|
|
3808
|
-
throw new
|
|
3788
|
+
throw new os({ code: "SIMULATE_AND_REVIEW_FAILED" });
|
|
3809
3789
|
return c;
|
|
3810
3790
|
}), s = r.map((c) => ({
|
|
3811
3791
|
...c.simulation,
|
|
@@ -3827,7 +3807,7 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3827
3807
|
} : void 0
|
|
3828
3808
|
};
|
|
3829
3809
|
}, rd = (t) => {
|
|
3830
|
-
const e =
|
|
3810
|
+
const e = Ur(t), n = ke(t);
|
|
3831
3811
|
return {
|
|
3832
3812
|
// for v1 transactions
|
|
3833
3813
|
maxFee: n,
|
|
@@ -3851,23 +3831,23 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3851
3831
|
}, fl = (t) => {
|
|
3852
3832
|
const e = Math.cbrt(t);
|
|
3853
3833
|
return isNaN(e) ? Math.cbrt(2) : e;
|
|
3854
|
-
}, od = (t) => t < 1 || isNaN(t) ? 1.1 : Math.log(t + 1) + 1, hl = [
|
|
3855
|
-
function
|
|
3834
|
+
}, od = (t) => t < 1 || isNaN(t) ? 1.1 : Math.log(t + 1) + 1, hl = [Re];
|
|
3835
|
+
function Ze({ address: t }) {
|
|
3856
3836
|
return hl.some((e) => nt(t, e));
|
|
3857
3837
|
}
|
|
3858
3838
|
function ad(t) {
|
|
3859
|
-
return t ?
|
|
3839
|
+
return t ? Ea().some((e) => nt(e, t)) : !1;
|
|
3860
3840
|
}
|
|
3861
|
-
function
|
|
3862
|
-
return
|
|
3841
|
+
function $n(t) {
|
|
3842
|
+
return Ze({
|
|
3863
3843
|
address: t
|
|
3864
3844
|
}) ? Z.TRANSACTION_VERSION.V3 : Z.TRANSACTION_VERSION.V1;
|
|
3865
3845
|
}
|
|
3866
3846
|
function id(t) {
|
|
3867
|
-
return
|
|
3847
|
+
return Ze({ address: t }) ? Z.TRANSACTION_VERSION.F3 : Z.TRANSACTION_VERSION.F1;
|
|
3868
3848
|
}
|
|
3869
3849
|
function cd(t, e) {
|
|
3870
|
-
return
|
|
3850
|
+
return us(e.contract) ? Ze({ address: t }) ? Z.TRANSACTION_VERSION.V3 : Z.TRANSACTION_VERSION.V2 : Z.TRANSACTION_VERSION.V1;
|
|
3871
3851
|
}
|
|
3872
3852
|
class ld {
|
|
3873
3853
|
constructor(e, n) {
|
|
@@ -3894,7 +3874,7 @@ class ld {
|
|
|
3894
3874
|
try {
|
|
3895
3875
|
if (!("getChainId" in e))
|
|
3896
3876
|
throw new Error("MISSING_METHOD");
|
|
3897
|
-
const c =
|
|
3877
|
+
const c = $n(r), l = i ? "0x0" : await e.getNonce(), d = await e.getChainId(), u = {
|
|
3898
3878
|
transactions: n.map((w) => ({
|
|
3899
3879
|
...ul({
|
|
3900
3880
|
transaction: w,
|
|
@@ -3908,14 +3888,14 @@ class ld {
|
|
|
3908
3888
|
}),
|
|
3909
3889
|
type: w.type
|
|
3910
3890
|
}))
|
|
3911
|
-
},
|
|
3891
|
+
}, b = k(this.apiBase, "reviewer", "transactions", "v2", "review", "starknet"), m = a ? Si(b, { delayedTransactions: "true" }) : b, S = await this.httpService.post(m, {
|
|
3912
3892
|
headers: {
|
|
3913
3893
|
Accept: "application/json",
|
|
3914
3894
|
"Content-Type": "application/json"
|
|
3915
3895
|
},
|
|
3916
3896
|
body: JSON.stringify(u)
|
|
3917
|
-
},
|
|
3918
|
-
if (S.transactions.some((w) =>
|
|
3897
|
+
}, is);
|
|
3898
|
+
if (S.transactions.some((w) => cs(w)))
|
|
3919
3899
|
return S;
|
|
3920
3900
|
const g = dl(S, r);
|
|
3921
3901
|
return {
|
|
@@ -3934,7 +3914,7 @@ class ld {
|
|
|
3934
3914
|
}
|
|
3935
3915
|
getCallsFromTx(e) {
|
|
3936
3916
|
let n;
|
|
3937
|
-
return e.calls && (n =
|
|
3917
|
+
return e.calls && (n = se(e.calls)), n;
|
|
3938
3918
|
}
|
|
3939
3919
|
async fallbackToOnchainFeeEstimation({ transactions: e, account: n, isDeploymentTransaction: r, feeTokenAddress: s, accountDeployTransaction: o }) {
|
|
3940
3920
|
try {
|
|
@@ -3964,7 +3944,7 @@ class ld {
|
|
|
3964
3944
|
}
|
|
3965
3945
|
async fetchFeesOnchain({ starknetAccount: e, calls: n, isDeployed: r, feeTokenAddress: s, accountDeployTransaction: o }) {
|
|
3966
3946
|
try {
|
|
3967
|
-
const a =
|
|
3947
|
+
const a = $n(s), i = {
|
|
3968
3948
|
transactions: {
|
|
3969
3949
|
feeTokenAddress: s,
|
|
3970
3950
|
amount: 0n,
|
|
@@ -3977,7 +3957,7 @@ class ld {
|
|
|
3977
3957
|
if ("estimateFeeBulk" in e) {
|
|
3978
3958
|
const c = [
|
|
3979
3959
|
{
|
|
3980
|
-
type:
|
|
3960
|
+
type: an.DEPLOY_ACCOUNT,
|
|
3981
3961
|
payload: {
|
|
3982
3962
|
classHash: o.classHash,
|
|
3983
3963
|
addressSalt: o.salt,
|
|
@@ -3986,7 +3966,7 @@ class ld {
|
|
|
3986
3966
|
}
|
|
3987
3967
|
},
|
|
3988
3968
|
{
|
|
3989
|
-
type:
|
|
3969
|
+
type: an.INVOKE,
|
|
3990
3970
|
payload: n
|
|
3991
3971
|
}
|
|
3992
3972
|
], [l, d] = await e.estimateFeeBulk(c, {
|
|
@@ -4047,9 +4027,9 @@ const ud = [
|
|
|
4047
4027
|
"swap",
|
|
4048
4028
|
"transfer"
|
|
4049
4029
|
], dd = (t) => ({ showBalanceChange: vt(() => {
|
|
4050
|
-
const n = t == null ? void 0 : t.some((s) => !
|
|
4030
|
+
const n = t == null ? void 0 : t.some((s) => !ln(s.transfers)), r = t == null ? void 0 : t.some((s) => !ln(s.approvals));
|
|
4051
4031
|
return t && (n || r);
|
|
4052
|
-
}, [t]) }),
|
|
4032
|
+
}, [t]) }), me = (t) => t ? t.filter((e) => e.token.type === "erc20") : [], fd = (t) => vt(() => me(t), [t]), hd = (t) => me(t).length > 0, pd = (t) => me(t).some((n) => n.amount > 0n), md = (t) => me(t).some((n) => n.amount < 0n), jr = (t) => t ? t.filter((e) => e.token.type === "erc721") : [], gd = (t) => vt(() => jr(t), [t]), pl = (t) => jr(t).length > 0, wd = (t) => vt(() => pl(t), [t]), bd = (t, e) => vt(() => t && e ? [
|
|
4053
4033
|
{
|
|
4054
4034
|
contractAddress: t.address,
|
|
4055
4035
|
entrypoint: "transfer",
|
|
@@ -4058,18 +4038,18 @@ const ud = [
|
|
|
4058
4038
|
amount: jt(t.balance)
|
|
4059
4039
|
})
|
|
4060
4040
|
}
|
|
4061
|
-
] : [], [t, e]),
|
|
4062
|
-
const a =
|
|
4041
|
+
] : [], [t, e]), yd = ({ apiData: { apiBaseUrl: t, apiHeaders: e }, address: n, network: r, transactionReviewEnabled: s = !0, transactions: o }) => {
|
|
4042
|
+
const a = Gn(async () => {
|
|
4063
4043
|
if (!n || !r)
|
|
4064
4044
|
return;
|
|
4065
4045
|
if (!t)
|
|
4066
4046
|
throw "Transaction review endpoint is not defined";
|
|
4067
|
-
const c = k(t, "reviewer/transactions/review/starknet"), l =
|
|
4047
|
+
const c = k(t, "reviewer/transactions/review/starknet"), l = ms(o) ? o : [o], d = {
|
|
4068
4048
|
network: r,
|
|
4069
4049
|
account: n,
|
|
4070
4050
|
calls: l
|
|
4071
4051
|
};
|
|
4072
|
-
return
|
|
4052
|
+
return Qn(c, {
|
|
4073
4053
|
method: "POST",
|
|
4074
4054
|
headers: {
|
|
4075
4055
|
"Content-Type": "application/json",
|
|
@@ -4077,12 +4057,12 @@ const ud = [
|
|
|
4077
4057
|
},
|
|
4078
4058
|
body: JSON.stringify(d)
|
|
4079
4059
|
});
|
|
4080
|
-
}, [n, r, o]), i = vt(() =>
|
|
4081
|
-
return
|
|
4060
|
+
}, [n, r, o]), i = vt(() => Es({ transactions: o, address: n, network: r }), [o, n, r]);
|
|
4061
|
+
return zs(!!s, [i, "transactionReview"], a);
|
|
4082
4062
|
}, Sd = (t) => {
|
|
4083
4063
|
if (!t)
|
|
4084
4064
|
return {};
|
|
4085
|
-
const e = t.assessment === "warn" && t.reason !== "contract_is_not_verified", n = t.reason ? ` (Reason: ${
|
|
4065
|
+
const e = t.assessment === "warn" && t.reason !== "contract_is_not_verified", n = t.reason ? ` (Reason: ${Wn(t.reason)})` : "", r = e ? t.reason === "recipient_is_token_address" ? "You are sending tokens to their own address. This is likely to burn them." : `This transaction has been flagged as dangerous. We recommend you reject this transaction unless you are sure.${n}` : void 0;
|
|
4086
4066
|
return {
|
|
4087
4067
|
warn: e,
|
|
4088
4068
|
reason: r
|
|
@@ -4115,20 +4095,20 @@ const ud = [
|
|
|
4115
4095
|
}, gl = async ({ feeTokenAddress: t, calls: e, selectedAccount: n, transactionReviewService: r, appDomain: s, accountDeployTransaction: o, isDelayedTransaction: a }) => {
|
|
4116
4096
|
const i = {
|
|
4117
4097
|
type: "INVOKE",
|
|
4118
|
-
calls:
|
|
4098
|
+
calls: se(e)
|
|
4119
4099
|
};
|
|
4120
4100
|
if (!n || !t)
|
|
4121
4101
|
return;
|
|
4122
4102
|
const c = o ? [o, i] : [i];
|
|
4123
4103
|
return { result: await r.simulateAndReview(n, c, t, s, o, a) };
|
|
4124
4104
|
}, wl = async (t, e, n, r) => {
|
|
4125
|
-
var
|
|
4105
|
+
var b, m, S, h, g, w;
|
|
4126
4106
|
let s = !1;
|
|
4127
4107
|
const o = e.transactions.find((E) => {
|
|
4128
4108
|
var x, _;
|
|
4129
4109
|
return (_ = (x = E == null ? void 0 : E.simulation) == null ? void 0 : x.summary) == null ? void 0 : _.find((B) => B.sent);
|
|
4130
4110
|
});
|
|
4131
|
-
if (!o || !((
|
|
4111
|
+
if (!o || !((b = o.simulation) != null && b.summary))
|
|
4132
4112
|
return s;
|
|
4133
4113
|
const a = o.simulation.summary.filter((E) => E.sent).map((E) => E.token.address);
|
|
4134
4114
|
if (!(((m = e.enrichedFeeEstimation) == null ? void 0 : m.transactions.feeTokenAddress) && a.includes((S = e.enrichedFeeEstimation) == null ? void 0 : S.transactions.feeTokenAddress)) || !((g = (h = e.enrichedFeeEstimation) == null ? void 0 : h.transactions) != null && g.max))
|
|
@@ -4138,7 +4118,7 @@ const ud = [
|
|
|
4138
4118
|
return s;
|
|
4139
4119
|
const d = await Jc(n, t, r) ?? 0n;
|
|
4140
4120
|
return BigInt(d) > c + BigInt(l) || (s = !0), s;
|
|
4141
|
-
}, Id = () =>
|
|
4121
|
+
}, Id = () => Gn(async ({ feeTokenAddress: e, calls: n, selectedAccount: r, transactionReviewService: s, appDomain: o, accountDeployPayload: a, provider: i, isDelayedTransaction: c }) => {
|
|
4142
4122
|
if (!r)
|
|
4143
4123
|
return;
|
|
4144
4124
|
const l = await gl({
|
|
@@ -4147,21 +4127,21 @@ const ud = [
|
|
|
4147
4127
|
selectedAccount: r,
|
|
4148
4128
|
transactionReviewService: s,
|
|
4149
4129
|
appDomain: o,
|
|
4150
|
-
accountDeployTransaction:
|
|
4130
|
+
accountDeployTransaction: bl(a),
|
|
4151
4131
|
isDelayedTransaction: c
|
|
4152
4132
|
});
|
|
4153
4133
|
if (!l || !l.result || !e)
|
|
4154
4134
|
return;
|
|
4155
4135
|
const d = await wl(r.address, l.result, e, i);
|
|
4156
4136
|
return { ...l.result, isSendingMoreThanBalanceAndGas: d };
|
|
4157
|
-
}, []),
|
|
4137
|
+
}, []), bl = (t) => t ? {
|
|
4158
4138
|
type: "DEPLOY_ACCOUNT",
|
|
4159
4139
|
calldata: t.calldata,
|
|
4160
4140
|
classHash: Pt.parse(t.class_hash),
|
|
4161
4141
|
salt: Pt.parse(t.salt),
|
|
4162
4142
|
signature: []
|
|
4163
4143
|
} : void 0;
|
|
4164
|
-
function
|
|
4144
|
+
function Fn() {
|
|
4165
4145
|
return { promise: Promise.resolve() };
|
|
4166
4146
|
}
|
|
4167
4147
|
function Td(t) {
|
|
@@ -4170,7 +4150,7 @@ function Td(t) {
|
|
|
4170
4150
|
super(), this.enabled = e, this.appVersion = n;
|
|
4171
4151
|
}
|
|
4172
4152
|
track(e, n) {
|
|
4173
|
-
return !this.enabled || !super.isLoaded ?
|
|
4153
|
+
return !this.enabled || !super.isLoaded ? Fn() : {
|
|
4174
4154
|
promise: super.track(e, {
|
|
4175
4155
|
app_version: this.appVersion,
|
|
4176
4156
|
...n
|
|
@@ -4179,50 +4159,50 @@ function Td(t) {
|
|
|
4179
4159
|
}
|
|
4180
4160
|
};
|
|
4181
4161
|
}
|
|
4182
|
-
const
|
|
4183
|
-
const [r, s] =
|
|
4162
|
+
const yl = ds({}), Bd = ({ enabled: t, initialize: e, children: n }) => {
|
|
4163
|
+
const [r, s] = Mn(!1);
|
|
4184
4164
|
return Ft(() => {
|
|
4185
4165
|
!r && t && e().then(() => s(!0));
|
|
4186
|
-
}, [r, t, e]), /* @__PURE__ */
|
|
4166
|
+
}, [r, t, e]), /* @__PURE__ */ As(yl.Provider, { value: {}, children: n });
|
|
4187
4167
|
};
|
|
4188
4168
|
export {
|
|
4189
4169
|
tt as ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES,
|
|
4190
4170
|
Jt as ARGENT_MULTISIG_CONTRACT_CLASS_HASHES,
|
|
4191
4171
|
kl as AddSmartAccountResponseSchema,
|
|
4192
4172
|
Pl as AddSmartAcountRequestSchema,
|
|
4193
|
-
|
|
4173
|
+
xs as BackendAccountSchema,
|
|
4194
4174
|
Su as BackendNftService,
|
|
4195
4175
|
Cd as BaseError,
|
|
4196
|
-
|
|
4176
|
+
to as C0_PROXY_CONTRACT_CLASS_HASHES,
|
|
4197
4177
|
Hl as CacheService,
|
|
4198
4178
|
Vt as DEFAULT_TOKEN_DECIMALS,
|
|
4199
4179
|
Vl as DateService,
|
|
4200
4180
|
Od as ESTIMATE_ERROR_MESSAGES,
|
|
4201
|
-
|
|
4202
|
-
|
|
4181
|
+
Dn as ETH_TOKEN_ADDRESS,
|
|
4182
|
+
os as EstimateError,
|
|
4203
4183
|
kd as EventEmitterProvider,
|
|
4204
4184
|
Pd as EventsBySelector,
|
|
4205
4185
|
Rd as FEE_OVERHEAD,
|
|
4206
|
-
|
|
4207
|
-
|
|
4186
|
+
Jn as HTTPService,
|
|
4187
|
+
Qe as HTTP_ERROR_MESSAGE,
|
|
4208
4188
|
K as HttpError,
|
|
4209
4189
|
ru as KnownDappsBackendService,
|
|
4210
|
-
|
|
4190
|
+
nn as MultiSigner,
|
|
4211
4191
|
Pu as OnchainRecoveryService,
|
|
4212
4192
|
el as PRETTY_UNLIMITED,
|
|
4213
|
-
|
|
4193
|
+
Ce as RecoveryStatusEnum,
|
|
4214
4194
|
ou as ResolveNameService,
|
|
4215
|
-
|
|
4216
|
-
|
|
4195
|
+
zr as STANDARD_DEVNET_ACCOUNT_CLASS_HASH,
|
|
4196
|
+
Re as STRK_TOKEN_ADDRESS,
|
|
4217
4197
|
Ml as SWRService,
|
|
4218
4198
|
Zl as StarknetAddressService,
|
|
4219
|
-
|
|
4199
|
+
Oe as StartOnchainRecoveryErrorStatusEnum,
|
|
4220
4200
|
$d as TOKEN_ERROR_MESSAGES,
|
|
4221
4201
|
Fd as TXV1_ACCOUNT_CLASS_HASH,
|
|
4222
4202
|
Ud as TXV1_MULTISIG_CLASS_HASH,
|
|
4223
4203
|
jd as TXV3_ACCOUNT_CLASS_HASH,
|
|
4224
4204
|
Ld as TXV3_MULTISIG_CLASS_HASH,
|
|
4225
|
-
|
|
4205
|
+
rs as TokenError,
|
|
4226
4206
|
Ku as TokenServiceWeb,
|
|
4227
4207
|
ld as TransactionReviewServiceWeb,
|
|
4228
4208
|
Bd as WebAmplitudeProvider,
|
|
@@ -4233,17 +4213,17 @@ export {
|
|
|
4233
4213
|
Vd as addOwnersCalldataSchema,
|
|
4234
4214
|
Md as addPluginCalldataSchema,
|
|
4235
4215
|
Gd as addressInputCharactersAndLengthSchema,
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4216
|
+
qd as addressInputSchema,
|
|
4217
|
+
Wd as addressOrDomainInputSchema,
|
|
4218
|
+
zd as addressOrDomainSchema,
|
|
4239
4219
|
Kd as addressOrEmptyUndefinedSchema,
|
|
4240
|
-
|
|
4241
|
-
|
|
4220
|
+
re as addressSchema,
|
|
4221
|
+
Pe as addressSchemaArgentBackend,
|
|
4242
4222
|
Zd as addressSchemaBase,
|
|
4243
4223
|
Yd as addressSchemaLooseLength,
|
|
4244
4224
|
Xd as addressSchemaStrictLength,
|
|
4245
4225
|
Jd as airdropSchema,
|
|
4246
|
-
|
|
4226
|
+
es as apiAccountTokenBalancesSchema,
|
|
4247
4227
|
Qd as apiAirdropSchema,
|
|
4248
4228
|
tf as apiCollateralizedDebtPositionSchema,
|
|
4249
4229
|
ef as apiCollateralizedDebtPositionsSchema,
|
|
@@ -4253,28 +4233,28 @@ export {
|
|
|
4253
4233
|
of as apiDefiDecompositionProducts,
|
|
4254
4234
|
af as apiDefiDecompositionSchema,
|
|
4255
4235
|
cf as apiDefiDecompositionToken,
|
|
4256
|
-
|
|
4236
|
+
ns as apiDefiPositionsSchema,
|
|
4257
4237
|
lf as apiPriceDataResponseSchema,
|
|
4258
4238
|
uf as apiPriceDetailsSchema,
|
|
4259
|
-
|
|
4239
|
+
ts as apiTokenInfoResponseSchema,
|
|
4260
4240
|
df as apiTokenInfoSchema,
|
|
4261
|
-
|
|
4241
|
+
Qr as apiTokensInfoResponseSchema,
|
|
4262
4242
|
ud as apiTransactionReviewActivityType,
|
|
4263
4243
|
ff as apiUnclaimedRewardsSchema,
|
|
4264
4244
|
hf as apiWalletResponseSchema,
|
|
4265
|
-
|
|
4266
|
-
|
|
4245
|
+
Ts as argentBackendNetworkIdSchema,
|
|
4246
|
+
as as argentMaxFee,
|
|
4267
4247
|
pf as argentNameSchema,
|
|
4268
|
-
|
|
4248
|
+
Is as argentNetworkIdSchema,
|
|
4269
4249
|
Dl as bigDecimal,
|
|
4270
4250
|
mf as bigNumberSchema,
|
|
4271
4251
|
gf as bigNumberishSchema,
|
|
4272
4252
|
wf as booleanToStringSchema,
|
|
4273
|
-
|
|
4274
|
-
|
|
4253
|
+
bl as buildAccountDeployTransaction,
|
|
4254
|
+
va as buildConstructorCalldata,
|
|
4275
4255
|
nd as buildDummyTx,
|
|
4276
|
-
|
|
4277
|
-
|
|
4256
|
+
bf as builtinsSchema,
|
|
4257
|
+
yf as byteCodeSchema,
|
|
4278
4258
|
Sf as cairo1EventSchema,
|
|
4279
4259
|
Ef as cairoAssemblySchema,
|
|
4280
4260
|
Af as cairoVersionSchema,
|
|
@@ -4282,7 +4262,7 @@ export {
|
|
|
4282
4262
|
od as calculateNonLinearAdjustment,
|
|
4283
4263
|
sd as calculateSqrtAdjustment,
|
|
4284
4264
|
xf as callDetailsSchema,
|
|
4285
|
-
|
|
4265
|
+
Lr as callSchema,
|
|
4286
4266
|
vf as calldataSchema,
|
|
4287
4267
|
At as castFeeEstimation,
|
|
4288
4268
|
If as changeGuardianCalldataSchema,
|
|
@@ -4298,13 +4278,13 @@ export {
|
|
|
4298
4278
|
Pf as compressedProgramSchema,
|
|
4299
4279
|
Rf as concentratedLiquidityPositionSchema,
|
|
4300
4280
|
$f as concentratedLiquidityPositionsSchema,
|
|
4301
|
-
|
|
4302
|
-
|
|
4281
|
+
Kr as constructorCallDataSchemaC0,
|
|
4282
|
+
Zr as constructorCallDataSchemaC1V1,
|
|
4303
4283
|
Ff as contractEntryPointFieldsSchema,
|
|
4304
4284
|
Mu as convertTokenAmountToCurrencyValue,
|
|
4305
4285
|
Gu as convertTokenUnitAmountWithDecimals,
|
|
4306
|
-
|
|
4307
|
-
|
|
4286
|
+
Ba as dappContractSchema,
|
|
4287
|
+
Ta as dappLinkSchema,
|
|
4308
4288
|
uu as daysBetween,
|
|
4309
4289
|
gi as decodeBase58,
|
|
4310
4290
|
lu as decodeBase58Array,
|
|
@@ -4316,60 +4296,60 @@ export {
|
|
|
4316
4296
|
Vf as denyTxV3,
|
|
4317
4297
|
mi as encodeBase58,
|
|
4318
4298
|
cu as encodeBase58Array,
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4299
|
+
se as ensureArray,
|
|
4300
|
+
qu as ensureDecimals,
|
|
4301
|
+
bu as entryPointToHumanReadable,
|
|
4322
4302
|
Mf as entryPointsByTypeSchema,
|
|
4323
4303
|
Iu as equalNft,
|
|
4324
4304
|
Zu as erc20TransferTransaction,
|
|
4325
4305
|
Xu as erc721SafeTransferFromTransaction,
|
|
4326
4306
|
Yu as erc721TransferFromTransaction,
|
|
4327
4307
|
Gf as escapeGuardianCalldataSchema,
|
|
4328
|
-
|
|
4308
|
+
ke as estimatedFeeToMaxFeeTotal,
|
|
4329
4309
|
rd as estimatedFeeToMaxResourceBounds,
|
|
4330
|
-
|
|
4310
|
+
ne as estimatedFeeToTotal,
|
|
4331
4311
|
ed as estimatedFeesToMaxFeeTotal,
|
|
4332
4312
|
td as estimatedFeesToTotal,
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4313
|
+
qf as eventAbiSchema,
|
|
4314
|
+
Wf as eventEntrySchema,
|
|
4315
|
+
zf as executeOnPluginCalldataSchema,
|
|
4316
|
+
Ze as feeTokenNeedsTxV3Support,
|
|
4337
4317
|
Kf as feltSchema,
|
|
4338
|
-
|
|
4318
|
+
Qn as fetchData,
|
|
4339
4319
|
Xt as fetcherError,
|
|
4340
4320
|
tu as findImplementationForAccount,
|
|
4341
4321
|
Zf as findTransfersAndApprovals,
|
|
4342
|
-
|
|
4322
|
+
sr as formatAddress,
|
|
4343
4323
|
Yf as formatFullAddress,
|
|
4344
4324
|
Xf as formatTruncatedAddress,
|
|
4345
4325
|
Jf as formatTruncatedSignerKey,
|
|
4346
4326
|
Qf as formatTruncatedString,
|
|
4347
4327
|
th as functionAbiSchema,
|
|
4348
4328
|
eh as functionAbiTypeSchema,
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4329
|
+
fi as generateAvatarImage,
|
|
4330
|
+
Ia as getAccountContractAddress,
|
|
4331
|
+
xa as getAccountDeploymentPayload,
|
|
4332
|
+
Wl as getAccountIdentifier,
|
|
4353
4333
|
qr as getAddressFromArgentName,
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4334
|
+
Qs as getAddressFromStarkName,
|
|
4335
|
+
fn as getArgentAccountClassHashes,
|
|
4336
|
+
Ea as getArgentAccountClassHashesWithTxV3Support,
|
|
4337
|
+
Sa as getArgentAccountWithMultiSignerClassHashes,
|
|
4358
4338
|
Kl as getBackendTimeNowSeconds,
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4339
|
+
Ks as getBackendTimeSeconds,
|
|
4340
|
+
Js as getCallFromStarkName,
|
|
4341
|
+
Zs as getChainIdFromNetworkId,
|
|
4362
4342
|
hi as getColor,
|
|
4363
|
-
|
|
4343
|
+
Oa as getDapplandLinkForDapp,
|
|
4364
4344
|
su as getDapplandUrlForDapp,
|
|
4365
4345
|
Sd as getDisplayWarnAndReasonForTransactionReview,
|
|
4366
|
-
|
|
4367
|
-
|
|
4346
|
+
me as getERC20Transactions,
|
|
4347
|
+
jr as getERC721Transactions,
|
|
4368
4348
|
ll as getEstimatedFeeFromBulkSimulation,
|
|
4369
4349
|
dl as getEstimatedFeeFromSimulationAndRespectWatermarkFee,
|
|
4370
|
-
|
|
4350
|
+
ui as getInitials,
|
|
4371
4351
|
Xl as getLastCairo0ArgentAccountClassHash,
|
|
4372
|
-
|
|
4352
|
+
ya as getLatestArgentAccountClassHash,
|
|
4373
4353
|
Yl as getLatestArgentMultisigClassHash,
|
|
4374
4354
|
Ql as getLatestLedgerAccountClassHash,
|
|
4375
4355
|
Jl as getLedgerAccountClassHashes,
|
|
@@ -4380,9 +4360,9 @@ export {
|
|
|
4380
4360
|
ul as getPayloadFromTransaction,
|
|
4381
4361
|
rh as getPrettyRpcError,
|
|
4382
4362
|
gl as getReviewForTransactions,
|
|
4383
|
-
|
|
4363
|
+
en as getSignerForMultiSigner,
|
|
4384
4364
|
id as getSimulationTxVersionFromFeeToken,
|
|
4385
|
-
|
|
4365
|
+
Xs as getStarknetIdContractAddressFromNetworkId,
|
|
4386
4366
|
Jc as getTokenBalance,
|
|
4387
4367
|
Hu as getTokens,
|
|
4388
4368
|
Du as getTokensBalances,
|
|
@@ -4390,7 +4370,7 @@ export {
|
|
|
4390
4370
|
xd as getTransactionReviewHasSwap,
|
|
4391
4371
|
ml as getTransactionReviewSwap,
|
|
4392
4372
|
vd as getTransactionReviewWithType,
|
|
4393
|
-
|
|
4373
|
+
$n as getTxVersionFromFeeToken,
|
|
4394
4374
|
cd as getTxVersionFromFeeTokenForDeclareContract,
|
|
4395
4375
|
Xc as getUAParserResult,
|
|
4396
4376
|
jt as getUint256CalldataFromBN,
|
|
@@ -4401,27 +4381,27 @@ export {
|
|
|
4401
4381
|
md as hasOutgoingERC20Transactions,
|
|
4402
4382
|
Pt as hexSchema,
|
|
4403
4383
|
sh as hexSchemaBase,
|
|
4404
|
-
|
|
4405
|
-
|
|
4384
|
+
ci as id,
|
|
4385
|
+
tn as implementationSchema,
|
|
4406
4386
|
oh as includesAddress,
|
|
4407
4387
|
ah as inputAmountSchema,
|
|
4408
4388
|
Fl as isAccountV4,
|
|
4409
4389
|
$l as isAccountV5,
|
|
4410
4390
|
Rl as isAccountV6,
|
|
4411
|
-
|
|
4391
|
+
Vr as isAddress,
|
|
4412
4392
|
pu as isAllowedAddressHexInputValue,
|
|
4413
4393
|
mu as isAllowedNumericInputValue,
|
|
4414
4394
|
Ll as isArgentBackendNetworkId,
|
|
4415
|
-
|
|
4395
|
+
Gr as isArgentName,
|
|
4416
4396
|
jl as isArgentNetworkId,
|
|
4417
4397
|
Ru as isBraveBrowser,
|
|
4418
|
-
|
|
4398
|
+
pe as isBrowser,
|
|
4419
4399
|
Fu as isChromeBrowser,
|
|
4420
4400
|
fu as isContractDeployed,
|
|
4421
4401
|
ju as isEdgeBrowser,
|
|
4422
4402
|
nt as isEqualAddress,
|
|
4423
4403
|
ih as isEqualArgentName,
|
|
4424
|
-
|
|
4404
|
+
Aa as isEqualImplementation,
|
|
4425
4405
|
ch as isEqualStarknetDomainName,
|
|
4426
4406
|
lh as isEqualStarknetId,
|
|
4427
4407
|
il as isFRI,
|
|
@@ -4430,54 +4410,54 @@ export {
|
|
|
4430
4410
|
Y as isNumeric,
|
|
4431
4411
|
Uu as isSafariBrowser,
|
|
4432
4412
|
uh as isStarknetDomainName,
|
|
4433
|
-
|
|
4413
|
+
Mr as isStarknetId,
|
|
4434
4414
|
tl as isUnlimitedAmount,
|
|
4435
|
-
|
|
4415
|
+
Hr as isValidAddress,
|
|
4436
4416
|
dh as isValidInputAmount,
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4417
|
+
Fr as isWEI,
|
|
4418
|
+
Dr as isZeroAddress,
|
|
4419
|
+
Na as knownDappSchema,
|
|
4420
|
+
Ca as knownDappsSchema,
|
|
4441
4421
|
fh as legacyContractClassSchema,
|
|
4442
4422
|
hh as legacyEventSchema,
|
|
4443
4423
|
ph as looseCalldataSchema,
|
|
4444
4424
|
mh as modifySnjsFeeOverhead,
|
|
4445
4425
|
gh as multiTypeSchema,
|
|
4446
4426
|
Ju as multiplyBigIntByFloat,
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4427
|
+
Pa as nameProviderResolutionSchema,
|
|
4428
|
+
Ra as nameResolutionAddressSchema,
|
|
4429
|
+
Fa as nameResolutionAddressesSchema,
|
|
4430
|
+
rr as nameResolutionStarknetIdSchema,
|
|
4431
|
+
ka as nameResolutionStarknetIdsSchema,
|
|
4452
4432
|
hu as nonNullable,
|
|
4453
|
-
|
|
4433
|
+
Ln as normalizeAddress,
|
|
4454
4434
|
wh as normalizeAddressOrDomain,
|
|
4455
|
-
|
|
4456
|
-
|
|
4435
|
+
bh as normalizeArgentName,
|
|
4436
|
+
yh as normalizeStarknetId,
|
|
4457
4437
|
Zc as onchainRecoverySchema,
|
|
4458
4438
|
Sh as parseAmount,
|
|
4459
|
-
|
|
4439
|
+
yi as parseAmountValue,
|
|
4460
4440
|
gu as pluralise,
|
|
4461
4441
|
Gl as postData,
|
|
4462
4442
|
Ul as preferencesEndpointPayload,
|
|
4463
|
-
|
|
4443
|
+
vs as preferencesSchema,
|
|
4464
4444
|
wi as prettifyCurrencyNumber,
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4445
|
+
Wu as prettifyCurrencyValue,
|
|
4446
|
+
dr as prettifyNumber,
|
|
4447
|
+
De as prettifyNumberConfig,
|
|
4448
|
+
zu as prettifyTokenAmount,
|
|
4449
|
+
bi as prettifyTokenNumber,
|
|
4470
4450
|
Eh as productGroupsSchema,
|
|
4471
4451
|
Ah as programSchema,
|
|
4472
|
-
|
|
4452
|
+
$a as providersNamesSchema,
|
|
4473
4453
|
xh as pythonicHintsSchema,
|
|
4474
4454
|
vh as rawArgsArraySchema,
|
|
4475
4455
|
Ih as rawArgsObjectSchema,
|
|
4476
4456
|
Th as rawArgsSchema,
|
|
4477
4457
|
wu as readFileAsString,
|
|
4478
|
-
|
|
4458
|
+
$r as recoveryBaseSchema,
|
|
4479
4459
|
Ou as recoveryBodySchema,
|
|
4480
|
-
|
|
4460
|
+
zc as recoveryStatusSchema,
|
|
4481
4461
|
Bh as removeOwnersCalldataSchema,
|
|
4482
4462
|
_h as removePluginCalldataSchema,
|
|
4483
4463
|
Nh as replaceSignerCalldataSchema,
|
|
@@ -4485,30 +4465,30 @@ export {
|
|
|
4485
4465
|
Ch as sierraContractEntryPointFieldsSchema,
|
|
4486
4466
|
Oh as sierraEntryPointsByTypeSchema,
|
|
4487
4467
|
kh as sierraProgramDebugInfoSchema,
|
|
4488
|
-
|
|
4468
|
+
Ys as starkNameToCallDataDomain,
|
|
4489
4469
|
Ph as starknetDomainNameSchema,
|
|
4490
|
-
|
|
4470
|
+
Yr as starknetIdSchema,
|
|
4491
4471
|
ku as startOnchainRecoveryErrorSchema,
|
|
4492
4472
|
Yc as startOnchainRecoveryErrorStatusSchema,
|
|
4493
|
-
|
|
4473
|
+
Wc as startOnchainRecoverySchema,
|
|
4494
4474
|
Rh as stringToBooleanSchema,
|
|
4495
4475
|
pi as stripAddressZeroPadding,
|
|
4496
4476
|
$h as structAbiSchema,
|
|
4497
|
-
|
|
4477
|
+
zl as swrRefetchDisabledConfig,
|
|
4498
4478
|
Rt as toMax,
|
|
4499
4479
|
Qu as tokensRequireTxV3Support,
|
|
4500
4480
|
Fh as transactionReviewTransactionsSchema,
|
|
4501
4481
|
Uh as transactionReviewWarningSchema,
|
|
4502
|
-
|
|
4482
|
+
ss as transferCalldataSchema,
|
|
4503
4483
|
jh as trpcErrorSchema,
|
|
4504
4484
|
Lh as txVersionSchema,
|
|
4505
4485
|
Dh as uint256Schema,
|
|
4506
4486
|
Hh as unclaimedRewardsSchema,
|
|
4507
|
-
|
|
4487
|
+
Te as unitToFeeTokenAddress,
|
|
4508
4488
|
Si as urlWithQuery,
|
|
4509
4489
|
dd as useBalanceChange,
|
|
4510
4490
|
Au as useCollection,
|
|
4511
|
-
|
|
4491
|
+
zs as useConditionallyEnabledSWR,
|
|
4512
4492
|
eu as useDebounce,
|
|
4513
4493
|
nu as useDebouncedValue,
|
|
4514
4494
|
fd as useERC20Transactions,
|
|
@@ -4516,17 +4496,26 @@ export {
|
|
|
4516
4496
|
Vh as useEmitEvent,
|
|
4517
4497
|
Mh as useEventEmitter,
|
|
4518
4498
|
Gh as useEventEmitterContext,
|
|
4519
|
-
|
|
4499
|
+
qh as useEventListener,
|
|
4520
4500
|
wd as useHasERC721Transaction,
|
|
4521
|
-
|
|
4522
|
-
|
|
4501
|
+
Wh as useIsEventEmitterEnabled,
|
|
4502
|
+
bd as useMaxAmountTransaction,
|
|
4523
4503
|
xu as useNft,
|
|
4524
4504
|
Eu as useNfts,
|
|
4525
4505
|
Vu as useToken,
|
|
4526
|
-
|
|
4506
|
+
yd as useTransactionReview,
|
|
4527
4507
|
Id as useTransactionReviewV2webFetcher,
|
|
4528
|
-
|
|
4508
|
+
zh as validChecksumAddressSchema,
|
|
4529
4509
|
Kh as validateAddressRangeSchema,
|
|
4530
|
-
|
|
4531
|
-
|
|
4510
|
+
yu as voidify,
|
|
4511
|
+
Zh as webBaseTokenSchema,
|
|
4512
|
+
Yh as webBaseTokenWithBalanceSchema,
|
|
4513
|
+
Xh as webTokenInfoDetailsSchema,
|
|
4514
|
+
Jh as webTokenPriceDetailsSchema,
|
|
4515
|
+
Qh as webTokenSchema,
|
|
4516
|
+
tp as webTokenWithBalanceAndPriceSchema,
|
|
4517
|
+
ep as webTokenWithBalanceSchema,
|
|
4518
|
+
np as webTokenWithPriceSchema,
|
|
4519
|
+
rp as webTokensWithBalanceAndPriceSchema,
|
|
4520
|
+
ql as withPolling
|
|
4532
4521
|
};
|