@argent/x-shared 1.34.0 → 1.34.2
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 +172 -86
- package/dist/http/HttpError.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +853 -846
- package/dist/knownDapps/schema.d.ts +78 -0
- package/dist/simulation.js +1 -1
- package/dist/simulation.mjs +2 -2
- package/dist/{transactionVersion-W-MhLhkx.js → transactionVersion-FKKSXkzh.js} +1 -1
- package/dist/{transactionVersion-BxOdbj7v.mjs → transactionVersion-tQTwHiJA.mjs} +3 -2
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import F, { z as
|
|
2
|
-
import { p as xt, H as K, a as
|
|
3
|
-
import { am as
|
|
4
|
-
import { constants as Z, starknetId as Mn, CallData as mt, CairoOption as
|
|
5
|
-
import { useEffect as Ft, useRef as
|
|
6
|
-
import { isFunction as qt, isString as Wn, upperCase as
|
|
1
|
+
import F, { z as f } from "zod";
|
|
2
|
+
import { p as xt, H as K, a as en, u as k, N as Ln, c as Dr, C as Dn, A as St, i as Hr, b as Vr, n as Hn, d as Mr, e as Gr, f as zr, g as qr, s as Q, h as nt, j as nn, k as Wr, S as Kr, l as rn, M as sn, m as Zr, o as Yr, q as Re, r as Xr, t as se, B as on, v as oe, w as Pt, x as Jr, y as Qr, z as ts, D as es, E as ns, F as rs, T as ss, G as $e, I as Vn, J as os, K as ye, L as as, O as is, P as cs, Q as ls, R as _t } from "./transactionVersion-tQTwHiJA.mjs";
|
|
3
|
+
import { am as Cd, aV as Od, bO as kd, aX as Pd, aT as Rd, an as $d, af as Fd, ah as Ud, ag as jd, ai as Ld, bt as Dd, bB as Hd, bh as Vd, bl as Md, a9 as Gd, aa as zd, a5 as qd, a4 as Wd, 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, b1 as mf, b5 as gf, b3 as wf, bo as yf, bD as bf, by as Sf, bJ as Ef, ae as Af, bd as xf, b7 as vf, bf as If, bk as Tf, aD as Bf, aE as _f, aF as Nf, bL as Cf, bK as Of, bH as kf, br as Pf, aB as Rf, aC as $f, bp as Ff, aK as Uf, aG as jf, aL as Lf, aI as Df, aJ as Hf, b0 as Vf, bq as Mf, bg as Gf, bA as zf, bw as qf, bn as Wf, be as Kf, aY as Zf, $ as Yf, _ as Xf, a1 as Jf, a2 as Qf, bv as th, bu as eh, aS as nh, aZ as rh, b2 as sh, a0 as oh, aP as ah, ac as ih, a7 as ch, ak as lh, a6 as uh, aQ as dh, bC as fh, bx as hh, bc as ph, aU as mh, b9 as gh, a8 as wh, ad as yh, al as bh, aO as Sh, aH as Eh, bs as Ah, bI as xh, b8 as vh, ba as Ih, bb as Th, bi as Bh, bm as _h, bj as Nh, bF as Ch, bG as Oh, bE as kh, a3 as Ph, b4 as Rh, bz as $h, aW as Fh, a_ as Uh, aR as jh, a$ as Lh, b6 as Dh, aN as Hh, bQ as Vh, bP as Mh, bM as Gh, bR as zh, bN as qh, U as Wh, V as Kh } from "./transactionVersion-tQTwHiJA.mjs";
|
|
4
|
+
import { constants as Z, starknetId as Mn, CallData as mt, CairoOption as an, CairoOptionVariant as cn, hash as Gn, num as O, encode as $t, uint256 as Ht, ec as us, isSierra as ds, TransactionType as ln } from "starknet";
|
|
5
|
+
import { useEffect as Ft, useRef as un, useState as zn, useMemo as vt, useCallback as qn, createContext as fs } from "react";
|
|
6
|
+
import { isFunction as qt, isString as Wn, upperCase as Fe, isNil as hs, upperFirst as ps, lowerCase as Kn, isUndefined as ms, isEmpty as dn, isArray as gs } from "lodash-es";
|
|
7
7
|
import ae, { useSWRConfig as ws } from "swr";
|
|
8
8
|
import { hex as Zn, base58 as Yn, stringToBytes as ys } from "@scure/base";
|
|
9
9
|
import { UAParser as bs } from "ua-parser-js";
|
|
@@ -11,64 +11,64 @@ import { validateMnemonic as Ss } from "@scure/bip39";
|
|
|
11
11
|
import { wordlist as Es } from "@scure/bip39/wordlists/english";
|
|
12
12
|
import As from "object-hash";
|
|
13
13
|
import { jsx as xs } from "react/jsx-runtime";
|
|
14
|
-
const vs =
|
|
15
|
-
name:
|
|
16
|
-
address:
|
|
17
|
-
ownerAddress:
|
|
18
|
-
chain:
|
|
19
|
-
deploymentStatus:
|
|
14
|
+
const vs = f.object({
|
|
15
|
+
name: f.string().optional(),
|
|
16
|
+
address: f.string(),
|
|
17
|
+
ownerAddress: f.string(),
|
|
18
|
+
chain: f.enum(["ethereum", "zksync", "zksync2", "starknet"]),
|
|
19
|
+
deploymentStatus: f.enum([
|
|
20
20
|
"notDeployed",
|
|
21
21
|
"deploying",
|
|
22
22
|
"deployed",
|
|
23
23
|
"deployError"
|
|
24
24
|
]),
|
|
25
|
-
application:
|
|
26
|
-
guardianAddresses:
|
|
27
|
-
enabledGuardianAddresses:
|
|
28
|
-
implClassHash:
|
|
29
|
-
proxyClassHash:
|
|
30
|
-
salt:
|
|
31
|
-
created:
|
|
32
|
-
contractVersion:
|
|
33
|
-
contractName:
|
|
34
|
-
version:
|
|
35
|
-
owner:
|
|
36
|
-
guid:
|
|
37
|
-
signerType:
|
|
25
|
+
application: f.enum(["mobile", "webwallet", "argentx"]),
|
|
26
|
+
guardianAddresses: f.array(f.string()).optional(),
|
|
27
|
+
enabledGuardianAddresses: f.array(f.string()).optional(),
|
|
28
|
+
implClassHash: f.string().optional(),
|
|
29
|
+
proxyClassHash: f.string().optional(),
|
|
30
|
+
salt: f.string().optional(),
|
|
31
|
+
created: f.string().optional(),
|
|
32
|
+
contractVersion: f.string().optional(),
|
|
33
|
+
contractName: f.string().optional(),
|
|
34
|
+
version: f.number().optional(),
|
|
35
|
+
owner: f.object({
|
|
36
|
+
guid: f.string().optional(),
|
|
37
|
+
signerType: f.enum(["StarknetKey", "EthereumKey"]).optional()
|
|
38
38
|
}).optional()
|
|
39
|
-
}),
|
|
40
|
-
address:
|
|
41
|
-
guardianAddress:
|
|
39
|
+
}), kl = f.object({
|
|
40
|
+
address: f.string(),
|
|
41
|
+
guardianAddress: f.string().optional(),
|
|
42
42
|
account: vs
|
|
43
|
-
}),
|
|
44
|
-
ownerAddress:
|
|
45
|
-
signature:
|
|
46
|
-
r:
|
|
47
|
-
s:
|
|
43
|
+
}), Pl = f.object({
|
|
44
|
+
ownerAddress: f.string(),
|
|
45
|
+
signature: f.object({
|
|
46
|
+
r: f.string(),
|
|
47
|
+
s: f.string()
|
|
48
48
|
}),
|
|
49
|
-
implClassHash:
|
|
50
|
-
name:
|
|
51
|
-
icon:
|
|
49
|
+
implClassHash: f.string().optional(),
|
|
50
|
+
name: f.string().optional(),
|
|
51
|
+
icon: f.string().optional()
|
|
52
52
|
});
|
|
53
|
-
function
|
|
53
|
+
function Rl(t) {
|
|
54
54
|
return "transactionVersion" in t;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function $l(t) {
|
|
57
57
|
return "simulateTransaction" in t;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Fl(t) {
|
|
60
60
|
return !("simulateTransaction" in t);
|
|
61
61
|
}
|
|
62
|
-
const Is =
|
|
63
|
-
value:
|
|
64
|
-
platform:
|
|
65
|
-
}),
|
|
66
|
-
preferences:
|
|
67
|
-
}), Ts =
|
|
68
|
-
function
|
|
62
|
+
const Is = f.object({
|
|
63
|
+
value: f.string(),
|
|
64
|
+
platform: f.enum(["ios", "argentx", "android", "webwallet"]).nullable()
|
|
65
|
+
}), Ul = f.object({
|
|
66
|
+
preferences: f.record(Is)
|
|
67
|
+
}), Ts = f.enum(["mainnet-alpha", "sepolia-alpha"]), Bs = f.enum(["mainnet", "sepolia"]);
|
|
68
|
+
function jl(t) {
|
|
69
69
|
return Ts.safeParse(t).success;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function Ll(t) {
|
|
72
72
|
return Bs.safeParse(t).success;
|
|
73
73
|
}
|
|
74
74
|
const Vt = 18;
|
|
@@ -80,7 +80,7 @@ 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 Ue = (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
|
}), Xn = (t) => {
|
|
@@ -89,9 +89,9 @@ const Fe = (t, e) => ({
|
|
|
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
|
|
92
|
+
return Ue(t, r);
|
|
93
93
|
}, Jn = (t, e) => {
|
|
94
|
-
const n = Math.max(t.decimals, e.decimals), [r, s] = [t, e].map((o) =>
|
|
94
|
+
const n = Math.max(t.decimals, e.decimals), [r, s] = [t, e].map((o) => Ue(o, n));
|
|
95
95
|
return [r.value, s.value, n];
|
|
96
96
|
}, ie = (t) => (e, n) => {
|
|
97
97
|
const [r, s, o] = Jn(e, n);
|
|
@@ -113,7 +113,7 @@ const Fe = (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
|
+
}), je = (t) => ({
|
|
117
117
|
decimals: t.decimals,
|
|
118
118
|
value: t.value >= BigInt(0) ? t.value : -t.value
|
|
119
119
|
}), Qn = Gt((t, e) => t === e), Ps = Gt((t, e) => t < e), Rs = Gt((t, e) => t > e), $s = Gt((t, e) => t <= e), Fs = Gt((t, e) => t >= e), Us = (t, e) => !Qn(t, e);
|
|
@@ -126,14 +126,14 @@ function Ls(t) {
|
|
|
126
126
|
function Ds(t) {
|
|
127
127
|
return Mt({ value: t, decimals: Vt });
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Le(t) {
|
|
130
130
|
return xt(t, Vt);
|
|
131
131
|
}
|
|
132
132
|
function Hs(t) {
|
|
133
|
-
return
|
|
133
|
+
return je({ value: t, decimals: 0 }).value;
|
|
134
134
|
}
|
|
135
135
|
function Vs(t) {
|
|
136
|
-
return
|
|
136
|
+
return je(Le(t));
|
|
137
137
|
}
|
|
138
138
|
function Ms(t, e) {
|
|
139
139
|
return {
|
|
@@ -143,12 +143,12 @@ function Ms(t, e) {
|
|
|
143
143
|
}
|
|
144
144
|
const Gs = { value: 1n, decimals: 0 };
|
|
145
145
|
function zs(t) {
|
|
146
|
-
return
|
|
146
|
+
return f.string().refine((e) => /^-?\d+(\.\d+)?$/.test(e), { message: "Invalid number format" }).transform((e) => xt(e, t));
|
|
147
147
|
}
|
|
148
|
-
const
|
|
148
|
+
const Dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
149
149
|
__proto__: null,
|
|
150
150
|
ONE: Gs,
|
|
151
|
-
abs:
|
|
151
|
+
abs: je,
|
|
152
152
|
absBigInt: Hs,
|
|
153
153
|
add: _s,
|
|
154
154
|
createUnitsSchema: zs,
|
|
@@ -164,16 +164,16 @@ const Ll = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
164
164
|
mod: ks,
|
|
165
165
|
mul: Os,
|
|
166
166
|
not: Us,
|
|
167
|
-
parseCurrency:
|
|
167
|
+
parseCurrency: Le,
|
|
168
168
|
parseCurrencyAbs: Vs,
|
|
169
169
|
parseEther: Ls,
|
|
170
170
|
parseUnits: xt,
|
|
171
171
|
sub: Ns,
|
|
172
172
|
toBigDecimal: Ms,
|
|
173
|
-
toFixedDecimals:
|
|
173
|
+
toFixedDecimals: Ue,
|
|
174
174
|
toTiniestPossibleDecimal: Xn
|
|
175
175
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
176
|
-
class
|
|
176
|
+
class Hl {
|
|
177
177
|
constructor(e, n) {
|
|
178
178
|
this.cachePromise = n.open(e).catch((r) => (console.error(new Error("Failed to open cache", { cause: r })), null));
|
|
179
179
|
}
|
|
@@ -207,7 +207,7 @@ class Dl {
|
|
|
207
207
|
await Promise.allSettled(n.map((r) => e.delete(r)));
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
class
|
|
210
|
+
class Vl {
|
|
211
211
|
constructor(e, n) {
|
|
212
212
|
this.httpService = e, this.baseUrl = n, this.offsetInS = 0, this.syncIntervalInMs = 60 * 1e3, this.initialSync = this.syncWithServer(), setInterval(() => void this.syncWithServer(), this.syncIntervalInMs);
|
|
213
213
|
}
|
|
@@ -221,7 +221,7 @@ class Hl {
|
|
|
221
221
|
this.offsetInS = r;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
class
|
|
224
|
+
class De {
|
|
225
225
|
constructor(e, n = "json") {
|
|
226
226
|
this.requestInit = e, this.responseType = n;
|
|
227
227
|
}
|
|
@@ -236,7 +236,7 @@ class Le {
|
|
|
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(en.FAILED_TO_FETCH_URL, 0);
|
|
240
240
|
});
|
|
241
241
|
if (this.responseType === "json") {
|
|
242
242
|
if (!o.ok)
|
|
@@ -256,7 +256,7 @@ class Le {
|
|
|
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(en.FAILED_TO_POST_URL, 0);
|
|
260
260
|
});
|
|
261
261
|
if (!a.ok)
|
|
262
262
|
throw new K(a.statusText, a.status, await a.json());
|
|
@@ -318,7 +318,7 @@ function qs(t, e) {
|
|
|
318
318
|
headers: r
|
|
319
319
|
});
|
|
320
320
|
}
|
|
321
|
-
class
|
|
321
|
+
class Ml {
|
|
322
322
|
constructor(e, n, r, s) {
|
|
323
323
|
this.dateService = e, this.cacheService = n, this.httpService = r, this.options = s, this.inFlightRequests = /* @__PURE__ */ new Map();
|
|
324
324
|
}
|
|
@@ -379,7 +379,7 @@ const Xt = (t, e, n) => {
|
|
|
379
379
|
} catch {
|
|
380
380
|
throw Xt("An error occurred while parsing", n, r);
|
|
381
381
|
}
|
|
382
|
-
},
|
|
382
|
+
}, Gl = async (t, e) => {
|
|
383
383
|
const n = await fetch(t, {
|
|
384
384
|
method: "POST",
|
|
385
385
|
...e
|
|
@@ -391,10 +391,10 @@ const Xt = (t, e, n) => {
|
|
|
391
391
|
} catch {
|
|
392
392
|
throw Xt("An error occurred while parsing", n, r);
|
|
393
393
|
}
|
|
394
|
-
},
|
|
394
|
+
}, zl = (t) => ({
|
|
395
395
|
refreshInterval: t,
|
|
396
396
|
dedupingInterval: t
|
|
397
|
-
}),
|
|
397
|
+
}), ql = (t) => `${t.networkId}::${t.address}`, Ws = () => {
|
|
398
398
|
};
|
|
399
399
|
function Ks(t, e, n, r) {
|
|
400
400
|
const { cache: s } = ws(), o = ae(t && e, t ? n : Ws, r);
|
|
@@ -402,7 +402,7 @@ function Ks(t, e, n, r) {
|
|
|
402
402
|
t || (o.mutate(), s.delete(e));
|
|
403
403
|
}, [t]), o;
|
|
404
404
|
}
|
|
405
|
-
const
|
|
405
|
+
const Wl = {
|
|
406
406
|
revalidateOnFocus: !1,
|
|
407
407
|
revalidateOnMount: !0,
|
|
408
408
|
revalidateOnReconnect: !1,
|
|
@@ -418,7 +418,7 @@ const ql = {
|
|
|
418
418
|
} catch {
|
|
419
419
|
throw new Error("failed to request time");
|
|
420
420
|
}
|
|
421
|
-
},
|
|
421
|
+
}, Kl = async (t, e) => {
|
|
422
422
|
const n = await Zs(t, e);
|
|
423
423
|
return Math.floor(n);
|
|
424
424
|
};
|
|
@@ -431,7 +431,7 @@ 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 Ln({
|
|
435
435
|
code: "NOT_FOUND",
|
|
436
436
|
message: `Unknown networkId: ${t}`
|
|
437
437
|
});
|
|
@@ -454,7 +454,7 @@ function Qs(t, e) {
|
|
|
454
454
|
calldata: o
|
|
455
455
|
});
|
|
456
456
|
} catch (s) {
|
|
457
|
-
throw new
|
|
457
|
+
throw new Dn({
|
|
458
458
|
code: "NOT_VALID",
|
|
459
459
|
options: { error: s }
|
|
460
460
|
});
|
|
@@ -462,14 +462,14 @@ function Qs(t, e) {
|
|
|
462
462
|
}
|
|
463
463
|
async function to(t, e, n) {
|
|
464
464
|
if (!e || !n)
|
|
465
|
-
throw new
|
|
465
|
+
throw new Ln({
|
|
466
466
|
code: "NO_NETWORK_OR_MULTICALL"
|
|
467
467
|
});
|
|
468
468
|
let r = null;
|
|
469
469
|
try {
|
|
470
470
|
r = Qs(t, e);
|
|
471
471
|
} catch (i) {
|
|
472
|
-
throw new
|
|
472
|
+
throw new Dn({
|
|
473
473
|
code: "NOT_VALID",
|
|
474
474
|
options: { error: i }
|
|
475
475
|
});
|
|
@@ -492,15 +492,15 @@ async function to(t, e, n) {
|
|
|
492
492
|
code: "STARKNAME_INVALID_ADDRESS",
|
|
493
493
|
message: `${t} resolved to an invalid address (${o})`
|
|
494
494
|
});
|
|
495
|
-
return
|
|
495
|
+
return Hn(o);
|
|
496
496
|
}
|
|
497
|
-
class
|
|
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
502
|
if (Mr(e))
|
|
503
|
-
return
|
|
503
|
+
return Hn(e);
|
|
504
504
|
try {
|
|
505
505
|
return await this.getAddressFromDomainName(e, n, r);
|
|
506
506
|
} catch {
|
|
@@ -555,9 +555,9 @@ var io = Object.prototype, co = io.toString;
|
|
|
555
555
|
function lo(t) {
|
|
556
556
|
return co.call(t);
|
|
557
557
|
}
|
|
558
|
-
var uo = "[object Null]", fo = "[object Undefined]",
|
|
558
|
+
var uo = "[object Null]", fo = "[object Undefined]", fn = Qt ? Qt.toStringTag : void 0;
|
|
559
559
|
function ho(t) {
|
|
560
|
-
return t == null ? t === void 0 ? fo : uo :
|
|
560
|
+
return t == null ? t === void 0 ? fo : uo : fn && fn in Object(t) ? ao(t) : lo(t);
|
|
561
561
|
}
|
|
562
562
|
function nr(t) {
|
|
563
563
|
var e = typeof t;
|
|
@@ -570,12 +570,12 @@ function yo(t) {
|
|
|
570
570
|
var e = ho(t);
|
|
571
571
|
return e == mo || e == go || e == po || e == wo;
|
|
572
572
|
}
|
|
573
|
-
var be = ce["__core-js_shared__"],
|
|
573
|
+
var be = ce["__core-js_shared__"], hn = 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 !!hn && hn in t;
|
|
579
579
|
}
|
|
580
580
|
var So = Function.prototype, Eo = So.toString;
|
|
581
581
|
function Ao(t) {
|
|
@@ -603,11 +603,11 @@ function Co(t) {
|
|
|
603
603
|
function Oo(t, e) {
|
|
604
604
|
return t == null ? void 0 : t[e];
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function He(t, e) {
|
|
607
607
|
var n = Oo(t, e);
|
|
608
608
|
return Co(n) ? n : void 0;
|
|
609
609
|
}
|
|
610
|
-
var Ut =
|
|
610
|
+
var Ut = He(Object, "create");
|
|
611
611
|
function ko() {
|
|
612
612
|
this.__data__ = Ut ? Ut(null) : {}, this.size = 0;
|
|
613
613
|
}
|
|
@@ -689,7 +689,7 @@ It.prototype.delete = Wo;
|
|
|
689
689
|
It.prototype.get = Ko;
|
|
690
690
|
It.prototype.has = Zo;
|
|
691
691
|
It.prototype.set = Yo;
|
|
692
|
-
var Xo =
|
|
692
|
+
var Xo = He(ce, "Map");
|
|
693
693
|
function Jo() {
|
|
694
694
|
this.size = 0, this.__data__ = {
|
|
695
695
|
hash: new ft(),
|
|
@@ -776,7 +776,7 @@ function fa(t, e, n) {
|
|
|
776
776
|
function ha(t, e) {
|
|
777
777
|
return t.has(e);
|
|
778
778
|
}
|
|
779
|
-
var Se =
|
|
779
|
+
var Se = He(ce, "Set");
|
|
780
780
|
function pa() {
|
|
781
781
|
}
|
|
782
782
|
function rr(t) {
|
|
@@ -814,7 +814,7 @@ function ya(t, e, n) {
|
|
|
814
814
|
function ba(t, e) {
|
|
815
815
|
return e = typeof e == "function" ? e : void 0, t && t.length ? ya(t, void 0, e) : [];
|
|
816
816
|
}
|
|
817
|
-
function
|
|
817
|
+
function pn(t) {
|
|
818
818
|
const e = Object.entries(tt), n = Object.entries(Jt);
|
|
819
819
|
switch (t) {
|
|
820
820
|
case "cairo0":
|
|
@@ -833,7 +833,7 @@ function Sa() {
|
|
|
833
833
|
throw new Error(`No argent account contract found: v${t} `);
|
|
834
834
|
return tt[t];
|
|
835
835
|
}
|
|
836
|
-
function
|
|
836
|
+
function Yl() {
|
|
837
837
|
const t = Q.maxSatisfying(Object.keys(Jt), "*");
|
|
838
838
|
if (!t)
|
|
839
839
|
throw new Error(`No argent multisig contract found: v${t} `);
|
|
@@ -842,7 +842,7 @@ function Zl() {
|
|
|
842
842
|
function Ea() {
|
|
843
843
|
return Object.entries(tt).filter(([t]) => Q.gte(t, "0.4.0")).map(([, t]) => t);
|
|
844
844
|
}
|
|
845
|
-
function
|
|
845
|
+
function Xl() {
|
|
846
846
|
const t = Q.maxSatisfying(Object.keys(tt), "<0.3.0");
|
|
847
847
|
if (!t)
|
|
848
848
|
throw new Error(`No argent account contract found: v${t} `);
|
|
@@ -852,25 +852,25 @@ function Aa() {
|
|
|
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
|
}
|
|
855
|
-
function
|
|
855
|
+
function Jl() {
|
|
856
856
|
return Object.entries(tt).filter(([t]) => Q.gte(t, "0.4.0")).map(([, t]) => t);
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function Ql() {
|
|
859
859
|
const t = Q.maxSatisfying(Object.keys(tt), ">=0.4.0");
|
|
860
860
|
if (!t)
|
|
861
861
|
throw new Error(`No ledger account contract found: v${t}`);
|
|
862
862
|
return tt[t];
|
|
863
863
|
}
|
|
864
864
|
const xa = (t, e) => t.cairoVersion === e.cairoVersion && nt(t.accountClassHash, e.accountClassHash);
|
|
865
|
-
function
|
|
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 = nn.parse({
|
|
869
869
|
cairoVersion: e.cairoVersion ?? "1",
|
|
870
870
|
accountClassHash: e.classHash ?? Sa()
|
|
871
|
-
}), s =
|
|
872
|
-
...
|
|
873
|
-
...
|
|
871
|
+
}), s = f.array(nn).parse(n), o = [
|
|
872
|
+
...pn("cairo0").map((l) => ({ cairoVersion: "0", accountClassHash: l })),
|
|
873
|
+
...pn("cairo1").map((l) => ({ cairoVersion: "1", accountClassHash: l }))
|
|
874
874
|
], c = ba([
|
|
875
875
|
r,
|
|
876
876
|
...s,
|
|
@@ -897,7 +897,7 @@ function Ia(t, e, n, r) {
|
|
|
897
897
|
...s ? {} : { guardian: r || "0" }
|
|
898
898
|
};
|
|
899
899
|
if (Ea().some((i) => nt(i, e))) {
|
|
900
|
-
const i =
|
|
900
|
+
const i = rn(n, sn.Starknet), c = r ? new an(cn.Some, rn(r, sn.Starknet)) : new an(cn.None, null);
|
|
901
901
|
return { ownerSigner: i, guardianAsOption: c };
|
|
902
902
|
}
|
|
903
903
|
return t === "0" ? Zr.parse({
|
|
@@ -913,8 +913,8 @@ function Ta(t, e, n, r, s) {
|
|
|
913
913
|
const o = va(t, e, n, r, s);
|
|
914
914
|
return Gn.calculateContractAddressFromHash(o.addressSalt, o.classHash, o.constructorCalldata, 0);
|
|
915
915
|
}
|
|
916
|
-
function
|
|
917
|
-
const n =
|
|
916
|
+
function eu(t, e) {
|
|
917
|
+
const n = un(t), r = un();
|
|
918
918
|
return Ft(() => {
|
|
919
919
|
n.current = t;
|
|
920
920
|
}, [t]), Ft(() => () => {
|
|
@@ -923,7 +923,7 @@ function tu(t, e) {
|
|
|
923
923
|
r.current && clearTimeout(r.current), r.current = setTimeout(() => n.current(...s), e);
|
|
924
924
|
};
|
|
925
925
|
}
|
|
926
|
-
function
|
|
926
|
+
function nu(t, e) {
|
|
927
927
|
const [n, r] = zn(t);
|
|
928
928
|
return Ft(() => {
|
|
929
929
|
const s = setTimeout(() => {
|
|
@@ -934,8 +934,8 @@ function eu(t, e) {
|
|
|
934
934
|
};
|
|
935
935
|
}, [t, e]), n;
|
|
936
936
|
}
|
|
937
|
-
const Ba =
|
|
938
|
-
name:
|
|
937
|
+
const Ba = f.object({
|
|
938
|
+
name: f.enum([
|
|
939
939
|
"dappland",
|
|
940
940
|
"discord",
|
|
941
941
|
"github",
|
|
@@ -943,67 +943,74 @@ const Ba = h.object({
|
|
|
943
943
|
"twitter",
|
|
944
944
|
"website"
|
|
945
945
|
]),
|
|
946
|
-
url:
|
|
947
|
-
position:
|
|
948
|
-
}), _a =
|
|
949
|
-
address:
|
|
950
|
-
chain:
|
|
951
|
-
}), Na =
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
946
|
+
url: f.string(),
|
|
947
|
+
position: f.number()
|
|
948
|
+
}), _a = f.object({
|
|
949
|
+
address: Re,
|
|
950
|
+
chain: f.enum(["ethereum", "starknet"])
|
|
951
|
+
}), Na = f.object({
|
|
952
|
+
maxExpiryDays: f.number().positive(),
|
|
953
|
+
allowList: f.array(f.object({
|
|
954
|
+
contractAddress: Re,
|
|
955
|
+
methods: f.array(f.string())
|
|
956
|
+
}))
|
|
957
|
+
}), Ca = f.object({
|
|
958
|
+
dappId: f.string(),
|
|
959
|
+
name: f.string(),
|
|
960
|
+
description: f.string().optional(),
|
|
961
|
+
logoUrl: f.string().optional(),
|
|
962
|
+
dappUrl: f.string().optional(),
|
|
963
|
+
inAppBrowserCompatible: f.boolean(),
|
|
964
|
+
argentVerified: f.boolean(),
|
|
965
|
+
links: f.array(Ba).optional(),
|
|
966
|
+
contracts: f.array(_a).optional(),
|
|
967
|
+
categories: f.array(f.string()).optional(),
|
|
968
|
+
supportedApps: f.array(f.string()).optional(),
|
|
969
|
+
brandColor: f.string().optional(),
|
|
970
|
+
executeFromOutsideAllowed: f.boolean().default(!1).optional(),
|
|
971
|
+
sessionConfig: Na.optional()
|
|
972
|
+
}), Oa = f.array(Ca);
|
|
973
|
+
class ru {
|
|
967
974
|
constructor(e, n) {
|
|
968
|
-
this.apiBase = e, this.httpService = new
|
|
975
|
+
this.apiBase = e, this.httpService = new De(n, "json");
|
|
969
976
|
}
|
|
970
977
|
async getAll() {
|
|
971
|
-
const e = await this.httpService.get(`${this.apiBase}/tokens/dapps`), n =
|
|
978
|
+
const e = await this.httpService.get(`${this.apiBase}/tokens/dapps`), n = Oa.safeParse(e);
|
|
972
979
|
if (!n.success)
|
|
973
980
|
throw new Error("Failed to parse known dapps");
|
|
974
981
|
return n.data;
|
|
975
982
|
}
|
|
976
983
|
}
|
|
977
|
-
function
|
|
984
|
+
function ka(t) {
|
|
978
985
|
var e;
|
|
979
986
|
return (e = t == null ? void 0 : t.links) == null ? void 0 : e.find((n) => n.name === "dappland");
|
|
980
987
|
}
|
|
981
|
-
function
|
|
988
|
+
function su(t) {
|
|
982
989
|
var e;
|
|
983
|
-
return (e =
|
|
990
|
+
return (e = ka(t)) == null ? void 0 : e.url;
|
|
984
991
|
}
|
|
985
992
|
const sr = F.object({
|
|
986
993
|
domain: Xr,
|
|
987
994
|
address: se.optional(),
|
|
988
995
|
avatar: F.string().optional(),
|
|
989
996
|
status: F.union([F.literal("KNOWN"), F.literal("UNKNOWN")])
|
|
990
|
-
}),
|
|
997
|
+
}), Pa = F.array(sr), Ra = F.object({
|
|
991
998
|
provider: F.string(),
|
|
992
999
|
name: F.string(),
|
|
993
1000
|
avatar: F.string().optional()
|
|
994
|
-
}),
|
|
1001
|
+
}), $a = F.object({
|
|
995
1002
|
address: se,
|
|
996
1003
|
status: F.union([F.literal("KNOWN"), F.literal("UNKNOWN")]),
|
|
997
|
-
resolutions: F.array(
|
|
998
|
-
}),
|
|
999
|
-
class
|
|
1004
|
+
resolutions: F.array(Ra).optional()
|
|
1005
|
+
}), Fa = F.array(F.string()), Ua = $a.array();
|
|
1006
|
+
class ou {
|
|
1000
1007
|
constructor(e, n) {
|
|
1001
|
-
this.apiBase = e, this.headers = n, this.httpService = new
|
|
1008
|
+
this.apiBase = e, this.headers = n, this.httpService = new De(this.headers, "json");
|
|
1002
1009
|
}
|
|
1003
1010
|
async getAddressFromMultipleStarknetId(e, n, r) {
|
|
1004
1011
|
const s = new URLSearchParams(n.map((c) => ["domain", c]));
|
|
1005
1012
|
r && s.set("includeAvatar", "true");
|
|
1006
|
-
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 = Pa.safeParse(a);
|
|
1007
1014
|
if (!i.success)
|
|
1008
1015
|
throw new Error("Failed to parse name resolution");
|
|
1009
1016
|
return i.data;
|
|
@@ -1020,69 +1027,69 @@ class su {
|
|
|
1020
1027
|
async getStarknetIdFromAddress(e, n, r) {
|
|
1021
1028
|
const s = new URLSearchParams(n.map((c) => ["address", c]));
|
|
1022
1029
|
r && s.set("includeAvatar", "true");
|
|
1023
|
-
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 = Ua.safeParse(a);
|
|
1024
1031
|
if (!i.success)
|
|
1025
1032
|
throw new Error("Failed to parse name resolution");
|
|
1026
1033
|
return i.data;
|
|
1027
1034
|
}
|
|
1028
1035
|
async getProvidersNames(e) {
|
|
1029
|
-
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 = Fa.safeParse(r);
|
|
1030
1037
|
if (!s.success)
|
|
1031
1038
|
throw new Error("Failed to parse name resolution");
|
|
1032
1039
|
return s.data;
|
|
1033
1040
|
}
|
|
1034
1041
|
}
|
|
1035
1042
|
const or = (t) => t.slice(0, 6) + "..." + t.slice(-4);
|
|
1036
|
-
function
|
|
1043
|
+
function mn(t) {
|
|
1037
1044
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
1038
1045
|
throw new Error(`positive integer expected, not ${t}`);
|
|
1039
1046
|
}
|
|
1040
|
-
function
|
|
1047
|
+
function ja(t) {
|
|
1041
1048
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1042
1049
|
}
|
|
1043
1050
|
function de(t, ...e) {
|
|
1044
|
-
if (!
|
|
1051
|
+
if (!ja(t))
|
|
1045
1052
|
throw new Error("Uint8Array expected");
|
|
1046
1053
|
if (e.length > 0 && !e.includes(t.length))
|
|
1047
1054
|
throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`);
|
|
1048
1055
|
}
|
|
1049
|
-
function
|
|
1056
|
+
function gn(t, e = !0) {
|
|
1050
1057
|
if (t.destroyed)
|
|
1051
1058
|
throw new Error("Hash instance has been destroyed");
|
|
1052
1059
|
if (e && t.finished)
|
|
1053
1060
|
throw new Error("Hash#digest() has already been called");
|
|
1054
1061
|
}
|
|
1055
|
-
function
|
|
1062
|
+
function La(t, e) {
|
|
1056
1063
|
de(t);
|
|
1057
1064
|
const n = e.outputLen;
|
|
1058
1065
|
if (t.length < n)
|
|
1059
1066
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
1060
1067
|
}
|
|
1061
|
-
const Kt = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
1062
|
-
function La(t, e = !1) {
|
|
1063
|
-
return e ? { h: Number(t & Kt), l: Number(t >> gn & Kt) } : { h: Number(t >> gn & Kt) | 0, l: Number(t & Kt) | 0 };
|
|
1064
|
-
}
|
|
1068
|
+
const Kt = /* @__PURE__ */ BigInt(2 ** 32 - 1), wn = /* @__PURE__ */ BigInt(32);
|
|
1065
1069
|
function Da(t, e = !1) {
|
|
1070
|
+
return e ? { h: Number(t & Kt), l: Number(t >> wn & Kt) } : { h: Number(t >> wn & Kt) | 0, l: Number(t & Kt) | 0 };
|
|
1071
|
+
}
|
|
1072
|
+
function Ha(t, e = !1) {
|
|
1066
1073
|
let n = new Uint32Array(t.length), r = new Uint32Array(t.length);
|
|
1067
1074
|
for (let s = 0; s < t.length; s++) {
|
|
1068
|
-
const { h: o, l: a } =
|
|
1075
|
+
const { h: o, l: a } = Da(t[s], e);
|
|
1069
1076
|
[n[s], r[s]] = [o, a];
|
|
1070
1077
|
}
|
|
1071
1078
|
return [n, r];
|
|
1072
1079
|
}
|
|
1073
|
-
const
|
|
1080
|
+
const Va = (t, e, n) => t << n | e >>> 32 - n, Ma = (t, e, n) => e << n | t >>> 32 - n, Ga = (t, e, n) => e << n - 32 | t >>> 64 - n, za = (t, e, n) => t << n - 32 | e >>> 64 - n;
|
|
1074
1081
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1075
|
-
const
|
|
1076
|
-
function
|
|
1082
|
+
const qa = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), yn = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, Wa = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
1083
|
+
function bn(t) {
|
|
1077
1084
|
for (let e = 0; e < t.length; e++)
|
|
1078
|
-
t[e] =
|
|
1085
|
+
t[e] = Wa(t[e]);
|
|
1079
1086
|
}
|
|
1080
|
-
const
|
|
1081
|
-
function
|
|
1087
|
+
const Ka = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
1088
|
+
function Za(t) {
|
|
1082
1089
|
de(t);
|
|
1083
1090
|
let e = "";
|
|
1084
1091
|
for (let n = 0; n < t.length; n++)
|
|
1085
|
-
e +=
|
|
1092
|
+
e += Ka[t[n]];
|
|
1086
1093
|
return e;
|
|
1087
1094
|
}
|
|
1088
1095
|
function ar(t) {
|
|
@@ -1093,38 +1100,38 @@ function ar(t) {
|
|
|
1093
1100
|
function ir(t) {
|
|
1094
1101
|
return typeof t == "string" && (t = ar(t)), de(t), t;
|
|
1095
1102
|
}
|
|
1096
|
-
let
|
|
1103
|
+
let Ya = class {
|
|
1097
1104
|
// Safe version that clones internal state
|
|
1098
1105
|
clone() {
|
|
1099
1106
|
return this._cloneInto();
|
|
1100
1107
|
}
|
|
1101
1108
|
};
|
|
1102
|
-
function
|
|
1109
|
+
function Xa(t) {
|
|
1103
1110
|
const e = (r) => t().update(ir(r)).digest(), n = t();
|
|
1104
1111
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1105
1112
|
}
|
|
1106
|
-
const cr = [], lr = [], ur = [],
|
|
1113
|
+
const cr = [], lr = [], ur = [], Ja = /* @__PURE__ */ BigInt(0), Ct = /* @__PURE__ */ BigInt(1), Qa = /* @__PURE__ */ BigInt(2), ti = /* @__PURE__ */ BigInt(7), ei = /* @__PURE__ */ BigInt(256), ni = /* @__PURE__ */ BigInt(113);
|
|
1107
1114
|
for (let t = 0, e = Ct, n = 1, r = 0; t < 24; t++) {
|
|
1108
1115
|
[n, r] = [r, (2 * n + 3 * r) % 5], cr.push(2 * (5 * r + n)), lr.push((t + 1) * (t + 2) / 2 % 64);
|
|
1109
|
-
let s =
|
|
1116
|
+
let s = Ja;
|
|
1110
1117
|
for (let o = 0; o < 7; o++)
|
|
1111
|
-
e = (e << Ct ^ (e >>
|
|
1118
|
+
e = (e << Ct ^ (e >> ti) * ni) % ei, e & Qa && (s ^= Ct << (Ct << /* @__PURE__ */ BigInt(o)) - Ct);
|
|
1112
1119
|
ur.push(s);
|
|
1113
1120
|
}
|
|
1114
|
-
const [
|
|
1115
|
-
function
|
|
1121
|
+
const [ri, si] = /* @__PURE__ */ Ha(ur, !0), Sn = (t, e, n) => n > 32 ? Ga(t, e, n) : Va(t, e, n), En = (t, e, n) => n > 32 ? za(t, e, n) : Ma(t, e, n);
|
|
1122
|
+
function oi(t, e = 24) {
|
|
1116
1123
|
const n = new Uint32Array(10);
|
|
1117
1124
|
for (let r = 24 - e; r < 24; r++) {
|
|
1118
1125
|
for (let a = 0; a < 10; a++)
|
|
1119
1126
|
n[a] = t[a] ^ t[a + 10] ^ t[a + 20] ^ t[a + 30] ^ t[a + 40];
|
|
1120
1127
|
for (let a = 0; a < 10; a += 2) {
|
|
1121
|
-
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 = Sn(l, d, 1) ^ n[i], y = En(l, d, 1) ^ n[i + 1];
|
|
1122
1129
|
for (let m = 0; m < 50; m += 10)
|
|
1123
1130
|
t[a + m] ^= u, t[a + m + 1] ^= y;
|
|
1124
1131
|
}
|
|
1125
1132
|
let s = t[2], o = t[3];
|
|
1126
1133
|
for (let a = 0; a < 24; a++) {
|
|
1127
|
-
const i = lr[a], c =
|
|
1134
|
+
const i = lr[a], c = Sn(s, o, i), l = En(s, o, i), d = cr[a];
|
|
1128
1135
|
s = t[d], o = t[d + 1], t[d] = c, t[d + 1] = l;
|
|
1129
1136
|
}
|
|
1130
1137
|
for (let a = 0; a < 50; a += 10) {
|
|
@@ -1133,22 +1140,22 @@ function si(t, e = 24) {
|
|
|
1133
1140
|
for (let i = 0; i < 10; i++)
|
|
1134
1141
|
t[a + i] ^= ~n[(i + 2) % 10] & n[(i + 4) % 10];
|
|
1135
1142
|
}
|
|
1136
|
-
t[0] ^=
|
|
1143
|
+
t[0] ^= ri[r], t[1] ^= si[r];
|
|
1137
1144
|
}
|
|
1138
1145
|
n.fill(0);
|
|
1139
1146
|
}
|
|
1140
|
-
let
|
|
1147
|
+
let ai = class dr extends Ya {
|
|
1141
1148
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1142
1149
|
constructor(e, n, r, s = !1, o = 24) {
|
|
1143
|
-
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, mn(r), 0 >= this.blockLen || this.blockLen >= 200)
|
|
1144
1151
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1145
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
1152
|
+
this.state = new Uint8Array(200), this.state32 = qa(this.state);
|
|
1146
1153
|
}
|
|
1147
1154
|
keccak() {
|
|
1148
|
-
|
|
1155
|
+
yn || bn(this.state32), oi(this.state32, this.rounds), yn || bn(this.state32), this.posOut = 0, this.pos = 0;
|
|
1149
1156
|
}
|
|
1150
1157
|
update(e) {
|
|
1151
|
-
|
|
1158
|
+
gn(this);
|
|
1152
1159
|
const { blockLen: n, state: r } = this;
|
|
1153
1160
|
e = ir(e);
|
|
1154
1161
|
const s = e.length;
|
|
@@ -1168,7 +1175,7 @@ let oi = class dr extends Za {
|
|
|
1168
1175
|
e[r] ^= n, n & 128 && r === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
1169
1176
|
}
|
|
1170
1177
|
writeInto(e) {
|
|
1171
|
-
|
|
1178
|
+
gn(this, !1), de(e), this.finish();
|
|
1172
1179
|
const n = this.state, { blockLen: r } = this;
|
|
1173
1180
|
for (let s = 0, o = e.length; s < o; ) {
|
|
1174
1181
|
this.posOut >= r && this.keccak();
|
|
@@ -1183,10 +1190,10 @@ let oi = class dr extends Za {
|
|
|
1183
1190
|
return this.writeInto(e);
|
|
1184
1191
|
}
|
|
1185
1192
|
xof(e) {
|
|
1186
|
-
return
|
|
1193
|
+
return mn(e), this.xofInto(new Uint8Array(e));
|
|
1187
1194
|
}
|
|
1188
1195
|
digestInto(e) {
|
|
1189
|
-
if (
|
|
1196
|
+
if (La(e, this), this.finished)
|
|
1190
1197
|
throw new Error("digest() was already called");
|
|
1191
1198
|
return this.writeInto(e), this.destroy(), e;
|
|
1192
1199
|
}
|
|
@@ -1201,33 +1208,33 @@ let oi = class dr extends Za {
|
|
|
1201
1208
|
return e || (e = new dr(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;
|
|
1202
1209
|
}
|
|
1203
1210
|
};
|
|
1204
|
-
const
|
|
1205
|
-
function
|
|
1206
|
-
return `0x${
|
|
1211
|
+
const ii = (t, e, n) => Xa(() => new ai(e, t, n)), ci = /* @__PURE__ */ ii(1, 136, 256 / 8);
|
|
1212
|
+
function li(t) {
|
|
1213
|
+
return `0x${Za(ci(ar(t)))}`;
|
|
1207
1214
|
}
|
|
1208
|
-
const
|
|
1215
|
+
const ui = (t) => {
|
|
1209
1216
|
if (!Wn(t))
|
|
1210
1217
|
return;
|
|
1211
1218
|
const e = /(\d+)$/, n = t.match(e);
|
|
1212
1219
|
if (n)
|
|
1213
1220
|
return n[1];
|
|
1214
|
-
},
|
|
1221
|
+
}, di = (t, e = !1) => {
|
|
1215
1222
|
if (!Wn(t))
|
|
1216
1223
|
return "";
|
|
1217
|
-
const n = e ? t.replace(/[^0-9a-z ]/gi, "") : t, s =
|
|
1224
|
+
const n = e ? t.replace(/[^0-9a-z ]/gi, "") : t, s = Fe(n).split(" "), o = ui(n), a = s.map((i) => i[0]);
|
|
1218
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("");
|
|
1219
|
-
}, { toBigInt:
|
|
1226
|
+
}, { toBigInt: fi } = O, An = (t) => {
|
|
1220
1227
|
const e = t.replace("#", "");
|
|
1221
1228
|
if (!/^[0-9A-F]{6}$/i.test(e))
|
|
1222
1229
|
throw new Error(`Invalid color ${t}`);
|
|
1223
1230
|
return `#${e}`;
|
|
1224
1231
|
}, ee = (t, e) => {
|
|
1225
|
-
const n =
|
|
1232
|
+
const n = An(e.background), r = An(e.color ?? "#ffffff"), s = di(t, !0), o = `<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
|
|
1226
1233
|
<rect width="48" height="48" fill="${n}" />
|
|
1227
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>
|
|
1228
1235
|
</svg>`;
|
|
1229
1236
|
return `data:image/svg+xml;base64,${btoa(o)}`;
|
|
1230
|
-
},
|
|
1237
|
+
}, xn = [
|
|
1231
1238
|
"02BBA8",
|
|
1232
1239
|
"29C5FF",
|
|
1233
1240
|
"0078A4",
|
|
@@ -1236,46 +1243,46 @@ const li = (t) => {
|
|
|
1236
1243
|
"FF875B",
|
|
1237
1244
|
"FF675C",
|
|
1238
1245
|
"FF5C72"
|
|
1239
|
-
],
|
|
1240
|
-
const e =
|
|
1241
|
-
return
|
|
1242
|
-
},
|
|
1246
|
+
], hi = (t) => {
|
|
1247
|
+
const e = li(t).slice(-2), n = parseInt(e, 16) % xn.length;
|
|
1248
|
+
return xn[n];
|
|
1249
|
+
}, pi = (t) => {
|
|
1243
1250
|
try {
|
|
1244
|
-
return O.toHex(
|
|
1251
|
+
return O.toHex(fi(O.hexToDecimalString(t)));
|
|
1245
1252
|
} catch {
|
|
1246
1253
|
}
|
|
1247
1254
|
return "";
|
|
1248
|
-
},
|
|
1249
|
-
const s =
|
|
1255
|
+
}, iu = ({ accountName: t, networkId: e, accountAddress: n, backgroundColor: r }) => {
|
|
1256
|
+
const s = pi(n), o = `${e}::${s}`, a = r || hi(o);
|
|
1250
1257
|
return ee(t, { background: a });
|
|
1251
|
-
},
|
|
1258
|
+
}, mi = (t) => {
|
|
1252
1259
|
const e = $t.removeHexPrefix($t.sanitizeHex(O.toHex(t))), n = Zn.decode(e);
|
|
1253
1260
|
return Yn.encode(n);
|
|
1254
|
-
},
|
|
1261
|
+
}, cu = (t) => t.map(mi), gi = (t) => {
|
|
1255
1262
|
const e = Yn.decode(t);
|
|
1256
1263
|
return $t.sanitizeHex(Zn.encode(e));
|
|
1257
|
-
},
|
|
1258
|
-
function
|
|
1264
|
+
}, lu = (t) => t.map(gi);
|
|
1265
|
+
function uu(t, e) {
|
|
1259
1266
|
const n = t.getTime(), r = e.getTime(), s = Math.abs(n - r);
|
|
1260
1267
|
return Math.floor(s / (1e3 * 60 * 60 * 24));
|
|
1261
1268
|
}
|
|
1262
|
-
const
|
|
1269
|
+
const du = (t) => (t || "false") === "true", fu = async (t, e) => {
|
|
1263
1270
|
try {
|
|
1264
1271
|
return await t.getClassHashAt(e), !0;
|
|
1265
1272
|
} catch {
|
|
1266
1273
|
return !1;
|
|
1267
1274
|
}
|
|
1268
1275
|
};
|
|
1269
|
-
function
|
|
1276
|
+
function hu(t) {
|
|
1270
1277
|
return !hs(t);
|
|
1271
1278
|
}
|
|
1272
|
-
const
|
|
1279
|
+
const pu = (t) => {
|
|
1273
1280
|
const e = /^(0|0x([a-f0-9A-F]+)?)$/;
|
|
1274
1281
|
return !!(t === "" || e.test(t));
|
|
1275
|
-
}, Y = (t) => !isNaN(parseFloat(t)) && isFinite(Number(t)),
|
|
1282
|
+
}, Y = (t) => !isNaN(parseFloat(t)) && isFinite(Number(t)), mu = (t, e = 16) => {
|
|
1276
1283
|
const n = new RegExp(`^[0-9]*.?[0-9]{0,${e}}$`);
|
|
1277
1284
|
return t === "" ? !0 : Y(t) ? !!n.test(t) : !1;
|
|
1278
|
-
},
|
|
1285
|
+
}, Ve = {
|
|
1279
1286
|
CURRENCY: {
|
|
1280
1287
|
minDecimalPlaces: 2,
|
|
1281
1288
|
maxDecimalPlaces: 10,
|
|
@@ -1290,76 +1297,76 @@ const hu = (t) => {
|
|
|
1290
1297
|
decimalPlacesWhenZero: 1,
|
|
1291
1298
|
allowLeadingZerosInDecimalPart: !0
|
|
1292
1299
|
}
|
|
1293
|
-
},
|
|
1294
|
-
...
|
|
1300
|
+
}, wi = (t, e) => fr(t, {
|
|
1301
|
+
...Ve.CURRENCY,
|
|
1295
1302
|
...e || {}
|
|
1296
|
-
}),
|
|
1297
|
-
...
|
|
1303
|
+
}), yi = (t, e) => fr(t, {
|
|
1304
|
+
...Ve.TOKEN,
|
|
1298
1305
|
...e || {}
|
|
1299
|
-
}), fr = (t, { minDecimalPlaces: e, maxDecimalPlaces: n, minDecimalSignificantDigits: r, decimalPlacesWhenZero: s, allowLeadingZerosInDecimalPart: o } =
|
|
1306
|
+
}), fr = (t, { minDecimalPlaces: e, maxDecimalPlaces: n, minDecimalSignificantDigits: r, decimalPlacesWhenZero: s, allowLeadingZerosInDecimalPart: o } = Ve.CURRENCY) => {
|
|
1300
1307
|
if (!Y(t))
|
|
1301
1308
|
return null;
|
|
1302
|
-
const a = new
|
|
1309
|
+
const a = new on(typeof t == "bigint" ? t.toString() : t);
|
|
1303
1310
|
let i;
|
|
1304
1311
|
const c = `0.${"".padStart(s - 1, "0")}1`;
|
|
1305
|
-
if (a.lt(new
|
|
1312
|
+
if (a.lt(new on(c)) && !o)
|
|
1306
1313
|
i = `0.${"".padStart(s, "0")}`;
|
|
1307
1314
|
else if (a.gte(1))
|
|
1308
1315
|
i = a.toFormat(e);
|
|
1309
1316
|
else {
|
|
1310
|
-
const m = a.toFormat(n).split(".")[1].match(/^0+/), S = o && m && m.length ? m[0].length : 0,
|
|
1311
|
-
i = a.toFormat(
|
|
1317
|
+
const m = a.toFormat(n).split(".")[1].match(/^0+/), S = o && m && m.length ? m[0].length : 0, h = Math.max(S + r, e);
|
|
1318
|
+
i = a.toFormat(h);
|
|
1312
1319
|
}
|
|
1313
1320
|
let l = i.replace(/0+$/, "");
|
|
1314
1321
|
const d = 1 + i.indexOf(".") + s;
|
|
1315
1322
|
return l.length < d && (l = i.substring(0, d)), l;
|
|
1316
|
-
},
|
|
1323
|
+
}, bi = (t, e = 18) => {
|
|
1317
1324
|
const n = t.replace(",", ".");
|
|
1318
1325
|
return !t || !Y(n) ? 0n : xt(n, Number(e)).value;
|
|
1319
1326
|
};
|
|
1320
1327
|
function jt(t) {
|
|
1321
1328
|
return Ht.bnToUint256(t);
|
|
1322
1329
|
}
|
|
1323
|
-
const
|
|
1330
|
+
const gu = (t, e) => `${t} ${e}${t === 1 ? "" : "s"}`, wu = (t) => new Promise((e, n) => {
|
|
1324
1331
|
const r = new FileReader();
|
|
1325
1332
|
r.onload = () => {
|
|
1326
1333
|
var s;
|
|
1327
1334
|
return r.result ? e((s = r.result) == null ? void 0 : s.toString()) : n(new Error("Could not read file"));
|
|
1328
1335
|
}, r.onerror = n, r.onabort = n.bind(null, new Error("User aborted")), r.readAsText(t);
|
|
1329
1336
|
});
|
|
1330
|
-
function
|
|
1337
|
+
function yu(t) {
|
|
1331
1338
|
try {
|
|
1332
1339
|
return ps(Kn(t));
|
|
1333
1340
|
} catch {
|
|
1334
1341
|
return t;
|
|
1335
1342
|
}
|
|
1336
1343
|
}
|
|
1337
|
-
const
|
|
1344
|
+
const Si = (t, e) => {
|
|
1338
1345
|
const n = new URLSearchParams(e), r = n.size ? `?${n}` : "";
|
|
1339
1346
|
return k(...oe(t), r);
|
|
1340
1347
|
};
|
|
1341
|
-
function
|
|
1348
|
+
function bu(t) {
|
|
1342
1349
|
return (...e) => {
|
|
1343
1350
|
t(...e);
|
|
1344
1351
|
};
|
|
1345
1352
|
}
|
|
1346
|
-
class
|
|
1353
|
+
class Ei extends Error {
|
|
1347
1354
|
constructor(e, n) {
|
|
1348
1355
|
super(`${e}::${n}`), this.name = e, this.code = n, this.name = e;
|
|
1349
1356
|
}
|
|
1350
1357
|
}
|
|
1351
|
-
class
|
|
1358
|
+
class vn extends Ei {
|
|
1352
1359
|
constructor(e) {
|
|
1353
1360
|
super("BackendPaginationError", e);
|
|
1354
1361
|
}
|
|
1355
1362
|
}
|
|
1356
|
-
const
|
|
1357
|
-
class
|
|
1363
|
+
const In = 32;
|
|
1364
|
+
class Su {
|
|
1358
1365
|
constructor(e, n, r) {
|
|
1359
|
-
this.apiBase = e, this.headers = n, this.imageOptimizationUrl = r, this.httpService = new
|
|
1366
|
+
this.apiBase = e, this.headers = n, this.imageOptimizationUrl = r, this.httpService = new De(this.headers, "json");
|
|
1360
1367
|
}
|
|
1361
1368
|
async getNfts(e, n, r, s = 1) {
|
|
1362
|
-
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=${In}`, d = await this.httpService.get(l), u = d.content.map((y) => this.mapItem(y, r));
|
|
1363
1370
|
return {
|
|
1364
1371
|
totalPages: d.totalPages,
|
|
1365
1372
|
page: d.number + 1,
|
|
@@ -1387,7 +1394,7 @@ class bu {
|
|
|
1387
1394
|
return this.mapItem(c);
|
|
1388
1395
|
}
|
|
1389
1396
|
async getProfileCollections(e, n, r, s = 1, o = !1) {
|
|
1390
|
-
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=${
|
|
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=${In}`), d = await this.httpService.get(l), u = [];
|
|
1391
1398
|
for (const y of d.content)
|
|
1392
1399
|
if (o) {
|
|
1393
1400
|
const m = await this.getCollectionMetrics(e, n, y.contractAddress);
|
|
@@ -1406,14 +1413,14 @@ class bu {
|
|
|
1406
1413
|
return this.httpService.get(a);
|
|
1407
1414
|
}
|
|
1408
1415
|
normalizeAddress(e) {
|
|
1409
|
-
return
|
|
1416
|
+
return Re.parse(e);
|
|
1410
1417
|
}
|
|
1411
1418
|
pageToPageIndex(e) {
|
|
1412
1419
|
if (!Number.isInteger(e))
|
|
1413
|
-
throw new
|
|
1420
|
+
throw new vn("notANumber");
|
|
1414
1421
|
const n = e - 1;
|
|
1415
1422
|
if (n < 0)
|
|
1416
|
-
throw new
|
|
1423
|
+
throw new vn("tooLow");
|
|
1417
1424
|
return n;
|
|
1418
1425
|
}
|
|
1419
1426
|
optimizeImage(e, n, r) {
|
|
@@ -1433,7 +1440,7 @@ class bu {
|
|
|
1433
1440
|
token_id: e.tokenId,
|
|
1434
1441
|
contract_address: e.contractAddress,
|
|
1435
1442
|
name: r,
|
|
1436
|
-
spec: "spec" in e ?
|
|
1443
|
+
spec: "spec" in e ? Ai(e.spec) : void 0,
|
|
1437
1444
|
description: "",
|
|
1438
1445
|
best_bid_order: {
|
|
1439
1446
|
payment_amount: "bestListPrice" in e ? BigInt(e.bestListPrice) : void 0
|
|
@@ -1454,7 +1461,7 @@ class bu {
|
|
|
1454
1461
|
};
|
|
1455
1462
|
}
|
|
1456
1463
|
}
|
|
1457
|
-
function
|
|
1464
|
+
function Ai(t) {
|
|
1458
1465
|
switch (t) {
|
|
1459
1466
|
case "erc721":
|
|
1460
1467
|
case "starknetErc721":
|
|
@@ -1495,19 +1502,19 @@ const hr = async (t, e, n, r, s = 1) => {
|
|
|
1495
1502
|
};
|
|
1496
1503
|
}
|
|
1497
1504
|
return o;
|
|
1498
|
-
},
|
|
1505
|
+
}, Eu = (t, e, n, r, s) => {
|
|
1499
1506
|
const { data: o, ...a } = ae(r && [r, "nfts"], () => r && hr(t, e, n, r), {
|
|
1500
1507
|
refreshInterval: 3e5,
|
|
1501
1508
|
...s
|
|
1502
1509
|
});
|
|
1503
1510
|
return { nfts: o == null ? void 0 : o.nfts, ...a };
|
|
1504
|
-
},
|
|
1511
|
+
}, Au = (t, e, n, r, s) => {
|
|
1505
1512
|
const { data: o, ...a } = ae(r && [`${r}`, "nfts-collection"], () => r && t.getCollection(e, n, r), {
|
|
1506
1513
|
refreshInterval: 6e4,
|
|
1507
1514
|
...s
|
|
1508
1515
|
});
|
|
1509
1516
|
return { collection: o, ...a };
|
|
1510
|
-
},
|
|
1517
|
+
}, xu = (t, e, n, r, s, o) => {
|
|
1511
1518
|
const { data: a, ...i } = ae(s && r && [`${r}:${s}`, "nft"], () => s && r ? t.getNft(e, n, r, s) : void 0, {
|
|
1512
1519
|
refreshInterval: 6e4,
|
|
1513
1520
|
revalidateOnFocus: !1,
|
|
@@ -1515,7 +1522,7 @@ const hr = async (t, e, n, r, s = 1) => {
|
|
|
1515
1522
|
...o
|
|
1516
1523
|
});
|
|
1517
1524
|
return { nft: a, ...i };
|
|
1518
|
-
},
|
|
1525
|
+
}, vu = ({ image_uri: t, image_url_copy: e }) => {
|
|
1519
1526
|
if (t && e) {
|
|
1520
1527
|
if (!e.startsWith("ipfs://"))
|
|
1521
1528
|
return e;
|
|
@@ -1523,16 +1530,16 @@ const hr = async (t, e, n, r, s = 1) => {
|
|
|
1523
1530
|
return t;
|
|
1524
1531
|
}
|
|
1525
1532
|
return e || t;
|
|
1526
|
-
},
|
|
1527
|
-
function
|
|
1533
|
+
}, Iu = (t, e) => t.token_id === e.token_id && nt(t.contract_address, e.contract_address);
|
|
1534
|
+
function Tn(t) {
|
|
1528
1535
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
1529
1536
|
throw new Error(`Wrong positive integer: ${t}`);
|
|
1530
1537
|
}
|
|
1531
|
-
function
|
|
1538
|
+
function xi(t) {
|
|
1532
1539
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1533
1540
|
}
|
|
1534
1541
|
function pr(t, ...e) {
|
|
1535
|
-
if (!
|
|
1542
|
+
if (!xi(t))
|
|
1536
1543
|
throw new Error("Expected Uint8Array");
|
|
1537
1544
|
if (e.length > 0 && !e.includes(t.length))
|
|
1538
1545
|
throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`);
|
|
@@ -1549,34 +1556,34 @@ function mr(t, e) {
|
|
|
1549
1556
|
if (t.length < n)
|
|
1550
1557
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
1551
1558
|
}
|
|
1552
|
-
const Zt = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
1553
|
-
function xi(t, e = !1) {
|
|
1554
|
-
return e ? { h: Number(t & Zt), l: Number(t >> Tn & Zt) } : { h: Number(t >> Tn & Zt) | 0, l: Number(t & Zt) | 0 };
|
|
1555
|
-
}
|
|
1559
|
+
const Zt = /* @__PURE__ */ BigInt(2 ** 32 - 1), Bn = /* @__PURE__ */ BigInt(32);
|
|
1556
1560
|
function vi(t, e = !1) {
|
|
1561
|
+
return e ? { h: Number(t & Zt), l: Number(t >> Bn & Zt) } : { h: Number(t >> Bn & Zt) | 0, l: Number(t & Zt) | 0 };
|
|
1562
|
+
}
|
|
1563
|
+
function Ii(t, e = !1) {
|
|
1557
1564
|
let n = new Uint32Array(t.length), r = new Uint32Array(t.length);
|
|
1558
1565
|
for (let s = 0; s < t.length; s++) {
|
|
1559
|
-
const { h: o, l: a } =
|
|
1566
|
+
const { h: o, l: a } = vi(t[s], e);
|
|
1560
1567
|
[n[s], r[s]] = [o, a];
|
|
1561
1568
|
}
|
|
1562
1569
|
return [n, r];
|
|
1563
1570
|
}
|
|
1564
|
-
const
|
|
1571
|
+
const Ti = (t, e, n) => t << n | e >>> 32 - n, Bi = (t, e, n) => e << n | t >>> 32 - n, _i = (t, e, n) => e << n - 32 | t >>> 64 - n, Ni = (t, e, n) => t << n - 32 | e >>> 64 - n;
|
|
1565
1572
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1566
|
-
const
|
|
1567
|
-
function
|
|
1573
|
+
const Ci = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
1574
|
+
function Oi(t) {
|
|
1568
1575
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1569
1576
|
}
|
|
1570
|
-
const Ae = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), J = (t, e) => t << 32 - e | t >>> e,
|
|
1571
|
-
if (!
|
|
1577
|
+
const Ae = (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
|
+
if (!ki)
|
|
1572
1579
|
throw new Error("Non little-endian hardware is not supported");
|
|
1573
1580
|
function gr(t) {
|
|
1574
1581
|
if (typeof t != "string")
|
|
1575
1582
|
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1576
1583
|
return new Uint8Array(new TextEncoder().encode(t));
|
|
1577
1584
|
}
|
|
1578
|
-
function
|
|
1579
|
-
if (typeof t == "string" && (t = gr(t)), !
|
|
1585
|
+
function Me(t) {
|
|
1586
|
+
if (typeof t == "string" && (t = gr(t)), !Oi(t))
|
|
1580
1587
|
throw new Error(`expected Uint8Array, got ${typeof t}`);
|
|
1581
1588
|
return t;
|
|
1582
1589
|
}
|
|
@@ -1587,31 +1594,31 @@ let wr = class {
|
|
|
1587
1594
|
}
|
|
1588
1595
|
};
|
|
1589
1596
|
function yr(t) {
|
|
1590
|
-
const e = (r) => t().update(
|
|
1597
|
+
const e = (r) => t().update(Me(r)).digest(), n = t();
|
|
1591
1598
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1592
1599
|
}
|
|
1593
|
-
const [br, Sr, Er] = [[], [], []],
|
|
1600
|
+
const [br, Sr, Er] = [[], [], []], Pi = /* @__PURE__ */ BigInt(0), Ot = /* @__PURE__ */ BigInt(1), Ri = /* @__PURE__ */ BigInt(2), $i = /* @__PURE__ */ BigInt(7), Fi = /* @__PURE__ */ BigInt(256), Ui = /* @__PURE__ */ BigInt(113);
|
|
1594
1601
|
for (let t = 0, e = Ot, n = 1, r = 0; t < 24; t++) {
|
|
1595
1602
|
[n, r] = [r, (2 * n + 3 * r) % 5], br.push(2 * (5 * r + n)), Sr.push((t + 1) * (t + 2) / 2 % 64);
|
|
1596
|
-
let s =
|
|
1603
|
+
let s = Pi;
|
|
1597
1604
|
for (let o = 0; o < 7; o++)
|
|
1598
|
-
e = (e << Ot ^ (e >>
|
|
1605
|
+
e = (e << Ot ^ (e >> $i) * Ui) % Fi, e & Ri && (s ^= Ot << (Ot << /* @__PURE__ */ BigInt(o)) - Ot);
|
|
1599
1606
|
Er.push(s);
|
|
1600
1607
|
}
|
|
1601
|
-
const [
|
|
1602
|
-
function
|
|
1608
|
+
const [ji, Li] = /* @__PURE__ */ Ii(Er, !0), _n = (t, e, n) => n > 32 ? _i(t, e, n) : Ti(t, e, n), Nn = (t, e, n) => n > 32 ? Ni(t, e, n) : Bi(t, e, n);
|
|
1609
|
+
function Di(t, e = 24) {
|
|
1603
1610
|
const n = new Uint32Array(10);
|
|
1604
1611
|
for (let r = 24 - e; r < 24; r++) {
|
|
1605
1612
|
for (let a = 0; a < 10; a++)
|
|
1606
1613
|
n[a] = t[a] ^ t[a + 10] ^ t[a + 20] ^ t[a + 30] ^ t[a + 40];
|
|
1607
1614
|
for (let a = 0; a < 10; a += 2) {
|
|
1608
|
-
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u =
|
|
1615
|
+
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u = _n(l, d, 1) ^ n[i], y = Nn(l, d, 1) ^ n[i + 1];
|
|
1609
1616
|
for (let m = 0; m < 50; m += 10)
|
|
1610
1617
|
t[a + m] ^= u, t[a + m + 1] ^= y;
|
|
1611
1618
|
}
|
|
1612
1619
|
let s = t[2], o = t[3];
|
|
1613
1620
|
for (let a = 0; a < 24; a++) {
|
|
1614
|
-
const i = Sr[a], c =
|
|
1621
|
+
const i = Sr[a], c = _n(s, o, i), l = Nn(s, o, i), d = br[a];
|
|
1615
1622
|
s = t[d], o = t[d + 1], t[d] = c, t[d + 1] = l;
|
|
1616
1623
|
}
|
|
1617
1624
|
for (let a = 0; a < 50; a += 10) {
|
|
@@ -1620,24 +1627,24 @@ function Li(t, e = 24) {
|
|
|
1620
1627
|
for (let i = 0; i < 10; i++)
|
|
1621
1628
|
t[a + i] ^= ~n[(i + 2) % 10] & n[(i + 4) % 10];
|
|
1622
1629
|
}
|
|
1623
|
-
t[0] ^=
|
|
1630
|
+
t[0] ^= ji[r], t[1] ^= Li[r];
|
|
1624
1631
|
}
|
|
1625
1632
|
n.fill(0);
|
|
1626
1633
|
}
|
|
1627
|
-
class
|
|
1634
|
+
class Ge extends wr {
|
|
1628
1635
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1629
1636
|
constructor(e, n, r, s = !1, o = 24) {
|
|
1630
|
-
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,
|
|
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, Tn(r), 0 >= this.blockLen || this.blockLen >= 200)
|
|
1631
1638
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1632
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
1639
|
+
this.state = new Uint8Array(200), this.state32 = Ci(this.state);
|
|
1633
1640
|
}
|
|
1634
1641
|
keccak() {
|
|
1635
|
-
|
|
1642
|
+
Di(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
|
|
1636
1643
|
}
|
|
1637
1644
|
update(e) {
|
|
1638
1645
|
ne(this);
|
|
1639
1646
|
const { blockLen: n, state: r } = this;
|
|
1640
|
-
e =
|
|
1647
|
+
e = Me(e);
|
|
1641
1648
|
const s = e.length;
|
|
1642
1649
|
for (let o = 0; o < s; ) {
|
|
1643
1650
|
const a = Math.min(n - this.pos, s - o);
|
|
@@ -1670,7 +1677,7 @@ class Me extends wr {
|
|
|
1670
1677
|
return this.writeInto(e);
|
|
1671
1678
|
}
|
|
1672
1679
|
xof(e) {
|
|
1673
|
-
return
|
|
1680
|
+
return Tn(e), this.xofInto(new Uint8Array(e));
|
|
1674
1681
|
}
|
|
1675
1682
|
digestInto(e) {
|
|
1676
1683
|
if (mr(e, this), this.finished)
|
|
@@ -1685,24 +1692,24 @@ class Me extends wr {
|
|
|
1685
1692
|
}
|
|
1686
1693
|
_cloneInto(e) {
|
|
1687
1694
|
const { blockLen: n, suffix: r, outputLen: s, rounds: o, enableXOF: a } = this;
|
|
1688
|
-
return e || (e = new
|
|
1695
|
+
return e || (e = new Ge(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;
|
|
1689
1696
|
}
|
|
1690
1697
|
}
|
|
1691
|
-
const
|
|
1692
|
-
function
|
|
1698
|
+
const Hi = (t, e, n) => yr(() => new Ge(e, t, n)), Vi = /* @__PURE__ */ Hi(1, 136, 256 / 8);
|
|
1699
|
+
function Mi(t, e, n, r) {
|
|
1693
1700
|
if (typeof t.setBigUint64 == "function")
|
|
1694
1701
|
return t.setBigUint64(e, n, r);
|
|
1695
1702
|
const s = BigInt(32), o = BigInt(4294967295), a = Number(n >> s & o), i = Number(n & o), c = r ? 4 : 0, l = r ? 0 : 4;
|
|
1696
1703
|
t.setUint32(e + c, a, r), t.setUint32(e + l, i, r);
|
|
1697
1704
|
}
|
|
1698
|
-
class
|
|
1705
|
+
class Gi extends wr {
|
|
1699
1706
|
constructor(e, n, r, s) {
|
|
1700
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 = Ae(this.buffer);
|
|
1701
1708
|
}
|
|
1702
1709
|
update(e) {
|
|
1703
1710
|
ne(this);
|
|
1704
1711
|
const { view: n, buffer: r, blockLen: s } = this;
|
|
1705
|
-
e =
|
|
1712
|
+
e = Me(e);
|
|
1706
1713
|
const o = e.length;
|
|
1707
1714
|
for (let a = 0; a < o; ) {
|
|
1708
1715
|
const i = Math.min(s - this.pos, o - a);
|
|
@@ -1723,7 +1730,7 @@ class Mi extends wr {
|
|
|
1723
1730
|
n[a++] = 128, this.buffer.subarray(a).fill(0), this.padOffset > s - a && (this.process(r, 0), a = 0);
|
|
1724
1731
|
for (let u = a; u < s; u++)
|
|
1725
1732
|
n[u] = 0;
|
|
1726
|
-
|
|
1733
|
+
Mi(r, s - 8, BigInt(this.length * 8), o), this.process(r, 0);
|
|
1727
1734
|
const i = Ae(e), c = this.outputLen;
|
|
1728
1735
|
if (c % 4)
|
|
1729
1736
|
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
@@ -1745,7 +1752,7 @@ class Mi extends wr {
|
|
|
1745
1752
|
return e.length = s, e.pos = i, e.finished = o, e.destroyed = a, s % n && e.buffer.set(r), e;
|
|
1746
1753
|
}
|
|
1747
1754
|
}
|
|
1748
|
-
const
|
|
1755
|
+
const zi = (t, e, n) => t & e ^ ~t & n, qi = (t, e, n) => t & e ^ t & n ^ e & n, Wi = /* @__PURE__ */ new Uint32Array([
|
|
1749
1756
|
1116352408,
|
|
1750
1757
|
1899447441,
|
|
1751
1758
|
3049323471,
|
|
@@ -1820,7 +1827,7 @@ const Gi = (t, e, n) => t & e ^ ~t & n, zi = (t, e, n) => t & e ^ t & n ^ e & n,
|
|
|
1820
1827
|
528734635,
|
|
1821
1828
|
1541459225
|
|
1822
1829
|
]), ct = /* @__PURE__ */ new Uint32Array(64);
|
|
1823
|
-
class
|
|
1830
|
+
class Ki extends Gi {
|
|
1824
1831
|
constructor() {
|
|
1825
1832
|
super(64, 32, 8, !1), this.A = it[0] | 0, this.B = it[1] | 0, this.C = it[2] | 0, this.D = it[3] | 0, this.E = it[4] | 0, this.F = it[5] | 0, this.G = it[6] | 0, this.H = it[7] | 0;
|
|
1826
1833
|
}
|
|
@@ -1836,13 +1843,13 @@ class Wi extends Mi {
|
|
|
1836
1843
|
for (let u = 0; u < 16; u++, n += 4)
|
|
1837
1844
|
ct[u] = e.getUint32(n, !1);
|
|
1838
1845
|
for (let u = 16; u < 64; u++) {
|
|
1839
|
-
const y = ct[u - 15], m = ct[u - 2], S = J(y, 7) ^ J(y, 18) ^ y >>> 3,
|
|
1840
|
-
ct[u] =
|
|
1846
|
+
const y = ct[u - 15], m = ct[u - 2], S = J(y, 7) ^ J(y, 18) ^ y >>> 3, h = J(m, 17) ^ J(m, 19) ^ m >>> 10;
|
|
1847
|
+
ct[u] = h + ct[u - 7] + S + ct[u - 16] | 0;
|
|
1841
1848
|
}
|
|
1842
1849
|
let { A: r, B: s, C: o, D: a, E: i, F: c, G: l, H: d } = this;
|
|
1843
1850
|
for (let u = 0; u < 64; u++) {
|
|
1844
|
-
const y = J(i, 6) ^ J(i, 11) ^ J(i, 25), m = d + y +
|
|
1845
|
-
d = l, l = c, c = i, i = a + m | 0, a = o, o = s, s = r, r = m +
|
|
1851
|
+
const y = J(i, 6) ^ J(i, 11) ^ J(i, 25), m = d + y + zi(i, c, l) + Wi[u] + ct[u] | 0, h = (J(r, 2) ^ J(r, 13) ^ J(r, 22)) + qi(r, s, o) | 0;
|
|
1852
|
+
d = l, l = c, c = i, i = a + m | 0, a = o, o = s, s = r, r = m + h | 0;
|
|
1846
1853
|
}
|
|
1847
1854
|
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);
|
|
1848
1855
|
}
|
|
@@ -1853,22 +1860,22 @@ class Wi extends Mi {
|
|
|
1853
1860
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
|
|
1854
1861
|
}
|
|
1855
1862
|
}
|
|
1856
|
-
const Ar = /* @__PURE__ */ yr(() => new
|
|
1863
|
+
const Ar = /* @__PURE__ */ yr(() => new Ki());
|
|
1857
1864
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1858
|
-
const xr = BigInt(0), fe = BigInt(1),
|
|
1865
|
+
const xr = BigInt(0), fe = BigInt(1), Zi = BigInt(2), he = (t) => t instanceof Uint8Array, Yi = Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
1859
1866
|
function ht(t) {
|
|
1860
1867
|
if (!he(t))
|
|
1861
1868
|
throw new Error("Uint8Array expected");
|
|
1862
1869
|
let e = "";
|
|
1863
1870
|
for (let n = 0; n < t.length; n++)
|
|
1864
|
-
e +=
|
|
1871
|
+
e += Yi[t[n]];
|
|
1865
1872
|
return e;
|
|
1866
1873
|
}
|
|
1867
1874
|
function vr(t) {
|
|
1868
1875
|
const e = t.toString(16);
|
|
1869
1876
|
return e.length & 1 ? `0${e}` : e;
|
|
1870
1877
|
}
|
|
1871
|
-
function
|
|
1878
|
+
function ze(t) {
|
|
1872
1879
|
if (typeof t != "string")
|
|
1873
1880
|
throw new Error("hex string expected, got " + typeof t);
|
|
1874
1881
|
return BigInt(t === "" ? "0" : `0x${t}`);
|
|
@@ -1888,14 +1895,14 @@ function pt(t) {
|
|
|
1888
1895
|
return e;
|
|
1889
1896
|
}
|
|
1890
1897
|
function X(t) {
|
|
1891
|
-
return
|
|
1898
|
+
return ze(ht(t));
|
|
1892
1899
|
}
|
|
1893
|
-
function
|
|
1900
|
+
function qe(t) {
|
|
1894
1901
|
if (!he(t))
|
|
1895
1902
|
throw new Error("Uint8Array expected");
|
|
1896
|
-
return
|
|
1903
|
+
return ze(ht(Uint8Array.from(t).reverse()));
|
|
1897
1904
|
}
|
|
1898
|
-
const Et = (t, e) => pt(t.toString(16).padStart(e * 2, "0")), Ir = (t, e) => Et(t, e).reverse(),
|
|
1905
|
+
const Et = (t, e) => pt(t.toString(16).padStart(e * 2, "0")), Ir = (t, e) => Et(t, e).reverse(), Xi = (t) => pt(vr(t));
|
|
1899
1906
|
function V(t, e, n) {
|
|
1900
1907
|
let r;
|
|
1901
1908
|
if (typeof e == "string")
|
|
@@ -1922,7 +1929,7 @@ function Lt(...t) {
|
|
|
1922
1929
|
e.set(r, n), n += r.length;
|
|
1923
1930
|
}), e;
|
|
1924
1931
|
}
|
|
1925
|
-
function
|
|
1932
|
+
function Ji(t, e) {
|
|
1926
1933
|
if (t.length !== e.length)
|
|
1927
1934
|
return !1;
|
|
1928
1935
|
for (let n = 0; n < t.length; n++)
|
|
@@ -1930,18 +1937,18 @@ function Xi(t, e) {
|
|
|
1930
1937
|
return !1;
|
|
1931
1938
|
return !0;
|
|
1932
1939
|
}
|
|
1933
|
-
function
|
|
1940
|
+
function Qi(t) {
|
|
1934
1941
|
if (typeof t != "string")
|
|
1935
1942
|
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1936
1943
|
return new TextEncoder().encode(t);
|
|
1937
1944
|
}
|
|
1938
|
-
function
|
|
1945
|
+
function tc(t) {
|
|
1939
1946
|
let e;
|
|
1940
1947
|
for (e = 0; t > xr; t >>= fe, e += 1)
|
|
1941
1948
|
;
|
|
1942
1949
|
return e;
|
|
1943
1950
|
}
|
|
1944
|
-
const
|
|
1951
|
+
const ec = (t, e) => t >> BigInt(e) & fe, nc = (t, e, n) => t | (n ? fe : xr) << BigInt(e), pe = (t) => (Zi << BigInt(t - 1)) - fe, xe = (t) => new Uint8Array(t), Cn = (t) => Uint8Array.from(t);
|
|
1945
1952
|
function Tr(t, e, n) {
|
|
1946
1953
|
if (typeof t != "number" || t < 2)
|
|
1947
1954
|
throw new Error("hashLen must be a number");
|
|
@@ -1953,7 +1960,7 @@ function Tr(t, e, n) {
|
|
|
1953
1960
|
const a = () => {
|
|
1954
1961
|
r.fill(1), s.fill(0), o = 0;
|
|
1955
1962
|
}, i = (...u) => n(s, r, ...u), c = (u = xe()) => {
|
|
1956
|
-
s = i(
|
|
1963
|
+
s = i(Cn([0]), u), r = i(), u.length !== 0 && (s = i(Cn([1]), u), r = i());
|
|
1957
1964
|
}, l = () => {
|
|
1958
1965
|
if (o++ >= 1e3)
|
|
1959
1966
|
throw new Error("drbg: tried 1000 values");
|
|
@@ -1974,7 +1981,7 @@ function Tr(t, e, n) {
|
|
|
1974
1981
|
return a(), m;
|
|
1975
1982
|
};
|
|
1976
1983
|
}
|
|
1977
|
-
const
|
|
1984
|
+
const rc = {
|
|
1978
1985
|
bigint: (t) => typeof t == "bigint",
|
|
1979
1986
|
function: (t) => typeof t == "function",
|
|
1980
1987
|
boolean: (t) => typeof t == "boolean",
|
|
@@ -1986,7 +1993,7 @@ const nc = {
|
|
|
1986
1993
|
};
|
|
1987
1994
|
function zt(t, e, n = {}) {
|
|
1988
1995
|
const r = (s, o, a) => {
|
|
1989
|
-
const i =
|
|
1996
|
+
const i = rc[o];
|
|
1990
1997
|
if (typeof i != "function")
|
|
1991
1998
|
throw new Error(`Invalid validator "${o}", expected function`);
|
|
1992
1999
|
const c = t[s];
|
|
@@ -1999,37 +2006,37 @@ function zt(t, e, n = {}) {
|
|
|
1999
2006
|
r(s, o, !0);
|
|
2000
2007
|
return t;
|
|
2001
2008
|
}
|
|
2002
|
-
const
|
|
2009
|
+
const sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2003
2010
|
__proto__: null,
|
|
2004
|
-
bitGet:
|
|
2005
|
-
bitLen:
|
|
2011
|
+
bitGet: ec,
|
|
2012
|
+
bitLen: tc,
|
|
2006
2013
|
bitMask: pe,
|
|
2007
|
-
bitSet:
|
|
2014
|
+
bitSet: nc,
|
|
2008
2015
|
bytesToHex: ht,
|
|
2009
2016
|
bytesToNumberBE: X,
|
|
2010
|
-
bytesToNumberLE:
|
|
2017
|
+
bytesToNumberLE: qe,
|
|
2011
2018
|
concatBytes: Lt,
|
|
2012
2019
|
createHmacDrbg: Tr,
|
|
2013
2020
|
ensureBytes: V,
|
|
2014
|
-
equalBytes:
|
|
2021
|
+
equalBytes: Ji,
|
|
2015
2022
|
hexToBytes: pt,
|
|
2016
|
-
hexToNumber:
|
|
2023
|
+
hexToNumber: ze,
|
|
2017
2024
|
numberToBytesBE: Et,
|
|
2018
2025
|
numberToBytesLE: Ir,
|
|
2019
2026
|
numberToHexUnpadded: vr,
|
|
2020
|
-
numberToVarBytesBE:
|
|
2021
|
-
utf8ToBytes:
|
|
2027
|
+
numberToVarBytesBE: Xi,
|
|
2028
|
+
utf8ToBytes: Qi,
|
|
2022
2029
|
validateObject: zt
|
|
2023
2030
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2024
2031
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2025
|
-
const U = BigInt(0), $ = BigInt(1), ut = BigInt(2),
|
|
2032
|
+
const U = BigInt(0), $ = BigInt(1), ut = BigInt(2), oc = BigInt(3), _e = BigInt(4), On = BigInt(5), kn = BigInt(8);
|
|
2026
2033
|
BigInt(9);
|
|
2027
2034
|
BigInt(16);
|
|
2028
2035
|
function M(t, e) {
|
|
2029
2036
|
const n = t % e;
|
|
2030
2037
|
return n >= U ? n : e + n;
|
|
2031
2038
|
}
|
|
2032
|
-
function
|
|
2039
|
+
function ac(t, e, n) {
|
|
2033
2040
|
if (n <= U || e < U)
|
|
2034
2041
|
throw new Error("Expected power/modulo > 0");
|
|
2035
2042
|
if (n === $)
|
|
@@ -2051,12 +2058,12 @@ function Ne(t, e) {
|
|
|
2051
2058
|
throw new Error("invert: does not exist");
|
|
2052
2059
|
return M(s, e);
|
|
2053
2060
|
}
|
|
2054
|
-
function
|
|
2061
|
+
function ic(t) {
|
|
2055
2062
|
const e = (t - $) / ut;
|
|
2056
2063
|
let n, r, s;
|
|
2057
2064
|
for (n = t - $, r = 0; n % ut === U; n /= ut, r++)
|
|
2058
2065
|
;
|
|
2059
|
-
for (s = ut; s < t &&
|
|
2066
|
+
for (s = ut; s < t && ac(s, e, t) !== t - $; s++)
|
|
2060
2067
|
;
|
|
2061
2068
|
if (r === 1) {
|
|
2062
2069
|
const a = (t + $) / _e;
|
|
@@ -2076,16 +2083,16 @@ function ac(t) {
|
|
|
2076
2083
|
if (i.eql(y, i.ZERO))
|
|
2077
2084
|
return i.ZERO;
|
|
2078
2085
|
let m = 1;
|
|
2079
|
-
for (let
|
|
2080
|
-
|
|
2086
|
+
for (let h = i.sqr(y); m < l && !i.eql(h, i.ONE); m++)
|
|
2087
|
+
h = i.sqr(h);
|
|
2081
2088
|
const S = i.pow(d, $ << BigInt(l - m - 1));
|
|
2082
2089
|
d = i.sqr(S), u = i.mul(u, S), y = i.mul(y, d), l = m;
|
|
2083
2090
|
}
|
|
2084
2091
|
return u;
|
|
2085
2092
|
};
|
|
2086
2093
|
}
|
|
2087
|
-
function
|
|
2088
|
-
if (t % _e ===
|
|
2094
|
+
function cc(t) {
|
|
2095
|
+
if (t % _e === oc) {
|
|
2089
2096
|
const e = (t + $) / _e;
|
|
2090
2097
|
return function(r, s) {
|
|
2091
2098
|
const o = r.pow(s, e);
|
|
@@ -2094,8 +2101,8 @@ function ic(t) {
|
|
|
2094
2101
|
return o;
|
|
2095
2102
|
};
|
|
2096
2103
|
}
|
|
2097
|
-
if (t %
|
|
2098
|
-
const e = (t -
|
|
2104
|
+
if (t % kn === On) {
|
|
2105
|
+
const e = (t - On) / kn;
|
|
2099
2106
|
return function(r, s) {
|
|
2100
2107
|
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));
|
|
2101
2108
|
if (!r.eql(r.sqr(l), s))
|
|
@@ -2103,9 +2110,9 @@ function ic(t) {
|
|
|
2103
2110
|
return l;
|
|
2104
2111
|
};
|
|
2105
2112
|
}
|
|
2106
|
-
return
|
|
2113
|
+
return ic(t);
|
|
2107
2114
|
}
|
|
2108
|
-
const
|
|
2115
|
+
const lc = [
|
|
2109
2116
|
"create",
|
|
2110
2117
|
"isValid",
|
|
2111
2118
|
"is0",
|
|
@@ -2124,13 +2131,13 @@ const cc = [
|
|
|
2124
2131
|
"mulN",
|
|
2125
2132
|
"sqrN"
|
|
2126
2133
|
];
|
|
2127
|
-
function
|
|
2134
|
+
function We(t) {
|
|
2128
2135
|
const e = {
|
|
2129
2136
|
ORDER: "bigint",
|
|
2130
2137
|
MASK: "bigint",
|
|
2131
2138
|
BYTES: "isSafeInteger",
|
|
2132
2139
|
BITS: "isSafeInteger"
|
|
2133
|
-
}, n =
|
|
2140
|
+
}, n = lc.reduce((r, s) => (r[s] = "function", r), e);
|
|
2134
2141
|
return zt(t, n);
|
|
2135
2142
|
}
|
|
2136
2143
|
function Br(t, e, n) {
|
|
@@ -2145,21 +2152,21 @@ function Br(t, e, n) {
|
|
|
2145
2152
|
n & $ && (r = t.mul(r, s)), s = t.sqr(s), n >>= $;
|
|
2146
2153
|
return r;
|
|
2147
2154
|
}
|
|
2148
|
-
function
|
|
2155
|
+
function uc(t, e) {
|
|
2149
2156
|
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);
|
|
2150
2157
|
return e.reduceRight((o, a, i) => t.is0(a) ? o : (n[i] = t.mul(o, n[i]), t.mul(o, a)), s), n;
|
|
2151
2158
|
}
|
|
2152
|
-
function
|
|
2159
|
+
function Ke(t, e) {
|
|
2153
2160
|
const n = e !== void 0 ? e : t.toString(2).length, r = Math.ceil(n / 8);
|
|
2154
2161
|
return { nBitLength: n, nByteLength: r };
|
|
2155
2162
|
}
|
|
2156
|
-
function
|
|
2163
|
+
function Ze(t, e, n = !1, r = {}) {
|
|
2157
2164
|
if (t <= U)
|
|
2158
2165
|
throw new Error(`Expected Fp ORDER > 0, got ${t}`);
|
|
2159
|
-
const { nBitLength: s, nByteLength: o } =
|
|
2166
|
+
const { nBitLength: s, nByteLength: o } = Ke(t, e);
|
|
2160
2167
|
if (o > 2048)
|
|
2161
2168
|
throw new Error("Field lengths over 2048 bytes are not supported");
|
|
2162
|
-
const a =
|
|
2169
|
+
const a = cc(t), i = Object.freeze({
|
|
2163
2170
|
ORDER: t,
|
|
2164
2171
|
BITS: s,
|
|
2165
2172
|
BYTES: o,
|
|
@@ -2189,7 +2196,7 @@ function Ke(t, e, n = !1, r = {}) {
|
|
|
2189
2196
|
mulN: (c, l) => c * l,
|
|
2190
2197
|
inv: (c) => Ne(c, t),
|
|
2191
2198
|
sqrt: r.sqrt || ((c) => a(i, c)),
|
|
2192
|
-
invertBatch: (c) =>
|
|
2199
|
+
invertBatch: (c) => uc(i, c),
|
|
2193
2200
|
// TODO: do we really need constant cmov?
|
|
2194
2201
|
// We don't have const-time bigints anyway, so probably will be not very useful
|
|
2195
2202
|
cmov: (c, l, d) => d ? l : c,
|
|
@@ -2197,23 +2204,23 @@ function Ke(t, e, n = !1, r = {}) {
|
|
|
2197
2204
|
fromBytes: (c) => {
|
|
2198
2205
|
if (c.length !== o)
|
|
2199
2206
|
throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);
|
|
2200
|
-
return n ?
|
|
2207
|
+
return n ? qe(c) : X(c);
|
|
2201
2208
|
}
|
|
2202
2209
|
});
|
|
2203
2210
|
return Object.freeze(i);
|
|
2204
2211
|
}
|
|
2205
|
-
function
|
|
2212
|
+
function dc(t, e, n = !1) {
|
|
2206
2213
|
t = V("privateHash", t);
|
|
2207
|
-
const r = t.length, s =
|
|
2214
|
+
const r = t.length, s = Ke(e).nByteLength + 8;
|
|
2208
2215
|
if (s < 24 || r < s || r > 1024)
|
|
2209
2216
|
throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${r}`);
|
|
2210
|
-
const o = n ?
|
|
2217
|
+
const o = n ? qe(t) : X(t);
|
|
2211
2218
|
return M(o, e - $) + $;
|
|
2212
2219
|
}
|
|
2213
2220
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2214
|
-
function
|
|
2221
|
+
function fc(t) {
|
|
2215
2222
|
const { Fp: e } = t;
|
|
2216
|
-
|
|
2223
|
+
We(e);
|
|
2217
2224
|
for (const c of ["t", "roundsFull", "roundsPartial"])
|
|
2218
2225
|
if (typeof t[c] != "number" || !Number.isSafeInteger(t[c]))
|
|
2219
2226
|
throw new Error(`Poseidon: invalid param ${c}=${t[c]} (${typeof t[c]})`);
|
|
@@ -2251,8 +2258,8 @@ function dc(t) {
|
|
|
2251
2258
|
});
|
|
2252
2259
|
return Object.freeze({ ...t, rounds: o, sboxFn: s, roundConstants: a, mds: i });
|
|
2253
2260
|
}
|
|
2254
|
-
function
|
|
2255
|
-
const { t: e, Fp: n, rounds: r, sboxFn: s, reversePartialPowIdx: o } =
|
|
2261
|
+
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, y) => (d = d.map((m, S) => n.add(m, t.roundConstants[y][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) {
|
|
2256
2263
|
if (!Array.isArray(u) || u.length !== e)
|
|
2257
2264
|
throw new Error(`Poseidon: wrong values (expected array of bigints with length ${e})`);
|
|
2258
2265
|
u = u.map((m) => {
|
|
@@ -2274,8 +2281,8 @@ function fc(t) {
|
|
|
2274
2281
|
return l.roundConstants = t.roundConstants, l;
|
|
2275
2282
|
}
|
|
2276
2283
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2277
|
-
const
|
|
2278
|
-
function
|
|
2284
|
+
const pc = BigInt(0), ve = BigInt(1);
|
|
2285
|
+
function mc(t, e) {
|
|
2279
2286
|
const n = (s, o) => {
|
|
2280
2287
|
const a = o.negate();
|
|
2281
2288
|
return s ? a : o;
|
|
@@ -2288,7 +2295,7 @@ function pc(t, e) {
|
|
|
2288
2295
|
// non-const time multiplication ladder
|
|
2289
2296
|
unsafeLadder(s, o) {
|
|
2290
2297
|
let a = t.ZERO, i = s;
|
|
2291
|
-
for (; o >
|
|
2298
|
+
for (; o > pc; )
|
|
2292
2299
|
o & ve && (a = a.add(i)), i = i.double(), o >>= ve;
|
|
2293
2300
|
return a;
|
|
2294
2301
|
},
|
|
@@ -2325,10 +2332,10 @@ function pc(t, e) {
|
|
|
2325
2332
|
let l = t.ZERO, d = t.BASE;
|
|
2326
2333
|
const u = BigInt(2 ** s - 1), y = 2 ** s, m = BigInt(s);
|
|
2327
2334
|
for (let S = 0; S < i; S++) {
|
|
2328
|
-
const
|
|
2335
|
+
const h = S * c;
|
|
2329
2336
|
let g = Number(a & u);
|
|
2330
2337
|
a >>= m, g > c && (g -= y, a += ve);
|
|
2331
|
-
const w =
|
|
2338
|
+
const w = h, E = h + Math.abs(g) - 1, x = S % 2 !== 0, _ = g < 0;
|
|
2332
2339
|
g === 0 ? d = d.add(n(x, o[w])) : l = l.add(n(_, o[E]));
|
|
2333
2340
|
}
|
|
2334
2341
|
return { p: l, f: d };
|
|
@@ -2341,7 +2348,7 @@ function pc(t, e) {
|
|
|
2341
2348
|
};
|
|
2342
2349
|
}
|
|
2343
2350
|
function _r(t) {
|
|
2344
|
-
return
|
|
2351
|
+
return We(t.Fp), zt(t, {
|
|
2345
2352
|
n: "bigint",
|
|
2346
2353
|
h: "bigint",
|
|
2347
2354
|
Gx: "field",
|
|
@@ -2350,13 +2357,13 @@ function _r(t) {
|
|
|
2350
2357
|
nBitLength: "isSafeInteger",
|
|
2351
2358
|
nByteLength: "isSafeInteger"
|
|
2352
2359
|
}), Object.freeze({
|
|
2353
|
-
...
|
|
2360
|
+
...Ke(t.n, t.nBitLength),
|
|
2354
2361
|
...t,
|
|
2355
2362
|
p: t.Fp.ORDER
|
|
2356
2363
|
});
|
|
2357
2364
|
}
|
|
2358
2365
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2359
|
-
function
|
|
2366
|
+
function gc(t) {
|
|
2360
2367
|
const e = _r(t);
|
|
2361
2368
|
zt(e, {
|
|
2362
2369
|
a: "field",
|
|
@@ -2379,7 +2386,7 @@ function mc(t) {
|
|
|
2379
2386
|
}
|
|
2380
2387
|
return Object.freeze({ ...e });
|
|
2381
2388
|
}
|
|
2382
|
-
const { bytesToNumberBE:
|
|
2389
|
+
const { bytesToNumberBE: wc, hexToBytes: yc } = sc, dt = {
|
|
2383
2390
|
// asn.1 DER encoding utils
|
|
2384
2391
|
Err: class extends Error {
|
|
2385
2392
|
constructor(e = "") {
|
|
@@ -2397,10 +2404,10 @@ const { bytesToNumberBE: gc, hexToBytes: wc } = rc, dt = {
|
|
|
2397
2404
|
throw new e("Invalid signature integer: negative");
|
|
2398
2405
|
if (r[0] === 0 && !(r[1] & 128))
|
|
2399
2406
|
throw new e("Invalid signature integer: unnecessary leading zero");
|
|
2400
|
-
return { d:
|
|
2407
|
+
return { d: wc(r), l: t.subarray(n + 2) };
|
|
2401
2408
|
},
|
|
2402
2409
|
toSig(t) {
|
|
2403
|
-
const { Err: e } = dt, n = typeof t == "string" ?
|
|
2410
|
+
const { Err: e } = dt, n = typeof t == "string" ? yc(t) : t;
|
|
2404
2411
|
if (!(n instanceof Uint8Array))
|
|
2405
2412
|
throw new Error("ui8a expected");
|
|
2406
2413
|
let r = n.length;
|
|
@@ -2422,19 +2429,19 @@ const { bytesToNumberBE: gc, hexToBytes: wc } = rc, dt = {
|
|
|
2422
2429
|
}
|
|
2423
2430
|
}, et = BigInt(0), q = BigInt(1);
|
|
2424
2431
|
BigInt(2);
|
|
2425
|
-
const
|
|
2432
|
+
const Pn = BigInt(3);
|
|
2426
2433
|
BigInt(4);
|
|
2427
|
-
function
|
|
2428
|
-
const e =
|
|
2429
|
-
const w =
|
|
2434
|
+
function bc(t) {
|
|
2435
|
+
const e = gc(t), { Fp: n } = e, r = e.toBytes || ((S, h, g) => {
|
|
2436
|
+
const w = h.toAffine();
|
|
2430
2437
|
return Lt(Uint8Array.from([4]), n.toBytes(w.x), n.toBytes(w.y));
|
|
2431
2438
|
}), s = e.fromBytes || ((S) => {
|
|
2432
|
-
const
|
|
2439
|
+
const h = S.subarray(1), g = n.fromBytes(h.subarray(0, n.BYTES)), w = n.fromBytes(h.subarray(n.BYTES, 2 * n.BYTES));
|
|
2433
2440
|
return { x: g, y: w };
|
|
2434
2441
|
});
|
|
2435
2442
|
function o(S) {
|
|
2436
|
-
const { a:
|
|
2437
|
-
return n.add(n.add(E, n.mul(S,
|
|
2443
|
+
const { a: h, b: g } = e, w = n.sqr(S), E = n.mul(w, S);
|
|
2444
|
+
return n.add(n.add(E, n.mul(S, h)), g);
|
|
2438
2445
|
}
|
|
2439
2446
|
if (!n.eql(n.sqr(e.Gy), o(e.Gx)))
|
|
2440
2447
|
throw new Error("bad generator point: equation left != right");
|
|
@@ -2446,9 +2453,9 @@ function yc(t) {
|
|
|
2446
2453
|
throw new Error("Expected valid bigint: 0 < bigint < curve.n");
|
|
2447
2454
|
}
|
|
2448
2455
|
function c(S) {
|
|
2449
|
-
const { allowedPrivateKeyLengths:
|
|
2450
|
-
if (
|
|
2451
|
-
if (S instanceof Uint8Array && (S = ht(S)), typeof S != "string" || !
|
|
2456
|
+
const { allowedPrivateKeyLengths: h, nByteLength: g, wrapPrivateKey: w, n: E } = e;
|
|
2457
|
+
if (h && typeof S != "bigint") {
|
|
2458
|
+
if (S instanceof Uint8Array && (S = ht(S)), typeof S != "string" || !h.includes(S.length))
|
|
2452
2459
|
throw new Error("Invalid key");
|
|
2453
2460
|
S = S.padStart(g * 2, "0");
|
|
2454
2461
|
}
|
|
@@ -2466,8 +2473,8 @@ function yc(t) {
|
|
|
2466
2473
|
throw new Error("ProjectivePoint expected");
|
|
2467
2474
|
}
|
|
2468
2475
|
class u {
|
|
2469
|
-
constructor(
|
|
2470
|
-
if (this.px =
|
|
2476
|
+
constructor(h, g, w) {
|
|
2477
|
+
if (this.px = h, this.py = g, this.pz = w, h == null || !n.isValid(h))
|
|
2471
2478
|
throw new Error("x required");
|
|
2472
2479
|
if (g == null || !n.isValid(g))
|
|
2473
2480
|
throw new Error("y required");
|
|
@@ -2476,11 +2483,11 @@ function yc(t) {
|
|
|
2476
2483
|
}
|
|
2477
2484
|
// Does not validate if the point is on-curve.
|
|
2478
2485
|
// Use fromHex instead, or call assertValidity() later.
|
|
2479
|
-
static fromAffine(
|
|
2480
|
-
const { x: g, y: w } =
|
|
2481
|
-
if (!
|
|
2486
|
+
static fromAffine(h) {
|
|
2487
|
+
const { x: g, y: w } = h || {};
|
|
2488
|
+
if (!h || !n.isValid(g) || !n.isValid(w))
|
|
2482
2489
|
throw new Error("invalid affine point");
|
|
2483
|
-
if (
|
|
2490
|
+
if (h instanceof u)
|
|
2484
2491
|
throw new Error("projective point not allowed");
|
|
2485
2492
|
const E = (x) => n.eql(x, n.ZERO);
|
|
2486
2493
|
return E(g) && E(w) ? u.ZERO : new u(g, w, n.ONE);
|
|
@@ -2497,25 +2504,25 @@ function yc(t) {
|
|
|
2497
2504
|
* so this improves performance massively.
|
|
2498
2505
|
* Optimization: converts a list of projective points to a list of identical points with Z=1.
|
|
2499
2506
|
*/
|
|
2500
|
-
static normalizeZ(
|
|
2501
|
-
const g = n.invertBatch(
|
|
2502
|
-
return
|
|
2507
|
+
static normalizeZ(h) {
|
|
2508
|
+
const g = n.invertBatch(h.map((w) => w.pz));
|
|
2509
|
+
return h.map((w, E) => w.toAffine(g[E])).map(u.fromAffine);
|
|
2503
2510
|
}
|
|
2504
2511
|
/**
|
|
2505
2512
|
* Converts hash string or Uint8Array to Point.
|
|
2506
2513
|
* @param hex short/long ECDSA hex
|
|
2507
2514
|
*/
|
|
2508
|
-
static fromHex(
|
|
2509
|
-
const g = u.fromAffine(s(V("pointHex",
|
|
2515
|
+
static fromHex(h) {
|
|
2516
|
+
const g = u.fromAffine(s(V("pointHex", h)));
|
|
2510
2517
|
return g.assertValidity(), g;
|
|
2511
2518
|
}
|
|
2512
2519
|
// Multiplies generator point by privateKey.
|
|
2513
|
-
static fromPrivateKey(
|
|
2514
|
-
return u.BASE.multiply(c(
|
|
2520
|
+
static fromPrivateKey(h) {
|
|
2521
|
+
return u.BASE.multiply(c(h));
|
|
2515
2522
|
}
|
|
2516
2523
|
// "Private method", don't use it directly
|
|
2517
|
-
_setWindowSize(
|
|
2518
|
-
this._WINDOW_SIZE =
|
|
2524
|
+
_setWindowSize(h) {
|
|
2525
|
+
this._WINDOW_SIZE = h, l.delete(this);
|
|
2519
2526
|
}
|
|
2520
2527
|
// A point on curve is valid if it conforms to equation.
|
|
2521
2528
|
assertValidity() {
|
|
@@ -2524,27 +2531,27 @@ function yc(t) {
|
|
|
2524
2531
|
return;
|
|
2525
2532
|
throw new Error("bad point: ZERO");
|
|
2526
2533
|
}
|
|
2527
|
-
const { x:
|
|
2528
|
-
if (!n.isValid(
|
|
2534
|
+
const { x: h, y: g } = this.toAffine();
|
|
2535
|
+
if (!n.isValid(h) || !n.isValid(g))
|
|
2529
2536
|
throw new Error("bad point: x or y not FE");
|
|
2530
|
-
const w = n.sqr(g), E = o(
|
|
2537
|
+
const w = n.sqr(g), E = o(h);
|
|
2531
2538
|
if (!n.eql(w, E))
|
|
2532
2539
|
throw new Error("bad point: equation left != right");
|
|
2533
2540
|
if (!this.isTorsionFree())
|
|
2534
2541
|
throw new Error("bad point: not in prime-order subgroup");
|
|
2535
2542
|
}
|
|
2536
2543
|
hasEvenY() {
|
|
2537
|
-
const { y:
|
|
2544
|
+
const { y: h } = this.toAffine();
|
|
2538
2545
|
if (n.isOdd)
|
|
2539
|
-
return !n.isOdd(
|
|
2546
|
+
return !n.isOdd(h);
|
|
2540
2547
|
throw new Error("Field doesn't support isOdd");
|
|
2541
2548
|
}
|
|
2542
2549
|
/**
|
|
2543
2550
|
* Compare one point to another.
|
|
2544
2551
|
*/
|
|
2545
|
-
equals(
|
|
2546
|
-
d(
|
|
2547
|
-
const { px: g, py: w, pz: E } = this, { px: x, py: _, pz: B } =
|
|
2552
|
+
equals(h) {
|
|
2553
|
+
d(h);
|
|
2554
|
+
const { px: g, py: w, pz: E } = this, { px: x, py: _, pz: B } = h, A = n.eql(n.mul(g, B), n.mul(x, E)), v = n.eql(n.mul(w, B), n.mul(_, E));
|
|
2548
2555
|
return A && v;
|
|
2549
2556
|
}
|
|
2550
2557
|
/**
|
|
@@ -2558,32 +2565,32 @@ function yc(t) {
|
|
|
2558
2565
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
2559
2566
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
2560
2567
|
double() {
|
|
2561
|
-
const { a:
|
|
2568
|
+
const { a: h, b: g } = e, w = n.mul(g, Pn), { px: E, py: x, pz: _ } = this;
|
|
2562
2569
|
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);
|
|
2563
|
-
return N = n.add(N, N), v = n.mul(E, _), v = n.add(v, v), B = n.mul(
|
|
2570
|
+
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);
|
|
2564
2571
|
}
|
|
2565
2572
|
// Renes-Costello-Batina exception-free addition formula.
|
|
2566
2573
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
2567
2574
|
// https://eprint.iacr.org/2015/1060, algorithm 1
|
|
2568
2575
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
2569
|
-
add(
|
|
2570
|
-
d(
|
|
2571
|
-
const { px: g, py: w, pz: E } = this, { px: x, py: _, pz: B } =
|
|
2576
|
+
add(h) {
|
|
2577
|
+
d(h);
|
|
2578
|
+
const { px: g, py: w, pz: E } = this, { px: x, py: _, pz: B } = h;
|
|
2572
2579
|
let A = n.ZERO, v = n.ZERO, T = n.ZERO;
|
|
2573
|
-
const G = e.a, R = n.mul(e.b,
|
|
2580
|
+
const G = e.a, R = n.mul(e.b, Pn);
|
|
2574
2581
|
let N = n.mul(g, x), L = n.mul(w, _), D = n.mul(E, B), rt = n.add(g, w), p = n.add(x, _);
|
|
2575
2582
|
rt = n.mul(rt, p), p = n.add(N, L), rt = n.sub(rt, p), p = n.add(g, E);
|
|
2576
2583
|
let b = n.add(x, B);
|
|
2577
2584
|
return p = n.mul(p, b), b = n.add(N, D), p = n.sub(p, b), b = n.add(w, E), A = n.add(_, B), b = n.mul(b, A), A = n.add(L, D), b = n.sub(b, 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(b, p), A = n.mul(rt, A), A = n.sub(A, N), N = n.mul(rt, L), T = n.mul(b, T), T = n.add(T, N), new u(A, v, T);
|
|
2578
2585
|
}
|
|
2579
|
-
subtract(
|
|
2580
|
-
return this.add(
|
|
2586
|
+
subtract(h) {
|
|
2587
|
+
return this.add(h.negate());
|
|
2581
2588
|
}
|
|
2582
2589
|
is0() {
|
|
2583
2590
|
return this.equals(u.ZERO);
|
|
2584
2591
|
}
|
|
2585
|
-
wNAF(
|
|
2586
|
-
return m.wNAFCached(this, l,
|
|
2592
|
+
wNAF(h) {
|
|
2593
|
+
return m.wNAFCached(this, l, h, (g) => {
|
|
2587
2594
|
const w = n.invertBatch(g.map((E) => E.pz));
|
|
2588
2595
|
return g.map((E, x) => E.toAffine(w[x])).map(u.fromAffine);
|
|
2589
2596
|
});
|
|
@@ -2593,16 +2600,16 @@ function yc(t) {
|
|
|
2593
2600
|
* It's faster, but should only be used when you don't care about
|
|
2594
2601
|
* an exposed private key e.g. sig verification, which works over *public* keys.
|
|
2595
2602
|
*/
|
|
2596
|
-
multiplyUnsafe(
|
|
2603
|
+
multiplyUnsafe(h) {
|
|
2597
2604
|
const g = u.ZERO;
|
|
2598
|
-
if (
|
|
2605
|
+
if (h === et)
|
|
2599
2606
|
return g;
|
|
2600
|
-
if (i(
|
|
2607
|
+
if (i(h), h === q)
|
|
2601
2608
|
return this;
|
|
2602
2609
|
const { endo: w } = e;
|
|
2603
2610
|
if (!w)
|
|
2604
|
-
return m.unsafeLadder(this,
|
|
2605
|
-
let { k1neg: E, k1: x, k2neg: _, k2: B } = w.splitScalar(
|
|
2611
|
+
return m.unsafeLadder(this, h);
|
|
2612
|
+
let { k1neg: E, k1: x, k2neg: _, k2: B } = w.splitScalar(h), A = g, v = g, T = this;
|
|
2606
2613
|
for (; x > et || B > et; )
|
|
2607
2614
|
x & q && (A = A.add(T)), B & q && (v = v.add(T)), T = T.double(), x >>= q, B >>= q;
|
|
2608
2615
|
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,9 +2623,9 @@ function yc(t) {
|
|
|
2616
2623
|
* @param scalar by which the point would be multiplied
|
|
2617
2624
|
* @returns New point
|
|
2618
2625
|
*/
|
|
2619
|
-
multiply(
|
|
2620
|
-
i(
|
|
2621
|
-
let g =
|
|
2626
|
+
multiply(h) {
|
|
2627
|
+
i(h);
|
|
2628
|
+
let g = h, w, E;
|
|
2622
2629
|
const { endo: x } = e;
|
|
2623
2630
|
if (x) {
|
|
2624
2631
|
const { k1neg: _, k1: B, k2neg: A, k2: v } = x.splitScalar(g);
|
|
@@ -2636,17 +2643,17 @@ function yc(t) {
|
|
|
2636
2643
|
* The trick could be useful if both P and Q are not G (not in our case).
|
|
2637
2644
|
* @returns non-zero affine point
|
|
2638
2645
|
*/
|
|
2639
|
-
multiplyAndAddUnsafe(
|
|
2640
|
-
const E = u.BASE, x = (B, A) => A === et || A === q || !B.equals(E) ? B.multiplyUnsafe(A) : B.multiply(A), _ = x(this, g).add(x(
|
|
2646
|
+
multiplyAndAddUnsafe(h, g, w) {
|
|
2647
|
+
const E = u.BASE, x = (B, A) => A === et || A === q || !B.equals(E) ? B.multiplyUnsafe(A) : B.multiply(A), _ = x(this, g).add(x(h, w));
|
|
2641
2648
|
return _.is0() ? void 0 : _;
|
|
2642
2649
|
}
|
|
2643
2650
|
// Converts Projective point to affine (x, y) coordinates.
|
|
2644
2651
|
// Can accept precomputed Z^-1 - for example, from invertBatch.
|
|
2645
2652
|
// (x, y, z) ∋ (x=x/z, y=y/z)
|
|
2646
|
-
toAffine(
|
|
2653
|
+
toAffine(h) {
|
|
2647
2654
|
const { px: g, py: w, pz: E } = this, x = this.is0();
|
|
2648
|
-
|
|
2649
|
-
const _ = n.mul(g,
|
|
2655
|
+
h == null && (h = x ? n.ONE : n.inv(E));
|
|
2656
|
+
const _ = n.mul(g, h), B = n.mul(w, h), A = n.mul(E, h);
|
|
2650
2657
|
if (x)
|
|
2651
2658
|
return { x: n.ZERO, y: n.ZERO };
|
|
2652
2659
|
if (!n.eql(A, n.ONE))
|
|
@@ -2654,26 +2661,26 @@ function yc(t) {
|
|
|
2654
2661
|
return { x: _, y: B };
|
|
2655
2662
|
}
|
|
2656
2663
|
isTorsionFree() {
|
|
2657
|
-
const { h
|
|
2658
|
-
if (
|
|
2664
|
+
const { h, isTorsionFree: g } = e;
|
|
2665
|
+
if (h === q)
|
|
2659
2666
|
return !0;
|
|
2660
2667
|
if (g)
|
|
2661
2668
|
return g(u, this);
|
|
2662
2669
|
throw new Error("isTorsionFree() has not been declared for the elliptic curve");
|
|
2663
2670
|
}
|
|
2664
2671
|
clearCofactor() {
|
|
2665
|
-
const { h
|
|
2666
|
-
return
|
|
2672
|
+
const { h, clearCofactor: g } = e;
|
|
2673
|
+
return h === q ? this : g ? g(u, this) : this.multiplyUnsafe(e.h);
|
|
2667
2674
|
}
|
|
2668
|
-
toRawBytes(
|
|
2669
|
-
return this.assertValidity(), r(u, this,
|
|
2675
|
+
toRawBytes(h = !0) {
|
|
2676
|
+
return this.assertValidity(), r(u, this, h);
|
|
2670
2677
|
}
|
|
2671
|
-
toHex(
|
|
2672
|
-
return ht(this.toRawBytes(
|
|
2678
|
+
toHex(h = !0) {
|
|
2679
|
+
return ht(this.toRawBytes(h));
|
|
2673
2680
|
}
|
|
2674
2681
|
}
|
|
2675
2682
|
u.BASE = new u(e.Gx, e.Gy, n.ONE), u.ZERO = new u(n.ZERO, n.ONE, n.ZERO);
|
|
2676
|
-
const y = e.nBitLength, m =
|
|
2683
|
+
const y = e.nBitLength, m = mc(u, e.endo ? Math.ceil(y / 2) : y);
|
|
2677
2684
|
return {
|
|
2678
2685
|
CURVE: e,
|
|
2679
2686
|
ProjectivePoint: u,
|
|
@@ -2682,7 +2689,7 @@ function yc(t) {
|
|
|
2682
2689
|
isWithinCurveOrder: a
|
|
2683
2690
|
};
|
|
2684
2691
|
}
|
|
2685
|
-
function
|
|
2692
|
+
function Sc(t) {
|
|
2686
2693
|
const e = _r(t);
|
|
2687
2694
|
return zt(e, {
|
|
2688
2695
|
hash: "hash",
|
|
@@ -2694,8 +2701,8 @@ function bc(t) {
|
|
|
2694
2701
|
lowS: "boolean"
|
|
2695
2702
|
}), Object.freeze({ lowS: !0, ...e });
|
|
2696
2703
|
}
|
|
2697
|
-
function
|
|
2698
|
-
const e =
|
|
2704
|
+
function Ec(t) {
|
|
2705
|
+
const e = Sc(t), { Fp: n, n: r } = e, s = n.BYTES + 1, o = 2 * n.BYTES + 1;
|
|
2699
2706
|
function a(p) {
|
|
2700
2707
|
return et < p && p < n.ORDER;
|
|
2701
2708
|
}
|
|
@@ -2705,7 +2712,7 @@ function Sc(t) {
|
|
|
2705
2712
|
function c(p) {
|
|
2706
2713
|
return Ne(p, r);
|
|
2707
2714
|
}
|
|
2708
|
-
const { ProjectivePoint: l, normPrivateKeyToScalar: d, weierstrassEquation: u, isWithinCurveOrder: y } =
|
|
2715
|
+
const { ProjectivePoint: l, normPrivateKeyToScalar: d, weierstrassEquation: u, isWithinCurveOrder: y } = bc({
|
|
2709
2716
|
...e,
|
|
2710
2717
|
toBytes(p, b, I) {
|
|
2711
2718
|
const P = b.toAffine(), C = n.toBytes(P.x), j = Lt;
|
|
@@ -2732,7 +2739,7 @@ function Sc(t) {
|
|
|
2732
2739
|
const b = r >> q;
|
|
2733
2740
|
return p > b;
|
|
2734
2741
|
}
|
|
2735
|
-
function
|
|
2742
|
+
function h(p) {
|
|
2736
2743
|
return S(p) ? i(-p) : p;
|
|
2737
2744
|
}
|
|
2738
2745
|
const g = (p, b, I) => X(p.slice(b, I));
|
|
@@ -2808,7 +2815,7 @@ function Sc(t) {
|
|
|
2808
2815
|
* as per FIPS 186 B.4.1 with modulo bias being neglible.
|
|
2809
2816
|
*/
|
|
2810
2817
|
randomPrivateKey: () => {
|
|
2811
|
-
const p = e.randomBytes(n.BYTES + 8), b =
|
|
2818
|
+
const p = e.randomBytes(n.BYTES + 8), b = dc(p, r);
|
|
2812
2819
|
return Et(b, e.nByteLength);
|
|
2813
2820
|
},
|
|
2814
2821
|
/**
|
|
@@ -2866,14 +2873,14 @@ function Sc(t) {
|
|
|
2866
2873
|
const wt = A(lt);
|
|
2867
2874
|
if (!y(wt))
|
|
2868
2875
|
return;
|
|
2869
|
-
const
|
|
2876
|
+
const Je = c(wt), yt = l.BASE.multiply(wt).toAffine(), W = i(yt.x);
|
|
2870
2877
|
if (W === et)
|
|
2871
2878
|
return;
|
|
2872
|
-
const bt = i(
|
|
2879
|
+
const bt = i(Je * i(at + W * ot));
|
|
2873
2880
|
if (bt === et)
|
|
2874
2881
|
return;
|
|
2875
|
-
let
|
|
2876
|
-
return j && S(bt) && (
|
|
2882
|
+
let Qe = (yt.x === W ? 0 : 2) | Number(yt.y & q), tn = bt;
|
|
2883
|
+
return j && S(bt) && (tn = h(bt), Qe ^= 1), new w(W, tn, Qe);
|
|
2877
2884
|
}
|
|
2878
2885
|
return { seed: Bt, k2sig: we };
|
|
2879
2886
|
}
|
|
@@ -2931,7 +2938,7 @@ function Ce(t) {
|
|
|
2931
2938
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
2932
2939
|
throw new Error(`Wrong positive integer: ${t}`);
|
|
2933
2940
|
}
|
|
2934
|
-
function
|
|
2941
|
+
function Ac(t) {
|
|
2935
2942
|
if (typeof t != "boolean")
|
|
2936
2943
|
throw new Error(`Expected boolean, not ${t}`);
|
|
2937
2944
|
}
|
|
@@ -2941,18 +2948,18 @@ function Nr(t, ...e) {
|
|
|
2941
2948
|
if (e.length > 0 && !e.includes(t.length))
|
|
2942
2949
|
throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`);
|
|
2943
2950
|
}
|
|
2944
|
-
function
|
|
2951
|
+
function xc(t) {
|
|
2945
2952
|
if (typeof t != "function" || typeof t.create != "function")
|
|
2946
2953
|
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
|
2947
2954
|
Ce(t.outputLen), Ce(t.blockLen);
|
|
2948
2955
|
}
|
|
2949
|
-
function
|
|
2956
|
+
function vc(t, e = !0) {
|
|
2950
2957
|
if (t.destroyed)
|
|
2951
2958
|
throw new Error("Hash instance has been destroyed");
|
|
2952
2959
|
if (e && t.finished)
|
|
2953
2960
|
throw new Error("Hash#digest() has already been called");
|
|
2954
2961
|
}
|
|
2955
|
-
function
|
|
2962
|
+
function Ic(t, e) {
|
|
2956
2963
|
Nr(t);
|
|
2957
2964
|
const n = e.outputLen;
|
|
2958
2965
|
if (t.length < n)
|
|
@@ -2960,28 +2967,28 @@ function vc(t, e) {
|
|
|
2960
2967
|
}
|
|
2961
2968
|
const Yt = {
|
|
2962
2969
|
number: Ce,
|
|
2963
|
-
bool:
|
|
2970
|
+
bool: Ac,
|
|
2964
2971
|
bytes: Nr,
|
|
2965
|
-
hash:
|
|
2966
|
-
exists:
|
|
2967
|
-
output:
|
|
2972
|
+
hash: xc,
|
|
2973
|
+
exists: vc,
|
|
2974
|
+
output: Ic
|
|
2968
2975
|
}, Ie = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
2969
2976
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2970
|
-
const
|
|
2971
|
-
if (!
|
|
2977
|
+
const Tc = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
2978
|
+
if (!Tc)
|
|
2972
2979
|
throw new Error("Non little-endian hardware is not supported");
|
|
2973
2980
|
Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
2974
|
-
function
|
|
2981
|
+
function Bc(t) {
|
|
2975
2982
|
if (typeof t != "string")
|
|
2976
2983
|
throw new TypeError(`utf8ToBytes expected string, got ${typeof t}`);
|
|
2977
2984
|
return new TextEncoder().encode(t);
|
|
2978
2985
|
}
|
|
2979
|
-
function
|
|
2980
|
-
if (typeof t == "string" && (t =
|
|
2986
|
+
function _c(t) {
|
|
2987
|
+
if (typeof t == "string" && (t = Bc(t)), !(t instanceof Uint8Array))
|
|
2981
2988
|
throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);
|
|
2982
2989
|
return t;
|
|
2983
2990
|
}
|
|
2984
|
-
function
|
|
2991
|
+
function Nc(...t) {
|
|
2985
2992
|
if (!t.every((r) => r instanceof Uint8Array))
|
|
2986
2993
|
throw new Error("Uint8Array list expected");
|
|
2987
2994
|
if (t.length === 1)
|
|
@@ -2993,21 +3000,21 @@ function _c(...t) {
|
|
|
2993
3000
|
}
|
|
2994
3001
|
return n;
|
|
2995
3002
|
}
|
|
2996
|
-
class
|
|
3003
|
+
class Cc {
|
|
2997
3004
|
// Safe version that clones internal state
|
|
2998
3005
|
clone() {
|
|
2999
3006
|
return this._cloneInto();
|
|
3000
3007
|
}
|
|
3001
3008
|
}
|
|
3002
|
-
function
|
|
3009
|
+
function Oc(t = 32) {
|
|
3003
3010
|
if (Ie && typeof Ie.getRandomValues == "function")
|
|
3004
3011
|
return Ie.getRandomValues(new Uint8Array(t));
|
|
3005
3012
|
throw new Error("crypto.getRandomValues must be defined");
|
|
3006
3013
|
}
|
|
3007
|
-
class Cr extends
|
|
3014
|
+
class Cr extends Cc {
|
|
3008
3015
|
constructor(e, n) {
|
|
3009
3016
|
super(), this.finished = !1, this.destroyed = !1, Yt.hash(e);
|
|
3010
|
-
const r =
|
|
3017
|
+
const r = _c(n);
|
|
3011
3018
|
if (this.iHash = e.create(), typeof this.iHash.update != "function")
|
|
3012
3019
|
throw new TypeError("Expected instance of class which extends utils.Hash");
|
|
3013
3020
|
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
@@ -3042,48 +3049,48 @@ class Cr extends Nc {
|
|
|
3042
3049
|
const Or = (t, e, n) => new Cr(t, e).update(n).digest();
|
|
3043
3050
|
Or.create = (t, e) => new Cr(t, e);
|
|
3044
3051
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3045
|
-
function
|
|
3052
|
+
function kc(t) {
|
|
3046
3053
|
return {
|
|
3047
3054
|
hash: t,
|
|
3048
|
-
hmac: (e, ...n) => Or(t, e,
|
|
3049
|
-
randomBytes:
|
|
3055
|
+
hmac: (e, ...n) => Or(t, e, Nc(...n)),
|
|
3056
|
+
randomBytes: Oc
|
|
3050
3057
|
};
|
|
3051
3058
|
}
|
|
3052
|
-
const
|
|
3053
|
-
function
|
|
3059
|
+
const Rn = BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"), kr = 252;
|
|
3060
|
+
function $n(t) {
|
|
3054
3061
|
for (; t[0] === 0; )
|
|
3055
3062
|
t = t.subarray(1);
|
|
3056
3063
|
const e = t.length * 8 - kr, n = X(t);
|
|
3057
3064
|
return e > 0 ? n >> BigInt(e) : n;
|
|
3058
3065
|
}
|
|
3059
3066
|
function Pr(t) {
|
|
3060
|
-
return typeof t == "string" && (t =
|
|
3067
|
+
return typeof t == "string" && (t = $c(t), t.length & 1 && (t = "0" + t)), pt(t);
|
|
3061
3068
|
}
|
|
3062
|
-
const Rr =
|
|
3069
|
+
const Rr = Ec({
|
|
3063
3070
|
a: BigInt(1),
|
|
3064
3071
|
b: BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),
|
|
3065
|
-
Fp:
|
|
3066
|
-
n:
|
|
3072
|
+
Fp: Ze(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),
|
|
3073
|
+
n: Rn,
|
|
3067
3074
|
nBitLength: kr,
|
|
3068
3075
|
Gx: BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),
|
|
3069
3076
|
Gy: BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),
|
|
3070
3077
|
h: BigInt(1),
|
|
3071
3078
|
lowS: !1,
|
|
3072
|
-
...
|
|
3073
|
-
bits2int:
|
|
3079
|
+
...kc(Ar),
|
|
3080
|
+
bits2int: $n,
|
|
3074
3081
|
bits2int_modN: (t) => {
|
|
3075
3082
|
const e = X(t).toString(16);
|
|
3076
|
-
return e.length === 63 && (t = Pr(e + "0")), M(
|
|
3083
|
+
return e.length === 63 && (t = Pr(e + "0")), M($n(t), Rn);
|
|
3077
3084
|
}
|
|
3078
3085
|
});
|
|
3079
|
-
function
|
|
3086
|
+
function Pc(t) {
|
|
3080
3087
|
return V("", typeof t == "string" ? Pr(t) : t);
|
|
3081
3088
|
}
|
|
3082
|
-
const { CURVE:
|
|
3083
|
-
function
|
|
3089
|
+
const { CURVE: _u, ProjectivePoint: kt, Signature: Nu, utils: Cu } = Rr;
|
|
3090
|
+
function Rc(t) {
|
|
3084
3091
|
return `0x${ht(t.subarray(1)).replace(/^0+/gm, "")}`;
|
|
3085
3092
|
}
|
|
3086
|
-
function
|
|
3093
|
+
function $c(t) {
|
|
3087
3094
|
return t.replace(/^0x/i, "");
|
|
3088
3095
|
}
|
|
3089
3096
|
const Dt = [
|
|
@@ -3103,8 +3110,8 @@ function $r(t, e) {
|
|
|
3103
3110
|
n.push(r), r = r.double();
|
|
3104
3111
|
return n;
|
|
3105
3112
|
}
|
|
3106
|
-
const
|
|
3107
|
-
function
|
|
3113
|
+
const Fc = $r(Dt[1], Dt[2]), Uc = $r(Dt[3], Dt[4]);
|
|
3114
|
+
function jc(t) {
|
|
3108
3115
|
let e;
|
|
3109
3116
|
if (typeof t == "bigint")
|
|
3110
3117
|
e = t;
|
|
@@ -3113,13 +3120,13 @@ function Uc(t) {
|
|
|
3113
3120
|
throw new Error(`Invalid pedersenArg: ${t}`);
|
|
3114
3121
|
e = BigInt(t);
|
|
3115
3122
|
} else
|
|
3116
|
-
e = X(
|
|
3123
|
+
e = X(Pc(t));
|
|
3117
3124
|
if (!(0n <= e && e < Rr.CURVE.Fp.ORDER))
|
|
3118
3125
|
throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${e}`);
|
|
3119
3126
|
return e;
|
|
3120
3127
|
}
|
|
3121
|
-
function
|
|
3122
|
-
let r =
|
|
3128
|
+
function Fn(t, e, n) {
|
|
3129
|
+
let r = jc(e);
|
|
3123
3130
|
for (let s = 0; s < 252; s++) {
|
|
3124
3131
|
const o = n[s];
|
|
3125
3132
|
if (o.equals(t))
|
|
@@ -3128,33 +3135,33 @@ function $n(t, e, n) {
|
|
|
3128
3135
|
}
|
|
3129
3136
|
return t;
|
|
3130
3137
|
}
|
|
3131
|
-
function
|
|
3138
|
+
function Lc(t, e) {
|
|
3132
3139
|
let n = Dt[0];
|
|
3133
|
-
return n =
|
|
3140
|
+
return n = Fn(n, t, Fc), n = Fn(n, e, Uc), Rc(n.toRawBytes(!0));
|
|
3134
3141
|
}
|
|
3135
|
-
const
|
|
3136
|
-
|
|
3137
|
-
const
|
|
3138
|
-
function
|
|
3142
|
+
const Dc = pe(250), Hc = (t) => X(Vi(t)) & Dc;
|
|
3143
|
+
Ze(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));
|
|
3144
|
+
const Vc = Ze(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));
|
|
3145
|
+
function Mc(t, e, n) {
|
|
3139
3146
|
const r = t.fromBytes(Ar(gr(`${e}${n}`)));
|
|
3140
3147
|
return t.create(r);
|
|
3141
3148
|
}
|
|
3142
|
-
const
|
|
3149
|
+
const Gc = [
|
|
3143
3150
|
[3, 1, 1],
|
|
3144
3151
|
[1, -1, 1],
|
|
3145
3152
|
[1, 1, -2]
|
|
3146
3153
|
].map((t) => t.map(BigInt));
|
|
3147
|
-
function
|
|
3148
|
-
if (
|
|
3154
|
+
function zc(t, e) {
|
|
3155
|
+
if (We(t.Fp), !Number.isSafeInteger(t.rate) || !Number.isSafeInteger(t.capacity))
|
|
3149
3156
|
throw new Error(`Wrong poseidon opts: ${t}`);
|
|
3150
3157
|
const n = t.rate + t.capacity, r = t.roundsFull + t.roundsPartial, s = [];
|
|
3151
3158
|
for (let a = 0; a < r; a++) {
|
|
3152
3159
|
const i = [];
|
|
3153
3160
|
for (let c = 0; c < n; c++)
|
|
3154
|
-
i.push(
|
|
3161
|
+
i.push(Mc(t.Fp, "Hades", n * a + c));
|
|
3155
3162
|
s.push(i);
|
|
3156
3163
|
}
|
|
3157
|
-
const o =
|
|
3164
|
+
const o = hc({
|
|
3158
3165
|
...t,
|
|
3159
3166
|
t: n,
|
|
3160
3167
|
sboxPower: 3,
|
|
@@ -3164,42 +3171,42 @@ function Gc(t, e) {
|
|
|
3164
3171
|
});
|
|
3165
3172
|
return o.m = n, o.rate = t.rate, o.capacity = t.capacity, o;
|
|
3166
3173
|
}
|
|
3167
|
-
|
|
3174
|
+
zc({ Fp: Vc, rate: 2, capacity: 1, roundsFull: 8, roundsPartial: 83 }, Gc);
|
|
3168
3175
|
var Oe;
|
|
3169
3176
|
(function(t) {
|
|
3170
3177
|
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";
|
|
3171
3178
|
})(Oe || (Oe = {}));
|
|
3172
|
-
const
|
|
3173
|
-
recoveryId:
|
|
3174
|
-
}),
|
|
3179
|
+
const qc = f.object({
|
|
3180
|
+
recoveryId: f.number()
|
|
3181
|
+
}), Ou = f.object({
|
|
3175
3182
|
feeToken: se,
|
|
3176
|
-
signerSignature:
|
|
3177
|
-
type:
|
|
3178
|
-
signer:
|
|
3183
|
+
signerSignature: f.object({
|
|
3184
|
+
type: f.literal("StarknetKey"),
|
|
3185
|
+
signer: f.object({
|
|
3179
3186
|
publicKey: Pt,
|
|
3180
3187
|
r: Pt,
|
|
3181
3188
|
s: Pt
|
|
3182
3189
|
})
|
|
3183
3190
|
})
|
|
3184
|
-
}),
|
|
3185
|
-
recoveryId:
|
|
3186
|
-
status:
|
|
3187
|
-
completionTime:
|
|
3188
|
-
}),
|
|
3189
|
-
activeRecovery: Fr.optional().or(
|
|
3190
|
-
minFees:
|
|
3191
|
-
}),
|
|
3192
|
-
recovery: Fr.optional().or(
|
|
3193
|
-
minFees:
|
|
3191
|
+
}), Wc = f.nativeEnum(Oe), Fr = f.object({
|
|
3192
|
+
recoveryId: f.number(),
|
|
3193
|
+
status: Wc,
|
|
3194
|
+
completionTime: f.array(f.number()).optional()
|
|
3195
|
+
}), Kc = f.object({
|
|
3196
|
+
activeRecovery: Fr.optional().or(f.null()).optional(),
|
|
3197
|
+
minFees: f.record(f.number()).optional()
|
|
3198
|
+
}), Zc = f.object({
|
|
3199
|
+
recovery: Fr.optional().or(f.null()).optional(),
|
|
3200
|
+
minFees: f.record(f.number()).optional()
|
|
3194
3201
|
});
|
|
3195
3202
|
var ke;
|
|
3196
3203
|
(function(t) {
|
|
3197
3204
|
t.UNDEPLOYED_ACCOUNT = "undeployedAccount", t.NOT_ENOUGH_TO_PAY_FEES = "notEnoughToPayFees", t.RECOVERY_ALREADY_EXISTS = "recoveryAlreadyExists";
|
|
3198
3205
|
})(ke || (ke = {}));
|
|
3199
|
-
const
|
|
3200
|
-
status:
|
|
3206
|
+
const Yc = f.nativeEnum(ke), ku = f.object({
|
|
3207
|
+
status: Yc
|
|
3201
3208
|
});
|
|
3202
|
-
class
|
|
3209
|
+
class Pu {
|
|
3203
3210
|
constructor(e, n) {
|
|
3204
3211
|
this.apiBase = e, this.httpService = n;
|
|
3205
3212
|
}
|
|
@@ -3211,7 +3218,7 @@ class ku {
|
|
|
3211
3218
|
* @returns A promise that resolves to the on-chain recovery details.
|
|
3212
3219
|
*/
|
|
3213
3220
|
async getRecovery(e, n) {
|
|
3214
|
-
const r = k(this.apiBase, "accounts", "starknet", e, "recovery", `${n}`), s = await this.httpService.get(r), o =
|
|
3221
|
+
const r = k(this.apiBase, "accounts", "starknet", e, "recovery", `${n}`), s = await this.httpService.get(r), o = Zc.safeParse(s);
|
|
3215
3222
|
return o.error ? null : o.data;
|
|
3216
3223
|
}
|
|
3217
3224
|
/**
|
|
@@ -3221,7 +3228,7 @@ class ku {
|
|
|
3221
3228
|
* @returns A promise that resolves to the on-chain recovery details.
|
|
3222
3229
|
*/
|
|
3223
3230
|
async getActiveRecovery(e) {
|
|
3224
|
-
const n = k(this.apiBase, "accounts", "starknet", e, "recovery"), r = await this.httpService.get(n), s =
|
|
3231
|
+
const n = k(this.apiBase, "accounts", "starknet", e, "recovery"), r = await this.httpService.get(n), s = Kc.safeParse(r);
|
|
3225
3232
|
return s.error ? null : s.data;
|
|
3226
3233
|
}
|
|
3227
3234
|
/**
|
|
@@ -3233,7 +3240,7 @@ class ku {
|
|
|
3233
3240
|
* @returns A promise that resolves to the recovery details.
|
|
3234
3241
|
*/
|
|
3235
3242
|
async startRecovery(e, n, r, s) {
|
|
3236
|
-
const { r: o, s: a } = us.starkCurve.sign(
|
|
3243
|
+
const { r: o, s: a } = us.starkCurve.sign(Lc(Hc(ys("utf8", "starknet:recovery")), r), s), i = {
|
|
3237
3244
|
feeToken: n,
|
|
3238
3245
|
signerSignature: {
|
|
3239
3246
|
type: "StarknetKey",
|
|
@@ -3246,7 +3253,7 @@ class ku {
|
|
|
3246
3253
|
};
|
|
3247
3254
|
return await this.httpService.post(`${this.apiBase}/accounts/starknet/${e}/recovery`, {
|
|
3248
3255
|
body: JSON.stringify(i)
|
|
3249
|
-
},
|
|
3256
|
+
}, qc);
|
|
3250
3257
|
}
|
|
3251
3258
|
/**
|
|
3252
3259
|
* Completes the recovery process for a given address and recovery ID.
|
|
@@ -3260,7 +3267,7 @@ class ku {
|
|
|
3260
3267
|
return await this.httpService.post(r);
|
|
3261
3268
|
}
|
|
3262
3269
|
}
|
|
3263
|
-
async function
|
|
3270
|
+
async function Ru() {
|
|
3264
3271
|
if ("brave" in navigator)
|
|
3265
3272
|
try {
|
|
3266
3273
|
return await navigator.brave.isBrave();
|
|
@@ -3269,25 +3276,25 @@ async function Pu() {
|
|
|
3269
3276
|
return !1;
|
|
3270
3277
|
}
|
|
3271
3278
|
let Te;
|
|
3272
|
-
function
|
|
3279
|
+
function Xc() {
|
|
3273
3280
|
return Te || (Te = new bs(navigator.userAgent).getResult()), Te;
|
|
3274
3281
|
}
|
|
3275
3282
|
function me(t) {
|
|
3276
|
-
return
|
|
3283
|
+
return Xc().browser.name === t;
|
|
3277
3284
|
}
|
|
3278
|
-
function
|
|
3285
|
+
function $u() {
|
|
3279
3286
|
return me("Firefox");
|
|
3280
3287
|
}
|
|
3281
|
-
function
|
|
3288
|
+
function Fu() {
|
|
3282
3289
|
return me("Chrome");
|
|
3283
3290
|
}
|
|
3284
|
-
function
|
|
3291
|
+
function Uu() {
|
|
3285
3292
|
return me("Safari");
|
|
3286
3293
|
}
|
|
3287
|
-
function
|
|
3294
|
+
function ju() {
|
|
3288
3295
|
return me("Edge");
|
|
3289
3296
|
}
|
|
3290
|
-
const
|
|
3297
|
+
const Lu = f.string().refine((t) => Ss(t, Es), "Invalid seedphrase"), Ye = [
|
|
3291
3298
|
{
|
|
3292
3299
|
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
3293
3300
|
name: "Ether",
|
|
@@ -3464,7 +3471,7 @@ const ju = h.string().refine((t) => Ss(t, Es), "Invalid seedphrase"), Ze = [
|
|
|
3464
3471
|
networkId: "mainnet-alpha",
|
|
3465
3472
|
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/ekubo.png"
|
|
3466
3473
|
}
|
|
3467
|
-
],
|
|
3474
|
+
], Jc = async (t, e, n) => {
|
|
3468
3475
|
const r = await n.callContract({
|
|
3469
3476
|
contractAddress: t,
|
|
3470
3477
|
entrypoint: "balanceOf",
|
|
@@ -3474,8 +3481,8 @@ const ju = h.string().refine((t) => Ss(t, Es), "Invalid seedphrase"), Ze = [
|
|
|
3474
3481
|
low: r[0],
|
|
3475
3482
|
high: r[1]
|
|
3476
3483
|
})));
|
|
3477
|
-
},
|
|
3478
|
-
const r =
|
|
3484
|
+
}, Du = async (t, e, n) => {
|
|
3485
|
+
const r = Ye.filter((o) => o.networkId === t);
|
|
3479
3486
|
return (await Promise.allSettled(r.map((o) => e.callContract({
|
|
3480
3487
|
contractAddress: o.address,
|
|
3481
3488
|
entrypoint: "balanceOf",
|
|
@@ -3492,44 +3499,44 @@ const ju = h.string().refine((t) => Ss(t, Es), "Invalid seedphrase"), Ze = [
|
|
|
3492
3499
|
};
|
|
3493
3500
|
return o.push(l), o;
|
|
3494
3501
|
}, []);
|
|
3495
|
-
},
|
|
3502
|
+
}, Hu = async () => Ye, Vu = ({ address: t, networkId: e }) => Ye.find((r) => r.address === t && r.networkId === e), Mu = ({ amount: t, decimals: e, unitCurrencyValue: n }) => {
|
|
3496
3503
|
if (!Y(t) || !Y(e) || !Y(n))
|
|
3497
3504
|
return;
|
|
3498
|
-
const r = Number(e), s = BigInt(t) *
|
|
3505
|
+
const r = Number(e), s = BigInt(t) * Le(n.toString()).value;
|
|
3499
3506
|
return Mt({
|
|
3500
3507
|
value: s,
|
|
3501
3508
|
decimals: r + Vt
|
|
3502
3509
|
});
|
|
3503
|
-
},
|
|
3510
|
+
}, Gu = ({ unitAmount: t, decimals: e }) => {
|
|
3504
3511
|
if (t === void 0 || !Y(t) || e === void 0 || !Y(e))
|
|
3505
3512
|
return;
|
|
3506
3513
|
const n = Number(e);
|
|
3507
3514
|
return xt(t.toString(), n).value.toString();
|
|
3508
|
-
},
|
|
3515
|
+
}, zu = (t) => Y(t) ? Number(t) : 18, { UINT_256_MAX: Qc } = Ht, tl = (t) => String(t) === String(Qc), qu = (t, e = "$", n) => {
|
|
3509
3516
|
if (t === void 0 || !Y(t))
|
|
3510
3517
|
return null;
|
|
3511
|
-
const r =
|
|
3518
|
+
const r = wi(t, n);
|
|
3512
3519
|
return [e, r].filter(Boolean).join("");
|
|
3513
|
-
},
|
|
3520
|
+
}, el = "Unlimited", Wu = ({ amount: t, decimals: e, symbol: n, showPlusSign: r = !1, withSymbol: s = !0, unlimitedText: o = el, prettyConfigOverrides: a }) => {
|
|
3514
3521
|
if (!Y(t))
|
|
3515
3522
|
return null;
|
|
3516
3523
|
let i, c = !1;
|
|
3517
|
-
if (
|
|
3524
|
+
if (tl(t))
|
|
3518
3525
|
i = o;
|
|
3519
3526
|
else {
|
|
3520
3527
|
const d = Number(e), u = BigInt(t);
|
|
3521
3528
|
c = u > 0n;
|
|
3522
3529
|
const y = d > 0 ? Mt({ value: u, decimals: d }) : u.toString();
|
|
3523
|
-
i = d > 0 ?
|
|
3530
|
+
i = d > 0 ? yi(y, a) : y;
|
|
3524
3531
|
}
|
|
3525
3532
|
const l = [i, s && n].filter(Boolean).join(" ");
|
|
3526
3533
|
return r && c ? `+${l}` : l;
|
|
3527
3534
|
};
|
|
3528
|
-
var
|
|
3529
|
-
function
|
|
3535
|
+
var nl = Jr, rl = nl;
|
|
3536
|
+
function sl(t, e) {
|
|
3530
3537
|
function n(r, s) {
|
|
3531
3538
|
var o = e || {}, a;
|
|
3532
|
-
"randomize" in o || (o.randomize = !0), a =
|
|
3539
|
+
"randomize" in o || (o.randomize = !0), a = rl.operation(o);
|
|
3533
3540
|
function i(d) {
|
|
3534
3541
|
s(d || new Error("Aborted"));
|
|
3535
3542
|
}
|
|
@@ -3556,9 +3563,9 @@ function rl(t, e) {
|
|
|
3556
3563
|
}
|
|
3557
3564
|
return new Promise(n);
|
|
3558
3565
|
}
|
|
3559
|
-
var
|
|
3560
|
-
const
|
|
3561
|
-
class
|
|
3566
|
+
var ol = sl;
|
|
3567
|
+
const al = /* @__PURE__ */ Qr(ol);
|
|
3568
|
+
class Ku {
|
|
3562
3569
|
constructor(e, n) {
|
|
3563
3570
|
this.apiBase = e, this.httpService = n, this.TOKENS_INFO_URL = "/tokens/info", this.TOKENS_DEFI_DECOMPOSITION_URL = "/tokens/defi/decomposition";
|
|
3564
3571
|
}
|
|
@@ -3582,7 +3589,7 @@ class Wu {
|
|
|
3582
3589
|
*/
|
|
3583
3590
|
async fetchAddressTokenBalancesFromBackend(e, n, r) {
|
|
3584
3591
|
const s = k(this.apiBase, "activity", "starknet", n, "account", e, "balance");
|
|
3585
|
-
return (await
|
|
3592
|
+
return (await al(
|
|
3586
3593
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3587
3594
|
async (i) => {
|
|
3588
3595
|
let c;
|
|
@@ -3617,14 +3624,14 @@ class Wu {
|
|
|
3617
3624
|
return r.dapps;
|
|
3618
3625
|
}
|
|
3619
3626
|
}
|
|
3620
|
-
const
|
|
3627
|
+
const Zu = (t, e, n, r) => ({
|
|
3621
3628
|
contractAddress: t,
|
|
3622
3629
|
entrypoint: "transfer",
|
|
3623
3630
|
calldata: mt.compile({
|
|
3624
3631
|
recipient: e,
|
|
3625
|
-
amount: jt(
|
|
3632
|
+
amount: jt(bi(n, r))
|
|
3626
3633
|
})
|
|
3627
|
-
}),
|
|
3634
|
+
}), Yu = (t, e, n, r) => ({
|
|
3628
3635
|
contractAddress: t,
|
|
3629
3636
|
entrypoint: "transferFrom",
|
|
3630
3637
|
calldata: mt.compile({
|
|
@@ -3633,7 +3640,7 @@ const Ku = (t, e, n, r) => ({
|
|
|
3633
3640
|
tokenId: jt(r)
|
|
3634
3641
|
// OZ specs need a uint256 as tokenId
|
|
3635
3642
|
})
|
|
3636
|
-
}),
|
|
3643
|
+
}), Xu = (t, e, n, r) => ({
|
|
3637
3644
|
contractAddress: t,
|
|
3638
3645
|
entrypoint: "safeTransferFrom",
|
|
3639
3646
|
calldata: mt.compile({
|
|
@@ -3645,10 +3652,10 @@ const Ku = (t, e, n, r) => ({
|
|
|
3645
3652
|
})
|
|
3646
3653
|
});
|
|
3647
3654
|
function Ur(t) {
|
|
3648
|
-
return
|
|
3655
|
+
return Fe(t.unit) === "WEI";
|
|
3649
3656
|
}
|
|
3650
|
-
function
|
|
3651
|
-
return
|
|
3657
|
+
function il(t) {
|
|
3658
|
+
return Fe(t.unit) === "FRI";
|
|
3652
3659
|
}
|
|
3653
3660
|
function At(t, e) {
|
|
3654
3661
|
return Ur(t) ? {
|
|
@@ -3675,13 +3682,13 @@ function Rt(t) {
|
|
|
3675
3682
|
};
|
|
3676
3683
|
}
|
|
3677
3684
|
function Be(t) {
|
|
3678
|
-
return
|
|
3685
|
+
return il({ unit: t }) ? $e : Vn;
|
|
3679
3686
|
}
|
|
3680
|
-
function
|
|
3687
|
+
function Ju(t, e, n = 2) {
|
|
3681
3688
|
const r = BigInt(10 ** n), s = BigInt(Math.round(e * 10 ** n));
|
|
3682
3689
|
return t * s / r;
|
|
3683
3690
|
}
|
|
3684
|
-
const
|
|
3691
|
+
const Qu = [$e], jr = (t, e = fl) => {
|
|
3685
3692
|
if (t.max && "amount" in t.max)
|
|
3686
3693
|
return {
|
|
3687
3694
|
...t,
|
|
@@ -3701,23 +3708,23 @@ const Ju = [Re], jr = (t, e = dl) => {
|
|
|
3701
3708
|
}, re = (t) => {
|
|
3702
3709
|
const { amount: e, pricePerUnit: n, dataGasConsumed: r = 0n, dataGasPrice: s = 0n } = t;
|
|
3703
3710
|
return e * n + r * s;
|
|
3704
|
-
},
|
|
3711
|
+
}, cl = (t) => {
|
|
3705
3712
|
if (t.max)
|
|
3706
3713
|
return "maxFee" in t.max ? t.max.maxFee : re(t.max);
|
|
3707
3714
|
}, Pe = (t) => {
|
|
3708
|
-
const e =
|
|
3715
|
+
const e = cl(t);
|
|
3709
3716
|
return e || re(jr(t));
|
|
3710
|
-
},
|
|
3717
|
+
}, td = (t) => {
|
|
3711
3718
|
if (t.deployment && !nt(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
3712
3719
|
throw Error("Cannot calculate estimated fees for different tokens");
|
|
3713
3720
|
const e = re(t.transactions), n = t.deployment ? re(t.deployment) : 0n;
|
|
3714
3721
|
return e + n;
|
|
3715
|
-
},
|
|
3722
|
+
}, ed = (t) => {
|
|
3716
3723
|
if (t.deployment && !nt(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
3717
3724
|
throw Error("Cannot calculate estimated fees for different tokens");
|
|
3718
3725
|
const e = t.deployment ? Pe(t.deployment) : 0n, n = Pe(t.transactions);
|
|
3719
3726
|
return e + n;
|
|
3720
|
-
},
|
|
3727
|
+
}, nd = (t, e) => [
|
|
3721
3728
|
{
|
|
3722
3729
|
contractAddress: t,
|
|
3723
3730
|
entrypoint: "transfer",
|
|
@@ -3728,7 +3735,7 @@ const Ju = [Re], jr = (t, e = dl) => {
|
|
|
3728
3735
|
amount: Ht.bnToUint256(BigInt(1))
|
|
3729
3736
|
}))
|
|
3730
3737
|
}
|
|
3731
|
-
],
|
|
3738
|
+
], ll = (t, e) => {
|
|
3732
3739
|
if (!t)
|
|
3733
3740
|
return {
|
|
3734
3741
|
transactions: {
|
|
@@ -3776,7 +3783,7 @@ const Ju = [Re], jr = (t, e = dl) => {
|
|
|
3776
3783
|
};
|
|
3777
3784
|
}
|
|
3778
3785
|
throw Error("Unexpected simulation response length");
|
|
3779
|
-
},
|
|
3786
|
+
}, ul = ({ transaction: t, nonce: e, chainId: n, version: r, isDeploymentTransaction: s, cairoVersion: o, address: a, appDomain: i }) => {
|
|
3780
3787
|
let c = e;
|
|
3781
3788
|
s && t.type !== "DEPLOY_ACCOUNT" && (c = O.toHex(1));
|
|
3782
3789
|
const l = oe(t.calls);
|
|
@@ -3795,7 +3802,7 @@ const Ju = [Re], jr = (t, e = dl) => {
|
|
|
3795
3802
|
appDomain: i
|
|
3796
3803
|
// appDomain: "https://starknetkit-blacked-listed.vercel.app", // to simulate blacklisted domain
|
|
3797
3804
|
};
|
|
3798
|
-
},
|
|
3805
|
+
}, dl = (t, e) => {
|
|
3799
3806
|
const { transactions: n } = t, r = n.map((c) => {
|
|
3800
3807
|
if (!c.simulation)
|
|
3801
3808
|
throw new as({ code: "SIMULATE_AND_REVIEW_FAILED" });
|
|
@@ -3803,7 +3810,7 @@ const Ju = [Re], jr = (t, e = dl) => {
|
|
|
3803
3810
|
}), s = r.map((c) => ({
|
|
3804
3811
|
...c.simulation,
|
|
3805
3812
|
feeEstimation: At(c.simulation.feeEstimation, Number)
|
|
3806
|
-
})), o =
|
|
3813
|
+
})), o = ll(s, e), [a, i] = r.length === 1 ? [r[0], void 0] : [r[1], r[0]];
|
|
3807
3814
|
return {
|
|
3808
3815
|
...o,
|
|
3809
3816
|
transactions: {
|
|
@@ -3819,7 +3826,7 @@ const Ju = [Re], jr = (t, e = dl) => {
|
|
|
3819
3826
|
max: Rt(At(i.simulation.feeEstimation, O.toBigInt))
|
|
3820
3827
|
} : void 0
|
|
3821
3828
|
};
|
|
3822
|
-
},
|
|
3829
|
+
}, rd = (t) => {
|
|
3823
3830
|
const e = jr(t), n = Pe(t);
|
|
3824
3831
|
return {
|
|
3825
3832
|
// for v1 transactions
|
|
@@ -3838,31 +3845,31 @@ const Ju = [Re], jr = (t, e = dl) => {
|
|
|
3838
3845
|
}
|
|
3839
3846
|
}
|
|
3840
3847
|
};
|
|
3841
|
-
},
|
|
3848
|
+
}, sd = (t) => {
|
|
3842
3849
|
const e = Math.sqrt(t);
|
|
3843
3850
|
return isNaN(e) ? Math.sqrt(2) : e;
|
|
3844
|
-
},
|
|
3851
|
+
}, fl = (t) => {
|
|
3845
3852
|
const e = Math.cbrt(t);
|
|
3846
3853
|
return isNaN(e) ? Math.cbrt(2) : e;
|
|
3847
|
-
},
|
|
3848
|
-
function
|
|
3849
|
-
return
|
|
3854
|
+
}, od = (t) => t < 1 || isNaN(t) ? 1.1 : Math.log(t + 1) + 1, hl = [$e];
|
|
3855
|
+
function Xe({ address: t }) {
|
|
3856
|
+
return hl.some((e) => nt(t, e));
|
|
3850
3857
|
}
|
|
3851
|
-
function
|
|
3858
|
+
function ad(t) {
|
|
3852
3859
|
return t ? Aa().some((e) => nt(e, t)) : !1;
|
|
3853
3860
|
}
|
|
3854
|
-
function
|
|
3855
|
-
return
|
|
3861
|
+
function Un(t) {
|
|
3862
|
+
return Xe({
|
|
3856
3863
|
address: t
|
|
3857
3864
|
}) ? Z.TRANSACTION_VERSION.V3 : Z.TRANSACTION_VERSION.V1;
|
|
3858
3865
|
}
|
|
3859
|
-
function
|
|
3860
|
-
return
|
|
3866
|
+
function id(t) {
|
|
3867
|
+
return Xe({ address: t }) ? Z.TRANSACTION_VERSION.F3 : Z.TRANSACTION_VERSION.F1;
|
|
3861
3868
|
}
|
|
3862
|
-
function
|
|
3863
|
-
return ds(e.contract) ?
|
|
3869
|
+
function cd(t, e) {
|
|
3870
|
+
return ds(e.contract) ? Xe({ address: t }) ? Z.TRANSACTION_VERSION.V3 : Z.TRANSACTION_VERSION.V2 : Z.TRANSACTION_VERSION.V1;
|
|
3864
3871
|
}
|
|
3865
|
-
class
|
|
3872
|
+
class ld {
|
|
3866
3873
|
constructor(e, n) {
|
|
3867
3874
|
this.apiBase = e, this.httpService = n;
|
|
3868
3875
|
}
|
|
@@ -3887,9 +3894,9 @@ class cd {
|
|
|
3887
3894
|
try {
|
|
3888
3895
|
if (!("getChainId" in e))
|
|
3889
3896
|
throw new Error("MISSING_METHOD");
|
|
3890
|
-
const c =
|
|
3897
|
+
const c = Un(r), l = i ? "0x0" : await e.getNonce(), d = await e.getChainId(), u = {
|
|
3891
3898
|
transactions: n.map((w) => ({
|
|
3892
|
-
...
|
|
3899
|
+
...ul({
|
|
3893
3900
|
transaction: w,
|
|
3894
3901
|
nonce: l,
|
|
3895
3902
|
version: c,
|
|
@@ -3901,7 +3908,7 @@ class cd {
|
|
|
3901
3908
|
}),
|
|
3902
3909
|
type: w.type
|
|
3903
3910
|
}))
|
|
3904
|
-
}, y = k(this.apiBase, "reviewer", "transactions", "v2", "review", "starknet"), m = a ?
|
|
3911
|
+
}, y = k(this.apiBase, "reviewer", "transactions", "v2", "review", "starknet"), m = a ? Si(y, { delayedTransactions: "true" }) : y, S = await this.httpService.post(m, {
|
|
3905
3912
|
headers: {
|
|
3906
3913
|
Accept: "application/json",
|
|
3907
3914
|
"Content-Type": "application/json"
|
|
@@ -3910,7 +3917,7 @@ class cd {
|
|
|
3910
3917
|
}, cs);
|
|
3911
3918
|
if (S.transactions.some((w) => ls(w)))
|
|
3912
3919
|
return S;
|
|
3913
|
-
const g =
|
|
3920
|
+
const g = dl(S, r);
|
|
3914
3921
|
return {
|
|
3915
3922
|
...S,
|
|
3916
3923
|
enrichedFeeEstimation: g
|
|
@@ -3957,7 +3964,7 @@ class cd {
|
|
|
3957
3964
|
}
|
|
3958
3965
|
async fetchFeesOnchain({ starknetAccount: e, calls: n, isDeployed: r, feeTokenAddress: s, accountDeployTransaction: o }) {
|
|
3959
3966
|
try {
|
|
3960
|
-
const a =
|
|
3967
|
+
const a = Un(s), i = {
|
|
3961
3968
|
transactions: {
|
|
3962
3969
|
feeTokenAddress: s,
|
|
3963
3970
|
amount: 0n,
|
|
@@ -3970,7 +3977,7 @@ class cd {
|
|
|
3970
3977
|
if ("estimateFeeBulk" in e) {
|
|
3971
3978
|
const c = [
|
|
3972
3979
|
{
|
|
3973
|
-
type:
|
|
3980
|
+
type: ln.DEPLOY_ACCOUNT,
|
|
3974
3981
|
payload: {
|
|
3975
3982
|
classHash: o.classHash,
|
|
3976
3983
|
addressSalt: o.salt,
|
|
@@ -3979,7 +3986,7 @@ class cd {
|
|
|
3979
3986
|
}
|
|
3980
3987
|
},
|
|
3981
3988
|
{
|
|
3982
|
-
type:
|
|
3989
|
+
type: ln.INVOKE,
|
|
3983
3990
|
payload: n
|
|
3984
3991
|
}
|
|
3985
3992
|
], [l, d] = await e.estimateFeeBulk(c, {
|
|
@@ -4033,16 +4040,16 @@ class cd {
|
|
|
4033
4040
|
}
|
|
4034
4041
|
}
|
|
4035
4042
|
}
|
|
4036
|
-
const
|
|
4043
|
+
const ud = [
|
|
4037
4044
|
"account-upgrade",
|
|
4038
4045
|
"approve",
|
|
4039
4046
|
"set-approval-for-all",
|
|
4040
4047
|
"swap",
|
|
4041
4048
|
"transfer"
|
|
4042
|
-
],
|
|
4043
|
-
const n = t == null ? void 0 : t.some((s) => !
|
|
4049
|
+
], dd = (t) => ({ showBalanceChange: vt(() => {
|
|
4050
|
+
const n = t == null ? void 0 : t.some((s) => !dn(s.transfers)), r = t == null ? void 0 : t.some((s) => !dn(s.approvals));
|
|
4044
4051
|
return t && (n || r);
|
|
4045
|
-
}, [t]) }), ge = (t) => t ? t.filter((e) => e.token.type === "erc20") : [],
|
|
4052
|
+
}, [t]) }), ge = (t) => t ? t.filter((e) => e.token.type === "erc20") : [], fd = (t) => vt(() => ge(t), [t]), hd = (t) => ge(t).length > 0, pd = (t) => ge(t).some((n) => n.amount > 0n), md = (t) => ge(t).some((n) => n.amount < 0n), Lr = (t) => t ? t.filter((e) => e.token.type === "erc721") : [], gd = (t) => vt(() => Lr(t), [t]), pl = (t) => Lr(t).length > 0, wd = (t) => vt(() => pl(t), [t]), yd = (t, e) => vt(() => t && e ? [
|
|
4046
4053
|
{
|
|
4047
4054
|
contractAddress: t.address,
|
|
4048
4055
|
entrypoint: "transfer",
|
|
@@ -4051,7 +4058,7 @@ const ld = [
|
|
|
4051
4058
|
amount: jt(t.balance)
|
|
4052
4059
|
})
|
|
4053
4060
|
}
|
|
4054
|
-
] : [], [t, e]),
|
|
4061
|
+
] : [], [t, e]), bd = ({ apiData: { apiBaseUrl: t, apiHeaders: e }, address: n, network: r, transactionReviewEnabled: s = !0, transactions: o }) => {
|
|
4055
4062
|
const a = qn(async () => {
|
|
4056
4063
|
if (!n || !r)
|
|
4057
4064
|
return;
|
|
@@ -4072,7 +4079,7 @@ const ld = [
|
|
|
4072
4079
|
});
|
|
4073
4080
|
}, [n, r, o]), i = vt(() => As({ transactions: o, address: n, network: r }), [o, n, r]);
|
|
4074
4081
|
return Ks(!!s, [i, "transactionReview"], a);
|
|
4075
|
-
},
|
|
4082
|
+
}, Sd = (t) => {
|
|
4076
4083
|
if (!t)
|
|
4077
4084
|
return {};
|
|
4078
4085
|
const e = t.assessment === "warn" && t.reason !== "contract_is_not_verified", n = t.reason ? ` (Reason: ${Kn(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;
|
|
@@ -4080,22 +4087,22 @@ const ld = [
|
|
|
4080
4087
|
warn: e,
|
|
4081
4088
|
reason: r
|
|
4082
4089
|
};
|
|
4083
|
-
},
|
|
4090
|
+
}, ml = (t) => {
|
|
4084
4091
|
var e;
|
|
4085
4092
|
if (t) {
|
|
4086
4093
|
for (const n of t.reviews)
|
|
4087
4094
|
if (((e = n.activity) == null ? void 0 : e.type) === "swap")
|
|
4088
4095
|
return n;
|
|
4089
4096
|
}
|
|
4090
|
-
},
|
|
4091
|
-
},
|
|
4097
|
+
}, Ed = (t) => {
|
|
4098
|
+
}, Ad = (t, e) => {
|
|
4092
4099
|
var n;
|
|
4093
4100
|
if (e) {
|
|
4094
4101
|
for (const r of e.reviews)
|
|
4095
4102
|
if (((n = r.activity) == null ? void 0 : n.type) === t)
|
|
4096
4103
|
return r.activity;
|
|
4097
4104
|
}
|
|
4098
|
-
},
|
|
4105
|
+
}, xd = (t) => !!ml(t), vd = (t) => {
|
|
4099
4106
|
var e, n;
|
|
4100
4107
|
if (t) {
|
|
4101
4108
|
for (const r of t.reviews)
|
|
@@ -4105,7 +4112,7 @@ const ld = [
|
|
|
4105
4112
|
type: (n = r.activity) == null ? void 0 : n.type
|
|
4106
4113
|
};
|
|
4107
4114
|
}
|
|
4108
|
-
},
|
|
4115
|
+
}, gl = async ({ feeTokenAddress: t, calls: e, selectedAccount: n, transactionReviewService: r, appDomain: s, accountDeployTransaction: o, isDelayedTransaction: a }) => {
|
|
4109
4116
|
const i = {
|
|
4110
4117
|
type: "INVOKE",
|
|
4111
4118
|
calls: oe(e)
|
|
@@ -4114,8 +4121,8 @@ const ld = [
|
|
|
4114
4121
|
return;
|
|
4115
4122
|
const c = o ? [o, i] : [i];
|
|
4116
4123
|
return { result: await r.simulateAndReview(n, c, t, s, o, a) };
|
|
4117
|
-
},
|
|
4118
|
-
var y, m, S,
|
|
4124
|
+
}, wl = async (t, e, n, r) => {
|
|
4125
|
+
var y, m, S, h, g, w;
|
|
4119
4126
|
let s = !1;
|
|
4120
4127
|
const o = e.transactions.find((E) => {
|
|
4121
4128
|
var x, _;
|
|
@@ -4124,46 +4131,46 @@ const ld = [
|
|
|
4124
4131
|
if (!o || !((y = o.simulation) != null && y.summary))
|
|
4125
4132
|
return s;
|
|
4126
4133
|
const a = o.simulation.summary.filter((E) => E.sent).map((E) => E.token.address);
|
|
4127
|
-
if (!(((m = e.enrichedFeeEstimation) == null ? void 0 : m.transactions.feeTokenAddress) && a.includes((S = e.enrichedFeeEstimation) == null ? void 0 : S.transactions.feeTokenAddress)) || !((g = (
|
|
4134
|
+
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))
|
|
4128
4135
|
return s;
|
|
4129
4136
|
const c = "amount" in e.enrichedFeeEstimation.transactions.max ? e.enrichedFeeEstimation.transactions.max.amount * e.enrichedFeeEstimation.transactions.max.pricePerUnit : "maxFee" in e.enrichedFeeEstimation.transactions.max ? e.enrichedFeeEstimation.transactions.max.maxFee : void 0, l = (w = o.simulation.summary.find((E) => E.sent && E.token.address === n)) == null ? void 0 : w.value;
|
|
4130
4137
|
if (!c || !l)
|
|
4131
4138
|
return s;
|
|
4132
|
-
const d = await
|
|
4139
|
+
const d = await Jc(n, t, r) ?? 0n;
|
|
4133
4140
|
return BigInt(d) > c + BigInt(l) || (s = !0), s;
|
|
4134
|
-
},
|
|
4141
|
+
}, Id = () => qn(async ({ feeTokenAddress: e, calls: n, selectedAccount: r, transactionReviewService: s, appDomain: o, accountDeployPayload: a, provider: i, isDelayedTransaction: c }) => {
|
|
4135
4142
|
if (!r)
|
|
4136
4143
|
return;
|
|
4137
|
-
const l = await
|
|
4144
|
+
const l = await gl({
|
|
4138
4145
|
feeTokenAddress: e,
|
|
4139
4146
|
calls: n,
|
|
4140
4147
|
selectedAccount: r,
|
|
4141
4148
|
transactionReviewService: s,
|
|
4142
4149
|
appDomain: o,
|
|
4143
|
-
accountDeployTransaction:
|
|
4150
|
+
accountDeployTransaction: yl(a),
|
|
4144
4151
|
isDelayedTransaction: c
|
|
4145
4152
|
});
|
|
4146
4153
|
if (!l || !l.result || !e)
|
|
4147
4154
|
return;
|
|
4148
|
-
const d = await
|
|
4155
|
+
const d = await wl(r.address, l.result, e, i);
|
|
4149
4156
|
return { ...l.result, isSendingMoreThanBalanceAndGas: d };
|
|
4150
|
-
}, []),
|
|
4157
|
+
}, []), yl = (t) => t ? {
|
|
4151
4158
|
type: "DEPLOY_ACCOUNT",
|
|
4152
4159
|
calldata: t.calldata,
|
|
4153
4160
|
classHash: Pt.parse(t.class_hash),
|
|
4154
4161
|
salt: Pt.parse(t.salt),
|
|
4155
4162
|
signature: []
|
|
4156
4163
|
} : void 0;
|
|
4157
|
-
function
|
|
4164
|
+
function jn() {
|
|
4158
4165
|
return { promise: Promise.resolve() };
|
|
4159
4166
|
}
|
|
4160
|
-
function
|
|
4167
|
+
function Td(t) {
|
|
4161
4168
|
return class extends t {
|
|
4162
4169
|
constructor({ enabled: e, appVersion: n }) {
|
|
4163
4170
|
super(), this.enabled = e, this.appVersion = n;
|
|
4164
4171
|
}
|
|
4165
4172
|
track(e, n) {
|
|
4166
|
-
return !this.enabled || !super.isLoaded ?
|
|
4173
|
+
return !this.enabled || !super.isLoaded ? jn() : {
|
|
4167
4174
|
promise: super.track(e, {
|
|
4168
4175
|
app_version: this.appVersion,
|
|
4169
4176
|
...n
|
|
@@ -4172,354 +4179,354 @@ function Id(t) {
|
|
|
4172
4179
|
}
|
|
4173
4180
|
};
|
|
4174
4181
|
}
|
|
4175
|
-
const
|
|
4182
|
+
const bl = fs({}), Bd = ({ enabled: t, initialize: e, children: n }) => {
|
|
4176
4183
|
const [r, s] = zn(!1);
|
|
4177
4184
|
return Ft(() => {
|
|
4178
4185
|
!r && t && e().then(() => s(!0));
|
|
4179
|
-
}, [r, t, e]), /* @__PURE__ */ xs(
|
|
4186
|
+
}, [r, t, e]), /* @__PURE__ */ xs(bl.Provider, { value: {}, children: n });
|
|
4180
4187
|
};
|
|
4181
4188
|
export {
|
|
4182
4189
|
tt as ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES,
|
|
4183
4190
|
Jt as ARGENT_MULTISIG_CONTRACT_CLASS_HASHES,
|
|
4184
|
-
|
|
4185
|
-
|
|
4191
|
+
kl as AddSmartAccountResponseSchema,
|
|
4192
|
+
Pl as AddSmartAcountRequestSchema,
|
|
4186
4193
|
vs as BackendAccountSchema,
|
|
4187
|
-
|
|
4188
|
-
|
|
4194
|
+
Su as BackendNftService,
|
|
4195
|
+
Cd as BaseError,
|
|
4189
4196
|
eo as C0_PROXY_CONTRACT_CLASS_HASHES,
|
|
4190
|
-
|
|
4197
|
+
Hl as CacheService,
|
|
4191
4198
|
Vt as DEFAULT_TOKEN_DECIMALS,
|
|
4192
|
-
|
|
4193
|
-
|
|
4199
|
+
Vl as DateService,
|
|
4200
|
+
Od as ESTIMATE_ERROR_MESSAGES,
|
|
4194
4201
|
Vn as ETH_TOKEN_ADDRESS,
|
|
4195
4202
|
as as EstimateError,
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4203
|
+
kd as EventEmitterProvider,
|
|
4204
|
+
Pd as EventsBySelector,
|
|
4205
|
+
Rd as FEE_OVERHEAD,
|
|
4206
|
+
De as HTTPService,
|
|
4207
|
+
en as HTTP_ERROR_MESSAGE,
|
|
4201
4208
|
K as HttpError,
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4209
|
+
ru as KnownDappsBackendService,
|
|
4210
|
+
sn as MultiSigner,
|
|
4211
|
+
Pu as OnchainRecoveryService,
|
|
4212
|
+
el as PRETTY_UNLIMITED,
|
|
4206
4213
|
Oe as RecoveryStatusEnum,
|
|
4207
|
-
|
|
4214
|
+
ou as ResolveNameService,
|
|
4208
4215
|
Kr as STANDARD_DEVNET_ACCOUNT_CLASS_HASH,
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4216
|
+
$e as STRK_TOKEN_ADDRESS,
|
|
4217
|
+
Ml as SWRService,
|
|
4218
|
+
Zl as StarknetAddressService,
|
|
4212
4219
|
ke as StartOnchainRecoveryErrorStatusEnum,
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4220
|
+
$d as TOKEN_ERROR_MESSAGES,
|
|
4221
|
+
Fd as TXV1_ACCOUNT_CLASS_HASH,
|
|
4222
|
+
Ud as TXV1_MULTISIG_CLASS_HASH,
|
|
4223
|
+
jd as TXV3_ACCOUNT_CLASS_HASH,
|
|
4224
|
+
Ld as TXV3_MULTISIG_CLASS_HASH,
|
|
4218
4225
|
ss as TokenError,
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4226
|
+
Ku as TokenServiceWeb,
|
|
4227
|
+
ld as TransactionReviewServiceWeb,
|
|
4228
|
+
Bd as WebAmplitudeProvider,
|
|
4229
|
+
Td as WebAnalyticsServiceFactory,
|
|
4230
|
+
Dd as abiEntrySchema,
|
|
4231
|
+
Hd as abiSchema,
|
|
4232
|
+
Kc as activeOnchainRecoverySchema,
|
|
4233
|
+
Vd as addOwnersCalldataSchema,
|
|
4234
|
+
Md as addPluginCalldataSchema,
|
|
4235
|
+
Gd as addressInputCharactersAndLengthSchema,
|
|
4236
|
+
zd as addressInputSchema,
|
|
4237
|
+
qd as addressOrDomainInputSchema,
|
|
4238
|
+
Wd as addressOrDomainSchema,
|
|
4239
|
+
Kd as addressOrEmptyUndefinedSchema,
|
|
4233
4240
|
se as addressSchema,
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4241
|
+
Re as addressSchemaArgentBackend,
|
|
4242
|
+
Zd as addressSchemaBase,
|
|
4243
|
+
Yd as addressSchemaLooseLength,
|
|
4244
|
+
Xd as addressSchemaStrictLength,
|
|
4245
|
+
Jd as airdropSchema,
|
|
4239
4246
|
ns as apiAccountTokenBalancesSchema,
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4247
|
+
Qd as apiAirdropSchema,
|
|
4248
|
+
tf as apiCollateralizedDebtPositionSchema,
|
|
4249
|
+
ef as apiCollateralizedDebtPositionsSchema,
|
|
4250
|
+
nf as apiConcentratedLiquidityPositionSchema,
|
|
4251
|
+
rf as apiConcentratedLiquidityPositionsSchema,
|
|
4252
|
+
sf as apiDefiDecompositionProduct,
|
|
4253
|
+
of as apiDefiDecompositionProducts,
|
|
4254
|
+
af as apiDefiDecompositionSchema,
|
|
4255
|
+
cf as apiDefiDecompositionToken,
|
|
4249
4256
|
rs as apiDefiPositionsSchema,
|
|
4250
|
-
|
|
4251
|
-
|
|
4257
|
+
lf as apiPriceDataResponseSchema,
|
|
4258
|
+
uf as apiPriceDetailsSchema,
|
|
4252
4259
|
es as apiTokenInfoResponseSchema,
|
|
4253
|
-
|
|
4260
|
+
df as apiTokenInfoSchema,
|
|
4254
4261
|
ts as apiTokensInfoResponseSchema,
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4262
|
+
ud as apiTransactionReviewActivityType,
|
|
4263
|
+
ff as apiUnclaimedRewardsSchema,
|
|
4264
|
+
hf as apiWalletResponseSchema,
|
|
4258
4265
|
Bs as argentBackendNetworkIdSchema,
|
|
4259
4266
|
is as argentMaxFee,
|
|
4260
|
-
|
|
4267
|
+
pf as argentNameSchema,
|
|
4261
4268
|
Ts as argentNetworkIdSchema,
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4269
|
+
Dl as bigDecimal,
|
|
4270
|
+
mf as bigNumberSchema,
|
|
4271
|
+
gf as bigNumberishSchema,
|
|
4272
|
+
wf as booleanToStringSchema,
|
|
4273
|
+
yl as buildAccountDeployTransaction,
|
|
4267
4274
|
Ia as buildConstructorCalldata,
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4275
|
+
nd as buildDummyTx,
|
|
4276
|
+
yf as builtinsSchema,
|
|
4277
|
+
bf as byteCodeSchema,
|
|
4278
|
+
Sf as cairo1EventSchema,
|
|
4279
|
+
Ef as cairoAssemblySchema,
|
|
4280
|
+
Af as cairoVersionSchema,
|
|
4281
|
+
fl as calculateCubeRootAdjustment,
|
|
4282
|
+
od as calculateNonLinearAdjustment,
|
|
4283
|
+
sd as calculateSqrtAdjustment,
|
|
4284
|
+
xf as callDetailsSchema,
|
|
4278
4285
|
Dr as callSchema,
|
|
4279
|
-
|
|
4286
|
+
vf as calldataSchema,
|
|
4280
4287
|
At as castFeeEstimation,
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4288
|
+
If as changeGuardianCalldataSchema,
|
|
4289
|
+
Tf as changeThresholdCalldataSchema,
|
|
4290
|
+
wl as checkGasFeeBalance,
|
|
4291
|
+
ad as classHashSupportsTxV3,
|
|
4292
|
+
Bf as collateralizedDebtGroupSchema,
|
|
4293
|
+
_f as collateralizedDebtPositionSchema,
|
|
4294
|
+
Nf as collateralizedDebtPositionsSchema,
|
|
4295
|
+
Cf as compiledContractClassSchema,
|
|
4296
|
+
Of as compiledSierraCasmSchema,
|
|
4297
|
+
kf as compiledSierraSchema,
|
|
4298
|
+
Pf as compressedProgramSchema,
|
|
4299
|
+
Rf as concentratedLiquidityPositionSchema,
|
|
4300
|
+
$f as concentratedLiquidityPositionsSchema,
|
|
4294
4301
|
Zr as constructorCallDataSchemaC0,
|
|
4295
4302
|
Yr as constructorCallDataSchemaC1V1,
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4303
|
+
Ff as contractEntryPointFieldsSchema,
|
|
4304
|
+
Mu as convertTokenAmountToCurrencyValue,
|
|
4305
|
+
Gu as convertTokenUnitAmountWithDecimals,
|
|
4299
4306
|
_a as dappContractSchema,
|
|
4300
4307
|
Ba as dappLinkSchema,
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4308
|
+
uu as daysBetween,
|
|
4309
|
+
gi as decodeBase58,
|
|
4310
|
+
lu as decodeBase58Array,
|
|
4311
|
+
Uf as defiDappsProductsSchema,
|
|
4312
|
+
jf as defiPositionSchema,
|
|
4313
|
+
Lf as defiPositionTypeSchema,
|
|
4314
|
+
Df as defiProductSchema,
|
|
4315
|
+
Hf as defiProductsSchema,
|
|
4316
|
+
Vf as denyTxV3,
|
|
4317
|
+
mi as encodeBase58,
|
|
4318
|
+
cu as encodeBase58Array,
|
|
4312
4319
|
oe as ensureArray,
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4320
|
+
zu as ensureDecimals,
|
|
4321
|
+
yu as entryPointToHumanReadable,
|
|
4322
|
+
Mf as entryPointsByTypeSchema,
|
|
4323
|
+
Iu as equalNft,
|
|
4324
|
+
Zu as erc20TransferTransaction,
|
|
4325
|
+
Xu as erc721SafeTransferFromTransaction,
|
|
4326
|
+
Yu as erc721TransferFromTransaction,
|
|
4327
|
+
Gf as escapeGuardianCalldataSchema,
|
|
4321
4328
|
Pe as estimatedFeeToMaxFeeTotal,
|
|
4322
|
-
|
|
4329
|
+
rd as estimatedFeeToMaxResourceBounds,
|
|
4323
4330
|
re as estimatedFeeToTotal,
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
+
ed as estimatedFeesToMaxFeeTotal,
|
|
4332
|
+
td as estimatedFeesToTotal,
|
|
4333
|
+
zf as eventAbiSchema,
|
|
4334
|
+
qf as eventEntrySchema,
|
|
4335
|
+
Wf as executeOnPluginCalldataSchema,
|
|
4336
|
+
Xe as feeTokenNeedsTxV3Support,
|
|
4337
|
+
Kf as feltSchema,
|
|
4331
4338
|
tr as fetchData,
|
|
4332
4339
|
Xt as fetcherError,
|
|
4333
|
-
|
|
4334
|
-
|
|
4340
|
+
tu as findImplementationForAccount,
|
|
4341
|
+
Zf as findTransfersAndApprovals,
|
|
4335
4342
|
or as formatAddress,
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4343
|
+
Yf as formatFullAddress,
|
|
4344
|
+
Xf as formatTruncatedAddress,
|
|
4345
|
+
Jf as formatTruncatedSignerKey,
|
|
4346
|
+
Qf as formatTruncatedString,
|
|
4347
|
+
th as functionAbiSchema,
|
|
4348
|
+
eh as functionAbiTypeSchema,
|
|
4342
4349
|
ee as generateAvatarImage,
|
|
4343
4350
|
Ta as getAccountContractAddress,
|
|
4344
4351
|
va as getAccountDeploymentPayload,
|
|
4345
|
-
|
|
4352
|
+
ql as getAccountIdentifier,
|
|
4346
4353
|
qr as getAddressFromArgentName,
|
|
4347
4354
|
to as getAddressFromStarkName,
|
|
4348
|
-
|
|
4355
|
+
pn as getArgentAccountClassHashes,
|
|
4349
4356
|
Aa as getArgentAccountClassHashesWithTxV3Support,
|
|
4350
4357
|
Ea as getArgentAccountWithMultiSignerClassHashes,
|
|
4351
|
-
|
|
4358
|
+
Kl as getBackendTimeNowSeconds,
|
|
4352
4359
|
Zs as getBackendTimeSeconds,
|
|
4353
4360
|
Qs as getCallFromStarkName,
|
|
4354
4361
|
Ys as getChainIdFromNetworkId,
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4362
|
+
hi as getColor,
|
|
4363
|
+
ka as getDapplandLinkForDapp,
|
|
4364
|
+
su as getDapplandUrlForDapp,
|
|
4365
|
+
Sd as getDisplayWarnAndReasonForTransactionReview,
|
|
4359
4366
|
ge as getERC20Transactions,
|
|
4360
4367
|
Lr as getERC721Transactions,
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4368
|
+
ll as getEstimatedFeeFromBulkSimulation,
|
|
4369
|
+
dl as getEstimatedFeeFromSimulationAndRespectWatermarkFee,
|
|
4370
|
+
di as getInitials,
|
|
4371
|
+
Xl as getLastCairo0ArgentAccountClassHash,
|
|
4365
4372
|
Sa as getLatestArgentAccountClassHash,
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4373
|
+
Yl as getLatestArgentMultisigClassHash,
|
|
4374
|
+
Ql as getLatestLedgerAccountClassHash,
|
|
4375
|
+
Jl as getLedgerAccountClassHashes,
|
|
4376
|
+
nh as getMessageFromTrpcError,
|
|
4377
|
+
Ed as getNFTTransferActivity,
|
|
4378
|
+
iu as getNetworkAccountImageUrl,
|
|
4379
|
+
vu as getNftPicture,
|
|
4380
|
+
ul as getPayloadFromTransaction,
|
|
4381
|
+
rh as getPrettyRpcError,
|
|
4382
|
+
gl as getReviewForTransactions,
|
|
4383
|
+
rn as getSignerForMultiSigner,
|
|
4384
|
+
id as getSimulationTxVersionFromFeeToken,
|
|
4378
4385
|
Js as getStarknetIdContractAddressFromNetworkId,
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4386
|
+
Jc as getTokenBalance,
|
|
4387
|
+
Hu as getTokens,
|
|
4388
|
+
Du as getTokensBalances,
|
|
4389
|
+
Ad as getTransactionReviewActivityOfType,
|
|
4390
|
+
xd as getTransactionReviewHasSwap,
|
|
4391
|
+
ml as getTransactionReviewSwap,
|
|
4392
|
+
vd as getTransactionReviewWithType,
|
|
4393
|
+
Un as getTxVersionFromFeeToken,
|
|
4394
|
+
cd as getTxVersionFromFeeTokenForDeclareContract,
|
|
4395
|
+
Xc as getUAParserResult,
|
|
4389
4396
|
jt as getUint256CalldataFromBN,
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4397
|
+
cl as getWatermarkedMaxFeeTotal,
|
|
4398
|
+
hd as hasERC20Transactions,
|
|
4399
|
+
pl as hasERC721Transactions,
|
|
4400
|
+
pd as hasIncomingERC20Transactions,
|
|
4401
|
+
md as hasOutgoingERC20Transactions,
|
|
4395
4402
|
Pt as hexSchema,
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4403
|
+
sh as hexSchemaBase,
|
|
4404
|
+
li as id,
|
|
4405
|
+
nn as implementationSchema,
|
|
4406
|
+
oh as includesAddress,
|
|
4407
|
+
ah as inputAmountSchema,
|
|
4408
|
+
Fl as isAccountV4,
|
|
4409
|
+
$l as isAccountV5,
|
|
4410
|
+
Rl as isAccountV6,
|
|
4404
4411
|
Mr as isAddress,
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4412
|
+
pu as isAllowedAddressHexInputValue,
|
|
4413
|
+
mu as isAllowedNumericInputValue,
|
|
4414
|
+
Ll as isArgentBackendNetworkId,
|
|
4408
4415
|
zr as isArgentName,
|
|
4409
|
-
|
|
4410
|
-
|
|
4416
|
+
jl as isArgentNetworkId,
|
|
4417
|
+
Ru as isBraveBrowser,
|
|
4411
4418
|
me as isBrowser,
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4419
|
+
Fu as isChromeBrowser,
|
|
4420
|
+
fu as isContractDeployed,
|
|
4421
|
+
ju as isEdgeBrowser,
|
|
4415
4422
|
nt as isEqualAddress,
|
|
4416
|
-
|
|
4423
|
+
ih as isEqualArgentName,
|
|
4417
4424
|
xa as isEqualImplementation,
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4425
|
+
ch as isEqualStarknetDomainName,
|
|
4426
|
+
lh as isEqualStarknetId,
|
|
4427
|
+
il as isFRI,
|
|
4428
|
+
du as isFeatureEnabled,
|
|
4429
|
+
$u as isFirefoxBrowser,
|
|
4423
4430
|
Y as isNumeric,
|
|
4424
|
-
|
|
4425
|
-
|
|
4431
|
+
Uu as isSafariBrowser,
|
|
4432
|
+
uh as isStarknetDomainName,
|
|
4426
4433
|
Gr as isStarknetId,
|
|
4427
|
-
|
|
4434
|
+
tl as isUnlimitedAmount,
|
|
4428
4435
|
Vr as isValidAddress,
|
|
4429
|
-
|
|
4436
|
+
dh as isValidInputAmount,
|
|
4430
4437
|
Ur as isWEI,
|
|
4431
4438
|
Hr as isZeroAddress,
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4439
|
+
Ca as knownDappSchema,
|
|
4440
|
+
Oa as knownDappsSchema,
|
|
4441
|
+
fh as legacyContractClassSchema,
|
|
4442
|
+
hh as legacyEventSchema,
|
|
4443
|
+
ph as looseCalldataSchema,
|
|
4444
|
+
mh as modifySnjsFeeOverhead,
|
|
4445
|
+
gh as multiTypeSchema,
|
|
4446
|
+
Ju as multiplyBigIntByFloat,
|
|
4447
|
+
Ra as nameProviderResolutionSchema,
|
|
4448
|
+
$a as nameResolutionAddressSchema,
|
|
4449
|
+
Ua as nameResolutionAddressesSchema,
|
|
4443
4450
|
sr as nameResolutionStarknetIdSchema,
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4451
|
+
Pa as nameResolutionStarknetIdsSchema,
|
|
4452
|
+
hu as nonNullable,
|
|
4453
|
+
Hn as normalizeAddress,
|
|
4454
|
+
wh as normalizeAddressOrDomain,
|
|
4455
|
+
yh as normalizeArgentName,
|
|
4456
|
+
bh as normalizeStarknetId,
|
|
4457
|
+
Zc as onchainRecoverySchema,
|
|
4458
|
+
Sh as parseAmount,
|
|
4459
|
+
bi as parseAmountValue,
|
|
4460
|
+
gu as pluralise,
|
|
4461
|
+
Gl as postData,
|
|
4462
|
+
Ul as preferencesEndpointPayload,
|
|
4456
4463
|
Is as preferencesSchema,
|
|
4457
|
-
|
|
4458
|
-
|
|
4464
|
+
wi as prettifyCurrencyNumber,
|
|
4465
|
+
qu as prettifyCurrencyValue,
|
|
4459
4466
|
fr as prettifyNumber,
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4467
|
+
Ve as prettifyNumberConfig,
|
|
4468
|
+
Wu as prettifyTokenAmount,
|
|
4469
|
+
yi as prettifyTokenNumber,
|
|
4470
|
+
Eh as productGroupsSchema,
|
|
4471
|
+
Ah as programSchema,
|
|
4472
|
+
Fa as providersNamesSchema,
|
|
4473
|
+
xh as pythonicHintsSchema,
|
|
4474
|
+
vh as rawArgsArraySchema,
|
|
4475
|
+
Ih as rawArgsObjectSchema,
|
|
4476
|
+
Th as rawArgsSchema,
|
|
4477
|
+
wu as readFileAsString,
|
|
4471
4478
|
Fr as recoveryBaseSchema,
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4479
|
+
Ou as recoveryBodySchema,
|
|
4480
|
+
Wc as recoveryStatusSchema,
|
|
4481
|
+
Bh as removeOwnersCalldataSchema,
|
|
4482
|
+
_h as removePluginCalldataSchema,
|
|
4483
|
+
Nh as replaceSignerCalldataSchema,
|
|
4484
|
+
Lu as seedphraseSchema,
|
|
4485
|
+
Ch as sierraContractEntryPointFieldsSchema,
|
|
4486
|
+
Oh as sierraEntryPointsByTypeSchema,
|
|
4487
|
+
kh as sierraProgramDebugInfoSchema,
|
|
4481
4488
|
Xs as starkNameToCallDataDomain,
|
|
4482
|
-
|
|
4489
|
+
Ph as starknetDomainNameSchema,
|
|
4483
4490
|
Xr as starknetIdSchema,
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
+
ku as startOnchainRecoveryErrorSchema,
|
|
4492
|
+
Yc as startOnchainRecoveryErrorStatusSchema,
|
|
4493
|
+
qc as startOnchainRecoverySchema,
|
|
4494
|
+
Rh as stringToBooleanSchema,
|
|
4495
|
+
pi as stripAddressZeroPadding,
|
|
4496
|
+
$h as structAbiSchema,
|
|
4497
|
+
Wl as swrRefetchDisabledConfig,
|
|
4491
4498
|
Rt as toMax,
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4499
|
+
Qu as tokensRequireTxV3Support,
|
|
4500
|
+
Fh as transactionReviewTransactionsSchema,
|
|
4501
|
+
Uh as transactionReviewWarningSchema,
|
|
4495
4502
|
os as transferCalldataSchema,
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4503
|
+
jh as trpcErrorSchema,
|
|
4504
|
+
Lh as txVersionSchema,
|
|
4505
|
+
Dh as uint256Schema,
|
|
4506
|
+
Hh as unclaimedRewardsSchema,
|
|
4500
4507
|
Be as unitToFeeTokenAddress,
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4508
|
+
Si as urlWithQuery,
|
|
4509
|
+
dd as useBalanceChange,
|
|
4510
|
+
Au as useCollection,
|
|
4504
4511
|
Ks as useConditionallyEnabledSWR,
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4512
|
+
eu as useDebounce,
|
|
4513
|
+
nu as useDebouncedValue,
|
|
4514
|
+
fd as useERC20Transactions,
|
|
4515
|
+
gd as useERC721Transactions,
|
|
4516
|
+
Vh as useEmitEvent,
|
|
4517
|
+
Mh as useEventEmitter,
|
|
4518
|
+
Gh as useEventEmitterContext,
|
|
4519
|
+
zh as useEventListener,
|
|
4520
|
+
wd as useHasERC721Transaction,
|
|
4521
|
+
qh as useIsEventEmitterEnabled,
|
|
4522
|
+
yd as useMaxAmountTransaction,
|
|
4523
|
+
xu as useNft,
|
|
4524
|
+
Eu as useNfts,
|
|
4525
|
+
Vu as useToken,
|
|
4526
|
+
bd as useTransactionReview,
|
|
4527
|
+
Id as useTransactionReviewV2webFetcher,
|
|
4528
|
+
Wh as validChecksumAddressSchema,
|
|
4529
|
+
Kh as validateAddressRangeSchema,
|
|
4530
|
+
bu as voidify,
|
|
4531
|
+
zl as withPolling
|
|
4525
4532
|
};
|