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