@argent/x-shared 1.32.2 → 1.32.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/index.mjs +1132 -1122
- package/dist/knownDapps/schema.d.ts +6 -0
- package/dist/onchainRecovery/IOnchainRecoveryService.d.ts +4 -3
- package/dist/onchainRecovery/OnchainRecoveryService.d.ts +22 -15
- package/dist/onchainRecovery/schema.d.ts +69 -8
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import F, { z as h } from "zod";
|
|
2
|
-
import { p as
|
|
3
|
-
import { am as
|
|
4
|
-
import { constants as Z, starknetId as
|
|
5
|
-
import { useEffect as Yt, useRef as
|
|
6
|
-
import { isFunction as zt, isString as
|
|
7
|
-
import ae, { useSWRConfig as
|
|
8
|
-
import { hex as
|
|
9
|
-
import { UAParser as
|
|
10
|
-
import { validateMnemonic as
|
|
11
|
-
import { wordlist as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
2
|
+
import { p as xt, H as K, a as Je, u as k, N as $n, c as Fr, C as Fn, A as St, i as Ur, b as jr, n as Un, d as Lr, e as Dr, f as Hr, g as Vr, s as Q, h as nt, j as Qe, k as Mr, S as Gr, l as tn, M as en, m as zr, o as qr, q as jn, r as Wr, t as se, B as nn, v as oe, w as Pt, x as Kr, y as Zr, z as Yr, D as Xr, E as Jr, F as Qr, T as ts, G as ke, I as Ln, J as es, K as ye, L as ns, O as rs, P as ss, Q as os, R as _t } from "./transactionVersion-DLjpblNo.mjs";
|
|
3
|
+
import { am as Sd, aV as Ed, bN as Ad, aX as xd, aT as vd, an as Id, af as Td, ah as Bd, ag as _d, ai as Nd, bs as Cd, bA as Od, bg as kd, bk as Pd, a9 as Rd, aa as $d, a5 as Fd, a4 as Ud, Z as jd, W as Ld, X as Dd, Y as Hd, aM as Vd, az as Md, au as Gd, av as zd, as as qd, at as Wd, ax as Kd, aw as Zd, ay as Yd, ar as Xd, aq as Jd, ap as Qd, ao as tf, aA as ef, aj as nf, ab as rf, b1 as sf, b5 as of, b3 as af, bn as cf, bC as lf, bx as uf, bI as df, ae as ff, bc as hf, b7 as pf, be as mf, bj as gf, aD as wf, aE as yf, aF as bf, bK as Sf, bJ as Ef, bG as Af, bq as xf, aB as vf, aC as If, bo as Tf, aK as Bf, aG as _f, aL as Nf, aI as Cf, aJ as Of, b0 as kf, bp as Pf, bf as Rf, bz as $f, bv as Ff, bm as Uf, bd as jf, aY as Lf, $ as Df, _ as Hf, a1 as Vf, a2 as Mf, bu as Gf, bt as zf, aS as qf, aZ as Wf, b2 as Kf, a0 as Zf, aP as Yf, ac as Xf, a7 as Jf, ak as Qf, a6 as th, aQ as eh, bB as nh, bw as rh, aU as sh, b9 as oh, a8 as ah, ad as ih, al as ch, aO as lh, aH as uh, br as dh, bH as fh, b8 as hh, ba as ph, bb as mh, bh as gh, bl as wh, bi as yh, bE as bh, bF as Sh, bD as Eh, a3 as Ah, b4 as xh, by as vh, aW as Ih, a_ as Th, aR as Bh, a$ as _h, b6 as Nh, aN as Ch, bP as Oh, bO as kh, bL as Ph, bQ as Rh, bM as $h, U as Fh, V as Uh } from "./transactionVersion-DLjpblNo.mjs";
|
|
4
|
+
import { constants as Z, starknetId as Dn, CallData as mt, CairoOption as rn, CairoOptionVariant as sn, hash as Hn, num as O, encode as $t, uint256 as Dt, ec as as, isSierra as is, TransactionType as on } from "starknet";
|
|
5
|
+
import { useEffect as Yt, useRef as an, useState as cs, useMemo as vt, useCallback as Vn } from "react";
|
|
6
|
+
import { isFunction as zt, isString as Mn, upperCase as Pe, isNil as ls, upperFirst as us, lowerCase as Gn, isUndefined as ds, isEmpty as cn, isArray as fs } from "lodash-es";
|
|
7
|
+
import ae, { useSWRConfig as hs } from "swr";
|
|
8
|
+
import { hex as zn, base58 as qn, stringToBytes as ps } from "@scure/base";
|
|
9
|
+
import { UAParser as ms } from "ua-parser-js";
|
|
10
|
+
import { validateMnemonic as gs } from "@scure/bip39";
|
|
11
|
+
import { wordlist as ws } from "@scure/bip39/wordlists/english";
|
|
12
|
+
import ys from "object-hash";
|
|
13
|
+
const bs = h.object({
|
|
14
14
|
name: h.string().optional(),
|
|
15
15
|
address: h.string(),
|
|
16
16
|
ownerAddress: h.string(),
|
|
@@ -35,11 +35,11 @@ const Ss = h.object({
|
|
|
35
35
|
guid: h.string().optional(),
|
|
36
36
|
signerType: h.enum(["StarknetKey", "EthereumKey"]).optional()
|
|
37
37
|
}).optional()
|
|
38
|
-
}),
|
|
38
|
+
}), xl = h.object({
|
|
39
39
|
address: h.string(),
|
|
40
40
|
guardianAddress: h.string().optional(),
|
|
41
|
-
account:
|
|
42
|
-
}),
|
|
41
|
+
account: bs
|
|
42
|
+
}), vl = h.object({
|
|
43
43
|
ownerAddress: h.string(),
|
|
44
44
|
signature: h.object({
|
|
45
45
|
r: h.string(),
|
|
@@ -49,26 +49,26 @@ const Ss = h.object({
|
|
|
49
49
|
name: h.string().optional(),
|
|
50
50
|
icon: h.string().optional()
|
|
51
51
|
});
|
|
52
|
-
function
|
|
52
|
+
function Il(t) {
|
|
53
53
|
return "transactionVersion" in t;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function Tl(t) {
|
|
56
56
|
return "simulateTransaction" in t;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Bl(t) {
|
|
59
59
|
return !("simulateTransaction" in t);
|
|
60
60
|
}
|
|
61
|
-
const
|
|
61
|
+
const Ss = h.object({
|
|
62
62
|
value: h.string(),
|
|
63
63
|
platform: h.enum(["ios", "argentx", "android", "webwallet"]).nullable()
|
|
64
|
-
}),
|
|
65
|
-
preferences: h.record(
|
|
66
|
-
}),
|
|
67
|
-
function
|
|
68
|
-
return
|
|
64
|
+
}), _l = h.object({
|
|
65
|
+
preferences: h.record(Ss)
|
|
66
|
+
}), Es = h.enum(["mainnet-alpha", "sepolia-alpha"]), As = h.enum(["mainnet", "sepolia"]);
|
|
67
|
+
function Nl(t) {
|
|
68
|
+
return Es.safeParse(t).success;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
return
|
|
70
|
+
function Cl(t) {
|
|
71
|
+
return As.safeParse(t).success;
|
|
72
72
|
}
|
|
73
73
|
const Ht = 18;
|
|
74
74
|
function Vt({ value: t, decimals: e }) {
|
|
@@ -82,97 +82,97 @@ function Vt({ value: t, decimals: e }) {
|
|
|
82
82
|
const Re = (t, e) => ({
|
|
83
83
|
decimals: e,
|
|
84
84
|
value: e >= t.decimals ? t.value * BigInt(10) ** BigInt(e - t.decimals) : t.value / BigInt(10) ** BigInt(t.decimals - e)
|
|
85
|
-
}),
|
|
85
|
+
}), Wn = (t) => {
|
|
86
86
|
const e = t.value.toString().split("").reverse();
|
|
87
87
|
let n = 0;
|
|
88
88
|
for (let s = 0; s < e.length && e[s] === "0"; s++)
|
|
89
89
|
n++;
|
|
90
90
|
const r = t.decimals - n;
|
|
91
91
|
return Re(t, r);
|
|
92
|
-
},
|
|
92
|
+
}, Kn = (t, e) => {
|
|
93
93
|
const n = Math.max(t.decimals, e.decimals), [r, s] = [t, e].map((o) => Re(o, n));
|
|
94
94
|
return [r.value, s.value, n];
|
|
95
95
|
}, ie = (t) => (e, n) => {
|
|
96
|
-
const [r, s, o] =
|
|
96
|
+
const [r, s, o] = Kn(e, n);
|
|
97
97
|
return {
|
|
98
98
|
decimals: o,
|
|
99
99
|
value: t(r, s, o)
|
|
100
100
|
};
|
|
101
101
|
}, Mt = (t) => (e, n) => {
|
|
102
|
-
const [r, s] =
|
|
102
|
+
const [r, s] = Kn(e, n);
|
|
103
103
|
return t(r, s);
|
|
104
|
-
},
|
|
104
|
+
}, xs = ie((t, e) => t + e), vs = ie((t, e) => t - e), Is = ie((t, e, n) => {
|
|
105
105
|
if (e === BigInt(0))
|
|
106
106
|
throw new Error("Division by zero is not allowed");
|
|
107
107
|
return t * BigInt(10) ** BigInt(n) / e;
|
|
108
|
-
}),
|
|
108
|
+
}), Ts = (t, e) => Wn({
|
|
109
109
|
decimals: t.decimals + e.decimals,
|
|
110
110
|
value: t.value * e.value
|
|
111
|
-
}),
|
|
111
|
+
}), Bs = ie((t, e) => {
|
|
112
112
|
if (e === BigInt(0))
|
|
113
113
|
throw new Error("Modulus by zero is not allowed");
|
|
114
114
|
return t % e;
|
|
115
115
|
}), $e = (t) => ({
|
|
116
116
|
decimals: t.decimals,
|
|
117
117
|
value: t.value >= BigInt(0) ? t.value : -t.value
|
|
118
|
-
}),
|
|
119
|
-
function
|
|
118
|
+
}), Zn = Mt((t, e) => t === e), _s = Mt((t, e) => t < e), Ns = Mt((t, e) => t > e), Cs = Mt((t, e) => t <= e), Os = Mt((t, e) => t >= e), ks = (t, e) => !Zn(t, e);
|
|
119
|
+
function Ps(t) {
|
|
120
120
|
return Vt({ value: t, decimals: Ht });
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
return
|
|
122
|
+
function Rs(t) {
|
|
123
|
+
return xt(t, Ht);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function $s(t) {
|
|
126
126
|
return Vt({ value: t, decimals: Ht });
|
|
127
127
|
}
|
|
128
128
|
function Fe(t) {
|
|
129
|
-
return
|
|
129
|
+
return xt(t, Ht);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Fs(t) {
|
|
132
132
|
return $e({ value: t, decimals: 0 }).value;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Us(t) {
|
|
135
135
|
return $e(Fe(t));
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function js(t, e) {
|
|
138
138
|
return {
|
|
139
139
|
value: BigInt(t),
|
|
140
140
|
decimals: e
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
const
|
|
144
|
-
function
|
|
145
|
-
return h.string().refine((e) => /^-?\d+(\.\d+)?$/.test(e), { message: "Invalid number format" }).transform((e) =>
|
|
143
|
+
const Ls = { value: 1n, decimals: 0 };
|
|
144
|
+
function Ds(t) {
|
|
145
|
+
return h.string().refine((e) => /^-?\d+(\.\d+)?$/.test(e), { message: "Invalid number format" }).transform((e) => xt(e, t));
|
|
146
146
|
}
|
|
147
|
-
const
|
|
147
|
+
const Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
148
148
|
__proto__: null,
|
|
149
|
-
ONE:
|
|
149
|
+
ONE: Ls,
|
|
150
150
|
abs: $e,
|
|
151
|
-
absBigInt:
|
|
152
|
-
add:
|
|
153
|
-
createUnitsSchema:
|
|
154
|
-
div:
|
|
155
|
-
eq:
|
|
156
|
-
formatCurrency:
|
|
157
|
-
formatEther:
|
|
151
|
+
absBigInt: Fs,
|
|
152
|
+
add: xs,
|
|
153
|
+
createUnitsSchema: Ds,
|
|
154
|
+
div: Is,
|
|
155
|
+
eq: Zn,
|
|
156
|
+
formatCurrency: $s,
|
|
157
|
+
formatEther: Ps,
|
|
158
158
|
formatUnits: Vt,
|
|
159
|
-
gt:
|
|
160
|
-
gte:
|
|
161
|
-
lt:
|
|
162
|
-
lte:
|
|
163
|
-
mod:
|
|
164
|
-
mul:
|
|
165
|
-
not:
|
|
159
|
+
gt: Ns,
|
|
160
|
+
gte: Os,
|
|
161
|
+
lt: _s,
|
|
162
|
+
lte: Cs,
|
|
163
|
+
mod: Bs,
|
|
164
|
+
mul: Ts,
|
|
165
|
+
not: ks,
|
|
166
166
|
parseCurrency: Fe,
|
|
167
|
-
parseCurrencyAbs:
|
|
168
|
-
parseEther:
|
|
169
|
-
parseUnits:
|
|
170
|
-
sub:
|
|
171
|
-
toBigDecimal:
|
|
167
|
+
parseCurrencyAbs: Us,
|
|
168
|
+
parseEther: Rs,
|
|
169
|
+
parseUnits: xt,
|
|
170
|
+
sub: vs,
|
|
171
|
+
toBigDecimal: js,
|
|
172
172
|
toFixedDecimals: Re,
|
|
173
|
-
toTiniestPossibleDecimal:
|
|
173
|
+
toTiniestPossibleDecimal: Wn
|
|
174
174
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
175
|
-
class
|
|
175
|
+
class kl {
|
|
176
176
|
constructor(e, n) {
|
|
177
177
|
this.cachePromise = n.open(e).catch((r) => (console.error(new Error("Failed to open cache", { cause: r })), null));
|
|
178
178
|
}
|
|
@@ -206,7 +206,7 @@ class Nl {
|
|
|
206
206
|
await Promise.allSettled(n.map((r) => e.delete(r)));
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
class
|
|
209
|
+
class Pl {
|
|
210
210
|
constructor(e, n) {
|
|
211
211
|
this.httpService = e, this.baseUrl = n, this.offsetInS = 0, this.syncIntervalInMs = 60 * 1e3, this.initialSync = this.syncWithServer(), setInterval(() => void this.syncWithServer(), this.syncIntervalInMs);
|
|
212
212
|
}
|
|
@@ -307,7 +307,7 @@ class Ue {
|
|
|
307
307
|
const qt = (t) => {
|
|
308
308
|
process.env.NODE_ENV;
|
|
309
309
|
};
|
|
310
|
-
function
|
|
310
|
+
function Hs(t, e) {
|
|
311
311
|
const n = t.clone(), r = new Headers(n.headers);
|
|
312
312
|
for (const [s, o] of Object.entries(e))
|
|
313
313
|
r.set(s, o);
|
|
@@ -317,7 +317,7 @@ function Vs(t, e) {
|
|
|
317
317
|
headers: r
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
|
-
class
|
|
320
|
+
class Rl {
|
|
321
321
|
constructor(e, n, r, s) {
|
|
322
322
|
this.dateService = e, this.cacheService = n, this.httpService = r, this.options = s, this.inFlightRequests = /* @__PURE__ */ new Map();
|
|
323
323
|
}
|
|
@@ -344,7 +344,7 @@ class Ol {
|
|
|
344
344
|
if (!r) {
|
|
345
345
|
const s = this.httpService.get(e, n).then(async (o) => {
|
|
346
346
|
const a = await this.dateService.now();
|
|
347
|
-
return await this.cacheService.set(e,
|
|
347
|
+
return await this.cacheService.set(e, Hs(o, {
|
|
348
348
|
date: a.toUTCString()
|
|
349
349
|
})), o;
|
|
350
350
|
}).finally(() => {
|
|
@@ -369,7 +369,7 @@ const Xt = (t, e, n) => {
|
|
|
369
369
|
} catch {
|
|
370
370
|
}
|
|
371
371
|
return r;
|
|
372
|
-
},
|
|
372
|
+
}, Yn = async (t, e) => {
|
|
373
373
|
const n = await fetch(t, e), r = await n.text();
|
|
374
374
|
if (!n.ok)
|
|
375
375
|
throw Xt("An error occurred while fetching", n, r);
|
|
@@ -378,7 +378,7 @@ const Xt = (t, e, n) => {
|
|
|
378
378
|
} catch {
|
|
379
379
|
throw Xt("An error occurred while parsing", n, r);
|
|
380
380
|
}
|
|
381
|
-
},
|
|
381
|
+
}, $l = async (t, e) => {
|
|
382
382
|
const n = await fetch(t, {
|
|
383
383
|
method: "POST",
|
|
384
384
|
...e
|
|
@@ -390,38 +390,38 @@ const Xt = (t, e, n) => {
|
|
|
390
390
|
} catch {
|
|
391
391
|
throw Xt("An error occurred while parsing", n, r);
|
|
392
392
|
}
|
|
393
|
-
},
|
|
393
|
+
}, Fl = (t) => ({
|
|
394
394
|
refreshInterval: t,
|
|
395
395
|
dedupingInterval: t
|
|
396
|
-
}),
|
|
396
|
+
}), Ul = (t) => `${t.networkId}::${t.address}`, Vs = () => {
|
|
397
397
|
};
|
|
398
|
-
function
|
|
399
|
-
const { cache: s } =
|
|
398
|
+
function Ms(t, e, n, r) {
|
|
399
|
+
const { cache: s } = hs(), o = ae(t && e, t ? n : Vs, r);
|
|
400
400
|
return Yt(() => {
|
|
401
401
|
t || (o.mutate(), s.delete(e));
|
|
402
402
|
}, [t]), o;
|
|
403
403
|
}
|
|
404
|
-
const
|
|
404
|
+
const jl = {
|
|
405
405
|
revalidateOnFocus: !1,
|
|
406
406
|
revalidateOnMount: !0,
|
|
407
407
|
revalidateOnReconnect: !1,
|
|
408
408
|
refreshWhenOffline: !1,
|
|
409
409
|
refreshWhenHidden: !1,
|
|
410
410
|
refreshInterval: 0
|
|
411
|
-
},
|
|
411
|
+
}, Gs = async (t, e) => {
|
|
412
412
|
try {
|
|
413
|
-
const { time: n } = await
|
|
413
|
+
const { time: n } = await Yn(k(t, "time"), {
|
|
414
414
|
headers: e
|
|
415
415
|
});
|
|
416
416
|
return n;
|
|
417
417
|
} catch {
|
|
418
418
|
throw new Error("failed to request time");
|
|
419
419
|
}
|
|
420
|
-
},
|
|
421
|
-
const n = await
|
|
420
|
+
}, Ll = async (t, e) => {
|
|
421
|
+
const n = await Gs(t, e);
|
|
422
422
|
return Math.floor(n);
|
|
423
423
|
};
|
|
424
|
-
function
|
|
424
|
+
function zs(t) {
|
|
425
425
|
switch (t) {
|
|
426
426
|
case "mainnet-alpha":
|
|
427
427
|
case Z.NetworkName.SN_MAIN:
|
|
@@ -430,45 +430,45 @@ function qs(t) {
|
|
|
430
430
|
case Z.NetworkName.SN_SEPOLIA:
|
|
431
431
|
return Z.StarknetChainId.SN_SEPOLIA;
|
|
432
432
|
default:
|
|
433
|
-
throw new
|
|
433
|
+
throw new $n({
|
|
434
434
|
code: "NOT_FOUND",
|
|
435
435
|
message: `Unknown networkId: ${t}`
|
|
436
436
|
});
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
-
function
|
|
440
|
-
return t.replace(".stark", "").split(".").map((r) =>
|
|
439
|
+
function qs(t) {
|
|
440
|
+
return t.replace(".stark", "").split(".").map((r) => Dn.useEncoded(r).toString(10));
|
|
441
441
|
}
|
|
442
|
-
function
|
|
443
|
-
const e =
|
|
444
|
-
return
|
|
442
|
+
function Ws(t) {
|
|
443
|
+
const e = zs(t);
|
|
444
|
+
return Dn.getStarknetIdContract(e);
|
|
445
445
|
}
|
|
446
|
-
function
|
|
447
|
-
const n =
|
|
446
|
+
function Ks(t, e) {
|
|
447
|
+
const n = Ws(e), r = qs(t);
|
|
448
448
|
try {
|
|
449
449
|
const o = { domain: r, hint: [] };
|
|
450
|
-
return
|
|
450
|
+
return Fr.parse({
|
|
451
451
|
contractAddress: n,
|
|
452
452
|
entrypoint: "domain_to_address",
|
|
453
453
|
calldata: o
|
|
454
454
|
});
|
|
455
455
|
} catch (s) {
|
|
456
|
-
throw new
|
|
456
|
+
throw new Fn({
|
|
457
457
|
code: "NOT_VALID",
|
|
458
458
|
options: { error: s }
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
async function
|
|
462
|
+
async function Zs(t, e, n) {
|
|
463
463
|
if (!e || !n)
|
|
464
|
-
throw new
|
|
464
|
+
throw new $n({
|
|
465
465
|
code: "NO_NETWORK_OR_MULTICALL"
|
|
466
466
|
});
|
|
467
467
|
let r = null;
|
|
468
468
|
try {
|
|
469
|
-
r =
|
|
469
|
+
r = Ks(t, e);
|
|
470
470
|
} catch (i) {
|
|
471
|
-
throw new
|
|
471
|
+
throw new Fn({
|
|
472
472
|
code: "NOT_VALID",
|
|
473
473
|
options: { error: i }
|
|
474
474
|
});
|
|
@@ -477,52 +477,52 @@ async function Ys(t, e, n) {
|
|
|
477
477
|
try {
|
|
478
478
|
s = await n.callContract(r), o = s[0];
|
|
479
479
|
} catch {
|
|
480
|
-
throw new
|
|
480
|
+
throw new St({
|
|
481
481
|
code: "STARKNAME_ERROR"
|
|
482
482
|
});
|
|
483
483
|
}
|
|
484
|
-
if (
|
|
485
|
-
throw new
|
|
484
|
+
if (Ur(o))
|
|
485
|
+
throw new St({
|
|
486
486
|
code: "STARKNAME_NOT_FOUND",
|
|
487
487
|
message: `${t} not found`
|
|
488
488
|
});
|
|
489
|
-
if (!
|
|
490
|
-
throw new
|
|
489
|
+
if (!jr(o))
|
|
490
|
+
throw new St({
|
|
491
491
|
code: "STARKNAME_INVALID_ADDRESS",
|
|
492
492
|
message: `${t} resolved to an invalid address (${o})`
|
|
493
493
|
});
|
|
494
|
-
return
|
|
494
|
+
return Un(o);
|
|
495
495
|
}
|
|
496
|
-
class
|
|
496
|
+
class Dl {
|
|
497
497
|
constructor(e, n, r) {
|
|
498
498
|
this.httpService = e, this.baseUrl = n, this.allowedArgentNameNetworkId = r;
|
|
499
499
|
}
|
|
500
500
|
async parseAddressOrDomain(e, n, r) {
|
|
501
|
-
if (
|
|
502
|
-
return
|
|
501
|
+
if (Lr(e))
|
|
502
|
+
return Un(e);
|
|
503
503
|
try {
|
|
504
504
|
return await this.getAddressFromDomainName(e, n, r);
|
|
505
505
|
} catch {
|
|
506
|
-
throw new
|
|
506
|
+
throw new St({ code: "NOT_VALID" });
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
async getAddressFromDomainName(e, n, r) {
|
|
510
|
-
if (
|
|
511
|
-
return
|
|
512
|
-
if (
|
|
510
|
+
if (Dr(e))
|
|
511
|
+
return Zs(e, n, r);
|
|
512
|
+
if (Hr(e)) {
|
|
513
513
|
if (n !== this.allowedArgentNameNetworkId)
|
|
514
|
-
throw new
|
|
514
|
+
throw new St({
|
|
515
515
|
code: "ARGENT_NAME_INVALID_NETWORK",
|
|
516
516
|
message: `Argent name is only enabled on "${this.allowedArgentNameNetworkId}"`
|
|
517
517
|
});
|
|
518
|
-
return
|
|
518
|
+
return Vr(e, this.httpService, this.baseUrl);
|
|
519
519
|
}
|
|
520
|
-
throw new
|
|
520
|
+
throw new St({
|
|
521
521
|
code: "NO_ADDRESS_FROM_DOMAIN"
|
|
522
522
|
});
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
|
-
const
|
|
525
|
+
const Ys = [
|
|
526
526
|
"0x25ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918"
|
|
527
527
|
], tt = {
|
|
528
528
|
// CAIRO_0
|
|
@@ -539,48 +539,48 @@ const Xs = [
|
|
|
539
539
|
"0.1.1": "0x6e150953b26271a740bf2b6e9bca17cc52c68d765f761295de51ceb8526ee72",
|
|
540
540
|
"0.1.0": "0x737ee2f87ce571a58c6c8da558ec18a07ceb64a6172d5ec46171fbc80077a48"
|
|
541
541
|
};
|
|
542
|
-
var
|
|
543
|
-
function
|
|
544
|
-
var e =
|
|
542
|
+
var Xs = typeof global == "object" && global && global.Object === Object && global, Js = typeof self == "object" && self && self.Object === Object && self, ce = Xs || Js || Function("return this")(), Qt = ce.Symbol, Xn = Object.prototype, Qs = Xn.hasOwnProperty, to = Xn.toString, Nt = Qt ? Qt.toStringTag : void 0;
|
|
543
|
+
function eo(t) {
|
|
544
|
+
var e = Qs.call(t, Nt), n = t[Nt];
|
|
545
545
|
try {
|
|
546
|
-
t[
|
|
546
|
+
t[Nt] = void 0;
|
|
547
547
|
var r = !0;
|
|
548
548
|
} catch {
|
|
549
549
|
}
|
|
550
|
-
var s =
|
|
551
|
-
return r && (e ? t[
|
|
550
|
+
var s = to.call(t);
|
|
551
|
+
return r && (e ? t[Nt] = n : delete t[Nt]), s;
|
|
552
552
|
}
|
|
553
|
-
var
|
|
554
|
-
function
|
|
555
|
-
return
|
|
553
|
+
var no = Object.prototype, ro = no.toString;
|
|
554
|
+
function so(t) {
|
|
555
|
+
return ro.call(t);
|
|
556
556
|
}
|
|
557
|
-
var
|
|
558
|
-
function
|
|
559
|
-
return t == null ? t === void 0 ?
|
|
557
|
+
var oo = "[object Null]", ao = "[object Undefined]", ln = Qt ? Qt.toStringTag : void 0;
|
|
558
|
+
function io(t) {
|
|
559
|
+
return t == null ? t === void 0 ? ao : oo : ln && ln in Object(t) ? eo(t) : so(t);
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function Jn(t) {
|
|
562
562
|
var e = typeof t;
|
|
563
563
|
return t != null && (e == "object" || e == "function");
|
|
564
564
|
}
|
|
565
|
-
var
|
|
566
|
-
function
|
|
567
|
-
if (!
|
|
565
|
+
var co = "[object AsyncFunction]", lo = "[object Function]", uo = "[object GeneratorFunction]", fo = "[object Proxy]";
|
|
566
|
+
function ho(t) {
|
|
567
|
+
if (!Jn(t))
|
|
568
568
|
return !1;
|
|
569
|
-
var e =
|
|
570
|
-
return e ==
|
|
569
|
+
var e = io(t);
|
|
570
|
+
return e == lo || e == uo || e == co || e == fo;
|
|
571
571
|
}
|
|
572
|
-
var be = ce["__core-js_shared__"],
|
|
572
|
+
var be = ce["__core-js_shared__"], un = function() {
|
|
573
573
|
var t = /[^.]+$/.exec(be && be.keys && be.keys.IE_PROTO || "");
|
|
574
574
|
return t ? "Symbol(src)_1." + t : "";
|
|
575
575
|
}();
|
|
576
|
-
function
|
|
577
|
-
return !!
|
|
576
|
+
function po(t) {
|
|
577
|
+
return !!un && un in t;
|
|
578
578
|
}
|
|
579
|
-
var
|
|
580
|
-
function
|
|
579
|
+
var mo = Function.prototype, go = mo.toString;
|
|
580
|
+
function wo(t) {
|
|
581
581
|
if (t != null) {
|
|
582
582
|
try {
|
|
583
|
-
return
|
|
583
|
+
return go.call(t);
|
|
584
584
|
} catch {
|
|
585
585
|
}
|
|
586
586
|
try {
|
|
@@ -590,212 +590,212 @@ function yo(t) {
|
|
|
590
590
|
}
|
|
591
591
|
return "";
|
|
592
592
|
}
|
|
593
|
-
var
|
|
594
|
-
"^" +
|
|
593
|
+
var yo = /[\\^$.*+?()[\]{}|]/g, bo = /^\[object .+?Constructor\]$/, So = Function.prototype, Eo = Object.prototype, Ao = So.toString, xo = Eo.hasOwnProperty, vo = RegExp(
|
|
594
|
+
"^" + Ao.call(xo).replace(yo, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
595
595
|
);
|
|
596
|
-
function
|
|
597
|
-
if (!
|
|
596
|
+
function Io(t) {
|
|
597
|
+
if (!Jn(t) || po(t))
|
|
598
598
|
return !1;
|
|
599
|
-
var e =
|
|
600
|
-
return e.test(
|
|
599
|
+
var e = ho(t) ? vo : bo;
|
|
600
|
+
return e.test(wo(t));
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function To(t, e) {
|
|
603
603
|
return t == null ? void 0 : t[e];
|
|
604
604
|
}
|
|
605
605
|
function je(t, e) {
|
|
606
|
-
var n =
|
|
607
|
-
return
|
|
606
|
+
var n = To(t, e);
|
|
607
|
+
return Io(n) ? n : void 0;
|
|
608
608
|
}
|
|
609
609
|
var Ft = je(Object, "create");
|
|
610
|
-
function
|
|
610
|
+
function Bo() {
|
|
611
611
|
this.__data__ = Ft ? Ft(null) : {}, this.size = 0;
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function _o(t) {
|
|
614
614
|
var e = this.has(t) && delete this.__data__[t];
|
|
615
615
|
return this.size -= e ? 1 : 0, e;
|
|
616
616
|
}
|
|
617
|
-
var
|
|
618
|
-
function
|
|
617
|
+
var No = "__lodash_hash_undefined__", Co = Object.prototype, Oo = Co.hasOwnProperty;
|
|
618
|
+
function ko(t) {
|
|
619
619
|
var e = this.__data__;
|
|
620
620
|
if (Ft) {
|
|
621
621
|
var n = e[t];
|
|
622
|
-
return n ===
|
|
622
|
+
return n === No ? void 0 : n;
|
|
623
623
|
}
|
|
624
|
-
return
|
|
624
|
+
return Oo.call(e, t) ? e[t] : void 0;
|
|
625
625
|
}
|
|
626
|
-
var
|
|
627
|
-
function
|
|
626
|
+
var Po = Object.prototype, Ro = Po.hasOwnProperty;
|
|
627
|
+
function $o(t) {
|
|
628
628
|
var e = this.__data__;
|
|
629
|
-
return Ft ? e[t] !== void 0 :
|
|
629
|
+
return Ft ? e[t] !== void 0 : Ro.call(e, t);
|
|
630
630
|
}
|
|
631
|
-
var
|
|
632
|
-
function
|
|
631
|
+
var Fo = "__lodash_hash_undefined__";
|
|
632
|
+
function Uo(t, e) {
|
|
633
633
|
var n = this.__data__;
|
|
634
|
-
return this.size += this.has(t) ? 0 : 1, n[t] = Ft && e === void 0 ?
|
|
634
|
+
return this.size += this.has(t) ? 0 : 1, n[t] = Ft && e === void 0 ? Fo : e, this;
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function ft(t) {
|
|
637
637
|
var e = -1, n = t == null ? 0 : t.length;
|
|
638
638
|
for (this.clear(); ++e < n; ) {
|
|
639
639
|
var r = t[e];
|
|
640
640
|
this.set(r[0], r[1]);
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
function
|
|
643
|
+
ft.prototype.clear = Bo;
|
|
644
|
+
ft.prototype.delete = _o;
|
|
645
|
+
ft.prototype.get = ko;
|
|
646
|
+
ft.prototype.has = $o;
|
|
647
|
+
ft.prototype.set = Uo;
|
|
648
|
+
function jo() {
|
|
649
649
|
this.__data__ = [], this.size = 0;
|
|
650
650
|
}
|
|
651
|
-
function
|
|
651
|
+
function Lo(t, e) {
|
|
652
652
|
return t === e || t !== t && e !== e;
|
|
653
653
|
}
|
|
654
654
|
function le(t, e) {
|
|
655
655
|
for (var n = t.length; n--; )
|
|
656
|
-
if (
|
|
656
|
+
if (Lo(t[n][0], e))
|
|
657
657
|
return n;
|
|
658
658
|
return -1;
|
|
659
659
|
}
|
|
660
|
-
var
|
|
661
|
-
function
|
|
660
|
+
var Do = Array.prototype, Ho = Do.splice;
|
|
661
|
+
function Vo(t) {
|
|
662
662
|
var e = this.__data__, n = le(e, t);
|
|
663
663
|
if (n < 0)
|
|
664
664
|
return !1;
|
|
665
665
|
var r = e.length - 1;
|
|
666
|
-
return n == r ? e.pop() :
|
|
666
|
+
return n == r ? e.pop() : Ho.call(e, n, 1), --this.size, !0;
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function Mo(t) {
|
|
669
669
|
var e = this.__data__, n = le(e, t);
|
|
670
670
|
return n < 0 ? void 0 : e[n][1];
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function Go(t) {
|
|
673
673
|
return le(this.__data__, t) > -1;
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function zo(t, e) {
|
|
676
676
|
var n = this.__data__, r = le(n, t);
|
|
677
677
|
return r < 0 ? (++this.size, n.push([t, e])) : n[r][1] = e, this;
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function It(t) {
|
|
680
680
|
var e = -1, n = t == null ? 0 : t.length;
|
|
681
681
|
for (this.clear(); ++e < n; ) {
|
|
682
682
|
var r = t[e];
|
|
683
683
|
this.set(r[0], r[1]);
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
var
|
|
692
|
-
function
|
|
686
|
+
It.prototype.clear = jo;
|
|
687
|
+
It.prototype.delete = Vo;
|
|
688
|
+
It.prototype.get = Mo;
|
|
689
|
+
It.prototype.has = Go;
|
|
690
|
+
It.prototype.set = zo;
|
|
691
|
+
var qo = je(ce, "Map");
|
|
692
|
+
function Wo() {
|
|
693
693
|
this.size = 0, this.__data__ = {
|
|
694
|
-
hash: new
|
|
695
|
-
map: new (
|
|
696
|
-
string: new
|
|
694
|
+
hash: new ft(),
|
|
695
|
+
map: new (qo || It)(),
|
|
696
|
+
string: new ft()
|
|
697
697
|
};
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function Ko(t) {
|
|
700
700
|
var e = typeof t;
|
|
701
701
|
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
702
702
|
}
|
|
703
703
|
function ue(t, e) {
|
|
704
704
|
var n = t.__data__;
|
|
705
|
-
return
|
|
705
|
+
return Ko(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function Zo(t) {
|
|
708
708
|
var e = ue(this, t).delete(t);
|
|
709
709
|
return this.size -= e ? 1 : 0, e;
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function Yo(t) {
|
|
712
712
|
return ue(this, t).get(t);
|
|
713
713
|
}
|
|
714
|
-
function
|
|
714
|
+
function Xo(t) {
|
|
715
715
|
return ue(this, t).has(t);
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function Jo(t, e) {
|
|
718
718
|
var n = ue(this, t), r = n.size;
|
|
719
719
|
return n.set(t, e), this.size += n.size == r ? 0 : 1, this;
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function Tt(t) {
|
|
722
722
|
var e = -1, n = t == null ? 0 : t.length;
|
|
723
723
|
for (this.clear(); ++e < n; ) {
|
|
724
724
|
var r = t[e];
|
|
725
725
|
this.set(r[0], r[1]);
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
var
|
|
734
|
-
function
|
|
735
|
-
return this.__data__.set(t,
|
|
728
|
+
Tt.prototype.clear = Wo;
|
|
729
|
+
Tt.prototype.delete = Zo;
|
|
730
|
+
Tt.prototype.get = Yo;
|
|
731
|
+
Tt.prototype.has = Xo;
|
|
732
|
+
Tt.prototype.set = Jo;
|
|
733
|
+
var Qo = "__lodash_hash_undefined__";
|
|
734
|
+
function ta(t) {
|
|
735
|
+
return this.__data__.set(t, Qo), this;
|
|
736
736
|
}
|
|
737
|
-
function
|
|
737
|
+
function ea(t) {
|
|
738
738
|
return this.__data__.has(t);
|
|
739
739
|
}
|
|
740
740
|
function te(t) {
|
|
741
741
|
var e = -1, n = t == null ? 0 : t.length;
|
|
742
|
-
for (this.__data__ = new
|
|
742
|
+
for (this.__data__ = new Tt(); ++e < n; )
|
|
743
743
|
this.add(t[e]);
|
|
744
744
|
}
|
|
745
|
-
te.prototype.add = te.prototype.push =
|
|
746
|
-
te.prototype.has =
|
|
747
|
-
function
|
|
745
|
+
te.prototype.add = te.prototype.push = ta;
|
|
746
|
+
te.prototype.has = ea;
|
|
747
|
+
function na(t, e, n, r) {
|
|
748
748
|
for (var s = t.length, o = n + -1; ++o < s; )
|
|
749
749
|
if (e(t[o], o, t))
|
|
750
750
|
return o;
|
|
751
751
|
return -1;
|
|
752
752
|
}
|
|
753
|
-
function
|
|
753
|
+
function ra(t) {
|
|
754
754
|
return t !== t;
|
|
755
755
|
}
|
|
756
|
-
function
|
|
756
|
+
function sa(t, e, n) {
|
|
757
757
|
for (var r = n - 1, s = t.length; ++r < s; )
|
|
758
758
|
if (t[r] === e)
|
|
759
759
|
return r;
|
|
760
760
|
return -1;
|
|
761
761
|
}
|
|
762
|
-
function
|
|
763
|
-
return e === e ?
|
|
762
|
+
function oa(t, e, n) {
|
|
763
|
+
return e === e ? sa(t, e, n) : na(t, ra, n);
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function aa(t, e) {
|
|
766
766
|
var n = t == null ? 0 : t.length;
|
|
767
|
-
return !!n &&
|
|
767
|
+
return !!n && oa(t, e, 0) > -1;
|
|
768
768
|
}
|
|
769
|
-
function
|
|
769
|
+
function ia(t, e, n) {
|
|
770
770
|
for (var r = -1, s = t == null ? 0 : t.length; ++r < s; )
|
|
771
771
|
if (n(e, t[r]))
|
|
772
772
|
return !0;
|
|
773
773
|
return !1;
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function ca(t, e) {
|
|
776
776
|
return t.has(e);
|
|
777
777
|
}
|
|
778
778
|
var Se = je(ce, "Set");
|
|
779
|
-
function
|
|
779
|
+
function la() {
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function Qn(t) {
|
|
782
782
|
var e = -1, n = Array(t.size);
|
|
783
783
|
return t.forEach(function(r) {
|
|
784
784
|
n[++e] = r;
|
|
785
785
|
}), n;
|
|
786
786
|
}
|
|
787
|
-
var
|
|
787
|
+
var ua = 1 / 0, da = Se && 1 / Qn(new Se([, -0]))[1] == ua ? function(t) {
|
|
788
788
|
return new Se(t);
|
|
789
|
-
} :
|
|
790
|
-
function
|
|
791
|
-
var r = -1, s =
|
|
789
|
+
} : la, fa = 200;
|
|
790
|
+
function ha(t, e, n) {
|
|
791
|
+
var r = -1, s = aa, o = t.length, a = !0, i = [], c = i;
|
|
792
792
|
if (n)
|
|
793
|
-
a = !1, s =
|
|
794
|
-
else if (o >=
|
|
795
|
-
var l =
|
|
793
|
+
a = !1, s = ia;
|
|
794
|
+
else if (o >= fa) {
|
|
795
|
+
var l = da(t);
|
|
796
796
|
if (l)
|
|
797
|
-
return
|
|
798
|
-
a = !1, s =
|
|
797
|
+
return Qn(l);
|
|
798
|
+
a = !1, s = ca, c = new te();
|
|
799
799
|
} else
|
|
800
800
|
c = i;
|
|
801
801
|
t:
|
|
@@ -810,10 +810,10 @@ function pa(t, e, n) {
|
|
|
810
810
|
}
|
|
811
811
|
return i;
|
|
812
812
|
}
|
|
813
|
-
function
|
|
814
|
-
return e = typeof e == "function" ? e : void 0, t && t.length ?
|
|
813
|
+
function pa(t, e) {
|
|
814
|
+
return e = typeof e == "function" ? e : void 0, t && t.length ? ha(t, void 0, e) : [];
|
|
815
815
|
}
|
|
816
|
-
function
|
|
816
|
+
function dn(t) {
|
|
817
817
|
const e = Object.entries(tt), n = Object.entries(Jt);
|
|
818
818
|
switch (t) {
|
|
819
819
|
case "cairo0":
|
|
@@ -826,92 +826,92 @@ function hn(t) {
|
|
|
826
826
|
return e.map(([, r]) => r);
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function ma() {
|
|
830
830
|
const t = Q.maxSatisfying(Object.keys(tt), "*");
|
|
831
831
|
if (!t)
|
|
832
832
|
throw new Error(`No argent account contract found: v${t} `);
|
|
833
833
|
return tt[t];
|
|
834
834
|
}
|
|
835
|
-
function
|
|
835
|
+
function Hl() {
|
|
836
836
|
const t = Q.maxSatisfying(Object.keys(Jt), "*");
|
|
837
837
|
if (!t)
|
|
838
838
|
throw new Error(`No argent multisig contract found: v${t} `);
|
|
839
839
|
return Jt[t];
|
|
840
840
|
}
|
|
841
|
-
function
|
|
841
|
+
function ga() {
|
|
842
842
|
return Object.entries(tt).filter(([t]) => Q.gte(t, "0.4.0")).map(([, t]) => t);
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function Vl() {
|
|
845
845
|
const t = Q.maxSatisfying(Object.keys(tt), "<0.3.0");
|
|
846
846
|
if (!t)
|
|
847
847
|
throw new Error(`No argent account contract found: v${t} `);
|
|
848
848
|
return tt[t];
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function wa() {
|
|
851
851
|
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);
|
|
852
852
|
return [...t, ...e];
|
|
853
853
|
}
|
|
854
|
-
function
|
|
854
|
+
function Ml() {
|
|
855
855
|
return Object.entries(tt).filter(([t]) => Q.gte(t, "0.4.0")).map(([, t]) => t);
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function Gl() {
|
|
858
858
|
const t = Q.maxSatisfying(Object.keys(tt), ">=0.4.0");
|
|
859
859
|
if (!t)
|
|
860
860
|
throw new Error(`No ledger account contract found: v${t}`);
|
|
861
861
|
return tt[t];
|
|
862
862
|
}
|
|
863
|
-
const
|
|
864
|
-
function
|
|
863
|
+
const ya = (t, e) => t.cairoVersion === e.cairoVersion && nt(t.accountClassHash, e.accountClassHash);
|
|
864
|
+
function zl(t, e, n = []) {
|
|
865
865
|
const r = Qe.parse({
|
|
866
866
|
cairoVersion: e.cairoVersion ?? "1",
|
|
867
|
-
accountClassHash: e.classHash ??
|
|
867
|
+
accountClassHash: e.classHash ?? ma()
|
|
868
868
|
}), s = h.array(Qe).parse(n), o = [
|
|
869
|
-
...
|
|
870
|
-
...
|
|
871
|
-
], c =
|
|
869
|
+
...dn("cairo0").map((l) => ({ cairoVersion: "0", accountClassHash: l })),
|
|
870
|
+
...dn("cairo1").map((l) => ({ cairoVersion: "1", accountClassHash: l }))
|
|
871
|
+
], c = pa([
|
|
872
872
|
r,
|
|
873
873
|
...s,
|
|
874
874
|
...o
|
|
875
|
-
],
|
|
875
|
+
], ya).map((l) => ({
|
|
876
876
|
implementation: l,
|
|
877
|
-
address:
|
|
877
|
+
address: Ea(l.cairoVersion, l.accountClassHash, t, e.guardian, e.salt)
|
|
878
878
|
})).find((l) => nt(l.address, e.address));
|
|
879
879
|
if (!c)
|
|
880
|
-
throw new
|
|
880
|
+
throw new Mr({ code: "CALCULATED_ADDRESS_NO_MATCH" });
|
|
881
881
|
return c.implementation;
|
|
882
882
|
}
|
|
883
|
-
function
|
|
884
|
-
const a =
|
|
883
|
+
function ba(t, e, n, r, s, o = Ys[0]) {
|
|
884
|
+
const a = Sa(t, e, n, r);
|
|
885
885
|
return {
|
|
886
886
|
classHash: t === "0" ? o : e,
|
|
887
|
-
constructorCalldata:
|
|
887
|
+
constructorCalldata: mt.compile(a),
|
|
888
888
|
addressSalt: s || n
|
|
889
889
|
};
|
|
890
890
|
}
|
|
891
|
-
function
|
|
892
|
-
const s = t !== "0" && nt(
|
|
891
|
+
function Sa(t, e, n, r) {
|
|
892
|
+
const s = t !== "0" && nt(Gr, e), o = {
|
|
893
893
|
pubkey: n,
|
|
894
894
|
...s ? {} : { guardian: r || "0" }
|
|
895
895
|
};
|
|
896
|
-
if (
|
|
896
|
+
if (ga().some((i) => nt(i, e))) {
|
|
897
897
|
const i = tn(n, en.Starknet), c = r ? new rn(sn.Some, tn(r, en.Starknet)) : new rn(sn.None, null);
|
|
898
898
|
return { ownerSigner: i, guardianAsOption: c };
|
|
899
899
|
}
|
|
900
|
-
return t === "0" ?
|
|
900
|
+
return t === "0" ? zr.parse({
|
|
901
901
|
implementation: e,
|
|
902
|
-
selector:
|
|
903
|
-
calldata:
|
|
904
|
-
}) :
|
|
902
|
+
selector: Hn.getSelectorFromName("initialize"),
|
|
903
|
+
calldata: mt.compile(o)
|
|
904
|
+
}) : qr.parse({
|
|
905
905
|
owner: n,
|
|
906
906
|
guardian: r
|
|
907
907
|
});
|
|
908
908
|
}
|
|
909
|
-
function
|
|
910
|
-
const o =
|
|
911
|
-
return
|
|
909
|
+
function Ea(t, e, n, r, s) {
|
|
910
|
+
const o = ba(t, e, n, r, s);
|
|
911
|
+
return Hn.calculateContractAddressFromHash(o.addressSalt, o.classHash, o.constructorCalldata, 0);
|
|
912
912
|
}
|
|
913
|
-
function
|
|
914
|
-
const n =
|
|
913
|
+
function ql(t, e) {
|
|
914
|
+
const n = an(t), r = an();
|
|
915
915
|
return Yt(() => {
|
|
916
916
|
n.current = t;
|
|
917
917
|
}, [t]), Yt(() => () => {
|
|
@@ -920,8 +920,8 @@ function Ml(t, e) {
|
|
|
920
920
|
r.current && clearTimeout(r.current), r.current = setTimeout(() => n.current(...s), e);
|
|
921
921
|
};
|
|
922
922
|
}
|
|
923
|
-
function
|
|
924
|
-
const [n, r] =
|
|
923
|
+
function Wl(t, e) {
|
|
924
|
+
const [n, r] = cs(t);
|
|
925
925
|
return Yt(() => {
|
|
926
926
|
const s = setTimeout(() => {
|
|
927
927
|
r(t);
|
|
@@ -931,7 +931,7 @@ function Gl(t, e) {
|
|
|
931
931
|
};
|
|
932
932
|
}, [t, e]), n;
|
|
933
933
|
}
|
|
934
|
-
const
|
|
934
|
+
const Aa = h.object({
|
|
935
935
|
name: h.enum([
|
|
936
936
|
"dappland",
|
|
937
937
|
"discord",
|
|
@@ -942,10 +942,10 @@ const xa = h.object({
|
|
|
942
942
|
]),
|
|
943
943
|
url: h.string(),
|
|
944
944
|
position: h.number()
|
|
945
|
-
}),
|
|
946
|
-
address:
|
|
945
|
+
}), xa = h.object({
|
|
946
|
+
address: jn,
|
|
947
947
|
chain: h.enum(["ethereum", "starknet"])
|
|
948
|
-
}),
|
|
948
|
+
}), va = h.object({
|
|
949
949
|
dappId: h.string(),
|
|
950
950
|
name: h.string(),
|
|
951
951
|
description: h.string().optional(),
|
|
@@ -953,59 +953,60 @@ const xa = h.object({
|
|
|
953
953
|
dappUrl: h.string().optional(),
|
|
954
954
|
inAppBrowserCompatible: h.boolean(),
|
|
955
955
|
argentVerified: h.boolean(),
|
|
956
|
-
links: h.array(
|
|
957
|
-
contracts: h.array(
|
|
956
|
+
links: h.array(Aa).optional(),
|
|
957
|
+
contracts: h.array(xa).optional(),
|
|
958
958
|
categories: h.array(h.string()).optional(),
|
|
959
959
|
supportedApps: h.array(h.string()).optional(),
|
|
960
|
-
brandColor: h.string().optional()
|
|
961
|
-
|
|
962
|
-
|
|
960
|
+
brandColor: h.string().optional(),
|
|
961
|
+
executeFromOutsideAllowed: h.boolean().default(!1).optional()
|
|
962
|
+
}), Ia = h.array(va);
|
|
963
|
+
class Kl {
|
|
963
964
|
constructor(e, n) {
|
|
964
965
|
this.apiBase = e, this.httpService = new Ue(n, "json");
|
|
965
966
|
}
|
|
966
967
|
async getAll() {
|
|
967
|
-
const e = await this.httpService.get(`${this.apiBase}/tokens/dapps`), n =
|
|
968
|
+
const e = await this.httpService.get(`${this.apiBase}/tokens/dapps`), n = Ia.safeParse(e);
|
|
968
969
|
if (!n.success)
|
|
969
970
|
throw new Error("Failed to parse known dapps");
|
|
970
971
|
return n.data;
|
|
971
972
|
}
|
|
972
973
|
}
|
|
973
|
-
function
|
|
974
|
+
function Ta(t) {
|
|
974
975
|
var e;
|
|
975
976
|
return (e = t == null ? void 0 : t.links) == null ? void 0 : e.find((n) => n.name === "dappland");
|
|
976
977
|
}
|
|
977
|
-
function
|
|
978
|
+
function Zl(t) {
|
|
978
979
|
var e;
|
|
979
|
-
return (e =
|
|
980
|
+
return (e = Ta(t)) == null ? void 0 : e.url;
|
|
980
981
|
}
|
|
981
|
-
const
|
|
982
|
-
domain:
|
|
982
|
+
const tr = F.object({
|
|
983
|
+
domain: Wr,
|
|
983
984
|
address: se.optional(),
|
|
984
985
|
avatar: F.string().optional(),
|
|
985
986
|
status: F.union([F.literal("KNOWN"), F.literal("UNKNOWN")])
|
|
986
|
-
}),
|
|
987
|
+
}), Ba = F.array(tr), _a = F.object({
|
|
987
988
|
provider: F.string(),
|
|
988
989
|
name: F.string(),
|
|
989
990
|
avatar: F.string().optional()
|
|
990
|
-
}),
|
|
991
|
+
}), Na = F.object({
|
|
991
992
|
address: se,
|
|
992
993
|
status: F.union([F.literal("KNOWN"), F.literal("UNKNOWN")]),
|
|
993
|
-
resolutions: F.array(
|
|
994
|
-
}),
|
|
995
|
-
class
|
|
994
|
+
resolutions: F.array(_a).optional()
|
|
995
|
+
}), Ca = F.array(F.string()), Oa = Na.array();
|
|
996
|
+
class Yl {
|
|
996
997
|
constructor(e, n) {
|
|
997
998
|
this.apiBase = e, this.headers = n, this.httpService = new Ue(this.headers, "json");
|
|
998
999
|
}
|
|
999
1000
|
async getAddressFromMultipleStarknetId(e, n, r) {
|
|
1000
1001
|
const s = new URLSearchParams(n.map((c) => ["domain", c]));
|
|
1001
1002
|
r && s.set("includeAvatar", "true");
|
|
1002
|
-
const o =
|
|
1003
|
+
const o = k(this.apiBase, e, "starknet.id", `?${s}`), a = await this.httpService.get(o), i = Ba.safeParse(a);
|
|
1003
1004
|
if (!i.success)
|
|
1004
1005
|
throw new Error("Failed to parse name resolution");
|
|
1005
1006
|
return i.data;
|
|
1006
1007
|
}
|
|
1007
1008
|
async getAddressFromStarknetId(e, n, r) {
|
|
1008
|
-
const s =
|
|
1009
|
+
const s = k(this.apiBase, e, "starknet.id", n, r ? "?includeAvatar=true" : ""), o = await this.httpService.get(s), a = tr.safeParse(o);
|
|
1009
1010
|
if (!a.success)
|
|
1010
1011
|
throw new Error("Failed to parse name resolution");
|
|
1011
1012
|
return a.data;
|
|
@@ -1016,111 +1017,111 @@ class Wl {
|
|
|
1016
1017
|
async getStarknetIdFromAddress(e, n, r) {
|
|
1017
1018
|
const s = new URLSearchParams(n.map((c) => ["address", c]));
|
|
1018
1019
|
r && s.set("includeAvatar", "true");
|
|
1019
|
-
const o =
|
|
1020
|
+
const o = k(this.apiBase, e, "addresses", `?${s}`), a = await this.httpService.get(o), i = Oa.safeParse(a);
|
|
1020
1021
|
if (!i.success)
|
|
1021
1022
|
throw new Error("Failed to parse name resolution");
|
|
1022
1023
|
return i.data;
|
|
1023
1024
|
}
|
|
1024
1025
|
async getProvidersNames(e) {
|
|
1025
|
-
const n =
|
|
1026
|
+
const n = k(this.apiBase, e, "providers", "name"), r = await this.httpService.get(n), s = Ca.safeParse(r);
|
|
1026
1027
|
if (!s.success)
|
|
1027
1028
|
throw new Error("Failed to parse name resolution");
|
|
1028
1029
|
return s.data;
|
|
1029
1030
|
}
|
|
1030
1031
|
}
|
|
1031
|
-
const
|
|
1032
|
-
function
|
|
1032
|
+
const er = (t) => t.slice(0, 6) + "..." + t.slice(-4);
|
|
1033
|
+
function fn(t) {
|
|
1033
1034
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
1034
1035
|
throw new Error(`positive integer expected, not ${t}`);
|
|
1035
1036
|
}
|
|
1036
|
-
function
|
|
1037
|
+
function ka(t) {
|
|
1037
1038
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1038
1039
|
}
|
|
1039
1040
|
function de(t, ...e) {
|
|
1040
|
-
if (!
|
|
1041
|
+
if (!ka(t))
|
|
1041
1042
|
throw new Error("Uint8Array expected");
|
|
1042
1043
|
if (e.length > 0 && !e.includes(t.length))
|
|
1043
1044
|
throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`);
|
|
1044
1045
|
}
|
|
1045
|
-
function
|
|
1046
|
+
function hn(t, e = !0) {
|
|
1046
1047
|
if (t.destroyed)
|
|
1047
1048
|
throw new Error("Hash instance has been destroyed");
|
|
1048
1049
|
if (e && t.finished)
|
|
1049
1050
|
throw new Error("Hash#digest() has already been called");
|
|
1050
1051
|
}
|
|
1051
|
-
function
|
|
1052
|
+
function Pa(t, e) {
|
|
1052
1053
|
de(t);
|
|
1053
1054
|
const n = e.outputLen;
|
|
1054
1055
|
if (t.length < n)
|
|
1055
1056
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
1056
1057
|
}
|
|
1057
|
-
const Wt = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
1058
|
-
function
|
|
1059
|
-
return e ? { h: Number(t & Wt), l: Number(t >>
|
|
1058
|
+
const Wt = /* @__PURE__ */ BigInt(2 ** 32 - 1), pn = /* @__PURE__ */ BigInt(32);
|
|
1059
|
+
function Ra(t, e = !1) {
|
|
1060
|
+
return e ? { h: Number(t & Wt), l: Number(t >> pn & Wt) } : { h: Number(t >> pn & Wt) | 0, l: Number(t & Wt) | 0 };
|
|
1060
1061
|
}
|
|
1061
|
-
function
|
|
1062
|
+
function $a(t, e = !1) {
|
|
1062
1063
|
let n = new Uint32Array(t.length), r = new Uint32Array(t.length);
|
|
1063
1064
|
for (let s = 0; s < t.length; s++) {
|
|
1064
|
-
const { h: o, l: a } =
|
|
1065
|
+
const { h: o, l: a } = Ra(t[s], e);
|
|
1065
1066
|
[n[s], r[s]] = [o, a];
|
|
1066
1067
|
}
|
|
1067
1068
|
return [n, r];
|
|
1068
1069
|
}
|
|
1069
|
-
const
|
|
1070
|
+
const Fa = (t, e, n) => t << n | e >>> 32 - n, Ua = (t, e, n) => e << n | t >>> 32 - n, ja = (t, e, n) => e << n - 32 | t >>> 64 - n, La = (t, e, n) => t << n - 32 | e >>> 64 - n;
|
|
1070
1071
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1071
|
-
const
|
|
1072
|
-
function
|
|
1072
|
+
const Da = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), mn = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, Ha = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
1073
|
+
function gn(t) {
|
|
1073
1074
|
for (let e = 0; e < t.length; e++)
|
|
1074
|
-
t[e] =
|
|
1075
|
+
t[e] = Ha(t[e]);
|
|
1075
1076
|
}
|
|
1076
|
-
const
|
|
1077
|
-
function
|
|
1077
|
+
const Va = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
1078
|
+
function Ma(t) {
|
|
1078
1079
|
de(t);
|
|
1079
1080
|
let e = "";
|
|
1080
1081
|
for (let n = 0; n < t.length; n++)
|
|
1081
|
-
e +=
|
|
1082
|
+
e += Va[t[n]];
|
|
1082
1083
|
return e;
|
|
1083
1084
|
}
|
|
1084
|
-
function
|
|
1085
|
+
function nr(t) {
|
|
1085
1086
|
if (typeof t != "string")
|
|
1086
1087
|
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1087
1088
|
return new Uint8Array(new TextEncoder().encode(t));
|
|
1088
1089
|
}
|
|
1089
|
-
function
|
|
1090
|
-
return typeof t == "string" && (t =
|
|
1090
|
+
function rr(t) {
|
|
1091
|
+
return typeof t == "string" && (t = nr(t)), de(t), t;
|
|
1091
1092
|
}
|
|
1092
|
-
let
|
|
1093
|
+
let Ga = class {
|
|
1093
1094
|
// Safe version that clones internal state
|
|
1094
1095
|
clone() {
|
|
1095
1096
|
return this._cloneInto();
|
|
1096
1097
|
}
|
|
1097
1098
|
};
|
|
1098
|
-
function
|
|
1099
|
-
const e = (r) => t().update(
|
|
1099
|
+
function za(t) {
|
|
1100
|
+
const e = (r) => t().update(rr(r)).digest(), n = t();
|
|
1100
1101
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1101
1102
|
}
|
|
1102
|
-
const
|
|
1103
|
-
for (let t = 0, e =
|
|
1104
|
-
[n, r] = [r, (2 * n + 3 * r) % 5],
|
|
1105
|
-
let s =
|
|
1103
|
+
const sr = [], or = [], ar = [], qa = /* @__PURE__ */ BigInt(0), Ct = /* @__PURE__ */ BigInt(1), Wa = /* @__PURE__ */ BigInt(2), Ka = /* @__PURE__ */ BigInt(7), Za = /* @__PURE__ */ BigInt(256), Ya = /* @__PURE__ */ BigInt(113);
|
|
1104
|
+
for (let t = 0, e = Ct, n = 1, r = 0; t < 24; t++) {
|
|
1105
|
+
[n, r] = [r, (2 * n + 3 * r) % 5], sr.push(2 * (5 * r + n)), or.push((t + 1) * (t + 2) / 2 % 64);
|
|
1106
|
+
let s = qa;
|
|
1106
1107
|
for (let o = 0; o < 7; o++)
|
|
1107
|
-
e = (e <<
|
|
1108
|
-
|
|
1108
|
+
e = (e << Ct ^ (e >> Ka) * Ya) % Za, e & Wa && (s ^= Ct << (Ct << /* @__PURE__ */ BigInt(o)) - Ct);
|
|
1109
|
+
ar.push(s);
|
|
1109
1110
|
}
|
|
1110
|
-
const [
|
|
1111
|
-
function
|
|
1111
|
+
const [Xa, Ja] = /* @__PURE__ */ $a(ar, !0), wn = (t, e, n) => n > 32 ? ja(t, e, n) : Fa(t, e, n), yn = (t, e, n) => n > 32 ? La(t, e, n) : Ua(t, e, n);
|
|
1112
|
+
function Qa(t, e = 24) {
|
|
1112
1113
|
const n = new Uint32Array(10);
|
|
1113
1114
|
for (let r = 24 - e; r < 24; r++) {
|
|
1114
1115
|
for (let a = 0; a < 10; a++)
|
|
1115
1116
|
n[a] = t[a] ^ t[a + 10] ^ t[a + 20] ^ t[a + 30] ^ t[a + 40];
|
|
1116
1117
|
for (let a = 0; a < 10; a += 2) {
|
|
1117
|
-
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u =
|
|
1118
|
+
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u = wn(l, d, 1) ^ n[i], w = yn(l, d, 1) ^ n[i + 1];
|
|
1118
1119
|
for (let m = 0; m < 50; m += 10)
|
|
1119
1120
|
t[a + m] ^= u, t[a + m + 1] ^= w;
|
|
1120
1121
|
}
|
|
1121
1122
|
let s = t[2], o = t[3];
|
|
1122
1123
|
for (let a = 0; a < 24; a++) {
|
|
1123
|
-
const i =
|
|
1124
|
+
const i = or[a], c = wn(s, o, i), l = yn(s, o, i), d = sr[a];
|
|
1124
1125
|
s = t[d], o = t[d + 1], t[d] = c, t[d + 1] = l;
|
|
1125
1126
|
}
|
|
1126
1127
|
for (let a = 0; a < 50; a += 10) {
|
|
@@ -1129,24 +1130,24 @@ function ti(t, e = 24) {
|
|
|
1129
1130
|
for (let i = 0; i < 10; i++)
|
|
1130
1131
|
t[a + i] ^= ~n[(i + 2) % 10] & n[(i + 4) % 10];
|
|
1131
1132
|
}
|
|
1132
|
-
t[0] ^=
|
|
1133
|
+
t[0] ^= Xa[r], t[1] ^= Ja[r];
|
|
1133
1134
|
}
|
|
1134
1135
|
n.fill(0);
|
|
1135
1136
|
}
|
|
1136
|
-
let
|
|
1137
|
+
let ti = class ir extends Ga {
|
|
1137
1138
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1138
1139
|
constructor(e, n, r, s = !1, o = 24) {
|
|
1139
|
-
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,
|
|
1140
|
+
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, fn(r), 0 >= this.blockLen || this.blockLen >= 200)
|
|
1140
1141
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1141
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
1142
|
+
this.state = new Uint8Array(200), this.state32 = Da(this.state);
|
|
1142
1143
|
}
|
|
1143
1144
|
keccak() {
|
|
1144
|
-
|
|
1145
|
+
mn || gn(this.state32), Qa(this.state32, this.rounds), mn || gn(this.state32), this.posOut = 0, this.pos = 0;
|
|
1145
1146
|
}
|
|
1146
1147
|
update(e) {
|
|
1147
|
-
|
|
1148
|
+
hn(this);
|
|
1148
1149
|
const { blockLen: n, state: r } = this;
|
|
1149
|
-
e =
|
|
1150
|
+
e = rr(e);
|
|
1150
1151
|
const s = e.length;
|
|
1151
1152
|
for (let o = 0; o < s; ) {
|
|
1152
1153
|
const a = Math.min(n - this.pos, s - o);
|
|
@@ -1164,7 +1165,7 @@ let ei = class dr extends za {
|
|
|
1164
1165
|
e[r] ^= n, n & 128 && r === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
1165
1166
|
}
|
|
1166
1167
|
writeInto(e) {
|
|
1167
|
-
|
|
1168
|
+
hn(this, !1), de(e), this.finish();
|
|
1168
1169
|
const n = this.state, { blockLen: r } = this;
|
|
1169
1170
|
for (let s = 0, o = e.length; s < o; ) {
|
|
1170
1171
|
this.posOut >= r && this.keccak();
|
|
@@ -1179,10 +1180,10 @@ let ei = class dr extends za {
|
|
|
1179
1180
|
return this.writeInto(e);
|
|
1180
1181
|
}
|
|
1181
1182
|
xof(e) {
|
|
1182
|
-
return
|
|
1183
|
+
return fn(e), this.xofInto(new Uint8Array(e));
|
|
1183
1184
|
}
|
|
1184
1185
|
digestInto(e) {
|
|
1185
|
-
if (
|
|
1186
|
+
if (Pa(e, this), this.finished)
|
|
1186
1187
|
throw new Error("digest() was already called");
|
|
1187
1188
|
return this.writeInto(e), this.destroy(), e;
|
|
1188
1189
|
}
|
|
@@ -1194,36 +1195,36 @@ let ei = class dr extends za {
|
|
|
1194
1195
|
}
|
|
1195
1196
|
_cloneInto(e) {
|
|
1196
1197
|
const { blockLen: n, suffix: r, outputLen: s, rounds: o, enableXOF: a } = this;
|
|
1197
|
-
return e || (e = new
|
|
1198
|
+
return e || (e = new ir(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;
|
|
1198
1199
|
}
|
|
1199
1200
|
};
|
|
1200
|
-
const
|
|
1201
|
-
function
|
|
1202
|
-
return `0x${
|
|
1201
|
+
const ei = (t, e, n) => za(() => new ti(e, t, n)), ni = /* @__PURE__ */ ei(1, 136, 256 / 8);
|
|
1202
|
+
function ri(t) {
|
|
1203
|
+
return `0x${Ma(ni(nr(t)))}`;
|
|
1203
1204
|
}
|
|
1204
|
-
const
|
|
1205
|
-
if (!
|
|
1205
|
+
const si = (t) => {
|
|
1206
|
+
if (!Mn(t))
|
|
1206
1207
|
return;
|
|
1207
1208
|
const e = /(\d+)$/, n = t.match(e);
|
|
1208
1209
|
if (n)
|
|
1209
1210
|
return n[1];
|
|
1210
|
-
},
|
|
1211
|
-
if (!
|
|
1211
|
+
}, oi = (t, e = !1) => {
|
|
1212
|
+
if (!Mn(t))
|
|
1212
1213
|
return "";
|
|
1213
|
-
const n = e ? t.replace(/[^0-9a-z ]/gi, "") : t, s = Pe(n).split(" "), o =
|
|
1214
|
+
const n = e ? t.replace(/[^0-9a-z ]/gi, "") : t, s = Pe(n).split(" "), o = si(n), a = s.map((i) => i[0]);
|
|
1214
1215
|
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("");
|
|
1215
|
-
}, { toBigInt:
|
|
1216
|
+
}, { toBigInt: ai } = O, bn = (t) => {
|
|
1216
1217
|
const e = t.replace("#", "");
|
|
1217
1218
|
if (!/^[0-9A-F]{6}$/i.test(e))
|
|
1218
1219
|
throw new Error(`Invalid color ${t}`);
|
|
1219
1220
|
return `#${e}`;
|
|
1220
1221
|
}, ee = (t, e) => {
|
|
1221
|
-
const n =
|
|
1222
|
+
const n = bn(e.background), r = bn(e.color ?? "#ffffff"), s = oi(t, !0), o = `<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
|
|
1222
1223
|
<rect width="48" height="48" fill="${n}" />
|
|
1223
1224
|
<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>
|
|
1224
1225
|
</svg>`;
|
|
1225
1226
|
return `data:image/svg+xml;base64,${btoa(o)}`;
|
|
1226
|
-
},
|
|
1227
|
+
}, Sn = [
|
|
1227
1228
|
"02BBA8",
|
|
1228
1229
|
"29C5FF",
|
|
1229
1230
|
"0078A4",
|
|
@@ -1232,43 +1233,43 @@ const oi = (t) => {
|
|
|
1232
1233
|
"FF875B",
|
|
1233
1234
|
"FF675C",
|
|
1234
1235
|
"FF5C72"
|
|
1235
|
-
],
|
|
1236
|
-
const e =
|
|
1237
|
-
return
|
|
1238
|
-
},
|
|
1236
|
+
], ii = (t) => {
|
|
1237
|
+
const e = ri(t).slice(-2), n = parseInt(e, 16) % Sn.length;
|
|
1238
|
+
return Sn[n];
|
|
1239
|
+
}, ci = (t) => {
|
|
1239
1240
|
try {
|
|
1240
|
-
return O.toHex(
|
|
1241
|
+
return O.toHex(ai(O.hexToDecimalString(t)));
|
|
1241
1242
|
} catch {
|
|
1242
1243
|
}
|
|
1243
1244
|
return "";
|
|
1244
|
-
},
|
|
1245
|
-
const s =
|
|
1245
|
+
}, Jl = ({ accountName: t, networkId: e, accountAddress: n, backgroundColor: r }) => {
|
|
1246
|
+
const s = ci(n), o = `${e}::${s}`, a = r || ii(o);
|
|
1246
1247
|
return ee(t, { background: a });
|
|
1247
|
-
},
|
|
1248
|
-
const e =
|
|
1249
|
-
return
|
|
1250
|
-
},
|
|
1251
|
-
const e =
|
|
1252
|
-
return
|
|
1253
|
-
},
|
|
1254
|
-
function
|
|
1248
|
+
}, li = (t) => {
|
|
1249
|
+
const e = $t.removeHexPrefix($t.sanitizeHex(O.toHex(t))), n = zn.decode(e);
|
|
1250
|
+
return qn.encode(n);
|
|
1251
|
+
}, Ql = (t) => t.map(li), ui = (t) => {
|
|
1252
|
+
const e = qn.decode(t);
|
|
1253
|
+
return $t.sanitizeHex(zn.encode(e));
|
|
1254
|
+
}, tu = (t) => t.map(ui);
|
|
1255
|
+
function eu(t, e) {
|
|
1255
1256
|
const n = t.getTime(), r = e.getTime(), s = Math.abs(n - r);
|
|
1256
1257
|
return Math.floor(s / (1e3 * 60 * 60 * 24));
|
|
1257
1258
|
}
|
|
1258
|
-
const
|
|
1259
|
+
const nu = (t) => (t || "false") === "true", ru = async (t, e) => {
|
|
1259
1260
|
try {
|
|
1260
1261
|
return await t.getClassHashAt(e), !0;
|
|
1261
1262
|
} catch {
|
|
1262
1263
|
return !1;
|
|
1263
1264
|
}
|
|
1264
1265
|
};
|
|
1265
|
-
function
|
|
1266
|
-
return !
|
|
1266
|
+
function su(t) {
|
|
1267
|
+
return !ls(t);
|
|
1267
1268
|
}
|
|
1268
|
-
const
|
|
1269
|
+
const ou = (t) => {
|
|
1269
1270
|
const e = /^(0|0x([a-f0-9A-F]+)?)$/;
|
|
1270
1271
|
return !!(t === "" || e.test(t));
|
|
1271
|
-
}, Y = (t) => !isNaN(parseFloat(t)) && isFinite(Number(t)),
|
|
1272
|
+
}, Y = (t) => !isNaN(parseFloat(t)) && isFinite(Number(t)), au = (t, e = 16) => {
|
|
1272
1273
|
const n = new RegExp(`^[0-9]*.?[0-9]{0,${e}}$`);
|
|
1273
1274
|
return t === "" ? !0 : Y(t) ? !!n.test(t) : !1;
|
|
1274
1275
|
}, Le = {
|
|
@@ -1286,13 +1287,13 @@ const nu = (t) => {
|
|
|
1286
1287
|
decimalPlacesWhenZero: 1,
|
|
1287
1288
|
allowLeadingZerosInDecimalPart: !0
|
|
1288
1289
|
}
|
|
1289
|
-
},
|
|
1290
|
+
}, di = (t, e) => cr(t, {
|
|
1290
1291
|
...Le.CURRENCY,
|
|
1291
1292
|
...e || {}
|
|
1292
|
-
}),
|
|
1293
|
+
}), fi = (t, e) => cr(t, {
|
|
1293
1294
|
...Le.TOKEN,
|
|
1294
1295
|
...e || {}
|
|
1295
|
-
}),
|
|
1296
|
+
}), cr = (t, { minDecimalPlaces: e, maxDecimalPlaces: n, minDecimalSignificantDigits: r, decimalPlacesWhenZero: s, allowLeadingZerosInDecimalPart: o } = Le.CURRENCY) => {
|
|
1296
1297
|
if (!Y(t))
|
|
1297
1298
|
return null;
|
|
1298
1299
|
const a = new nn(typeof t == "bigint" ? t.toString() : t);
|
|
@@ -1309,53 +1310,53 @@ const nu = (t) => {
|
|
|
1309
1310
|
let l = i.replace(/0+$/, "");
|
|
1310
1311
|
const d = 1 + i.indexOf(".") + s;
|
|
1311
1312
|
return l.length < d && (l = i.substring(0, d)), l;
|
|
1312
|
-
},
|
|
1313
|
+
}, hi = (t, e = 18) => {
|
|
1313
1314
|
const n = t.replace(",", ".");
|
|
1314
|
-
return !t || !Y(n) ? 0n :
|
|
1315
|
+
return !t || !Y(n) ? 0n : xt(n, Number(e)).value;
|
|
1315
1316
|
};
|
|
1316
1317
|
function Ut(t) {
|
|
1317
1318
|
return Dt.bnToUint256(t);
|
|
1318
1319
|
}
|
|
1319
|
-
const
|
|
1320
|
+
const iu = (t, e) => `${t} ${e}${t === 1 ? "" : "s"}`, cu = (t) => new Promise((e, n) => {
|
|
1320
1321
|
const r = new FileReader();
|
|
1321
1322
|
r.onload = () => {
|
|
1322
1323
|
var s;
|
|
1323
1324
|
return r.result ? e((s = r.result) == null ? void 0 : s.toString()) : n(new Error("Could not read file"));
|
|
1324
1325
|
}, r.onerror = n, r.onabort = n.bind(null, new Error("User aborted")), r.readAsText(t);
|
|
1325
1326
|
});
|
|
1326
|
-
function
|
|
1327
|
+
function lu(t) {
|
|
1327
1328
|
try {
|
|
1328
|
-
return
|
|
1329
|
+
return us(Gn(t));
|
|
1329
1330
|
} catch {
|
|
1330
1331
|
return t;
|
|
1331
1332
|
}
|
|
1332
1333
|
}
|
|
1333
|
-
const
|
|
1334
|
+
const uu = (t, e) => {
|
|
1334
1335
|
const n = new URLSearchParams(e), r = n.size ? `?${n}` : "";
|
|
1335
|
-
return
|
|
1336
|
+
return k(...oe(t), r);
|
|
1336
1337
|
};
|
|
1337
|
-
function
|
|
1338
|
+
function du(t) {
|
|
1338
1339
|
return (...e) => {
|
|
1339
1340
|
t(...e);
|
|
1340
1341
|
};
|
|
1341
1342
|
}
|
|
1342
|
-
class
|
|
1343
|
+
class pi extends Error {
|
|
1343
1344
|
constructor(e, n) {
|
|
1344
1345
|
super(`${e}::${n}`), this.name = e, this.code = n, this.name = e;
|
|
1345
1346
|
}
|
|
1346
1347
|
}
|
|
1347
|
-
class
|
|
1348
|
+
class En extends pi {
|
|
1348
1349
|
constructor(e) {
|
|
1349
1350
|
super("BackendPaginationError", e);
|
|
1350
1351
|
}
|
|
1351
1352
|
}
|
|
1352
|
-
const
|
|
1353
|
-
class
|
|
1353
|
+
const An = 32;
|
|
1354
|
+
class fu {
|
|
1354
1355
|
constructor(e, n, r) {
|
|
1355
1356
|
this.apiBase = e, this.headers = n, this.imageOptimizationUrl = r, this.httpService = new Ue(this.headers, "json");
|
|
1356
1357
|
}
|
|
1357
1358
|
async getNfts(e, n, r, s = 1) {
|
|
1358
|
-
const o = this.normalizeAddress(r), a =
|
|
1359
|
+
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=${An}`, d = await this.httpService.get(l), u = d.content.map((w) => this.mapItem(w, r));
|
|
1359
1360
|
return {
|
|
1360
1361
|
totalPages: d.totalPages,
|
|
1361
1362
|
page: d.number + 1,
|
|
@@ -1364,7 +1365,7 @@ class lu {
|
|
|
1364
1365
|
};
|
|
1365
1366
|
}
|
|
1366
1367
|
async getCollection(e, n, r) {
|
|
1367
|
-
const s = this.normalizeAddress(r), o =
|
|
1368
|
+
const s = this.normalizeAddress(r), o = k(this.apiBase, "pandora", e, n), a = k(o, "collection", s), i = `${o}/collection/${s}`, [c, l] = await Promise.all([
|
|
1368
1369
|
this.httpService.get(a),
|
|
1369
1370
|
this.httpService.get(i)
|
|
1370
1371
|
]), d = Ee(c), u = l.content.map((w) => this.mapItem(w));
|
|
@@ -1379,11 +1380,11 @@ class lu {
|
|
|
1379
1380
|
};
|
|
1380
1381
|
}
|
|
1381
1382
|
async getNft(e, n, r, s) {
|
|
1382
|
-
const o = this.normalizeAddress(r), a =
|
|
1383
|
+
const o = this.normalizeAddress(r), a = k(this.apiBase, "pandora", e, n), i = k(a, "nft", o, s), c = await this.httpService.get(i);
|
|
1383
1384
|
return this.mapItem(c);
|
|
1384
1385
|
}
|
|
1385
1386
|
async getProfileCollections(e, n, r, s = 1, o = !1) {
|
|
1386
|
-
const a = this.pageToPageIndex(s), i = this.normalizeAddress(r), c =
|
|
1387
|
+
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=${An}`), d = await this.httpService.get(l), u = [];
|
|
1387
1388
|
for (const w of d.content)
|
|
1388
1389
|
if (o) {
|
|
1389
1390
|
const m = await this.getCollectionMetrics(e, n, w.contractAddress);
|
|
@@ -1398,18 +1399,18 @@ class lu {
|
|
|
1398
1399
|
};
|
|
1399
1400
|
}
|
|
1400
1401
|
async getCollectionMetrics(e, n, r) {
|
|
1401
|
-
const s = this.normalizeAddress(r), o =
|
|
1402
|
+
const s = this.normalizeAddress(r), o = k(this.apiBase, "pandora", e, n), a = k(o, "collection", s, "metrics");
|
|
1402
1403
|
return this.httpService.get(a);
|
|
1403
1404
|
}
|
|
1404
1405
|
normalizeAddress(e) {
|
|
1405
|
-
return
|
|
1406
|
+
return jn.parse(e);
|
|
1406
1407
|
}
|
|
1407
1408
|
pageToPageIndex(e) {
|
|
1408
1409
|
if (!Number.isInteger(e))
|
|
1409
|
-
throw new
|
|
1410
|
+
throw new En("notANumber");
|
|
1410
1411
|
const n = e - 1;
|
|
1411
1412
|
if (n < 0)
|
|
1412
|
-
throw new
|
|
1413
|
+
throw new En("tooLow");
|
|
1413
1414
|
return n;
|
|
1414
1415
|
}
|
|
1415
1416
|
optimizeImage(e, n, r) {
|
|
@@ -1429,7 +1430,7 @@ class lu {
|
|
|
1429
1430
|
token_id: e.tokenId,
|
|
1430
1431
|
contract_address: e.contractAddress,
|
|
1431
1432
|
name: r,
|
|
1432
|
-
spec: "spec" in e ?
|
|
1433
|
+
spec: "spec" in e ? mi(e.spec) : void 0,
|
|
1433
1434
|
description: "",
|
|
1434
1435
|
best_bid_order: {
|
|
1435
1436
|
payment_amount: "bestListPrice" in e ? BigInt(e.bestListPrice) : void 0
|
|
@@ -1446,11 +1447,11 @@ class lu {
|
|
|
1446
1447
|
owner: {
|
|
1447
1448
|
account_address: ((s = e.owner) == null ? void 0 : s.address) || n
|
|
1448
1449
|
},
|
|
1449
|
-
contract_name:
|
|
1450
|
+
contract_name: er(e.contractAddress)
|
|
1450
1451
|
};
|
|
1451
1452
|
}
|
|
1452
1453
|
}
|
|
1453
|
-
function
|
|
1454
|
+
function mi(t) {
|
|
1454
1455
|
switch (t) {
|
|
1455
1456
|
case "erc721":
|
|
1456
1457
|
case "starknetErc721":
|
|
@@ -1463,7 +1464,7 @@ function gi(t) {
|
|
|
1463
1464
|
function Ee(t, e) {
|
|
1464
1465
|
return {
|
|
1465
1466
|
contractAddress: se.parse(t.contractAddress),
|
|
1466
|
-
name: t.name ||
|
|
1467
|
+
name: t.name || er(t.contractAddress),
|
|
1467
1468
|
description: t.description ?? "",
|
|
1468
1469
|
imageUri: t.imageUrls.preview ?? ee(t.name || t.contractAddress.replace("0x", ""), {
|
|
1469
1470
|
background: "#15192A",
|
|
@@ -1481,29 +1482,29 @@ function Ee(t, e) {
|
|
|
1481
1482
|
}
|
|
1482
1483
|
};
|
|
1483
1484
|
}
|
|
1484
|
-
const
|
|
1485
|
+
const lr = async (t, e, n, r, s = 1) => {
|
|
1485
1486
|
const o = await t.getNfts(e, n, r, s);
|
|
1486
1487
|
if (s < o.totalPages) {
|
|
1487
|
-
const a = await
|
|
1488
|
+
const a = await lr(t, e, n, r, o.page + 1);
|
|
1488
1489
|
return {
|
|
1489
1490
|
...o,
|
|
1490
1491
|
nfts: o.nfts.concat(a.nfts)
|
|
1491
1492
|
};
|
|
1492
1493
|
}
|
|
1493
1494
|
return o;
|
|
1494
|
-
},
|
|
1495
|
-
const { data: o, ...a } = ae(r && [r, "nfts"], () => r &&
|
|
1495
|
+
}, hu = (t, e, n, r, s) => {
|
|
1496
|
+
const { data: o, ...a } = ae(r && [r, "nfts"], () => r && lr(t, e, n, r), {
|
|
1496
1497
|
refreshInterval: 3e5,
|
|
1497
1498
|
...s
|
|
1498
1499
|
});
|
|
1499
1500
|
return { nfts: o == null ? void 0 : o.nfts, ...a };
|
|
1500
|
-
},
|
|
1501
|
+
}, pu = (t, e, n, r, s) => {
|
|
1501
1502
|
const { data: o, ...a } = ae(r && [`${r}`, "nfts-collection"], () => r && t.getCollection(e, n, r), {
|
|
1502
1503
|
refreshInterval: 6e4,
|
|
1503
1504
|
...s
|
|
1504
1505
|
});
|
|
1505
1506
|
return { collection: o, ...a };
|
|
1506
|
-
},
|
|
1507
|
+
}, mu = (t, e, n, r, s, o) => {
|
|
1507
1508
|
const { data: a, ...i } = ae(s && r && [`${r}:${s}`, "nft"], () => s && r ? t.getNft(e, n, r, s) : void 0, {
|
|
1508
1509
|
refreshInterval: 6e4,
|
|
1509
1510
|
revalidateOnFocus: !1,
|
|
@@ -1511,7 +1512,7 @@ const hr = async (t, e, n, r, s = 1) => {
|
|
|
1511
1512
|
...o
|
|
1512
1513
|
});
|
|
1513
1514
|
return { nft: a, ...i };
|
|
1514
|
-
},
|
|
1515
|
+
}, gu = ({ image_uri: t, image_url_copy: e }) => {
|
|
1515
1516
|
if (t && e) {
|
|
1516
1517
|
if (!e.startsWith("ipfs://"))
|
|
1517
1518
|
return e;
|
|
@@ -1519,16 +1520,16 @@ const hr = async (t, e, n, r, s = 1) => {
|
|
|
1519
1520
|
return t;
|
|
1520
1521
|
}
|
|
1521
1522
|
return e || t;
|
|
1522
|
-
},
|
|
1523
|
-
function
|
|
1523
|
+
}, wu = (t, e) => t.token_id === e.token_id && nt(t.contract_address, e.contract_address);
|
|
1524
|
+
function xn(t) {
|
|
1524
1525
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
1525
1526
|
throw new Error(`Wrong positive integer: ${t}`);
|
|
1526
1527
|
}
|
|
1527
|
-
function
|
|
1528
|
+
function gi(t) {
|
|
1528
1529
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1529
1530
|
}
|
|
1530
|
-
function
|
|
1531
|
-
if (!
|
|
1531
|
+
function ur(t, ...e) {
|
|
1532
|
+
if (!gi(t))
|
|
1532
1533
|
throw new Error("Expected Uint8Array");
|
|
1533
1534
|
if (e.length > 0 && !e.includes(t.length))
|
|
1534
1535
|
throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`);
|
|
@@ -1539,75 +1540,75 @@ function ne(t, e = !0) {
|
|
|
1539
1540
|
if (e && t.finished)
|
|
1540
1541
|
throw new Error("Hash#digest() has already been called");
|
|
1541
1542
|
}
|
|
1542
|
-
function
|
|
1543
|
-
|
|
1543
|
+
function dr(t, e) {
|
|
1544
|
+
ur(t);
|
|
1544
1545
|
const n = e.outputLen;
|
|
1545
1546
|
if (t.length < n)
|
|
1546
1547
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
1547
1548
|
}
|
|
1548
|
-
const Kt = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
1549
|
-
function
|
|
1550
|
-
return e ? { h: Number(t & Kt), l: Number(t >>
|
|
1549
|
+
const Kt = /* @__PURE__ */ BigInt(2 ** 32 - 1), vn = /* @__PURE__ */ BigInt(32);
|
|
1550
|
+
function wi(t, e = !1) {
|
|
1551
|
+
return e ? { h: Number(t & Kt), l: Number(t >> vn & Kt) } : { h: Number(t >> vn & Kt) | 0, l: Number(t & Kt) | 0 };
|
|
1551
1552
|
}
|
|
1552
|
-
function
|
|
1553
|
+
function yi(t, e = !1) {
|
|
1553
1554
|
let n = new Uint32Array(t.length), r = new Uint32Array(t.length);
|
|
1554
1555
|
for (let s = 0; s < t.length; s++) {
|
|
1555
|
-
const { h: o, l: a } =
|
|
1556
|
+
const { h: o, l: a } = wi(t[s], e);
|
|
1556
1557
|
[n[s], r[s]] = [o, a];
|
|
1557
1558
|
}
|
|
1558
1559
|
return [n, r];
|
|
1559
1560
|
}
|
|
1560
|
-
const
|
|
1561
|
+
const bi = (t, e, n) => t << n | e >>> 32 - n, Si = (t, e, n) => e << n | t >>> 32 - n, Ei = (t, e, n) => e << n - 32 | t >>> 64 - n, Ai = (t, e, n) => t << n - 32 | e >>> 64 - n;
|
|
1561
1562
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1562
|
-
const
|
|
1563
|
-
function
|
|
1563
|
+
const xi = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
1564
|
+
function vi(t) {
|
|
1564
1565
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1565
1566
|
}
|
|
1566
|
-
const Ae = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), J = (t, e) => t << 32 - e | t >>> e,
|
|
1567
|
-
if (!
|
|
1567
|
+
const Ae = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), J = (t, e) => t << 32 - e | t >>> e, Ii = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
1568
|
+
if (!Ii)
|
|
1568
1569
|
throw new Error("Non little-endian hardware is not supported");
|
|
1569
|
-
function
|
|
1570
|
+
function fr(t) {
|
|
1570
1571
|
if (typeof t != "string")
|
|
1571
1572
|
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1572
1573
|
return new Uint8Array(new TextEncoder().encode(t));
|
|
1573
1574
|
}
|
|
1574
1575
|
function De(t) {
|
|
1575
|
-
if (typeof t == "string" && (t =
|
|
1576
|
+
if (typeof t == "string" && (t = fr(t)), !vi(t))
|
|
1576
1577
|
throw new Error(`expected Uint8Array, got ${typeof t}`);
|
|
1577
1578
|
return t;
|
|
1578
1579
|
}
|
|
1579
|
-
let
|
|
1580
|
+
let hr = class {
|
|
1580
1581
|
// Safe version that clones internal state
|
|
1581
1582
|
clone() {
|
|
1582
1583
|
return this._cloneInto();
|
|
1583
1584
|
}
|
|
1584
1585
|
};
|
|
1585
|
-
function
|
|
1586
|
+
function pr(t) {
|
|
1586
1587
|
const e = (r) => t().update(De(r)).digest(), n = t();
|
|
1587
1588
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1588
1589
|
}
|
|
1589
|
-
const [
|
|
1590
|
-
for (let t = 0, e =
|
|
1591
|
-
[n, r] = [r, (2 * n + 3 * r) % 5],
|
|
1592
|
-
let s =
|
|
1590
|
+
const [mr, gr, wr] = [[], [], []], Ti = /* @__PURE__ */ BigInt(0), Ot = /* @__PURE__ */ BigInt(1), Bi = /* @__PURE__ */ BigInt(2), _i = /* @__PURE__ */ BigInt(7), Ni = /* @__PURE__ */ BigInt(256), Ci = /* @__PURE__ */ BigInt(113);
|
|
1591
|
+
for (let t = 0, e = Ot, n = 1, r = 0; t < 24; t++) {
|
|
1592
|
+
[n, r] = [r, (2 * n + 3 * r) % 5], mr.push(2 * (5 * r + n)), gr.push((t + 1) * (t + 2) / 2 % 64);
|
|
1593
|
+
let s = Ti;
|
|
1593
1594
|
for (let o = 0; o < 7; o++)
|
|
1594
|
-
e = (e <<
|
|
1595
|
-
|
|
1595
|
+
e = (e << Ot ^ (e >> _i) * Ci) % Ni, e & Bi && (s ^= Ot << (Ot << /* @__PURE__ */ BigInt(o)) - Ot);
|
|
1596
|
+
wr.push(s);
|
|
1596
1597
|
}
|
|
1597
|
-
const [
|
|
1598
|
-
function
|
|
1598
|
+
const [Oi, ki] = /* @__PURE__ */ yi(wr, !0), In = (t, e, n) => n > 32 ? Ei(t, e, n) : bi(t, e, n), Tn = (t, e, n) => n > 32 ? Ai(t, e, n) : Si(t, e, n);
|
|
1599
|
+
function Pi(t, e = 24) {
|
|
1599
1600
|
const n = new Uint32Array(10);
|
|
1600
1601
|
for (let r = 24 - e; r < 24; r++) {
|
|
1601
1602
|
for (let a = 0; a < 10; a++)
|
|
1602
1603
|
n[a] = t[a] ^ t[a + 10] ^ t[a + 20] ^ t[a + 30] ^ t[a + 40];
|
|
1603
1604
|
for (let a = 0; a < 10; a += 2) {
|
|
1604
|
-
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u =
|
|
1605
|
+
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u = In(l, d, 1) ^ n[i], w = Tn(l, d, 1) ^ n[i + 1];
|
|
1605
1606
|
for (let m = 0; m < 50; m += 10)
|
|
1606
1607
|
t[a + m] ^= u, t[a + m + 1] ^= w;
|
|
1607
1608
|
}
|
|
1608
1609
|
let s = t[2], o = t[3];
|
|
1609
1610
|
for (let a = 0; a < 24; a++) {
|
|
1610
|
-
const i =
|
|
1611
|
+
const i = gr[a], c = In(s, o, i), l = Tn(s, o, i), d = mr[a];
|
|
1611
1612
|
s = t[d], o = t[d + 1], t[d] = c, t[d + 1] = l;
|
|
1612
1613
|
}
|
|
1613
1614
|
for (let a = 0; a < 50; a += 10) {
|
|
@@ -1616,19 +1617,19 @@ function Ri(t, e = 24) {
|
|
|
1616
1617
|
for (let i = 0; i < 10; i++)
|
|
1617
1618
|
t[a + i] ^= ~n[(i + 2) % 10] & n[(i + 4) % 10];
|
|
1618
1619
|
}
|
|
1619
|
-
t[0] ^=
|
|
1620
|
+
t[0] ^= Oi[r], t[1] ^= ki[r];
|
|
1620
1621
|
}
|
|
1621
1622
|
n.fill(0);
|
|
1622
1623
|
}
|
|
1623
|
-
class He extends
|
|
1624
|
+
class He extends hr {
|
|
1624
1625
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1625
1626
|
constructor(e, n, r, s = !1, o = 24) {
|
|
1626
|
-
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,
|
|
1627
|
+
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, xn(r), 0 >= this.blockLen || this.blockLen >= 200)
|
|
1627
1628
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1628
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
1629
|
+
this.state = new Uint8Array(200), this.state32 = xi(this.state);
|
|
1629
1630
|
}
|
|
1630
1631
|
keccak() {
|
|
1631
|
-
|
|
1632
|
+
Pi(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
|
|
1632
1633
|
}
|
|
1633
1634
|
update(e) {
|
|
1634
1635
|
ne(this);
|
|
@@ -1651,7 +1652,7 @@ class He extends wr {
|
|
|
1651
1652
|
e[r] ^= n, n & 128 && r === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
1652
1653
|
}
|
|
1653
1654
|
writeInto(e) {
|
|
1654
|
-
ne(this, !1),
|
|
1655
|
+
ne(this, !1), ur(e), this.finish();
|
|
1655
1656
|
const n = this.state, { blockLen: r } = this;
|
|
1656
1657
|
for (let s = 0, o = e.length; s < o; ) {
|
|
1657
1658
|
this.posOut >= r && this.keccak();
|
|
@@ -1666,10 +1667,10 @@ class He extends wr {
|
|
|
1666
1667
|
return this.writeInto(e);
|
|
1667
1668
|
}
|
|
1668
1669
|
xof(e) {
|
|
1669
|
-
return
|
|
1670
|
+
return xn(e), this.xofInto(new Uint8Array(e));
|
|
1670
1671
|
}
|
|
1671
1672
|
digestInto(e) {
|
|
1672
|
-
if (
|
|
1673
|
+
if (dr(e, this), this.finished)
|
|
1673
1674
|
throw new Error("digest() was already called");
|
|
1674
1675
|
return this.writeInto(e), this.destroy(), e;
|
|
1675
1676
|
}
|
|
@@ -1684,14 +1685,14 @@ class He extends wr {
|
|
|
1684
1685
|
return e || (e = new He(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;
|
|
1685
1686
|
}
|
|
1686
1687
|
}
|
|
1687
|
-
const
|
|
1688
|
-
function
|
|
1688
|
+
const Ri = (t, e, n) => pr(() => new He(e, t, n)), $i = /* @__PURE__ */ Ri(1, 136, 256 / 8);
|
|
1689
|
+
function Fi(t, e, n, r) {
|
|
1689
1690
|
if (typeof t.setBigUint64 == "function")
|
|
1690
1691
|
return t.setBigUint64(e, n, r);
|
|
1691
1692
|
const s = BigInt(32), o = BigInt(4294967295), a = Number(n >> s & o), i = Number(n & o), c = r ? 4 : 0, l = r ? 0 : 4;
|
|
1692
1693
|
t.setUint32(e + c, a, r), t.setUint32(e + l, i, r);
|
|
1693
1694
|
}
|
|
1694
|
-
class
|
|
1695
|
+
class Ui extends hr {
|
|
1695
1696
|
constructor(e, n, r, s) {
|
|
1696
1697
|
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);
|
|
1697
1698
|
}
|
|
@@ -1713,13 +1714,13 @@ class ji extends wr {
|
|
|
1713
1714
|
return this.length += e.length, this.roundClean(), this;
|
|
1714
1715
|
}
|
|
1715
1716
|
digestInto(e) {
|
|
1716
|
-
ne(this),
|
|
1717
|
+
ne(this), dr(e, this), this.finished = !0;
|
|
1717
1718
|
const { buffer: n, view: r, blockLen: s, isLE: o } = this;
|
|
1718
1719
|
let { pos: a } = this;
|
|
1719
1720
|
n[a++] = 128, this.buffer.subarray(a).fill(0), this.padOffset > s - a && (this.process(r, 0), a = 0);
|
|
1720
1721
|
for (let u = a; u < s; u++)
|
|
1721
1722
|
n[u] = 0;
|
|
1722
|
-
|
|
1723
|
+
Fi(r, s - 8, BigInt(this.length * 8), o), this.process(r, 0);
|
|
1723
1724
|
const i = Ae(e), c = this.outputLen;
|
|
1724
1725
|
if (c % 4)
|
|
1725
1726
|
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
@@ -1741,7 +1742,7 @@ class ji extends wr {
|
|
|
1741
1742
|
return e.length = s, e.pos = i, e.finished = o, e.destroyed = a, s % n && e.buffer.set(r), e;
|
|
1742
1743
|
}
|
|
1743
1744
|
}
|
|
1744
|
-
const
|
|
1745
|
+
const ji = (t, e, n) => t & e ^ ~t & n, Li = (t, e, n) => t & e ^ t & n ^ e & n, Di = /* @__PURE__ */ new Uint32Array([
|
|
1745
1746
|
1116352408,
|
|
1746
1747
|
1899447441,
|
|
1747
1748
|
3049323471,
|
|
@@ -1816,7 +1817,7 @@ const Li = (t, e, n) => t & e ^ ~t & n, Di = (t, e, n) => t & e ^ t & n ^ e & n,
|
|
|
1816
1817
|
528734635,
|
|
1817
1818
|
1541459225
|
|
1818
1819
|
]), ct = /* @__PURE__ */ new Uint32Array(64);
|
|
1819
|
-
class
|
|
1820
|
+
class Hi extends Ui {
|
|
1820
1821
|
constructor() {
|
|
1821
1822
|
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;
|
|
1822
1823
|
}
|
|
@@ -1837,7 +1838,7 @@ class Vi extends ji {
|
|
|
1837
1838
|
}
|
|
1838
1839
|
let { A: r, B: s, C: o, D: a, E: i, F: c, G: l, H: d } = this;
|
|
1839
1840
|
for (let u = 0; u < 64; u++) {
|
|
1840
|
-
const w = J(i, 6) ^ J(i, 11) ^ J(i, 25), m = d + w +
|
|
1841
|
+
const w = J(i, 6) ^ J(i, 11) ^ J(i, 25), m = d + w + ji(i, c, l) + Di[u] + ct[u] | 0, f = (J(r, 2) ^ J(r, 13) ^ J(r, 22)) + Li(r, s, o) | 0;
|
|
1841
1842
|
d = l, l = c, c = i, i = a + m | 0, a = o, o = s, s = r, r = m + f | 0;
|
|
1842
1843
|
}
|
|
1843
1844
|
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);
|
|
@@ -1849,18 +1850,18 @@ class Vi extends ji {
|
|
|
1849
1850
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
|
|
1850
1851
|
}
|
|
1851
1852
|
}
|
|
1852
|
-
const
|
|
1853
|
+
const yr = /* @__PURE__ */ pr(() => new Hi());
|
|
1853
1854
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1854
|
-
const
|
|
1855
|
-
function
|
|
1855
|
+
const br = BigInt(0), fe = BigInt(1), Vi = BigInt(2), he = (t) => t instanceof Uint8Array, Mi = Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
1856
|
+
function ht(t) {
|
|
1856
1857
|
if (!he(t))
|
|
1857
1858
|
throw new Error("Uint8Array expected");
|
|
1858
1859
|
let e = "";
|
|
1859
1860
|
for (let n = 0; n < t.length; n++)
|
|
1860
|
-
e +=
|
|
1861
|
+
e += Mi[t[n]];
|
|
1861
1862
|
return e;
|
|
1862
1863
|
}
|
|
1863
|
-
function
|
|
1864
|
+
function Sr(t) {
|
|
1864
1865
|
const e = t.toString(16);
|
|
1865
1866
|
return e.length & 1 ? `0${e}` : e;
|
|
1866
1867
|
}
|
|
@@ -1869,7 +1870,7 @@ function Ve(t) {
|
|
|
1869
1870
|
throw new Error("hex string expected, got " + typeof t);
|
|
1870
1871
|
return BigInt(t === "" ? "0" : `0x${t}`);
|
|
1871
1872
|
}
|
|
1872
|
-
function
|
|
1873
|
+
function pt(t) {
|
|
1873
1874
|
if (typeof t != "string")
|
|
1874
1875
|
throw new Error("hex string expected, got " + typeof t);
|
|
1875
1876
|
if (t.length % 2)
|
|
@@ -1884,19 +1885,19 @@ function mt(t) {
|
|
|
1884
1885
|
return e;
|
|
1885
1886
|
}
|
|
1886
1887
|
function X(t) {
|
|
1887
|
-
return Ve(
|
|
1888
|
+
return Ve(ht(t));
|
|
1888
1889
|
}
|
|
1889
1890
|
function Me(t) {
|
|
1890
1891
|
if (!he(t))
|
|
1891
1892
|
throw new Error("Uint8Array expected");
|
|
1892
|
-
return Ve(
|
|
1893
|
+
return Ve(ht(Uint8Array.from(t).reverse()));
|
|
1893
1894
|
}
|
|
1894
|
-
const
|
|
1895
|
+
const Et = (t, e) => pt(t.toString(16).padStart(e * 2, "0")), Er = (t, e) => Et(t, e).reverse(), Gi = (t) => pt(Sr(t));
|
|
1895
1896
|
function V(t, e, n) {
|
|
1896
1897
|
let r;
|
|
1897
1898
|
if (typeof e == "string")
|
|
1898
1899
|
try {
|
|
1899
|
-
r =
|
|
1900
|
+
r = pt(e);
|
|
1900
1901
|
} catch (o) {
|
|
1901
1902
|
throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`);
|
|
1902
1903
|
}
|
|
@@ -1918,7 +1919,7 @@ function jt(...t) {
|
|
|
1918
1919
|
e.set(r, n), n += r.length;
|
|
1919
1920
|
}), e;
|
|
1920
1921
|
}
|
|
1921
|
-
function
|
|
1922
|
+
function zi(t, e) {
|
|
1922
1923
|
if (t.length !== e.length)
|
|
1923
1924
|
return !1;
|
|
1924
1925
|
for (let n = 0; n < t.length; n++)
|
|
@@ -1926,19 +1927,19 @@ function qi(t, e) {
|
|
|
1926
1927
|
return !1;
|
|
1927
1928
|
return !0;
|
|
1928
1929
|
}
|
|
1929
|
-
function
|
|
1930
|
+
function qi(t) {
|
|
1930
1931
|
if (typeof t != "string")
|
|
1931
1932
|
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1932
1933
|
return new TextEncoder().encode(t);
|
|
1933
1934
|
}
|
|
1934
|
-
function
|
|
1935
|
+
function Wi(t) {
|
|
1935
1936
|
let e;
|
|
1936
|
-
for (e = 0; t >
|
|
1937
|
+
for (e = 0; t > br; t >>= fe, e += 1)
|
|
1937
1938
|
;
|
|
1938
1939
|
return e;
|
|
1939
1940
|
}
|
|
1940
|
-
const
|
|
1941
|
-
function
|
|
1941
|
+
const Ki = (t, e) => t >> BigInt(e) & fe, Zi = (t, e, n) => t | (n ? fe : br) << BigInt(e), pe = (t) => (Vi << BigInt(t - 1)) - fe, xe = (t) => new Uint8Array(t), Bn = (t) => Uint8Array.from(t);
|
|
1942
|
+
function Ar(t, e, n) {
|
|
1942
1943
|
if (typeof t != "number" || t < 2)
|
|
1943
1944
|
throw new Error("hashLen must be a number");
|
|
1944
1945
|
if (typeof e != "number" || e < 2)
|
|
@@ -1949,7 +1950,7 @@ function Tr(t, e, n) {
|
|
|
1949
1950
|
const a = () => {
|
|
1950
1951
|
r.fill(1), s.fill(0), o = 0;
|
|
1951
1952
|
}, i = (...u) => n(s, r, ...u), c = (u = xe()) => {
|
|
1952
|
-
s = i(
|
|
1953
|
+
s = i(Bn([0]), u), r = i(), u.length !== 0 && (s = i(Bn([1]), u), r = i());
|
|
1953
1954
|
}, l = () => {
|
|
1954
1955
|
if (o++ >= 1e3)
|
|
1955
1956
|
throw new Error("drbg: tried 1000 values");
|
|
@@ -1970,7 +1971,7 @@ function Tr(t, e, n) {
|
|
|
1970
1971
|
return a(), m;
|
|
1971
1972
|
};
|
|
1972
1973
|
}
|
|
1973
|
-
const
|
|
1974
|
+
const Yi = {
|
|
1974
1975
|
bigint: (t) => typeof t == "bigint",
|
|
1975
1976
|
function: (t) => typeof t == "function",
|
|
1976
1977
|
boolean: (t) => typeof t == "boolean",
|
|
@@ -1982,7 +1983,7 @@ const Xi = {
|
|
|
1982
1983
|
};
|
|
1983
1984
|
function Gt(t, e, n = {}) {
|
|
1984
1985
|
const r = (s, o, a) => {
|
|
1985
|
-
const i =
|
|
1986
|
+
const i = Yi[o];
|
|
1986
1987
|
if (typeof i != "function")
|
|
1987
1988
|
throw new Error(`Invalid validator "${o}", expected function`);
|
|
1988
1989
|
const c = t[s];
|
|
@@ -1995,37 +1996,37 @@ function Gt(t, e, n = {}) {
|
|
|
1995
1996
|
r(s, o, !0);
|
|
1996
1997
|
return t;
|
|
1997
1998
|
}
|
|
1998
|
-
const
|
|
1999
|
+
const Xi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1999
2000
|
__proto__: null,
|
|
2000
|
-
bitGet:
|
|
2001
|
-
bitLen:
|
|
2001
|
+
bitGet: Ki,
|
|
2002
|
+
bitLen: Wi,
|
|
2002
2003
|
bitMask: pe,
|
|
2003
|
-
bitSet:
|
|
2004
|
-
bytesToHex:
|
|
2004
|
+
bitSet: Zi,
|
|
2005
|
+
bytesToHex: ht,
|
|
2005
2006
|
bytesToNumberBE: X,
|
|
2006
2007
|
bytesToNumberLE: Me,
|
|
2007
2008
|
concatBytes: jt,
|
|
2008
|
-
createHmacDrbg:
|
|
2009
|
+
createHmacDrbg: Ar,
|
|
2009
2010
|
ensureBytes: V,
|
|
2010
|
-
equalBytes:
|
|
2011
|
-
hexToBytes:
|
|
2011
|
+
equalBytes: zi,
|
|
2012
|
+
hexToBytes: pt,
|
|
2012
2013
|
hexToNumber: Ve,
|
|
2013
|
-
numberToBytesBE:
|
|
2014
|
-
numberToBytesLE:
|
|
2015
|
-
numberToHexUnpadded:
|
|
2016
|
-
numberToVarBytesBE:
|
|
2017
|
-
utf8ToBytes:
|
|
2014
|
+
numberToBytesBE: Et,
|
|
2015
|
+
numberToBytesLE: Er,
|
|
2016
|
+
numberToHexUnpadded: Sr,
|
|
2017
|
+
numberToVarBytesBE: Gi,
|
|
2018
|
+
utf8ToBytes: qi,
|
|
2018
2019
|
validateObject: Gt
|
|
2019
2020
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2020
2021
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2021
|
-
const U = BigInt(0), $ = BigInt(1), ut = BigInt(2),
|
|
2022
|
+
const U = BigInt(0), $ = BigInt(1), ut = BigInt(2), Ji = BigInt(3), _e = BigInt(4), _n = BigInt(5), Nn = BigInt(8);
|
|
2022
2023
|
BigInt(9);
|
|
2023
2024
|
BigInt(16);
|
|
2024
2025
|
function M(t, e) {
|
|
2025
2026
|
const n = t % e;
|
|
2026
2027
|
return n >= U ? n : e + n;
|
|
2027
2028
|
}
|
|
2028
|
-
function
|
|
2029
|
+
function Qi(t, e, n) {
|
|
2029
2030
|
if (n <= U || e < U)
|
|
2030
2031
|
throw new Error("Expected power/modulo > 0");
|
|
2031
2032
|
if (n === $)
|
|
@@ -2047,12 +2048,12 @@ function Ne(t, e) {
|
|
|
2047
2048
|
throw new Error("invert: does not exist");
|
|
2048
2049
|
return M(s, e);
|
|
2049
2050
|
}
|
|
2050
|
-
function
|
|
2051
|
+
function tc(t) {
|
|
2051
2052
|
const e = (t - $) / ut;
|
|
2052
2053
|
let n, r, s;
|
|
2053
2054
|
for (n = t - $, r = 0; n % ut === U; n /= ut, r++)
|
|
2054
2055
|
;
|
|
2055
|
-
for (s = ut; s < t &&
|
|
2056
|
+
for (s = ut; s < t && Qi(s, e, t) !== t - $; s++)
|
|
2056
2057
|
;
|
|
2057
2058
|
if (r === 1) {
|
|
2058
2059
|
const a = (t + $) / _e;
|
|
@@ -2080,8 +2081,8 @@ function ec(t) {
|
|
|
2080
2081
|
return u;
|
|
2081
2082
|
};
|
|
2082
2083
|
}
|
|
2083
|
-
function
|
|
2084
|
-
if (t % _e ===
|
|
2084
|
+
function ec(t) {
|
|
2085
|
+
if (t % _e === Ji) {
|
|
2085
2086
|
const e = (t + $) / _e;
|
|
2086
2087
|
return function(r, s) {
|
|
2087
2088
|
const o = r.pow(s, e);
|
|
@@ -2090,8 +2091,8 @@ function nc(t) {
|
|
|
2090
2091
|
return o;
|
|
2091
2092
|
};
|
|
2092
2093
|
}
|
|
2093
|
-
if (t %
|
|
2094
|
-
const e = (t -
|
|
2094
|
+
if (t % Nn === _n) {
|
|
2095
|
+
const e = (t - _n) / Nn;
|
|
2095
2096
|
return function(r, s) {
|
|
2096
2097
|
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));
|
|
2097
2098
|
if (!r.eql(r.sqr(l), s))
|
|
@@ -2099,9 +2100,9 @@ function nc(t) {
|
|
|
2099
2100
|
return l;
|
|
2100
2101
|
};
|
|
2101
2102
|
}
|
|
2102
|
-
return
|
|
2103
|
+
return tc(t);
|
|
2103
2104
|
}
|
|
2104
|
-
const
|
|
2105
|
+
const nc = [
|
|
2105
2106
|
"create",
|
|
2106
2107
|
"isValid",
|
|
2107
2108
|
"is0",
|
|
@@ -2126,10 +2127,10 @@ function Ge(t) {
|
|
|
2126
2127
|
MASK: "bigint",
|
|
2127
2128
|
BYTES: "isSafeInteger",
|
|
2128
2129
|
BITS: "isSafeInteger"
|
|
2129
|
-
}, n =
|
|
2130
|
+
}, n = nc.reduce((r, s) => (r[s] = "function", r), e);
|
|
2130
2131
|
return Gt(t, n);
|
|
2131
2132
|
}
|
|
2132
|
-
function
|
|
2133
|
+
function xr(t, e, n) {
|
|
2133
2134
|
if (n < U)
|
|
2134
2135
|
throw new Error("Expected power > 0");
|
|
2135
2136
|
if (n === U)
|
|
@@ -2141,7 +2142,7 @@ function Br(t, e, n) {
|
|
|
2141
2142
|
n & $ && (r = t.mul(r, s)), s = t.sqr(s), n >>= $;
|
|
2142
2143
|
return r;
|
|
2143
2144
|
}
|
|
2144
|
-
function
|
|
2145
|
+
function rc(t, e) {
|
|
2145
2146
|
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);
|
|
2146
2147
|
return e.reduceRight((o, a, i) => t.is0(a) ? o : (n[i] = t.mul(o, n[i]), t.mul(o, a)), s), n;
|
|
2147
2148
|
}
|
|
@@ -2155,7 +2156,7 @@ function qe(t, e, n = !1, r = {}) {
|
|
|
2155
2156
|
const { nBitLength: s, nByteLength: o } = ze(t, e);
|
|
2156
2157
|
if (o > 2048)
|
|
2157
2158
|
throw new Error("Field lengths over 2048 bytes are not supported");
|
|
2158
|
-
const a =
|
|
2159
|
+
const a = ec(t), i = Object.freeze({
|
|
2159
2160
|
ORDER: t,
|
|
2160
2161
|
BITS: s,
|
|
2161
2162
|
BYTES: o,
|
|
@@ -2176,7 +2177,7 @@ function qe(t, e, n = !1, r = {}) {
|
|
|
2176
2177
|
add: (c, l) => M(c + l, t),
|
|
2177
2178
|
sub: (c, l) => M(c - l, t),
|
|
2178
2179
|
mul: (c, l) => M(c * l, t),
|
|
2179
|
-
pow: (c, l) =>
|
|
2180
|
+
pow: (c, l) => xr(i, c, l),
|
|
2180
2181
|
div: (c, l) => M(c * Ne(l, t), t),
|
|
2181
2182
|
// Same as above, but doesn't normalize
|
|
2182
2183
|
sqrN: (c) => c * c,
|
|
@@ -2185,11 +2186,11 @@ function qe(t, e, n = !1, r = {}) {
|
|
|
2185
2186
|
mulN: (c, l) => c * l,
|
|
2186
2187
|
inv: (c) => Ne(c, t),
|
|
2187
2188
|
sqrt: r.sqrt || ((c) => a(i, c)),
|
|
2188
|
-
invertBatch: (c) =>
|
|
2189
|
+
invertBatch: (c) => rc(i, c),
|
|
2189
2190
|
// TODO: do we really need constant cmov?
|
|
2190
2191
|
// We don't have const-time bigints anyway, so probably will be not very useful
|
|
2191
2192
|
cmov: (c, l, d) => d ? l : c,
|
|
2192
|
-
toBytes: (c) => n ?
|
|
2193
|
+
toBytes: (c) => n ? Er(c, o) : Et(c, o),
|
|
2193
2194
|
fromBytes: (c) => {
|
|
2194
2195
|
if (c.length !== o)
|
|
2195
2196
|
throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);
|
|
@@ -2198,7 +2199,7 @@ function qe(t, e, n = !1, r = {}) {
|
|
|
2198
2199
|
});
|
|
2199
2200
|
return Object.freeze(i);
|
|
2200
2201
|
}
|
|
2201
|
-
function
|
|
2202
|
+
function sc(t, e, n = !1) {
|
|
2202
2203
|
t = V("privateHash", t);
|
|
2203
2204
|
const r = t.length, s = ze(e).nByteLength + 8;
|
|
2204
2205
|
if (s < 24 || r < s || r > 1024)
|
|
@@ -2207,7 +2208,7 @@ function oc(t, e, n = !1) {
|
|
|
2207
2208
|
return M(o, e - $) + $;
|
|
2208
2209
|
}
|
|
2209
2210
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2210
|
-
function
|
|
2211
|
+
function oc(t) {
|
|
2211
2212
|
const { Fp: e } = t;
|
|
2212
2213
|
Ge(e);
|
|
2213
2214
|
for (const c of ["t", "roundsFull", "roundsPartial"])
|
|
@@ -2219,7 +2220,7 @@ function ac(t) {
|
|
|
2219
2220
|
if (n === void 0 && (n = 5), typeof n != "number" || !Number.isSafeInteger(n))
|
|
2220
2221
|
throw new Error(`Poseidon wrong sboxPower=${n}`);
|
|
2221
2222
|
const r = BigInt(n);
|
|
2222
|
-
let s = (c) =>
|
|
2223
|
+
let s = (c) => xr(e, c, r);
|
|
2223
2224
|
if (n === 3 ? s = (c) => e.mul(e.sqrN(c), c) : n === 5 && (s = (c) => e.mul(e.sqrN(e.sqrN(c)), c)), t.roundsFull % 2 !== 0)
|
|
2224
2225
|
throw new Error(`Poseidon roundsFull is not even: ${t.roundsFull}`);
|
|
2225
2226
|
const o = t.roundsFull + t.roundsPartial;
|
|
@@ -2247,8 +2248,8 @@ function ac(t) {
|
|
|
2247
2248
|
});
|
|
2248
2249
|
return Object.freeze({ ...t, rounds: o, sboxFn: s, roundConstants: a, mds: i });
|
|
2249
2250
|
}
|
|
2250
|
-
function
|
|
2251
|
-
const { t: e, Fp: n, rounds: r, sboxFn: s, reversePartialPowIdx: o } =
|
|
2251
|
+
function ac(t) {
|
|
2252
|
+
const { t: e, Fp: n, rounds: r, sboxFn: s, reversePartialPowIdx: o } = oc(t), a = Math.floor(t.roundsFull / 2), i = o ? e - 1 : 0, c = (d, u, w) => (d = d.map((m, S) => n.add(m, t.roundConstants[w][S])), u ? d = d.map((m) => s(m)) : d[i] = s(d[i]), d = t.mds.map((m) => m.reduce((S, f, g) => n.add(S, n.mulN(f, d[g])), n.ZERO)), d), l = function(u) {
|
|
2252
2253
|
if (!Array.isArray(u) || u.length !== e)
|
|
2253
2254
|
throw new Error(`Poseidon: wrong values (expected array of bigints with length ${e})`);
|
|
2254
2255
|
u = u.map((m) => {
|
|
@@ -2270,8 +2271,8 @@ function ic(t) {
|
|
|
2270
2271
|
return l.roundConstants = t.roundConstants, l;
|
|
2271
2272
|
}
|
|
2272
2273
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2273
|
-
const
|
|
2274
|
-
function
|
|
2274
|
+
const ic = BigInt(0), ve = BigInt(1);
|
|
2275
|
+
function cc(t, e) {
|
|
2275
2276
|
const n = (s, o) => {
|
|
2276
2277
|
const a = o.negate();
|
|
2277
2278
|
return s ? a : o;
|
|
@@ -2284,7 +2285,7 @@ function lc(t, e) {
|
|
|
2284
2285
|
// non-const time multiplication ladder
|
|
2285
2286
|
unsafeLadder(s, o) {
|
|
2286
2287
|
let a = t.ZERO, i = s;
|
|
2287
|
-
for (; o >
|
|
2288
|
+
for (; o > ic; )
|
|
2288
2289
|
o & ve && (a = a.add(i)), i = i.double(), o >>= ve;
|
|
2289
2290
|
return a;
|
|
2290
2291
|
},
|
|
@@ -2336,7 +2337,7 @@ function lc(t, e) {
|
|
|
2336
2337
|
}
|
|
2337
2338
|
};
|
|
2338
2339
|
}
|
|
2339
|
-
function
|
|
2340
|
+
function vr(t) {
|
|
2340
2341
|
return Ge(t.Fp), Gt(t, {
|
|
2341
2342
|
n: "bigint",
|
|
2342
2343
|
h: "bigint",
|
|
@@ -2352,8 +2353,8 @@ function _r(t) {
|
|
|
2352
2353
|
});
|
|
2353
2354
|
}
|
|
2354
2355
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2355
|
-
function
|
|
2356
|
-
const e =
|
|
2356
|
+
function lc(t) {
|
|
2357
|
+
const e = vr(t);
|
|
2357
2358
|
Gt(e, {
|
|
2358
2359
|
a: "field",
|
|
2359
2360
|
b: "field"
|
|
@@ -2375,7 +2376,7 @@ function uc(t) {
|
|
|
2375
2376
|
}
|
|
2376
2377
|
return Object.freeze({ ...e });
|
|
2377
2378
|
}
|
|
2378
|
-
const { bytesToNumberBE:
|
|
2379
|
+
const { bytesToNumberBE: uc, hexToBytes: dc } = Xi, dt = {
|
|
2379
2380
|
// asn.1 DER encoding utils
|
|
2380
2381
|
Err: class extends Error {
|
|
2381
2382
|
constructor(e = "") {
|
|
@@ -2383,7 +2384,7 @@ const { bytesToNumberBE: dc, hexToBytes: fc } = Ji, ft = {
|
|
|
2383
2384
|
}
|
|
2384
2385
|
},
|
|
2385
2386
|
_parseInt(t) {
|
|
2386
|
-
const { Err: e } =
|
|
2387
|
+
const { Err: e } = dt;
|
|
2387
2388
|
if (t.length < 2 || t[0] !== 2)
|
|
2388
2389
|
throw new e("Invalid signature integer tag");
|
|
2389
2390
|
const n = t[1], r = t.subarray(2, n + 2);
|
|
@@ -2393,10 +2394,10 @@ const { bytesToNumberBE: dc, hexToBytes: fc } = Ji, ft = {
|
|
|
2393
2394
|
throw new e("Invalid signature integer: negative");
|
|
2394
2395
|
if (r[0] === 0 && !(r[1] & 128))
|
|
2395
2396
|
throw new e("Invalid signature integer: unnecessary leading zero");
|
|
2396
|
-
return { d:
|
|
2397
|
+
return { d: uc(r), l: t.subarray(n + 2) };
|
|
2397
2398
|
},
|
|
2398
2399
|
toSig(t) {
|
|
2399
|
-
const { Err: e } =
|
|
2400
|
+
const { Err: e } = dt, n = typeof t == "string" ? dc(t) : t;
|
|
2400
2401
|
if (!(n instanceof Uint8Array))
|
|
2401
2402
|
throw new Error("ui8a expected");
|
|
2402
2403
|
let r = n.length;
|
|
@@ -2404,7 +2405,7 @@ const { bytesToNumberBE: dc, hexToBytes: fc } = Ji, ft = {
|
|
|
2404
2405
|
throw new e("Invalid signature tag");
|
|
2405
2406
|
if (n[1] !== r - 2)
|
|
2406
2407
|
throw new e("Invalid signature: incorrect length");
|
|
2407
|
-
const { d: s, l: o } =
|
|
2408
|
+
const { d: s, l: o } = dt._parseInt(n.subarray(2)), { d: a, l: i } = dt._parseInt(o);
|
|
2408
2409
|
if (i.length)
|
|
2409
2410
|
throw new e("Invalid signature: left bytes after parsing");
|
|
2410
2411
|
return { r: s, s: a };
|
|
@@ -2418,10 +2419,10 @@ const { bytesToNumberBE: dc, hexToBytes: fc } = Ji, ft = {
|
|
|
2418
2419
|
}
|
|
2419
2420
|
}, et = BigInt(0), q = BigInt(1);
|
|
2420
2421
|
BigInt(2);
|
|
2421
|
-
const
|
|
2422
|
+
const Cn = BigInt(3);
|
|
2422
2423
|
BigInt(4);
|
|
2423
|
-
function
|
|
2424
|
-
const e =
|
|
2424
|
+
function fc(t) {
|
|
2425
|
+
const e = lc(t), { Fp: n } = e, r = e.toBytes || ((S, f, g) => {
|
|
2425
2426
|
const b = f.toAffine();
|
|
2426
2427
|
return jt(Uint8Array.from([4]), n.toBytes(b.x), n.toBytes(b.y));
|
|
2427
2428
|
}), s = e.fromBytes || ((S) => {
|
|
@@ -2444,7 +2445,7 @@ function hc(t) {
|
|
|
2444
2445
|
function c(S) {
|
|
2445
2446
|
const { allowedPrivateKeyLengths: f, nByteLength: g, wrapPrivateKey: b, n: E } = e;
|
|
2446
2447
|
if (f && typeof S != "bigint") {
|
|
2447
|
-
if (S instanceof Uint8Array && (S =
|
|
2448
|
+
if (S instanceof Uint8Array && (S = ht(S)), typeof S != "string" || !f.includes(S.length))
|
|
2448
2449
|
throw new Error("Invalid key");
|
|
2449
2450
|
S = S.padStart(g * 2, "0");
|
|
2450
2451
|
}
|
|
@@ -2554,9 +2555,9 @@ function hc(t) {
|
|
|
2554
2555
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
2555
2556
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
2556
2557
|
double() {
|
|
2557
|
-
const { a: f, b: g } = e, b = n.mul(g,
|
|
2558
|
-
let B = n.ZERO, A = n.ZERO, v = n.ZERO, T = n.mul(E, E), G = n.mul(x, x),
|
|
2559
|
-
return N = n.add(N, N), v = n.mul(E, _), v = n.add(v, v), B = n.mul(f, v), A = n.mul(b,
|
|
2558
|
+
const { a: f, b: g } = e, b = n.mul(g, Cn), { px: E, py: x, pz: _ } = this;
|
|
2559
|
+
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);
|
|
2560
|
+
return N = n.add(N, N), v = n.mul(E, _), v = n.add(v, v), B = n.mul(f, v), A = n.mul(b, 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(b, v), R = n.mul(f, R), N = n.sub(T, R), N = n.mul(f, 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);
|
|
2560
2561
|
}
|
|
2561
2562
|
// Renes-Costello-Batina exception-free addition formula.
|
|
2562
2563
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -2566,11 +2567,11 @@ function hc(t) {
|
|
|
2566
2567
|
d(f);
|
|
2567
2568
|
const { px: g, py: b, pz: E } = this, { px: x, py: _, pz: B } = f;
|
|
2568
2569
|
let A = n.ZERO, v = n.ZERO, T = n.ZERO;
|
|
2569
|
-
const G = e.a,
|
|
2570
|
+
const G = e.a, R = n.mul(e.b, Cn);
|
|
2570
2571
|
let N = n.mul(g, x), L = n.mul(b, _), D = n.mul(E, B), rt = n.add(g, b), p = n.add(x, _);
|
|
2571
2572
|
rt = n.mul(rt, p), p = n.add(N, L), rt = n.sub(rt, p), p = n.add(g, E);
|
|
2572
2573
|
let y = n.add(x, B);
|
|
2573
|
-
return p = n.mul(p, y), y = n.add(N, D), p = n.sub(p, y), y = n.add(b, E), A = n.add(_, B), y = n.mul(y, A), A = n.add(L, D), y = n.sub(y, A), T = n.mul(G, p), A = n.mul(
|
|
2574
|
+
return p = n.mul(p, y), y = n.add(N, D), p = n.sub(p, y), y = n.add(b, E), A = n.add(_, B), y = n.mul(y, A), A = n.add(L, D), y = n.sub(y, A), T = n.mul(G, p), A = n.mul(R, D), T = n.add(A, T), A = n.sub(L, T), T = n.add(L, T), v = n.mul(A, T), L = n.add(N, N), L = n.add(L, N), D = n.mul(G, D), p = n.mul(R, p), L = n.add(L, D), D = n.sub(N, D), D = n.mul(G, D), p = n.add(p, D), N = n.mul(L, p), v = n.add(v, N), N = n.mul(y, p), A = n.mul(rt, A), A = n.sub(A, N), N = n.mul(rt, L), T = n.mul(y, T), T = n.add(T, N), new u(A, v, T);
|
|
2574
2575
|
}
|
|
2575
2576
|
subtract(f) {
|
|
2576
2577
|
return this.add(f.negate());
|
|
@@ -2618,8 +2619,8 @@ function hc(t) {
|
|
|
2618
2619
|
const { endo: x } = e;
|
|
2619
2620
|
if (x) {
|
|
2620
2621
|
const { k1neg: _, k1: B, k2neg: A, k2: v } = x.splitScalar(g);
|
|
2621
|
-
let { p: T, f: G } = this.wNAF(B), { p:
|
|
2622
|
-
T = m.constTimeNegate(_, T),
|
|
2622
|
+
let { p: T, f: G } = this.wNAF(B), { p: R, f: N } = this.wNAF(v);
|
|
2623
|
+
T = m.constTimeNegate(_, T), R = m.constTimeNegate(A, R), R = new u(n.mul(R.px, x.beta), R.py, R.pz), b = T.add(R), E = G.add(N);
|
|
2623
2624
|
} else {
|
|
2624
2625
|
const { p: _, f: B } = this.wNAF(g);
|
|
2625
2626
|
b = _, E = B;
|
|
@@ -2665,11 +2666,11 @@ function hc(t) {
|
|
|
2665
2666
|
return this.assertValidity(), r(u, this, f);
|
|
2666
2667
|
}
|
|
2667
2668
|
toHex(f = !0) {
|
|
2668
|
-
return
|
|
2669
|
+
return ht(this.toRawBytes(f));
|
|
2669
2670
|
}
|
|
2670
2671
|
}
|
|
2671
2672
|
u.BASE = new u(e.Gx, e.Gy, n.ONE), u.ZERO = new u(n.ZERO, n.ONE, n.ZERO);
|
|
2672
|
-
const w = e.nBitLength, m =
|
|
2673
|
+
const w = e.nBitLength, m = cc(u, e.endo ? Math.ceil(w / 2) : w);
|
|
2673
2674
|
return {
|
|
2674
2675
|
CURVE: e,
|
|
2675
2676
|
ProjectivePoint: u,
|
|
@@ -2678,8 +2679,8 @@ function hc(t) {
|
|
|
2678
2679
|
isWithinCurveOrder: a
|
|
2679
2680
|
};
|
|
2680
2681
|
}
|
|
2681
|
-
function
|
|
2682
|
-
const e =
|
|
2682
|
+
function hc(t) {
|
|
2683
|
+
const e = vr(t);
|
|
2683
2684
|
return Gt(e, {
|
|
2684
2685
|
hash: "hash",
|
|
2685
2686
|
hmac: "function",
|
|
@@ -2690,8 +2691,8 @@ function pc(t) {
|
|
|
2690
2691
|
lowS: "boolean"
|
|
2691
2692
|
}), Object.freeze({ lowS: !0, ...e });
|
|
2692
2693
|
}
|
|
2693
|
-
function
|
|
2694
|
-
const e =
|
|
2694
|
+
function pc(t) {
|
|
2695
|
+
const e = hc(t), { Fp: n, n: r } = e, s = n.BYTES + 1, o = 2 * n.BYTES + 1;
|
|
2695
2696
|
function a(p) {
|
|
2696
2697
|
return et < p && p < n.ORDER;
|
|
2697
2698
|
}
|
|
@@ -2701,16 +2702,16 @@ function mc(t) {
|
|
|
2701
2702
|
function c(p) {
|
|
2702
2703
|
return Ne(p, r);
|
|
2703
2704
|
}
|
|
2704
|
-
const { ProjectivePoint: l, normPrivateKeyToScalar: d, weierstrassEquation: u, isWithinCurveOrder: w } =
|
|
2705
|
+
const { ProjectivePoint: l, normPrivateKeyToScalar: d, weierstrassEquation: u, isWithinCurveOrder: w } = fc({
|
|
2705
2706
|
...e,
|
|
2706
2707
|
toBytes(p, y, I) {
|
|
2707
|
-
const
|
|
2708
|
-
return I ? j(Uint8Array.from([y.hasEvenY() ? 2 : 3]), C) : j(Uint8Array.from([4]), C, n.toBytes(
|
|
2708
|
+
const P = y.toAffine(), C = n.toBytes(P.x), j = jt;
|
|
2709
|
+
return I ? j(Uint8Array.from([y.hasEvenY() ? 2 : 3]), C) : j(Uint8Array.from([4]), C, n.toBytes(P.y));
|
|
2709
2710
|
},
|
|
2710
2711
|
fromBytes(p) {
|
|
2711
|
-
const y = p.length, I = p[0],
|
|
2712
|
+
const y = p.length, I = p[0], P = p.subarray(1);
|
|
2712
2713
|
if (y === s && (I === 2 || I === 3)) {
|
|
2713
|
-
const C = X(
|
|
2714
|
+
const C = X(P);
|
|
2714
2715
|
if (!a(C))
|
|
2715
2716
|
throw new Error("Point is not on curve");
|
|
2716
2717
|
const j = u(C);
|
|
@@ -2718,12 +2719,12 @@ function mc(t) {
|
|
|
2718
2719
|
const H = (z & q) === q;
|
|
2719
2720
|
return (I & 1) === 1 !== H && (z = n.neg(z)), { x: C, y: z };
|
|
2720
2721
|
} else if (y === o && I === 4) {
|
|
2721
|
-
const C = n.fromBytes(
|
|
2722
|
+
const C = n.fromBytes(P.subarray(0, n.BYTES)), j = n.fromBytes(P.subarray(n.BYTES, 2 * n.BYTES));
|
|
2722
2723
|
return { x: C, y: j };
|
|
2723
2724
|
} else
|
|
2724
2725
|
throw new Error(`Point of length ${y} was invalid. Expected ${s} compressed bytes or ${o} uncompressed bytes`);
|
|
2725
2726
|
}
|
|
2726
|
-
}), m = (p) =>
|
|
2727
|
+
}), m = (p) => ht(Et(p, e.nByteLength));
|
|
2727
2728
|
function S(p) {
|
|
2728
2729
|
const y = r >> q;
|
|
2729
2730
|
return p > y;
|
|
@@ -2733,8 +2734,8 @@ function mc(t) {
|
|
|
2733
2734
|
}
|
|
2734
2735
|
const g = (p, y, I) => X(p.slice(y, I));
|
|
2735
2736
|
class b {
|
|
2736
|
-
constructor(y, I,
|
|
2737
|
-
this.r = y, this.s = I, this.recovery =
|
|
2737
|
+
constructor(y, I, P) {
|
|
2738
|
+
this.r = y, this.s = I, this.recovery = P, this.assertValidity();
|
|
2738
2739
|
}
|
|
2739
2740
|
// pair (bytes of r, bytes of s)
|
|
2740
2741
|
static fromCompact(y) {
|
|
@@ -2744,8 +2745,8 @@ function mc(t) {
|
|
|
2744
2745
|
// DER encoded ECDSA signature
|
|
2745
2746
|
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
|
|
2746
2747
|
static fromDER(y) {
|
|
2747
|
-
const { r: I, s:
|
|
2748
|
-
return new b(I,
|
|
2748
|
+
const { r: I, s: P } = dt.toSig(V("DER", y));
|
|
2749
|
+
return new b(I, P);
|
|
2749
2750
|
}
|
|
2750
2751
|
assertValidity() {
|
|
2751
2752
|
if (!w(this.r))
|
|
@@ -2757,13 +2758,13 @@ function mc(t) {
|
|
|
2757
2758
|
return new b(this.r, this.s, y);
|
|
2758
2759
|
}
|
|
2759
2760
|
recoverPublicKey(y) {
|
|
2760
|
-
const { r: I, s:
|
|
2761
|
+
const { r: I, s: P, recovery: C } = this, j = v(V("msgHash", y));
|
|
2761
2762
|
if (C == null || ![0, 1, 2, 3].includes(C))
|
|
2762
2763
|
throw new Error("recovery id invalid");
|
|
2763
2764
|
const z = C === 2 || C === 3 ? I + e.n : I;
|
|
2764
2765
|
if (z >= n.ORDER)
|
|
2765
2766
|
throw new Error("recovery id 2 or 3 invalid");
|
|
2766
|
-
const H = C & 1 ? "03" : "02", st = l.fromHex(H + m(z)), ot = c(z),
|
|
2767
|
+
const H = C & 1 ? "03" : "02", st = l.fromHex(H + m(z)), ot = c(z), gt = i(-j * ot), Bt = i(P * ot), at = l.BASE.multiplyAndAddUnsafe(st, gt, Bt);
|
|
2767
2768
|
if (!at)
|
|
2768
2769
|
throw new Error("point at infinify");
|
|
2769
2770
|
return at.assertValidity(), at;
|
|
@@ -2777,14 +2778,14 @@ function mc(t) {
|
|
|
2777
2778
|
}
|
|
2778
2779
|
// DER-encoded
|
|
2779
2780
|
toDERRawBytes() {
|
|
2780
|
-
return
|
|
2781
|
+
return pt(this.toDERHex());
|
|
2781
2782
|
}
|
|
2782
2783
|
toDERHex() {
|
|
2783
|
-
return
|
|
2784
|
+
return dt.hexFromSig({ r: this.r, s: this.s });
|
|
2784
2785
|
}
|
|
2785
2786
|
// padded bytes of r, then padded bytes of s
|
|
2786
2787
|
toCompactRawBytes() {
|
|
2787
|
-
return
|
|
2788
|
+
return pt(this.toCompactHex());
|
|
2788
2789
|
}
|
|
2789
2790
|
toCompactHex() {
|
|
2790
2791
|
return m(this.r) + m(this.s);
|
|
@@ -2804,8 +2805,8 @@ function mc(t) {
|
|
|
2804
2805
|
* as per FIPS 186 B.4.1 with modulo bias being neglible.
|
|
2805
2806
|
*/
|
|
2806
2807
|
randomPrivateKey: () => {
|
|
2807
|
-
const p = e.randomBytes(n.BYTES + 8), y =
|
|
2808
|
-
return
|
|
2808
|
+
const p = e.randomBytes(n.BYTES + 8), y = sc(p, r);
|
|
2809
|
+
return Et(y, e.nByteLength);
|
|
2809
2810
|
},
|
|
2810
2811
|
/**
|
|
2811
2812
|
* Creates precompute table for an arbitrary EC point. Makes point "cached".
|
|
@@ -2823,8 +2824,8 @@ function mc(t) {
|
|
|
2823
2824
|
return l.fromPrivateKey(p).toRawBytes(y);
|
|
2824
2825
|
}
|
|
2825
2826
|
function _(p) {
|
|
2826
|
-
const y = p instanceof Uint8Array, I = typeof p == "string",
|
|
2827
|
-
return y ?
|
|
2827
|
+
const y = p instanceof Uint8Array, I = typeof p == "string", P = (y || I) && p.length;
|
|
2828
|
+
return y ? P === s || P === o : I ? P === 2 * s || P === 2 * o : p instanceof l;
|
|
2828
2829
|
}
|
|
2829
2830
|
function B(p, y, I = !0) {
|
|
2830
2831
|
if (_(p))
|
|
@@ -2844,60 +2845,60 @@ function mc(t) {
|
|
|
2844
2845
|
throw new Error("bigint expected");
|
|
2845
2846
|
if (!(et <= p && p < T))
|
|
2846
2847
|
throw new Error(`bigint expected < 2^${e.nBitLength}`);
|
|
2847
|
-
return
|
|
2848
|
+
return Et(p, e.nByteLength);
|
|
2848
2849
|
}
|
|
2849
|
-
function
|
|
2850
|
+
function R(p, y, I = N) {
|
|
2850
2851
|
if (["recovered", "canonical"].some((lt) => lt in I))
|
|
2851
2852
|
throw new Error("sign() legacy options not supported");
|
|
2852
|
-
const { hash:
|
|
2853
|
+
const { hash: P, randomBytes: C } = e;
|
|
2853
2854
|
let { lowS: j, prehash: z, extraEntropy: H } = I;
|
|
2854
|
-
j == null && (j = !0), p = V("msgHash", p), z && (p = V("prehashed msgHash",
|
|
2855
|
-
const st = v(p), ot = d(y),
|
|
2855
|
+
j == null && (j = !0), p = V("msgHash", p), z && (p = V("prehashed msgHash", P(p)));
|
|
2856
|
+
const st = v(p), ot = d(y), gt = [G(ot), G(st)];
|
|
2856
2857
|
if (H != null) {
|
|
2857
2858
|
const lt = H === !0 ? C(n.BYTES) : H;
|
|
2858
|
-
|
|
2859
|
+
gt.push(V("extraEntropy", lt, n.BYTES));
|
|
2859
2860
|
}
|
|
2860
|
-
const
|
|
2861
|
+
const Bt = jt(...gt), at = st;
|
|
2861
2862
|
function we(lt) {
|
|
2862
|
-
const
|
|
2863
|
-
if (!w(
|
|
2863
|
+
const wt = A(lt);
|
|
2864
|
+
if (!w(wt))
|
|
2864
2865
|
return;
|
|
2865
|
-
const Ze = c(
|
|
2866
|
+
const Ze = c(wt), yt = l.BASE.multiply(wt).toAffine(), W = i(yt.x);
|
|
2866
2867
|
if (W === et)
|
|
2867
2868
|
return;
|
|
2868
|
-
const
|
|
2869
|
-
if (
|
|
2869
|
+
const bt = i(Ze * i(at + W * ot));
|
|
2870
|
+
if (bt === et)
|
|
2870
2871
|
return;
|
|
2871
|
-
let Ye = (
|
|
2872
|
-
return j && S(
|
|
2872
|
+
let Ye = (yt.x === W ? 0 : 2) | Number(yt.y & q), Xe = bt;
|
|
2873
|
+
return j && S(bt) && (Xe = f(bt), Ye ^= 1), new b(W, Xe, Ye);
|
|
2873
2874
|
}
|
|
2874
|
-
return { seed:
|
|
2875
|
+
return { seed: Bt, k2sig: we };
|
|
2875
2876
|
}
|
|
2876
2877
|
const N = { lowS: e.lowS, prehash: !1 }, L = { lowS: e.lowS, prehash: !1 };
|
|
2877
2878
|
function D(p, y, I = N) {
|
|
2878
|
-
const { seed:
|
|
2879
|
-
return
|
|
2879
|
+
const { seed: P, k2sig: C } = R(p, y, I);
|
|
2880
|
+
return Ar(e.hash.outputLen, e.nByteLength, e.hmac)(P, C);
|
|
2880
2881
|
}
|
|
2881
2882
|
l.BASE._setWindowSize(8);
|
|
2882
|
-
function rt(p, y, I,
|
|
2883
|
-
var
|
|
2883
|
+
function rt(p, y, I, P = L) {
|
|
2884
|
+
var yt;
|
|
2884
2885
|
const C = p;
|
|
2885
|
-
if (y = V("msgHash", y), I = V("publicKey", I), "strict" in
|
|
2886
|
+
if (y = V("msgHash", y), I = V("publicKey", I), "strict" in P)
|
|
2886
2887
|
throw new Error("options.strict was renamed to lowS");
|
|
2887
|
-
const { lowS: j, prehash: z } =
|
|
2888
|
+
const { lowS: j, prehash: z } = P;
|
|
2888
2889
|
let H, st;
|
|
2889
2890
|
try {
|
|
2890
2891
|
if (typeof C == "string" || C instanceof Uint8Array)
|
|
2891
2892
|
try {
|
|
2892
2893
|
H = b.fromDER(C);
|
|
2893
2894
|
} catch (W) {
|
|
2894
|
-
if (!(W instanceof
|
|
2895
|
+
if (!(W instanceof dt.Err))
|
|
2895
2896
|
throw W;
|
|
2896
2897
|
H = b.fromCompact(C);
|
|
2897
2898
|
}
|
|
2898
2899
|
else if (typeof C == "object" && typeof C.r == "bigint" && typeof C.s == "bigint") {
|
|
2899
|
-
const { r: W, s:
|
|
2900
|
-
H = new b(W,
|
|
2900
|
+
const { r: W, s: bt } = C;
|
|
2901
|
+
H = new b(W, bt);
|
|
2901
2902
|
} else
|
|
2902
2903
|
throw new Error("PARSE");
|
|
2903
2904
|
st = l.fromHex(I);
|
|
@@ -2909,8 +2910,8 @@ function mc(t) {
|
|
|
2909
2910
|
if (j && H.hasHighS())
|
|
2910
2911
|
return !1;
|
|
2911
2912
|
z && (y = e.hash(y));
|
|
2912
|
-
const { r: ot, s:
|
|
2913
|
-
return
|
|
2913
|
+
const { r: ot, s: gt } = H, Bt = v(y), at = c(gt), we = i(Bt * at), lt = i(ot * at), wt = (yt = l.BASE.multiplyAndAddUnsafe(st, we, lt)) == null ? void 0 : yt.toAffine();
|
|
2914
|
+
return wt ? i(wt.x) === ot : !1;
|
|
2914
2915
|
}
|
|
2915
2916
|
return {
|
|
2916
2917
|
CURVE: e,
|
|
@@ -2927,57 +2928,57 @@ function Ce(t) {
|
|
|
2927
2928
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
2928
2929
|
throw new Error(`Wrong positive integer: ${t}`);
|
|
2929
2930
|
}
|
|
2930
|
-
function
|
|
2931
|
+
function mc(t) {
|
|
2931
2932
|
if (typeof t != "boolean")
|
|
2932
2933
|
throw new Error(`Expected boolean, not ${t}`);
|
|
2933
2934
|
}
|
|
2934
|
-
function
|
|
2935
|
+
function Ir(t, ...e) {
|
|
2935
2936
|
if (!(t instanceof Uint8Array))
|
|
2936
2937
|
throw new TypeError("Expected Uint8Array");
|
|
2937
2938
|
if (e.length > 0 && !e.includes(t.length))
|
|
2938
2939
|
throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`);
|
|
2939
2940
|
}
|
|
2940
|
-
function
|
|
2941
|
+
function gc(t) {
|
|
2941
2942
|
if (typeof t != "function" || typeof t.create != "function")
|
|
2942
2943
|
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
|
2943
2944
|
Ce(t.outputLen), Ce(t.blockLen);
|
|
2944
2945
|
}
|
|
2945
|
-
function
|
|
2946
|
+
function wc(t, e = !0) {
|
|
2946
2947
|
if (t.destroyed)
|
|
2947
2948
|
throw new Error("Hash instance has been destroyed");
|
|
2948
2949
|
if (e && t.finished)
|
|
2949
2950
|
throw new Error("Hash#digest() has already been called");
|
|
2950
2951
|
}
|
|
2951
|
-
function
|
|
2952
|
-
|
|
2952
|
+
function yc(t, e) {
|
|
2953
|
+
Ir(t);
|
|
2953
2954
|
const n = e.outputLen;
|
|
2954
2955
|
if (t.length < n)
|
|
2955
2956
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
2956
2957
|
}
|
|
2957
2958
|
const Zt = {
|
|
2958
2959
|
number: Ce,
|
|
2959
|
-
bool:
|
|
2960
|
-
bytes:
|
|
2961
|
-
hash:
|
|
2962
|
-
exists:
|
|
2963
|
-
output:
|
|
2960
|
+
bool: mc,
|
|
2961
|
+
bytes: Ir,
|
|
2962
|
+
hash: gc,
|
|
2963
|
+
exists: wc,
|
|
2964
|
+
output: yc
|
|
2964
2965
|
}, Ie = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
2965
2966
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2966
|
-
const
|
|
2967
|
-
if (!
|
|
2967
|
+
const bc = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
2968
|
+
if (!bc)
|
|
2968
2969
|
throw new Error("Non little-endian hardware is not supported");
|
|
2969
2970
|
Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
2970
|
-
function
|
|
2971
|
+
function Sc(t) {
|
|
2971
2972
|
if (typeof t != "string")
|
|
2972
2973
|
throw new TypeError(`utf8ToBytes expected string, got ${typeof t}`);
|
|
2973
2974
|
return new TextEncoder().encode(t);
|
|
2974
2975
|
}
|
|
2975
|
-
function
|
|
2976
|
-
if (typeof t == "string" && (t =
|
|
2976
|
+
function Ec(t) {
|
|
2977
|
+
if (typeof t == "string" && (t = Sc(t)), !(t instanceof Uint8Array))
|
|
2977
2978
|
throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);
|
|
2978
2979
|
return t;
|
|
2979
2980
|
}
|
|
2980
|
-
function
|
|
2981
|
+
function Ac(...t) {
|
|
2981
2982
|
if (!t.every((r) => r instanceof Uint8Array))
|
|
2982
2983
|
throw new Error("Uint8Array list expected");
|
|
2983
2984
|
if (t.length === 1)
|
|
@@ -2989,21 +2990,21 @@ function xc(...t) {
|
|
|
2989
2990
|
}
|
|
2990
2991
|
return n;
|
|
2991
2992
|
}
|
|
2992
|
-
class
|
|
2993
|
+
class xc {
|
|
2993
2994
|
// Safe version that clones internal state
|
|
2994
2995
|
clone() {
|
|
2995
2996
|
return this._cloneInto();
|
|
2996
2997
|
}
|
|
2997
2998
|
}
|
|
2998
|
-
function
|
|
2999
|
+
function vc(t = 32) {
|
|
2999
3000
|
if (Ie && typeof Ie.getRandomValues == "function")
|
|
3000
3001
|
return Ie.getRandomValues(new Uint8Array(t));
|
|
3001
3002
|
throw new Error("crypto.getRandomValues must be defined");
|
|
3002
3003
|
}
|
|
3003
|
-
class
|
|
3004
|
+
class Tr extends xc {
|
|
3004
3005
|
constructor(e, n) {
|
|
3005
3006
|
super(), this.finished = !1, this.destroyed = !1, Zt.hash(e);
|
|
3006
|
-
const r =
|
|
3007
|
+
const r = Ec(n);
|
|
3007
3008
|
if (this.iHash = e.create(), typeof this.iHash.update != "function")
|
|
3008
3009
|
throw new TypeError("Expected instance of class which extends utils.Hash");
|
|
3009
3010
|
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
@@ -3035,61 +3036,61 @@ class Cr extends vc {
|
|
|
3035
3036
|
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
3036
3037
|
}
|
|
3037
3038
|
}
|
|
3038
|
-
const
|
|
3039
|
-
|
|
3039
|
+
const Br = (t, e, n) => new Tr(t, e).update(n).digest();
|
|
3040
|
+
Br.create = (t, e) => new Tr(t, e);
|
|
3040
3041
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3041
|
-
function
|
|
3042
|
+
function Ic(t) {
|
|
3042
3043
|
return {
|
|
3043
3044
|
hash: t,
|
|
3044
|
-
hmac: (e, ...n) =>
|
|
3045
|
-
randomBytes:
|
|
3045
|
+
hmac: (e, ...n) => Br(t, e, Ac(...n)),
|
|
3046
|
+
randomBytes: vc
|
|
3046
3047
|
};
|
|
3047
3048
|
}
|
|
3048
|
-
const
|
|
3049
|
-
function
|
|
3049
|
+
const On = BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"), _r = 252;
|
|
3050
|
+
function kn(t) {
|
|
3050
3051
|
for (; t[0] === 0; )
|
|
3051
3052
|
t = t.subarray(1);
|
|
3052
|
-
const e = t.length * 8 -
|
|
3053
|
+
const e = t.length * 8 - _r, n = X(t);
|
|
3053
3054
|
return e > 0 ? n >> BigInt(e) : n;
|
|
3054
3055
|
}
|
|
3055
|
-
function
|
|
3056
|
-
return typeof t == "string" && (t =
|
|
3056
|
+
function Nr(t) {
|
|
3057
|
+
return typeof t == "string" && (t = _c(t), t.length & 1 && (t = "0" + t)), pt(t);
|
|
3057
3058
|
}
|
|
3058
|
-
const
|
|
3059
|
+
const Cr = pc({
|
|
3059
3060
|
a: BigInt(1),
|
|
3060
3061
|
b: BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),
|
|
3061
3062
|
Fp: qe(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),
|
|
3062
|
-
n:
|
|
3063
|
-
nBitLength:
|
|
3063
|
+
n: On,
|
|
3064
|
+
nBitLength: _r,
|
|
3064
3065
|
Gx: BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),
|
|
3065
3066
|
Gy: BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),
|
|
3066
3067
|
h: BigInt(1),
|
|
3067
3068
|
lowS: !1,
|
|
3068
|
-
...
|
|
3069
|
-
bits2int:
|
|
3069
|
+
...Ic(yr),
|
|
3070
|
+
bits2int: kn,
|
|
3070
3071
|
bits2int_modN: (t) => {
|
|
3071
3072
|
const e = X(t).toString(16);
|
|
3072
|
-
return e.length === 63 && (t =
|
|
3073
|
+
return e.length === 63 && (t = Nr(e + "0")), M(kn(t), On);
|
|
3073
3074
|
}
|
|
3074
3075
|
});
|
|
3076
|
+
function Tc(t) {
|
|
3077
|
+
return V("", typeof t == "string" ? Nr(t) : t);
|
|
3078
|
+
}
|
|
3079
|
+
const { CURVE: Su, ProjectivePoint: kt, Signature: Eu, utils: Au } = Cr;
|
|
3075
3080
|
function Bc(t) {
|
|
3076
|
-
return
|
|
3081
|
+
return `0x${ht(t.subarray(1)).replace(/^0+/gm, "")}`;
|
|
3077
3082
|
}
|
|
3078
|
-
const { CURVE: wu, ProjectivePoint: Pt, Signature: yu, utils: bu } = Rr;
|
|
3079
3083
|
function _c(t) {
|
|
3080
|
-
return `0x${pt(t.subarray(1)).replace(/^0+/gm, "")}`;
|
|
3081
|
-
}
|
|
3082
|
-
function Nc(t) {
|
|
3083
3084
|
return t.replace(/^0x/i, "");
|
|
3084
3085
|
}
|
|
3085
3086
|
const Lt = [
|
|
3086
|
-
new
|
|
3087
|
-
new
|
|
3088
|
-
new
|
|
3089
|
-
new
|
|
3090
|
-
new
|
|
3087
|
+
new kt(2089986280348253421170679821480865132823066470938446095505822317253594081284n, 1713931329540660377023406109199410414810705867260802078187082345529207694986n, 1n),
|
|
3088
|
+
new kt(996781205833008774514500082376783249102396023663454813447423147977397232763n, 1668503676786377725805489344771023921079126552019160156920634619255970485781n, 1n),
|
|
3089
|
+
new kt(2251563274489750535117886426533222435294046428347329203627021249169616184184n, 1798716007562728905295480679789526322175868328062420237419143593021674992973n, 1n),
|
|
3090
|
+
new kt(2138414695194151160943305727036575959195309218611738193261179310511854807447n, 113410276730064486255102093846540133784865286929052426931474106396135072156n, 1n),
|
|
3091
|
+
new kt(2379962749567351885752724891227938183011949129833673362440656643086021394946n, 776496453633298175483985398648758586525933812536653089401905292063708816422n, 1n)
|
|
3091
3092
|
];
|
|
3092
|
-
function
|
|
3093
|
+
function Or(t, e) {
|
|
3093
3094
|
const n = [];
|
|
3094
3095
|
let r = t;
|
|
3095
3096
|
for (let s = 0; s < 248; s++)
|
|
@@ -3099,8 +3100,8 @@ function $r(t, e) {
|
|
|
3099
3100
|
n.push(r), r = r.double();
|
|
3100
3101
|
return n;
|
|
3101
3102
|
}
|
|
3102
|
-
const
|
|
3103
|
-
function
|
|
3103
|
+
const Nc = Or(Lt[1], Lt[2]), Cc = Or(Lt[3], Lt[4]);
|
|
3104
|
+
function Oc(t) {
|
|
3104
3105
|
let e;
|
|
3105
3106
|
if (typeof t == "bigint")
|
|
3106
3107
|
e = t;
|
|
@@ -3109,13 +3110,13 @@ function kc(t) {
|
|
|
3109
3110
|
throw new Error(`Invalid pedersenArg: ${t}`);
|
|
3110
3111
|
e = BigInt(t);
|
|
3111
3112
|
} else
|
|
3112
|
-
e = X(
|
|
3113
|
-
if (!(0n <= e && e <
|
|
3113
|
+
e = X(Tc(t));
|
|
3114
|
+
if (!(0n <= e && e < Cr.CURVE.Fp.ORDER))
|
|
3114
3115
|
throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${e}`);
|
|
3115
3116
|
return e;
|
|
3116
3117
|
}
|
|
3117
|
-
function
|
|
3118
|
-
let r =
|
|
3118
|
+
function Pn(t, e, n) {
|
|
3119
|
+
let r = Oc(e);
|
|
3119
3120
|
for (let s = 0; s < 252; s++) {
|
|
3120
3121
|
const o = n[s];
|
|
3121
3122
|
if (o.equals(t))
|
|
@@ -3124,33 +3125,33 @@ function $n(t, e, n) {
|
|
|
3124
3125
|
}
|
|
3125
3126
|
return t;
|
|
3126
3127
|
}
|
|
3127
|
-
function
|
|
3128
|
+
function kc(t, e) {
|
|
3128
3129
|
let n = Lt[0];
|
|
3129
|
-
return n =
|
|
3130
|
+
return n = Pn(n, t, Nc), n = Pn(n, e, Cc), Bc(n.toRawBytes(!0));
|
|
3130
3131
|
}
|
|
3131
|
-
const Pc = pe(250),
|
|
3132
|
+
const Pc = pe(250), Rc = (t) => X($i(t)) & Pc;
|
|
3132
3133
|
qe(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));
|
|
3133
|
-
const
|
|
3134
|
-
function
|
|
3135
|
-
const r = t.fromBytes(
|
|
3134
|
+
const $c = qe(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));
|
|
3135
|
+
function Fc(t, e, n) {
|
|
3136
|
+
const r = t.fromBytes(yr(fr(`${e}${n}`)));
|
|
3136
3137
|
return t.create(r);
|
|
3137
3138
|
}
|
|
3138
|
-
const
|
|
3139
|
+
const Uc = [
|
|
3139
3140
|
[3, 1, 1],
|
|
3140
3141
|
[1, -1, 1],
|
|
3141
3142
|
[1, 1, -2]
|
|
3142
3143
|
].map((t) => t.map(BigInt));
|
|
3143
|
-
function
|
|
3144
|
+
function jc(t, e) {
|
|
3144
3145
|
if (Ge(t.Fp), !Number.isSafeInteger(t.rate) || !Number.isSafeInteger(t.capacity))
|
|
3145
3146
|
throw new Error(`Wrong poseidon opts: ${t}`);
|
|
3146
3147
|
const n = t.rate + t.capacity, r = t.roundsFull + t.roundsPartial, s = [];
|
|
3147
3148
|
for (let a = 0; a < r; a++) {
|
|
3148
3149
|
const i = [];
|
|
3149
3150
|
for (let c = 0; c < n; c++)
|
|
3150
|
-
i.push(
|
|
3151
|
+
i.push(Fc(t.Fp, "Hades", n * a + c));
|
|
3151
3152
|
s.push(i);
|
|
3152
3153
|
}
|
|
3153
|
-
const o =
|
|
3154
|
+
const o = ac({
|
|
3154
3155
|
...t,
|
|
3155
3156
|
t: n,
|
|
3156
3157
|
sboxPower: 3,
|
|
@@ -3160,39 +3161,68 @@ function Uc(t, e) {
|
|
|
3160
3161
|
});
|
|
3161
3162
|
return o.m = n, o.rate = t.rate, o.capacity = t.capacity, o;
|
|
3162
3163
|
}
|
|
3163
|
-
|
|
3164
|
-
const
|
|
3164
|
+
jc({ Fp: $c, rate: 2, capacity: 1, roundsFull: 8, roundsPartial: 83 }, Uc);
|
|
3165
|
+
const Lc = h.object({
|
|
3165
3166
|
recoveryId: h.number()
|
|
3166
|
-
}),
|
|
3167
|
+
}), xu = h.object({
|
|
3167
3168
|
feeToken: se,
|
|
3168
3169
|
signerSignature: h.object({
|
|
3169
3170
|
type: h.literal("StarknetKey"),
|
|
3170
3171
|
signer: h.object({
|
|
3171
|
-
publicKey:
|
|
3172
|
-
r:
|
|
3173
|
-
s:
|
|
3172
|
+
publicKey: Pt,
|
|
3173
|
+
r: Pt,
|
|
3174
|
+
s: Pt
|
|
3174
3175
|
})
|
|
3175
3176
|
})
|
|
3176
|
-
}),
|
|
3177
|
+
}), Dc = h.enum([
|
|
3178
|
+
"NOT_STARTED",
|
|
3177
3179
|
"ONGOING",
|
|
3180
|
+
"AWAITING_FUNDS",
|
|
3181
|
+
"AWAITING_COMPLETION",
|
|
3178
3182
|
"COMPLETED",
|
|
3179
|
-
"ERROR",
|
|
3180
3183
|
"CANCELLED",
|
|
3181
|
-
"
|
|
3182
|
-
]),
|
|
3183
|
-
|
|
3184
|
-
|
|
3184
|
+
"ERROR"
|
|
3185
|
+
]), kr = h.object({
|
|
3186
|
+
recoveryId: h.number(),
|
|
3187
|
+
status: Dc,
|
|
3185
3188
|
completionTime: h.array(h.number()).optional()
|
|
3186
|
-
}),
|
|
3189
|
+
}), Hc = h.object({
|
|
3190
|
+
activeRecovery: kr.optional().or(h.null()).optional(),
|
|
3191
|
+
minFees: h.record(h.number()).optional()
|
|
3192
|
+
}), Vc = h.object({
|
|
3193
|
+
recovery: kr.optional().or(h.null()).optional(),
|
|
3194
|
+
minFees: h.record(h.number()).optional()
|
|
3195
|
+
}), Mc = h.enum([
|
|
3187
3196
|
"undeployedAccount",
|
|
3188
3197
|
"notEnoughToPayFees"
|
|
3189
|
-
]),
|
|
3190
|
-
status:
|
|
3198
|
+
]), vu = h.object({
|
|
3199
|
+
status: Mc
|
|
3191
3200
|
});
|
|
3192
|
-
class
|
|
3201
|
+
class Iu {
|
|
3193
3202
|
constructor(e, n) {
|
|
3194
3203
|
this.apiBase = e, this.httpService = n;
|
|
3195
3204
|
}
|
|
3205
|
+
/**
|
|
3206
|
+
* Retrieves the on-chain recovery details for a given address and recovery ID.
|
|
3207
|
+
* If no recovery ID is provided, it retrieves the latest recovery details.
|
|
3208
|
+
* @param address - The address to retrieve the recovery details.
|
|
3209
|
+
* @param recoveryId - The recovery ID to retrieve the details.
|
|
3210
|
+
* @returns A promise that resolves to the on-chain recovery details.
|
|
3211
|
+
*/
|
|
3212
|
+
async getRecovery(e, n) {
|
|
3213
|
+
const r = k(this.apiBase, "accounts", "starknet", e, "recovery", `${n}`), s = await this.httpService.get(r), o = Vc.safeParse(s);
|
|
3214
|
+
return o.error ? null : o.data;
|
|
3215
|
+
}
|
|
3216
|
+
/**
|
|
3217
|
+
* Retrieves the on-chain recovery details for a given address and recovery ID.
|
|
3218
|
+
* If no recovery ID is provided, it retrieves the latest recovery details.
|
|
3219
|
+
* @param address - The address to retrieve the current active recovery details.
|
|
3220
|
+
* @returns A promise that resolves to the on-chain recovery details.
|
|
3221
|
+
*/
|
|
3222
|
+
async getActiveRecovery(e) {
|
|
3223
|
+
const n = k(this.apiBase, "accounts", "starknet", e, "recovery"), r = await this.httpService.get(n), s = Hc.safeParse(r);
|
|
3224
|
+
return s.error ? null : s.data;
|
|
3225
|
+
}
|
|
3196
3226
|
/**
|
|
3197
3227
|
* Starts the recovery process for a given address.
|
|
3198
3228
|
* @param address - The address to recover.
|
|
@@ -3202,56 +3232,34 @@ class xu {
|
|
|
3202
3232
|
* @returns A promise that resolves to the recovery details.
|
|
3203
3233
|
*/
|
|
3204
3234
|
async startRecovery(e, n, r, s) {
|
|
3205
|
-
const { r: o, s: a } =
|
|
3235
|
+
const { r: o, s: a } = as.starkCurve.sign(kc(Rc(ps("utf8", "starknet:recovery")), r), s), i = {
|
|
3206
3236
|
feeToken: n,
|
|
3207
3237
|
signerSignature: {
|
|
3208
3238
|
type: "StarknetKey",
|
|
3209
3239
|
signer: {
|
|
3210
3240
|
publicKey: r,
|
|
3211
|
-
r:
|
|
3212
|
-
s:
|
|
3241
|
+
r: $t.addHexPrefix(o.toString(16)),
|
|
3242
|
+
s: $t.addHexPrefix(a.toString(16))
|
|
3213
3243
|
}
|
|
3214
3244
|
}
|
|
3215
3245
|
};
|
|
3216
3246
|
return await this.httpService.post(`${this.apiBase}/accounts/starknet/${e}/recovery`, {
|
|
3217
3247
|
body: JSON.stringify(i)
|
|
3218
|
-
},
|
|
3219
|
-
}
|
|
3220
|
-
/**
|
|
3221
|
-
* Retrieves the on-chain recovery details for a given address and recovery ID.
|
|
3222
|
-
* If no recovery ID is provided, it retrieves the latest recovery details.
|
|
3223
|
-
* @param address - The address to retrieve the recovery details for.
|
|
3224
|
-
* @param recoveryId - (Optional) The recovery ID to retrieve the details for. If not provided, retrieves the latest recovery details.
|
|
3225
|
-
* @returns A promise that resolves to the on-chain recovery details.
|
|
3226
|
-
*/
|
|
3227
|
-
async getRecovery(e, n) {
|
|
3228
|
-
const r = R(this.apiBase, "accounts", "starknet", e, "recovery", n ? `${n}` : "");
|
|
3229
|
-
return await this.httpService.get(r);
|
|
3248
|
+
}, Lc);
|
|
3230
3249
|
}
|
|
3231
3250
|
/**
|
|
3232
|
-
*
|
|
3233
|
-
* @param address - The address
|
|
3234
|
-
* @param
|
|
3235
|
-
* @
|
|
3236
|
-
*
|
|
3251
|
+
* Completes the recovery process for a given address and recovery ID.
|
|
3252
|
+
* @param address - The address to recover.
|
|
3253
|
+
* @param recoveryId - The recovery ID to complete.
|
|
3254
|
+
* @returns A promise that resolves to the recovery details
|
|
3255
|
+
*
|
|
3237
3256
|
*/
|
|
3238
|
-
async
|
|
3239
|
-
const
|
|
3240
|
-
|
|
3241
|
-
type: "StarknetKey",
|
|
3242
|
-
signer: {
|
|
3243
|
-
publicKey: n,
|
|
3244
|
-
r: dt.addHexPrefix(s.toString(16)),
|
|
3245
|
-
s: dt.addHexPrefix(o.toString(16))
|
|
3246
|
-
}
|
|
3247
|
-
}
|
|
3248
|
-
};
|
|
3249
|
-
await this.httpService.post(`${this.apiBase}/accounts/starknet/${e}/recovery/cancel`, {
|
|
3250
|
-
body: JSON.stringify(a)
|
|
3251
|
-
});
|
|
3257
|
+
async completeRecovery(e, n) {
|
|
3258
|
+
const r = k(this.apiBase, "accounts", "starknet", e, "recovery", `${n}`, "complete");
|
|
3259
|
+
return await this.httpService.post(r);
|
|
3252
3260
|
}
|
|
3253
3261
|
}
|
|
3254
|
-
async function
|
|
3262
|
+
async function Tu() {
|
|
3255
3263
|
if ("brave" in navigator)
|
|
3256
3264
|
try {
|
|
3257
3265
|
return await navigator.brave.isBrave();
|
|
@@ -3260,25 +3268,25 @@ async function vu() {
|
|
|
3260
3268
|
return !1;
|
|
3261
3269
|
}
|
|
3262
3270
|
let Te;
|
|
3263
|
-
function
|
|
3264
|
-
return Te || (Te = new
|
|
3271
|
+
function Gc() {
|
|
3272
|
+
return Te || (Te = new ms(navigator.userAgent).getResult()), Te;
|
|
3265
3273
|
}
|
|
3266
3274
|
function me(t) {
|
|
3267
|
-
return
|
|
3275
|
+
return Gc().browser.name === t;
|
|
3268
3276
|
}
|
|
3269
|
-
function
|
|
3277
|
+
function Bu() {
|
|
3270
3278
|
return me("Firefox");
|
|
3271
3279
|
}
|
|
3272
|
-
function
|
|
3280
|
+
function _u() {
|
|
3273
3281
|
return me("Chrome");
|
|
3274
3282
|
}
|
|
3275
|
-
function
|
|
3283
|
+
function Nu() {
|
|
3276
3284
|
return me("Safari");
|
|
3277
3285
|
}
|
|
3278
|
-
function
|
|
3286
|
+
function Cu() {
|
|
3279
3287
|
return me("Edge");
|
|
3280
3288
|
}
|
|
3281
|
-
const
|
|
3289
|
+
const Ou = h.string().refine((t) => gs(t, ws), "Invalid seedphrase"), We = [
|
|
3282
3290
|
{
|
|
3283
3291
|
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
3284
3292
|
name: "Ether",
|
|
@@ -3455,7 +3463,7 @@ const Nu = h.string().refine((t) => ws(t, ys), "Invalid seedphrase"), We = [
|
|
|
3455
3463
|
networkId: "mainnet-alpha",
|
|
3456
3464
|
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/ekubo.png"
|
|
3457
3465
|
}
|
|
3458
|
-
],
|
|
3466
|
+
], zc = async (t, e, n) => {
|
|
3459
3467
|
const r = await n.callContract({
|
|
3460
3468
|
contractAddress: t,
|
|
3461
3469
|
entrypoint: "balanceOf",
|
|
@@ -3465,14 +3473,14 @@ const Nu = h.string().refine((t) => ws(t, ys), "Invalid seedphrase"), We = [
|
|
|
3465
3473
|
low: r[0],
|
|
3466
3474
|
high: r[1]
|
|
3467
3475
|
})));
|
|
3468
|
-
},
|
|
3476
|
+
}, ku = async (t, e, n) => {
|
|
3469
3477
|
const r = We.filter((o) => o.networkId === t);
|
|
3470
3478
|
return (await Promise.allSettled(r.map((o) => e.callContract({
|
|
3471
3479
|
contractAddress: o.address,
|
|
3472
3480
|
entrypoint: "balanceOf",
|
|
3473
3481
|
calldata: [n]
|
|
3474
3482
|
})))).reduce((o, a, i) => {
|
|
3475
|
-
if (a.status === "fulfilled" &&
|
|
3483
|
+
if (a.status === "fulfilled" && ds(a.value) || a.status === "rejected" || a.value[0] === "0x0" && a.value[1] === "0x0")
|
|
3476
3484
|
return o;
|
|
3477
3485
|
const c = BigInt(O.toHex(Dt.uint256ToBN({
|
|
3478
3486
|
low: a.value[0],
|
|
@@ -3483,7 +3491,7 @@ const Nu = h.string().refine((t) => ws(t, ys), "Invalid seedphrase"), We = [
|
|
|
3483
3491
|
};
|
|
3484
3492
|
return o.push(l), o;
|
|
3485
3493
|
}, []);
|
|
3486
|
-
},
|
|
3494
|
+
}, Pu = async () => We, Ru = ({ address: t, networkId: e }) => We.find((r) => r.address === t && r.networkId === e), $u = ({ amount: t, decimals: e, unitCurrencyValue: n }) => {
|
|
3487
3495
|
if (!Y(t) || !Y(e) || !Y(n))
|
|
3488
3496
|
return;
|
|
3489
3497
|
const r = Number(e), s = BigInt(t) * Fe(n.toString()).value;
|
|
@@ -3491,36 +3499,36 @@ const Nu = h.string().refine((t) => ws(t, ys), "Invalid seedphrase"), We = [
|
|
|
3491
3499
|
value: s,
|
|
3492
3500
|
decimals: r + Ht
|
|
3493
3501
|
});
|
|
3494
|
-
},
|
|
3502
|
+
}, Fu = ({ unitAmount: t, decimals: e }) => {
|
|
3495
3503
|
if (t === void 0 || !Y(t) || e === void 0 || !Y(e))
|
|
3496
3504
|
return;
|
|
3497
3505
|
const n = Number(e);
|
|
3498
|
-
return
|
|
3499
|
-
},
|
|
3506
|
+
return xt(t.toString(), n).value.toString();
|
|
3507
|
+
}, Uu = (t) => Y(t) ? Number(t) : 18, { UINT_256_MAX: qc } = Dt, Wc = (t) => String(t) === String(qc), ju = (t, e = "$", n) => {
|
|
3500
3508
|
if (t === void 0 || !Y(t))
|
|
3501
3509
|
return null;
|
|
3502
|
-
const r =
|
|
3510
|
+
const r = di(t, n);
|
|
3503
3511
|
return [e, r].filter(Boolean).join("");
|
|
3504
|
-
},
|
|
3512
|
+
}, Kc = "Unlimited", Lu = ({ amount: t, decimals: e, symbol: n, showPlusSign: r = !1, withSymbol: s = !0, unlimitedText: o = Kc, prettyConfigOverrides: a }) => {
|
|
3505
3513
|
if (!Y(t))
|
|
3506
3514
|
return null;
|
|
3507
3515
|
let i, c = !1;
|
|
3508
|
-
if (
|
|
3516
|
+
if (Wc(t))
|
|
3509
3517
|
i = o;
|
|
3510
3518
|
else {
|
|
3511
3519
|
const d = Number(e), u = BigInt(t);
|
|
3512
3520
|
c = u > 0n;
|
|
3513
3521
|
const w = d > 0 ? Vt({ value: u, decimals: d }) : u.toString();
|
|
3514
|
-
i = d > 0 ?
|
|
3522
|
+
i = d > 0 ? fi(w, a) : w;
|
|
3515
3523
|
}
|
|
3516
3524
|
const l = [i, s && n].filter(Boolean).join(" ");
|
|
3517
3525
|
return r && c ? `+${l}` : l;
|
|
3518
3526
|
};
|
|
3519
|
-
var
|
|
3520
|
-
function
|
|
3527
|
+
var Zc = Kr, Yc = Zc;
|
|
3528
|
+
function Xc(t, e) {
|
|
3521
3529
|
function n(r, s) {
|
|
3522
3530
|
var o = e || {}, a;
|
|
3523
|
-
"randomize" in o || (o.randomize = !0), a =
|
|
3531
|
+
"randomize" in o || (o.randomize = !0), a = Yc.operation(o);
|
|
3524
3532
|
function i(d) {
|
|
3525
3533
|
s(d || new Error("Aborted"));
|
|
3526
3534
|
}
|
|
@@ -3547,9 +3555,9 @@ function Kc(t, e) {
|
|
|
3547
3555
|
}
|
|
3548
3556
|
return new Promise(n);
|
|
3549
3557
|
}
|
|
3550
|
-
var
|
|
3551
|
-
const
|
|
3552
|
-
class
|
|
3558
|
+
var Jc = Xc;
|
|
3559
|
+
const Qc = /* @__PURE__ */ Zr(Jc);
|
|
3560
|
+
class Du {
|
|
3553
3561
|
constructor(e, n) {
|
|
3554
3562
|
this.apiBase = e, this.httpService = n, this.TOKENS_INFO_URL = "/tokens/info", this.TOKENS_DEFI_DECOMPOSITION_URL = "/tokens/defi/decomposition";
|
|
3555
3563
|
}
|
|
@@ -3559,10 +3567,10 @@ class ju {
|
|
|
3559
3567
|
* @returns {Promise<ApiTokenInfo[]>} - The fetched tokens or undefined if there was an error or not default network
|
|
3560
3568
|
*/
|
|
3561
3569
|
async fetchTokensInfoFromBackend(e) {
|
|
3562
|
-
const n =
|
|
3570
|
+
const n = k(this.apiBase, this.TOKENS_INFO_URL, e ?? "", "?chain=starknet"), r = await this.httpService.get(n), s = Yr.safeParse(r);
|
|
3563
3571
|
if (s.success)
|
|
3564
3572
|
return s.data.tokens;
|
|
3565
|
-
const o =
|
|
3573
|
+
const o = Xr.safeParse(r);
|
|
3566
3574
|
if (o.success)
|
|
3567
3575
|
return [o.data];
|
|
3568
3576
|
}
|
|
@@ -3572,8 +3580,8 @@ class ju {
|
|
|
3572
3580
|
* @returns {Promise<BaseTokenWithBalance[]>} - The fetched balances for the account address.
|
|
3573
3581
|
*/
|
|
3574
3582
|
async fetchAddressTokenBalancesFromBackend(e, n, r) {
|
|
3575
|
-
const s =
|
|
3576
|
-
return (await
|
|
3583
|
+
const s = k(this.apiBase, "activity", "starknet", n, "account", e, "balance");
|
|
3584
|
+
return (await Qc(
|
|
3577
3585
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3578
3586
|
async (i) => {
|
|
3579
3587
|
let c;
|
|
@@ -3582,7 +3590,7 @@ class ju {
|
|
|
3582
3590
|
} catch {
|
|
3583
3591
|
return i(new Error("Error fetching")), [];
|
|
3584
3592
|
}
|
|
3585
|
-
const l =
|
|
3593
|
+
const l = Jr.safeParse(c);
|
|
3586
3594
|
if (!l.success)
|
|
3587
3595
|
return i(new Error("Error parsing response")), [];
|
|
3588
3596
|
if (l.data.status !== "initialised")
|
|
@@ -3602,32 +3610,32 @@ class ju {
|
|
|
3602
3610
|
}));
|
|
3603
3611
|
}
|
|
3604
3612
|
async fetchDefiDecomposition(e) {
|
|
3605
|
-
const n =
|
|
3606
|
-
if (!
|
|
3607
|
-
throw new
|
|
3613
|
+
const n = k(this.apiBase, this.TOKENS_DEFI_DECOMPOSITION_URL, e, "?chain=starknet"), r = await this.httpService.get(n);
|
|
3614
|
+
if (!Qr.safeParse(r).success)
|
|
3615
|
+
throw new ts({ code: "TOKEN_DEFI_DECOMPOSITION_PARSING_ERROR" });
|
|
3608
3616
|
return r.dapps;
|
|
3609
3617
|
}
|
|
3610
3618
|
}
|
|
3611
|
-
const
|
|
3619
|
+
const Hu = (t, e, n, r) => ({
|
|
3612
3620
|
contractAddress: t,
|
|
3613
3621
|
entrypoint: "transfer",
|
|
3614
|
-
calldata:
|
|
3622
|
+
calldata: mt.compile({
|
|
3615
3623
|
recipient: e,
|
|
3616
|
-
amount: Ut(
|
|
3624
|
+
amount: Ut(hi(n, r))
|
|
3617
3625
|
})
|
|
3618
|
-
}),
|
|
3626
|
+
}), Vu = (t, e, n, r) => ({
|
|
3619
3627
|
contractAddress: t,
|
|
3620
3628
|
entrypoint: "transferFrom",
|
|
3621
|
-
calldata:
|
|
3629
|
+
calldata: mt.compile({
|
|
3622
3630
|
from_: e,
|
|
3623
3631
|
to: n,
|
|
3624
3632
|
tokenId: Ut(r)
|
|
3625
3633
|
// OZ specs need a uint256 as tokenId
|
|
3626
3634
|
})
|
|
3627
|
-
}),
|
|
3635
|
+
}), Mu = (t, e, n, r) => ({
|
|
3628
3636
|
contractAddress: t,
|
|
3629
3637
|
entrypoint: "safeTransferFrom",
|
|
3630
|
-
calldata:
|
|
3638
|
+
calldata: mt.compile({
|
|
3631
3639
|
from_: e,
|
|
3632
3640
|
to: n,
|
|
3633
3641
|
tokenId: Ut(r),
|
|
@@ -3635,14 +3643,14 @@ const Lu = (t, e, n, r) => ({
|
|
|
3635
3643
|
data_len: "0"
|
|
3636
3644
|
})
|
|
3637
3645
|
});
|
|
3638
|
-
function
|
|
3646
|
+
function Pr(t) {
|
|
3639
3647
|
return Pe(t.unit) === "WEI";
|
|
3640
3648
|
}
|
|
3641
|
-
function
|
|
3649
|
+
function tl(t) {
|
|
3642
3650
|
return Pe(t.unit) === "FRI";
|
|
3643
3651
|
}
|
|
3644
|
-
function
|
|
3645
|
-
return
|
|
3652
|
+
function At(t, e) {
|
|
3653
|
+
return Pr(t) ? {
|
|
3646
3654
|
...t,
|
|
3647
3655
|
maxFee: e(t.maxFee),
|
|
3648
3656
|
overallFee: e(t.overallFee),
|
|
@@ -3657,8 +3665,8 @@ function xt(t, e) {
|
|
|
3657
3665
|
maxPricePerUnit: e(t.maxPricePerUnit)
|
|
3658
3666
|
};
|
|
3659
3667
|
}
|
|
3660
|
-
function
|
|
3661
|
-
return
|
|
3668
|
+
function Rt(t) {
|
|
3669
|
+
return Pr(t) ? {
|
|
3662
3670
|
maxFee: t.maxFee
|
|
3663
3671
|
} : {
|
|
3664
3672
|
amount: t.maxAmount,
|
|
@@ -3666,13 +3674,13 @@ function $t(t) {
|
|
|
3666
3674
|
};
|
|
3667
3675
|
}
|
|
3668
3676
|
function Be(t) {
|
|
3669
|
-
return
|
|
3677
|
+
return tl({ unit: t }) ? ke : Ln;
|
|
3670
3678
|
}
|
|
3671
|
-
function
|
|
3679
|
+
function Gu(t, e, n = 2) {
|
|
3672
3680
|
const r = BigInt(10 ** n), s = BigInt(Math.round(e * 10 ** n));
|
|
3673
3681
|
return t * s / r;
|
|
3674
3682
|
}
|
|
3675
|
-
const
|
|
3683
|
+
const zu = [ke], Rr = (t, e = ol) => {
|
|
3676
3684
|
if (t.max && "amount" in t.max)
|
|
3677
3685
|
return {
|
|
3678
3686
|
...t,
|
|
@@ -3681,7 +3689,7 @@ const Mu = [ke], Ur = (t, e = nl) => {
|
|
|
3681
3689
|
const n = 10000n, { amount: r, pricePerUnit: s, dataGasConsumed: o = 0n, dataGasPrice: a = 0n } = t, i = r * s + o * a;
|
|
3682
3690
|
if (i < 0)
|
|
3683
3691
|
throw Error("Cannot calculate max fee for negative fee");
|
|
3684
|
-
const c = O.toBigInt(
|
|
3692
|
+
const c = O.toBigInt(rs({ estimatedFee: i })), l = Number(c) / Number(i), d = e(l), u = BigInt(Math.trunc(d * Number(n)));
|
|
3685
3693
|
return {
|
|
3686
3694
|
...t,
|
|
3687
3695
|
amount: r * u / n,
|
|
@@ -3692,38 +3700,38 @@ const Mu = [ke], Ur = (t, e = nl) => {
|
|
|
3692
3700
|
}, re = (t) => {
|
|
3693
3701
|
const { amount: e, pricePerUnit: n, dataGasConsumed: r = 0n, dataGasPrice: s = 0n } = t;
|
|
3694
3702
|
return e * n + r * s;
|
|
3695
|
-
},
|
|
3703
|
+
}, el = (t) => {
|
|
3696
3704
|
if (t.max)
|
|
3697
3705
|
return "maxFee" in t.max ? t.max.maxFee : re(t.max);
|
|
3698
3706
|
}, Oe = (t) => {
|
|
3699
|
-
const e =
|
|
3700
|
-
return e || re(
|
|
3701
|
-
},
|
|
3707
|
+
const e = el(t);
|
|
3708
|
+
return e || re(Rr(t));
|
|
3709
|
+
}, qu = (t) => {
|
|
3702
3710
|
if (t.deployment && !nt(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
3703
3711
|
throw Error("Cannot calculate estimated fees for different tokens");
|
|
3704
3712
|
const e = re(t.transactions), n = t.deployment ? re(t.deployment) : 0n;
|
|
3705
3713
|
return e + n;
|
|
3706
|
-
},
|
|
3714
|
+
}, Wu = (t) => {
|
|
3707
3715
|
if (t.deployment && !nt(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
3708
3716
|
throw Error("Cannot calculate estimated fees for different tokens");
|
|
3709
3717
|
const e = t.deployment ? Oe(t.deployment) : 0n, n = Oe(t.transactions);
|
|
3710
3718
|
return e + n;
|
|
3711
|
-
},
|
|
3719
|
+
}, Ku = (t, e) => [
|
|
3712
3720
|
{
|
|
3713
3721
|
contractAddress: t,
|
|
3714
3722
|
entrypoint: "transfer",
|
|
3715
|
-
calldata:
|
|
3723
|
+
calldata: mt.compile(es.parse({
|
|
3716
3724
|
// We are using a dummy address (ETH here) as recipient to estimate the fee given we don't have a receipient yet
|
|
3717
3725
|
recipient: e,
|
|
3718
3726
|
// We are using the smallest possible amount to make sure this doesn't throw an error
|
|
3719
3727
|
amount: Dt.bnToUint256(BigInt(1))
|
|
3720
3728
|
}))
|
|
3721
3729
|
}
|
|
3722
|
-
],
|
|
3730
|
+
], nl = (t, e) => {
|
|
3723
3731
|
if (!t)
|
|
3724
3732
|
return {
|
|
3725
3733
|
transactions: {
|
|
3726
|
-
feeTokenAddress: e ??
|
|
3734
|
+
feeTokenAddress: e ?? Ln,
|
|
3727
3735
|
amount: 0n,
|
|
3728
3736
|
pricePerUnit: 0n,
|
|
3729
3737
|
dataGasConsumed: 0n,
|
|
@@ -3739,7 +3747,7 @@ const Mu = [ke], Ur = (t, e = nl) => {
|
|
|
3739
3747
|
feeTokenAddress: Be(n.unit),
|
|
3740
3748
|
amount: O.toBigInt(n.gasUsage),
|
|
3741
3749
|
pricePerUnit: O.toBigInt(n.gasPrice),
|
|
3742
|
-
max:
|
|
3750
|
+
max: Rt(At(n, O.toBigInt)),
|
|
3743
3751
|
dataGasConsumed: n.dataGasConsumed ? O.toBigInt(n.dataGasConsumed) : 0n,
|
|
3744
3752
|
dataGasPrice: n.dataGasPrice ? O.toBigInt(n.dataGasPrice) : 0n
|
|
3745
3753
|
}
|
|
@@ -3752,7 +3760,7 @@ const Mu = [ke], Ur = (t, e = nl) => {
|
|
|
3752
3760
|
feeTokenAddress: Be(n.unit),
|
|
3753
3761
|
amount: O.toBigInt(n.gasUsage),
|
|
3754
3762
|
pricePerUnit: O.toBigInt(n.gasPrice),
|
|
3755
|
-
max:
|
|
3763
|
+
max: Rt(At(n, O.toBigInt)),
|
|
3756
3764
|
dataGasConsumed: n.dataGasConsumed ? O.toBigInt(n.dataGasConsumed) : 0n,
|
|
3757
3765
|
dataGasPrice: n.dataGasPrice ? O.toBigInt(n.dataGasPrice) : 0n
|
|
3758
3766
|
},
|
|
@@ -3760,14 +3768,14 @@ const Mu = [ke], Ur = (t, e = nl) => {
|
|
|
3760
3768
|
feeTokenAddress: Be(r.unit),
|
|
3761
3769
|
amount: O.toBigInt(r.gasUsage),
|
|
3762
3770
|
pricePerUnit: O.toBigInt(r.gasPrice),
|
|
3763
|
-
max:
|
|
3771
|
+
max: Rt(At(r, O.toBigInt)),
|
|
3764
3772
|
dataGasConsumed: r.dataGasConsumed ? O.toBigInt(r.dataGasConsumed) : 0n,
|
|
3765
3773
|
dataGasPrice: r.dataGasPrice ? O.toBigInt(r.dataGasPrice) : 0n
|
|
3766
3774
|
}
|
|
3767
3775
|
};
|
|
3768
3776
|
}
|
|
3769
3777
|
throw Error("Unexpected simulation response length");
|
|
3770
|
-
},
|
|
3778
|
+
}, rl = ({ transaction: t, nonce: e, chainId: n, version: r, isDeploymentTransaction: s, cairoVersion: o, address: a, appDomain: i }) => {
|
|
3771
3779
|
let c = e;
|
|
3772
3780
|
s && t.type !== "DEPLOY_ACCOUNT" && (c = O.toHex(1));
|
|
3773
3781
|
const l = oe(t.calls);
|
|
@@ -3786,32 +3794,32 @@ const Mu = [ke], Ur = (t, e = nl) => {
|
|
|
3786
3794
|
appDomain: i
|
|
3787
3795
|
// appDomain: "https://starknetkit-blacked-listed.vercel.app", // to simulate blacklisted domain
|
|
3788
3796
|
};
|
|
3789
|
-
},
|
|
3797
|
+
}, sl = (t, e) => {
|
|
3790
3798
|
const { transactions: n } = t, r = n.map((c) => {
|
|
3791
3799
|
if (!c.simulation)
|
|
3792
|
-
throw new
|
|
3800
|
+
throw new ns({ code: "SIMULATE_AND_REVIEW_FAILED" });
|
|
3793
3801
|
return c;
|
|
3794
3802
|
}), s = r.map((c) => ({
|
|
3795
3803
|
...c.simulation,
|
|
3796
|
-
feeEstimation:
|
|
3797
|
-
})), o =
|
|
3804
|
+
feeEstimation: At(c.simulation.feeEstimation, Number)
|
|
3805
|
+
})), o = nl(s, e), [a, i] = r.length === 1 ? [r[0], void 0] : [r[1], r[0]];
|
|
3798
3806
|
return {
|
|
3799
3807
|
...o,
|
|
3800
3808
|
transactions: {
|
|
3801
3809
|
...o.transactions,
|
|
3802
3810
|
dataGasConsumed: o.transactions.dataGasConsumed ?? 0n,
|
|
3803
3811
|
dataGasPrice: o.transactions.dataGasPrice ?? 0n,
|
|
3804
|
-
max:
|
|
3812
|
+
max: Rt(At(a.simulation.feeEstimation, O.toBigInt))
|
|
3805
3813
|
},
|
|
3806
3814
|
deployment: o.deployment && i ? {
|
|
3807
3815
|
...o.deployment,
|
|
3808
3816
|
dataGasConsumed: o.deployment.dataGasConsumed ?? 0n,
|
|
3809
3817
|
dataGasPrice: o.deployment.dataGasPrice ?? 0n,
|
|
3810
|
-
max:
|
|
3818
|
+
max: Rt(At(i.simulation.feeEstimation, O.toBigInt))
|
|
3811
3819
|
} : void 0
|
|
3812
3820
|
};
|
|
3813
|
-
},
|
|
3814
|
-
const e =
|
|
3821
|
+
}, Zu = (t) => {
|
|
3822
|
+
const e = Rr(t), n = Oe(t);
|
|
3815
3823
|
return {
|
|
3816
3824
|
// for v1 transactions
|
|
3817
3825
|
maxFee: n,
|
|
@@ -3829,31 +3837,31 @@ const Mu = [ke], Ur = (t, e = nl) => {
|
|
|
3829
3837
|
}
|
|
3830
3838
|
}
|
|
3831
3839
|
};
|
|
3832
|
-
},
|
|
3840
|
+
}, Yu = (t) => {
|
|
3833
3841
|
const e = Math.sqrt(t);
|
|
3834
3842
|
return isNaN(e) ? Math.sqrt(2) : e;
|
|
3835
|
-
},
|
|
3843
|
+
}, ol = (t) => {
|
|
3836
3844
|
const e = Math.cbrt(t);
|
|
3837
3845
|
return isNaN(e) ? Math.cbrt(2) : e;
|
|
3838
|
-
},
|
|
3846
|
+
}, Xu = (t) => t < 1 || isNaN(t) ? 1.1 : Math.log(t + 1) + 1, al = [ke];
|
|
3839
3847
|
function Ke({ address: t }) {
|
|
3840
|
-
return
|
|
3848
|
+
return al.some((e) => nt(t, e));
|
|
3841
3849
|
}
|
|
3842
|
-
function
|
|
3843
|
-
return t ?
|
|
3850
|
+
function Ju(t) {
|
|
3851
|
+
return t ? wa().some((e) => nt(e, t)) : !1;
|
|
3844
3852
|
}
|
|
3845
|
-
function
|
|
3853
|
+
function Rn(t) {
|
|
3846
3854
|
return Ke({
|
|
3847
3855
|
address: t
|
|
3848
3856
|
}) ? Z.TRANSACTION_VERSION.V3 : Z.TRANSACTION_VERSION.V1;
|
|
3849
3857
|
}
|
|
3850
|
-
function
|
|
3858
|
+
function Qu(t) {
|
|
3851
3859
|
return Ke({ address: t }) ? Z.TRANSACTION_VERSION.F3 : Z.TRANSACTION_VERSION.F1;
|
|
3852
3860
|
}
|
|
3853
|
-
function
|
|
3854
|
-
return
|
|
3861
|
+
function td(t, e) {
|
|
3862
|
+
return is(e.contract) ? Ke({ address: t }) ? Z.TRANSACTION_VERSION.V3 : Z.TRANSACTION_VERSION.V2 : Z.TRANSACTION_VERSION.V1;
|
|
3855
3863
|
}
|
|
3856
|
-
class
|
|
3864
|
+
class ed {
|
|
3857
3865
|
constructor(e, n) {
|
|
3858
3866
|
this.apiBase = e, this.httpService = n;
|
|
3859
3867
|
}
|
|
@@ -3862,7 +3870,7 @@ class Qu {
|
|
|
3862
3870
|
* @returns {Promise<TransactionReviewLabel[] | undefined>} The account activities.
|
|
3863
3871
|
*/
|
|
3864
3872
|
async getLabels() {
|
|
3865
|
-
const e =
|
|
3873
|
+
const e = k(this.apiBase, "reviewer", "labels");
|
|
3866
3874
|
return await this.httpService.get(e);
|
|
3867
3875
|
}
|
|
3868
3876
|
/**
|
|
@@ -3870,7 +3878,7 @@ class Qu {
|
|
|
3870
3878
|
* @returns {Promise<TransactionReviewWarning[] | undefined>} The account activities.
|
|
3871
3879
|
*/
|
|
3872
3880
|
async getWarnings() {
|
|
3873
|
-
const e =
|
|
3881
|
+
const e = k(this.apiBase, "reviewer", "warnings/reasons");
|
|
3874
3882
|
return await this.httpService.get(e);
|
|
3875
3883
|
}
|
|
3876
3884
|
async simulateAndReview(e, n, r, s, o) {
|
|
@@ -3878,9 +3886,9 @@ class Qu {
|
|
|
3878
3886
|
try {
|
|
3879
3887
|
if (!("getChainId" in e))
|
|
3880
3888
|
throw new Error("MISSING_METHOD");
|
|
3881
|
-
const i =
|
|
3889
|
+
const i = Rn(r), c = a ? "0x0" : await e.getNonce(), l = await e.getChainId(), d = {
|
|
3882
3890
|
transactions: n.map((f) => ({
|
|
3883
|
-
...
|
|
3891
|
+
...rl({
|
|
3884
3892
|
transaction: f,
|
|
3885
3893
|
nonce: c,
|
|
3886
3894
|
version: i,
|
|
@@ -3892,16 +3900,16 @@ class Qu {
|
|
|
3892
3900
|
}),
|
|
3893
3901
|
type: f.type
|
|
3894
3902
|
}))
|
|
3895
|
-
}, u =
|
|
3903
|
+
}, u = k(this.apiBase, "reviewer", "transactions", "v2", "review", "starknet"), w = await this.httpService.post(u, {
|
|
3896
3904
|
headers: {
|
|
3897
3905
|
Accept: "application/json",
|
|
3898
3906
|
"Content-Type": "application/json"
|
|
3899
3907
|
},
|
|
3900
3908
|
body: JSON.stringify(d)
|
|
3901
|
-
},
|
|
3902
|
-
if (w.transactions.some((f) =>
|
|
3909
|
+
}, ss);
|
|
3910
|
+
if (w.transactions.some((f) => os(f)))
|
|
3903
3911
|
return w;
|
|
3904
|
-
const S =
|
|
3912
|
+
const S = sl(w, r);
|
|
3905
3913
|
return {
|
|
3906
3914
|
...w,
|
|
3907
3915
|
enrichedFeeEstimation: S
|
|
@@ -3924,7 +3932,7 @@ class Qu {
|
|
|
3924
3932
|
try {
|
|
3925
3933
|
const a = r ? this.getCallsFromTx(e[1]) : this.getCallsFromTx(e[0]);
|
|
3926
3934
|
if (!a)
|
|
3927
|
-
throw new
|
|
3935
|
+
throw new _t({
|
|
3928
3936
|
code: "NO_CALLS_FOUND"
|
|
3929
3937
|
});
|
|
3930
3938
|
const i = await this.fetchFeesOnchain({
|
|
@@ -3940,7 +3948,7 @@ class Qu {
|
|
|
3940
3948
|
isBackendDown: !0
|
|
3941
3949
|
};
|
|
3942
3950
|
} catch (a) {
|
|
3943
|
-
throw console.error(a), new
|
|
3951
|
+
throw console.error(a), new _t({
|
|
3944
3952
|
message: `${a}`,
|
|
3945
3953
|
code: "SIMULATE_AND_REVIEW_FAILED"
|
|
3946
3954
|
});
|
|
@@ -3948,7 +3956,7 @@ class Qu {
|
|
|
3948
3956
|
}
|
|
3949
3957
|
async fetchFeesOnchain({ starknetAccount: e, calls: n, isDeployed: r, feeTokenAddress: s, accountDeployTransaction: o }) {
|
|
3950
3958
|
try {
|
|
3951
|
-
const a =
|
|
3959
|
+
const a = Rn(s), i = {
|
|
3952
3960
|
transactions: {
|
|
3953
3961
|
feeTokenAddress: s,
|
|
3954
3962
|
amount: 0n,
|
|
@@ -3961,7 +3969,7 @@ class Qu {
|
|
|
3961
3969
|
if ("estimateFeeBulk" in e) {
|
|
3962
3970
|
const c = [
|
|
3963
3971
|
{
|
|
3964
|
-
type:
|
|
3972
|
+
type: on.DEPLOY_ACCOUNT,
|
|
3965
3973
|
payload: {
|
|
3966
3974
|
classHash: o.classHash,
|
|
3967
3975
|
addressSalt: o.salt,
|
|
@@ -3970,7 +3978,7 @@ class Qu {
|
|
|
3970
3978
|
}
|
|
3971
3979
|
},
|
|
3972
3980
|
{
|
|
3973
|
-
type:
|
|
3981
|
+
type: on.INVOKE,
|
|
3974
3982
|
payload: n
|
|
3975
3983
|
}
|
|
3976
3984
|
], [l, d] = await e.estimateFeeBulk(c, {
|
|
@@ -3979,7 +3987,7 @@ class Qu {
|
|
|
3979
3987
|
throw console.error(u), u;
|
|
3980
3988
|
});
|
|
3981
3989
|
if (!l.gas_consumed || !l.gas_price || !d.gas_consumed || !d.gas_price)
|
|
3982
|
-
throw new
|
|
3990
|
+
throw new _t({
|
|
3983
3991
|
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
3984
3992
|
message: "Missing gas_consumed or gas_price"
|
|
3985
3993
|
});
|
|
@@ -4003,7 +4011,7 @@ class Qu {
|
|
|
4003
4011
|
version: a
|
|
4004
4012
|
});
|
|
4005
4013
|
if (!c || !l)
|
|
4006
|
-
throw new
|
|
4014
|
+
throw new _t({
|
|
4007
4015
|
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
4008
4016
|
message: "Missing gas_consumed or gas_price"
|
|
4009
4017
|
});
|
|
@@ -4017,43 +4025,43 @@ class Qu {
|
|
|
4017
4025
|
}
|
|
4018
4026
|
return i;
|
|
4019
4027
|
} catch (a) {
|
|
4020
|
-
throw new
|
|
4028
|
+
throw new _t({
|
|
4021
4029
|
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
4022
4030
|
message: `${a}`
|
|
4023
4031
|
});
|
|
4024
4032
|
}
|
|
4025
4033
|
}
|
|
4026
4034
|
}
|
|
4027
|
-
const
|
|
4035
|
+
const nd = [
|
|
4028
4036
|
"account-upgrade",
|
|
4029
4037
|
"approve",
|
|
4030
4038
|
"set-approval-for-all",
|
|
4031
4039
|
"swap",
|
|
4032
4040
|
"transfer"
|
|
4033
|
-
],
|
|
4034
|
-
const n = t == null ? void 0 : t.some((s) => !
|
|
4041
|
+
], rd = (t) => ({ showBalanceChange: vt(() => {
|
|
4042
|
+
const n = t == null ? void 0 : t.some((s) => !cn(s.transfers)), r = t == null ? void 0 : t.some((s) => !cn(s.approvals));
|
|
4035
4043
|
return t && (n || r);
|
|
4036
|
-
}, [t]) }), ge = (t) => t ? t.filter((e) => e.token.type === "erc20") : [],
|
|
4044
|
+
}, [t]) }), ge = (t) => t ? t.filter((e) => e.token.type === "erc20") : [], sd = (t) => vt(() => ge(t), [t]), od = (t) => ge(t).length > 0, ad = (t) => ge(t).some((n) => n.amount > 0n), id = (t) => ge(t).some((n) => n.amount < 0n), $r = (t) => t ? t.filter((e) => e.token.type === "erc721") : [], cd = (t) => vt(() => $r(t), [t]), il = (t) => $r(t).length > 0, ld = (t) => vt(() => il(t), [t]), ud = (t, e) => vt(() => t && e ? [
|
|
4037
4045
|
{
|
|
4038
4046
|
contractAddress: t.address,
|
|
4039
4047
|
entrypoint: "transfer",
|
|
4040
|
-
calldata:
|
|
4048
|
+
calldata: mt.compile({
|
|
4041
4049
|
recipient: e,
|
|
4042
4050
|
amount: Ut(t.balance)
|
|
4043
4051
|
})
|
|
4044
4052
|
}
|
|
4045
|
-
] : [], [t, e]),
|
|
4046
|
-
const a =
|
|
4053
|
+
] : [], [t, e]), dd = ({ apiData: { apiBaseUrl: t, apiHeaders: e }, address: n, network: r, transactionReviewEnabled: s = !0, transactions: o }) => {
|
|
4054
|
+
const a = Vn(async () => {
|
|
4047
4055
|
if (!n || !r)
|
|
4048
4056
|
return;
|
|
4049
4057
|
if (!t)
|
|
4050
4058
|
throw "Transaction review endpoint is not defined";
|
|
4051
|
-
const c =
|
|
4059
|
+
const c = k(t, "reviewer/transactions/review/starknet"), l = fs(o) ? o : [o], d = {
|
|
4052
4060
|
network: r,
|
|
4053
4061
|
account: n,
|
|
4054
4062
|
calls: l
|
|
4055
4063
|
};
|
|
4056
|
-
return
|
|
4064
|
+
return Yn(c, {
|
|
4057
4065
|
method: "POST",
|
|
4058
4066
|
headers: {
|
|
4059
4067
|
"Content-Type": "application/json",
|
|
@@ -4061,32 +4069,32 @@ const td = [
|
|
|
4061
4069
|
},
|
|
4062
4070
|
body: JSON.stringify(d)
|
|
4063
4071
|
});
|
|
4064
|
-
}, [n, r, o]), i =
|
|
4065
|
-
return
|
|
4066
|
-
},
|
|
4072
|
+
}, [n, r, o]), i = vt(() => ys({ transactions: o, address: n, network: r }), [o, n, r]);
|
|
4073
|
+
return Ms(!!s, [i, "transactionReview"], a);
|
|
4074
|
+
}, fd = (t) => {
|
|
4067
4075
|
if (!t)
|
|
4068
4076
|
return {};
|
|
4069
|
-
const e = t.assessment === "warn" && t.reason !== "contract_is_not_verified", n = t.reason ? ` (Reason: ${
|
|
4077
|
+
const e = t.assessment === "warn" && t.reason !== "contract_is_not_verified", n = t.reason ? ` (Reason: ${Gn(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;
|
|
4070
4078
|
return {
|
|
4071
4079
|
warn: e,
|
|
4072
4080
|
reason: r
|
|
4073
4081
|
};
|
|
4074
|
-
},
|
|
4082
|
+
}, cl = (t) => {
|
|
4075
4083
|
var e;
|
|
4076
4084
|
if (t) {
|
|
4077
4085
|
for (const n of t.reviews)
|
|
4078
4086
|
if (((e = n.activity) == null ? void 0 : e.type) === "swap")
|
|
4079
4087
|
return n;
|
|
4080
4088
|
}
|
|
4081
|
-
},
|
|
4082
|
-
},
|
|
4089
|
+
}, hd = (t) => {
|
|
4090
|
+
}, pd = (t, e) => {
|
|
4083
4091
|
var n;
|
|
4084
4092
|
if (e) {
|
|
4085
4093
|
for (const r of e.reviews)
|
|
4086
4094
|
if (((n = r.activity) == null ? void 0 : n.type) === t)
|
|
4087
4095
|
return r.activity;
|
|
4088
4096
|
}
|
|
4089
|
-
},
|
|
4097
|
+
}, md = (t) => !!cl(t), gd = (t) => {
|
|
4090
4098
|
var e, n;
|
|
4091
4099
|
if (t) {
|
|
4092
4100
|
for (const r of t.reviews)
|
|
@@ -4096,7 +4104,7 @@ const td = [
|
|
|
4096
4104
|
type: (n = r.activity) == null ? void 0 : n.type
|
|
4097
4105
|
};
|
|
4098
4106
|
}
|
|
4099
|
-
},
|
|
4107
|
+
}, ll = async ({ feeTokenAddress: t, calls: e, selectedAccount: n, transactionReviewService: r, appDomain: s, accountDeployTransaction: o }) => {
|
|
4100
4108
|
const a = {
|
|
4101
4109
|
type: "INVOKE",
|
|
4102
4110
|
calls: oe(e)
|
|
@@ -4105,7 +4113,7 @@ const td = [
|
|
|
4105
4113
|
return;
|
|
4106
4114
|
const i = o ? [o, a] : [a];
|
|
4107
4115
|
return { result: await r.simulateAndReview(n, i, t, s, o) };
|
|
4108
|
-
},
|
|
4116
|
+
}, ul = async (t, e, n, r) => {
|
|
4109
4117
|
var w, m, S, f, g, b;
|
|
4110
4118
|
let s = !1;
|
|
4111
4119
|
const o = e.transactions.find((E) => {
|
|
@@ -4120,365 +4128,367 @@ const td = [
|
|
|
4120
4128
|
const c = "amount" in e.enrichedFeeEstimation.transactions.max ? e.enrichedFeeEstimation.transactions.max.amount : "maxFee" in e.enrichedFeeEstimation.transactions.max ? e.enrichedFeeEstimation.transactions.max.maxFee : void 0, l = (b = o.simulation.summary.find((E) => E.sent && E.token.address === n)) == null ? void 0 : b.value;
|
|
4121
4129
|
if (!c || !l)
|
|
4122
4130
|
return s;
|
|
4123
|
-
const d = await
|
|
4131
|
+
const d = await zc(n, t, r) ?? 0n;
|
|
4124
4132
|
return BigInt(d) > c + BigInt(l) || (s = !0), s;
|
|
4125
|
-
},
|
|
4133
|
+
}, wd = () => Vn(async ({ feeTokenAddress: e, calls: n, selectedAccount: r, transactionReviewService: s, appDomain: o, accountDeployPayload: a, provider: i }) => {
|
|
4126
4134
|
if (!r)
|
|
4127
4135
|
return;
|
|
4128
|
-
const c = await
|
|
4136
|
+
const c = await ll({
|
|
4129
4137
|
feeTokenAddress: e,
|
|
4130
4138
|
calls: n,
|
|
4131
4139
|
selectedAccount: r,
|
|
4132
4140
|
transactionReviewService: s,
|
|
4133
4141
|
appDomain: o,
|
|
4134
|
-
accountDeployTransaction:
|
|
4142
|
+
accountDeployTransaction: dl(a)
|
|
4135
4143
|
});
|
|
4136
4144
|
if (!c || !c.result || !e)
|
|
4137
4145
|
return;
|
|
4138
|
-
const l = await
|
|
4146
|
+
const l = await ul(r.address, c.result, e, i);
|
|
4139
4147
|
return { ...c.result, isSendingMoreThanBalanceAndGas: l };
|
|
4140
|
-
}, []),
|
|
4148
|
+
}, []), dl = (t) => t ? {
|
|
4141
4149
|
type: "DEPLOY_ACCOUNT",
|
|
4142
4150
|
calldata: t.calldata,
|
|
4143
|
-
classHash:
|
|
4144
|
-
salt:
|
|
4151
|
+
classHash: Pt.parse(t.class_hash),
|
|
4152
|
+
salt: Pt.parse(t.salt),
|
|
4145
4153
|
signature: []
|
|
4146
4154
|
} : void 0;
|
|
4147
4155
|
export {
|
|
4148
4156
|
tt as ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES,
|
|
4149
4157
|
Jt as ARGENT_MULTISIG_CONTRACT_CLASS_HASHES,
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4158
|
+
xl as AddSmartAccountResponseSchema,
|
|
4159
|
+
vl as AddSmartAcountRequestSchema,
|
|
4160
|
+
bs as BackendAccountSchema,
|
|
4161
|
+
fu as BackendNftService,
|
|
4162
|
+
Sd as BaseError,
|
|
4163
|
+
Ys as C0_PROXY_CONTRACT_CLASS_HASHES,
|
|
4164
|
+
kl as CacheService,
|
|
4157
4165
|
Ht as DEFAULT_TOKEN_DECIMALS,
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4166
|
+
Pl as DateService,
|
|
4167
|
+
Ed as ESTIMATE_ERROR_MESSAGES,
|
|
4168
|
+
Ln as ETH_TOKEN_ADDRESS,
|
|
4169
|
+
ns as EstimateError,
|
|
4170
|
+
Ad as EventEmitterProvider,
|
|
4171
|
+
xd as EventsBySelector,
|
|
4172
|
+
vd as FEE_OVERHEAD,
|
|
4165
4173
|
Ue as HTTPService,
|
|
4166
4174
|
Je as HTTP_ERROR_MESSAGE,
|
|
4167
4175
|
K as HttpError,
|
|
4168
|
-
|
|
4176
|
+
Kl as KnownDappsBackendService,
|
|
4169
4177
|
en as MultiSigner,
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4178
|
+
Iu as OnchainRecoveryService,
|
|
4179
|
+
Kc as PRETTY_UNLIMITED,
|
|
4180
|
+
Yl as ResolveNameService,
|
|
4181
|
+
Gr as STANDARD_DEVNET_ACCOUNT_CLASS_HASH,
|
|
4174
4182
|
ke as STRK_TOKEN_ADDRESS,
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4183
|
+
Rl as SWRService,
|
|
4184
|
+
Dl as StarknetAddressService,
|
|
4185
|
+
Id as TOKEN_ERROR_MESSAGES,
|
|
4186
|
+
Td as TXV1_ACCOUNT_CLASS_HASH,
|
|
4187
|
+
Bd as TXV1_MULTISIG_CLASS_HASH,
|
|
4188
|
+
_d as TXV3_ACCOUNT_CLASS_HASH,
|
|
4189
|
+
Nd as TXV3_MULTISIG_CLASS_HASH,
|
|
4190
|
+
ts as TokenError,
|
|
4191
|
+
Du as TokenServiceWeb,
|
|
4192
|
+
ed as TransactionReviewServiceWeb,
|
|
4193
|
+
Cd as abiEntrySchema,
|
|
4194
|
+
Od as abiSchema,
|
|
4195
|
+
Hc as activeOnchainRecoverySchema,
|
|
4196
|
+
kd as addOwnersCalldataSchema,
|
|
4197
|
+
Pd as addPluginCalldataSchema,
|
|
4198
|
+
Rd as addressInputCharactersAndLengthSchema,
|
|
4199
|
+
$d as addressInputSchema,
|
|
4200
|
+
Fd as addressOrDomainInputSchema,
|
|
4201
|
+
Ud as addressOrDomainSchema,
|
|
4202
|
+
jd as addressOrEmptyUndefinedSchema,
|
|
4194
4203
|
se as addressSchema,
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4204
|
+
jn as addressSchemaArgentBackend,
|
|
4205
|
+
Ld as addressSchemaBase,
|
|
4206
|
+
Dd as addressSchemaLooseLength,
|
|
4207
|
+
Hd as addressSchemaStrictLength,
|
|
4208
|
+
Vd as airdropSchema,
|
|
4209
|
+
Jr as apiAccountTokenBalancesSchema,
|
|
4210
|
+
Md as apiAirdropSchema,
|
|
4211
|
+
Gd as apiCollateralizedDebtPositionSchema,
|
|
4212
|
+
zd as apiCollateralizedDebtPositionsSchema,
|
|
4213
|
+
qd as apiConcentratedLiquidityPositionSchema,
|
|
4214
|
+
Wd as apiConcentratedLiquidityPositionsSchema,
|
|
4215
|
+
Kd as apiDefiDecompositionProduct,
|
|
4216
|
+
Zd as apiDefiDecompositionProducts,
|
|
4217
|
+
Yd as apiDefiDecompositionSchema,
|
|
4218
|
+
Xd as apiDefiDecompositionToken,
|
|
4219
|
+
Qr as apiDefiPositionsSchema,
|
|
4220
|
+
Jd as apiPriceDataResponseSchema,
|
|
4221
|
+
Qd as apiPriceDetailsSchema,
|
|
4222
|
+
Xr as apiTokenInfoResponseSchema,
|
|
4223
|
+
tf as apiTokenInfoSchema,
|
|
4224
|
+
Yr as apiTokensInfoResponseSchema,
|
|
4225
|
+
nd as apiTransactionReviewActivityType,
|
|
4226
|
+
ef as apiUnclaimedRewardsSchema,
|
|
4227
|
+
nf as apiWalletResponseSchema,
|
|
4228
|
+
As as argentBackendNetworkIdSchema,
|
|
4229
|
+
rs as argentMaxFee,
|
|
4230
|
+
rf as argentNameSchema,
|
|
4231
|
+
Es as argentNetworkIdSchema,
|
|
4232
|
+
Ol as bigDecimal,
|
|
4233
|
+
sf as bigNumberSchema,
|
|
4234
|
+
of as bigNumberishSchema,
|
|
4235
|
+
af as booleanToStringSchema,
|
|
4236
|
+
dl as buildAccountDeployTransaction,
|
|
4237
|
+
Sa as buildConstructorCalldata,
|
|
4238
|
+
Ku as buildDummyTx,
|
|
4239
|
+
cf as builtinsSchema,
|
|
4240
|
+
lf as byteCodeSchema,
|
|
4241
|
+
uf as cairo1EventSchema,
|
|
4242
|
+
df as cairoAssemblySchema,
|
|
4243
|
+
ff as cairoVersionSchema,
|
|
4244
|
+
ol as calculateCubeRootAdjustment,
|
|
4245
|
+
Xu as calculateNonLinearAdjustment,
|
|
4246
|
+
Yu as calculateSqrtAdjustment,
|
|
4247
|
+
hf as callDetailsSchema,
|
|
4248
|
+
Fr as callSchema,
|
|
4249
|
+
pf as calldataSchema,
|
|
4250
|
+
At as castFeeEstimation,
|
|
4251
|
+
mf as changeGuardianCalldataSchema,
|
|
4252
|
+
gf as changeThresholdCalldataSchema,
|
|
4253
|
+
ul as checkGasFeeBalance,
|
|
4254
|
+
Ju as classHashSupportsTxV3,
|
|
4255
|
+
wf as collateralizedDebtGroupSchema,
|
|
4256
|
+
yf as collateralizedDebtPositionSchema,
|
|
4257
|
+
bf as collateralizedDebtPositionsSchema,
|
|
4258
|
+
Sf as compiledContractClassSchema,
|
|
4259
|
+
Ef as compiledSierraCasmSchema,
|
|
4260
|
+
Af as compiledSierraSchema,
|
|
4261
|
+
xf as compressedProgramSchema,
|
|
4262
|
+
vf as concentratedLiquidityPositionSchema,
|
|
4263
|
+
If as concentratedLiquidityPositionsSchema,
|
|
4264
|
+
zr as constructorCallDataSchemaC0,
|
|
4265
|
+
qr as constructorCallDataSchemaC1V1,
|
|
4266
|
+
Tf as contractEntryPointFieldsSchema,
|
|
4267
|
+
$u as convertTokenAmountToCurrencyValue,
|
|
4268
|
+
Fu as convertTokenUnitAmountWithDecimals,
|
|
4269
|
+
xa as dappContractSchema,
|
|
4270
|
+
Aa as dappLinkSchema,
|
|
4271
|
+
eu as daysBetween,
|
|
4272
|
+
ui as decodeBase58,
|
|
4273
|
+
tu as decodeBase58Array,
|
|
4274
|
+
Bf as defiDappsProductsSchema,
|
|
4275
|
+
_f as defiPositionSchema,
|
|
4276
|
+
Nf as defiPositionTypeSchema,
|
|
4277
|
+
Cf as defiProductSchema,
|
|
4278
|
+
Of as defiProductsSchema,
|
|
4279
|
+
kf as denyTxV3,
|
|
4280
|
+
li as encodeBase58,
|
|
4281
|
+
Ql as encodeBase58Array,
|
|
4273
4282
|
oe as ensureArray,
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4283
|
+
Uu as ensureDecimals,
|
|
4284
|
+
lu as entryPointToHumanReadable,
|
|
4285
|
+
Pf as entryPointsByTypeSchema,
|
|
4286
|
+
wu as equalNft,
|
|
4287
|
+
Hu as erc20TransferTransaction,
|
|
4288
|
+
Mu as erc721SafeTransferFromTransaction,
|
|
4289
|
+
Vu as erc721TransferFromTransaction,
|
|
4290
|
+
Rf as escapeGuardianCalldataSchema,
|
|
4282
4291
|
Oe as estimatedFeeToMaxFeeTotal,
|
|
4283
|
-
|
|
4292
|
+
Zu as estimatedFeeToMaxResourceBounds,
|
|
4284
4293
|
re as estimatedFeeToTotal,
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4294
|
+
Wu as estimatedFeesToMaxFeeTotal,
|
|
4295
|
+
qu as estimatedFeesToTotal,
|
|
4296
|
+
$f as eventAbiSchema,
|
|
4297
|
+
Ff as eventEntrySchema,
|
|
4298
|
+
Uf as executeOnPluginCalldataSchema,
|
|
4290
4299
|
Ke as feeTokenNeedsTxV3Support,
|
|
4291
|
-
|
|
4292
|
-
|
|
4300
|
+
jf as feltSchema,
|
|
4301
|
+
Yn as fetchData,
|
|
4293
4302
|
Xt as fetcherError,
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
+
zl as findImplementationForAccount,
|
|
4304
|
+
Lf as findTransfersAndApprovals,
|
|
4305
|
+
er as formatAddress,
|
|
4306
|
+
Df as formatFullAddress,
|
|
4307
|
+
Hf as formatTruncatedAddress,
|
|
4308
|
+
Vf as formatTruncatedSignerKey,
|
|
4309
|
+
Mf as formatTruncatedString,
|
|
4310
|
+
Gf as functionAbiSchema,
|
|
4311
|
+
zf as functionAbiTypeSchema,
|
|
4303
4312
|
ee as generateAvatarImage,
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4313
|
+
Ea as getAccountContractAddress,
|
|
4314
|
+
ba as getAccountDeploymentPayload,
|
|
4315
|
+
Ul as getAccountIdentifier,
|
|
4316
|
+
Vr as getAddressFromArgentName,
|
|
4317
|
+
Zs as getAddressFromStarkName,
|
|
4318
|
+
dn as getArgentAccountClassHashes,
|
|
4319
|
+
wa as getArgentAccountClassHashesWithTxV3Support,
|
|
4320
|
+
ga as getArgentAccountWithMultiSignerClassHashes,
|
|
4321
|
+
Ll as getBackendTimeNowSeconds,
|
|
4322
|
+
Gs as getBackendTimeSeconds,
|
|
4323
|
+
Ks as getCallFromStarkName,
|
|
4324
|
+
zs as getChainIdFromNetworkId,
|
|
4325
|
+
ii as getColor,
|
|
4326
|
+
Ta as getDapplandLinkForDapp,
|
|
4327
|
+
Zl as getDapplandUrlForDapp,
|
|
4328
|
+
fd as getDisplayWarnAndReasonForTransactionReview,
|
|
4320
4329
|
ge as getERC20Transactions,
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4330
|
+
$r as getERC721Transactions,
|
|
4331
|
+
nl as getEstimatedFeeFromBulkSimulation,
|
|
4332
|
+
sl as getEstimatedFeeFromSimulationAndRespectWatermarkFee,
|
|
4333
|
+
oi as getInitials,
|
|
4334
|
+
Vl as getLastCairo0ArgentAccountClassHash,
|
|
4335
|
+
ma as getLatestArgentAccountClassHash,
|
|
4336
|
+
Hl as getLatestArgentMultisigClassHash,
|
|
4337
|
+
Gl as getLatestLedgerAccountClassHash,
|
|
4338
|
+
Ml as getLedgerAccountClassHashes,
|
|
4339
|
+
qf as getMessageFromTrpcError,
|
|
4340
|
+
hd as getNFTTransferActivity,
|
|
4341
|
+
Jl as getNetworkAccountImageUrl,
|
|
4342
|
+
gu as getNftPicture,
|
|
4343
|
+
rl as getPayloadFromTransaction,
|
|
4344
|
+
Wf as getPrettyRpcError,
|
|
4345
|
+
ll as getReviewForTransactions,
|
|
4337
4346
|
tn as getSignerForMultiSigner,
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4347
|
+
Qu as getSimulationTxVersionFromFeeToken,
|
|
4348
|
+
Ws as getStarknetIdContractAddressFromNetworkId,
|
|
4349
|
+
zc as getTokenBalance,
|
|
4350
|
+
Pu as getTokens,
|
|
4351
|
+
ku as getTokensBalances,
|
|
4352
|
+
pd as getTransactionReviewActivityOfType,
|
|
4353
|
+
md as getTransactionReviewHasSwap,
|
|
4354
|
+
cl as getTransactionReviewSwap,
|
|
4355
|
+
gd as getTransactionReviewWithType,
|
|
4356
|
+
Rn as getTxVersionFromFeeToken,
|
|
4357
|
+
td as getTxVersionFromFeeTokenForDeclareContract,
|
|
4358
|
+
Gc as getUAParserResult,
|
|
4350
4359
|
Ut as getUint256CalldataFromBN,
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4360
|
+
el as getWatermarkedMaxFeeTotal,
|
|
4361
|
+
od as hasERC20Transactions,
|
|
4362
|
+
il as hasERC721Transactions,
|
|
4363
|
+
ad as hasIncomingERC20Transactions,
|
|
4364
|
+
id as hasOutgoingERC20Transactions,
|
|
4365
|
+
Pt as hexSchema,
|
|
4366
|
+
Kf as hexSchemaBase,
|
|
4367
|
+
ri as id,
|
|
4359
4368
|
Qe as implementationSchema,
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4369
|
+
Zf as includesAddress,
|
|
4370
|
+
Yf as inputAmountSchema,
|
|
4371
|
+
Bl as isAccountV4,
|
|
4372
|
+
Tl as isAccountV5,
|
|
4373
|
+
Il as isAccountV6,
|
|
4374
|
+
Lr as isAddress,
|
|
4375
|
+
ou as isAllowedAddressHexInputValue,
|
|
4376
|
+
au as isAllowedNumericInputValue,
|
|
4377
|
+
Cl as isArgentBackendNetworkId,
|
|
4378
|
+
Hr as isArgentName,
|
|
4379
|
+
Nl as isArgentNetworkId,
|
|
4380
|
+
Tu as isBraveBrowser,
|
|
4372
4381
|
me as isBrowser,
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4382
|
+
_u as isChromeBrowser,
|
|
4383
|
+
ru as isContractDeployed,
|
|
4384
|
+
Cu as isEdgeBrowser,
|
|
4376
4385
|
nt as isEqualAddress,
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4386
|
+
Xf as isEqualArgentName,
|
|
4387
|
+
ya as isEqualImplementation,
|
|
4388
|
+
Jf as isEqualStarknetDomainName,
|
|
4389
|
+
Qf as isEqualStarknetId,
|
|
4390
|
+
tl as isFRI,
|
|
4391
|
+
nu as isFeatureEnabled,
|
|
4392
|
+
Bu as isFirefoxBrowser,
|
|
4384
4393
|
Y as isNumeric,
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4394
|
+
Nu as isSafariBrowser,
|
|
4395
|
+
th as isStarknetDomainName,
|
|
4396
|
+
Dr as isStarknetId,
|
|
4397
|
+
Wc as isUnlimitedAmount,
|
|
4398
|
+
jr as isValidAddress,
|
|
4399
|
+
eh as isValidInputAmount,
|
|
4400
|
+
Pr as isWEI,
|
|
4401
|
+
Ur as isZeroAddress,
|
|
4402
|
+
va as knownDappSchema,
|
|
4403
|
+
Ia as knownDappsSchema,
|
|
4404
|
+
nh as legacyContractClassSchema,
|
|
4405
|
+
rh as legacyEventSchema,
|
|
4406
|
+
sh as modifySnjsFeeOverhead,
|
|
4407
|
+
oh as multiTypeSchema,
|
|
4408
|
+
Gu as multiplyBigIntByFloat,
|
|
4409
|
+
_a as nameProviderResolutionSchema,
|
|
4410
|
+
Na as nameResolutionAddressSchema,
|
|
4411
|
+
Oa as nameResolutionAddressesSchema,
|
|
4412
|
+
tr as nameResolutionStarknetIdSchema,
|
|
4413
|
+
Ba as nameResolutionStarknetIdsSchema,
|
|
4414
|
+
su as nonNullable,
|
|
4415
|
+
Un as normalizeAddress,
|
|
4416
|
+
ah as normalizeAddressOrDomain,
|
|
4417
|
+
ih as normalizeArgentName,
|
|
4418
|
+
ch as normalizeStarknetId,
|
|
4419
|
+
Vc as onchainRecoverySchema,
|
|
4420
|
+
lh as parseAmount,
|
|
4421
|
+
hi as parseAmountValue,
|
|
4422
|
+
iu as pluralise,
|
|
4423
|
+
$l as postData,
|
|
4424
|
+
_l as preferencesEndpointPayload,
|
|
4425
|
+
Ss as preferencesSchema,
|
|
4426
|
+
di as prettifyCurrencyNumber,
|
|
4427
|
+
ju as prettifyCurrencyValue,
|
|
4428
|
+
cr as prettifyNumber,
|
|
4420
4429
|
Le as prettifyNumberConfig,
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4430
|
+
Lu as prettifyTokenAmount,
|
|
4431
|
+
fi as prettifyTokenNumber,
|
|
4432
|
+
uh as productGroupsSchema,
|
|
4433
|
+
dh as programSchema,
|
|
4434
|
+
Ca as providersNamesSchema,
|
|
4435
|
+
fh as pythonicHintsSchema,
|
|
4436
|
+
hh as rawArgsArraySchema,
|
|
4437
|
+
ph as rawArgsObjectSchema,
|
|
4438
|
+
mh as rawArgsSchema,
|
|
4439
|
+
cu as readFileAsString,
|
|
4440
|
+
kr as recoveryBaseSchema,
|
|
4441
|
+
xu as recoveryBodySchema,
|
|
4442
|
+
Dc as recoveryStatusSchema,
|
|
4443
|
+
gh as removeOwnersCalldataSchema,
|
|
4444
|
+
wh as removePluginCalldataSchema,
|
|
4445
|
+
yh as replaceSignerCalldataSchema,
|
|
4446
|
+
Ou as seedphraseSchema,
|
|
4447
|
+
bh as sierraContractEntryPointFieldsSchema,
|
|
4448
|
+
Sh as sierraEntryPointsByTypeSchema,
|
|
4449
|
+
Eh as sierraProgramDebugInfoSchema,
|
|
4450
|
+
qs as starkNameToCallDataDomain,
|
|
4451
|
+
Ah as starknetDomainNameSchema,
|
|
4452
|
+
Wr as starknetIdSchema,
|
|
4453
|
+
vu as startOnchainRecoveryErrorSchema,
|
|
4454
|
+
Mc as startOnchainRecoveryErrorStatusSchema,
|
|
4455
|
+
Lc as startOnchainRecoverySchema,
|
|
4456
|
+
xh as stringToBooleanSchema,
|
|
4457
|
+
ci as stripAddressZeroPadding,
|
|
4458
|
+
vh as structAbiSchema,
|
|
4459
|
+
jl as swrRefetchDisabledConfig,
|
|
4460
|
+
Rt as toMax,
|
|
4461
|
+
zu as tokensRequireTxV3Support,
|
|
4462
|
+
Ih as transactionReviewTransactionsSchema,
|
|
4463
|
+
Th as transactionReviewWarningSchema,
|
|
4464
|
+
es as transferCalldataSchema,
|
|
4465
|
+
Bh as trpcErrorSchema,
|
|
4466
|
+
_h as txVersionSchema,
|
|
4467
|
+
Nh as uint256Schema,
|
|
4468
|
+
Ch as unclaimedRewardsSchema,
|
|
4459
4469
|
Be as unitToFeeTokenAddress,
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4470
|
+
uu as urlWithQuery,
|
|
4471
|
+
rd as useBalanceChange,
|
|
4472
|
+
pu as useCollection,
|
|
4473
|
+
Ms as useConditionallyEnabledSWR,
|
|
4474
|
+
ql as useDebounce,
|
|
4475
|
+
Wl as useDebouncedValue,
|
|
4476
|
+
sd as useERC20Transactions,
|
|
4477
|
+
cd as useERC721Transactions,
|
|
4478
|
+
Oh as useEmitEvent,
|
|
4479
|
+
kh as useEventEmitter,
|
|
4480
|
+
Ph as useEventEmitterContext,
|
|
4481
|
+
Rh as useEventListener,
|
|
4482
|
+
ld as useHasERC721Transaction,
|
|
4483
|
+
$h as useIsEventEmitterEnabled,
|
|
4484
|
+
ud as useMaxAmountTransaction,
|
|
4485
|
+
mu as useNft,
|
|
4486
|
+
hu as useNfts,
|
|
4487
|
+
Ru as useToken,
|
|
4488
|
+
dd as useTransactionReview,
|
|
4489
|
+
wd as useTransactionReviewV2webFetcher,
|
|
4490
|
+
Fh as validChecksumAddressSchema,
|
|
4491
|
+
Uh as validateAddressRangeSchema,
|
|
4492
|
+
du as voidify,
|
|
4493
|
+
Fl as withPolling
|
|
4484
4494
|
};
|