@argent/x-shared 1.34.5 → 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 +1326 -1407
- package/dist/nfts/BackendNftService.d.ts +2 -4
- package/dist/nfts/INFTService.d.ts +1 -1
- package/dist/simulation.js +1 -1
- package/dist/simulation.mjs +101 -100
- package/dist/swap.d.ts +2 -0
- package/dist/swap.js +1 -0
- package/dist/swap.mjs +183 -0
- package/dist/tokens/service/implementation.d.ts +3 -3
- package/dist/tokens/service/interface.d.ts +2 -2
- package/dist/tokens/service/types/defiPosition.model.d.ts +117 -0
- package/dist/tokens/service/types/index.d.ts +1 -0
- package/dist/tokens/service/types/{token.model.d.ts → webToken.model.d.ts} +27 -18
- package/dist/transactionVersion-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 +9 -2
- package/dist/transactionVersion-CL9JUEKt.js +0 -1
- package/dist/transactionVersion-CpEa4gsg.mjs +0 -2661
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 vs = 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 vs = 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 Bs.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 Ue = (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
|
-
}), Xn = (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 Ue(t, r);
|
|
93
|
-
}, Jn = (t, e) => {
|
|
94
|
-
const n = Math.max(t.decimals, e.decimals), [r, s] = [t, e].map((o) => Ue(o, n));
|
|
95
|
-
return [r.value, s.value, n];
|
|
96
|
-
}, ie = (t) => (e, n) => {
|
|
97
|
-
const [r, s, o] = Jn(e, n);
|
|
98
|
-
return {
|
|
99
|
-
decimals: o,
|
|
100
|
-
value: t(r, s, o)
|
|
101
|
-
};
|
|
102
|
-
}, Gt = (t) => (e, n) => {
|
|
103
|
-
const [r, s] = Jn(e, n);
|
|
104
|
-
return t(r, s);
|
|
105
|
-
}, _s = ie((t, e) => t + e), Ns = ie((t, e) => t - e), Cs = ie((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
|
-
}), Os = (t, e) => Xn({
|
|
110
|
-
decimals: t.decimals + e.decimals,
|
|
111
|
-
value: t.value * e.value
|
|
112
|
-
}), ks = ie((t, e) => {
|
|
113
|
-
if (e === BigInt(0))
|
|
114
|
-
throw new Error("Modulus by zero is not allowed");
|
|
115
|
-
return t % e;
|
|
116
|
-
}), je = (t) => ({
|
|
117
|
-
decimals: t.decimals,
|
|
118
|
-
value: t.value >= BigInt(0) ? t.value : -t.value
|
|
119
|
-
}), Qn = Gt((t, e) => t === e), Ps = Gt((t, e) => t < e), Rs = Gt((t, e) => t > e), $s = Gt((t, e) => t <= e), Fs = Gt((t, e) => t >= e), Us = (t, e) => !Qn(t, e);
|
|
120
|
-
function js(t) {
|
|
121
|
-
return Mt({ value: t, decimals: Vt });
|
|
122
|
-
}
|
|
123
|
-
function Ls(t) {
|
|
124
|
-
return xt(t, Vt);
|
|
125
|
-
}
|
|
126
|
-
function Ds(t) {
|
|
127
|
-
return Mt({ value: t, decimals: Vt });
|
|
128
|
-
}
|
|
129
|
-
function Le(t) {
|
|
130
|
-
return xt(t, Vt);
|
|
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;
|
|
131
74
|
}
|
|
132
|
-
function
|
|
133
|
-
return
|
|
75
|
+
function jl(t) {
|
|
76
|
+
return Hs.safeParse(t).success;
|
|
134
77
|
}
|
|
135
78
|
function Vs(t) {
|
|
136
|
-
return
|
|
79
|
+
return f.string().refine((e) => /^-?\d+(\.\d+)?$/.test(e), { message: "Invalid number format" }).transform((e) => Qt(e, t));
|
|
137
80
|
}
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
value: BigInt(t),
|
|
141
|
-
decimals: e
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
const Gs = { value: 1n, decimals: 0 };
|
|
145
|
-
function zs(t) {
|
|
146
|
-
return f.string().refine((e) => /^-?\d+(\.\d+)?$/.test(e), { message: "Invalid number format" }).transform((e) => xt(e, t));
|
|
147
|
-
}
|
|
148
|
-
const Dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
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 De {
|
|
|
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 De {
|
|
|
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 De {
|
|
|
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 De {
|
|
|
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 De {
|
|
|
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 De {
|
|
|
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,34 +303,34 @@ 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
|
-
}), ql = (t) => `${t.networkId}::${t.address}`,
|
|
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;
|
|
@@ -409,20 +342,20 @@ const Wl = {
|
|
|
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 Ys(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 to(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 eo = [
|
|
|
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 Ao(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,77 +659,77 @@ 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:
|
|
@@ -811,11 +744,11 @@ function ya(t, e, n) {
|
|
|
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 pn(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 Ba = 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 Ba = 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
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 oi(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 ai = class dr extends Ya {
|
|
|
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 ai = class dr extends Ya {
|
|
|
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 ai = class dr extends Ya {
|
|
|
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 ui = (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
|
-
|
|
1345
|
-
const n = new URLSearchParams(e), r = n.size ? `?${n}` : "";
|
|
1346
|
-
return k(...oe(t), r);
|
|
1347
|
-
};
|
|
1348
|
-
function bu(t) {
|
|
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
|
|
1365
|
-
constructor(e, n
|
|
1366
|
-
this.apiBase = e, this.
|
|
1292
|
+
const wn = 32;
|
|
1293
|
+
class bu {
|
|
1294
|
+
constructor(e, n) {
|
|
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 =
|
|
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 = [];
|
|
1398
1327
|
for (const y of d.content)
|
|
1399
1328
|
if (o) {
|
|
1400
1329
|
const m = await this.getCollectionMetrics(e, n, y.contractAddress);
|
|
1401
|
-
u.push(
|
|
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,30 +1338,20 @@ 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
|
-
optimizeImage(e, n, r) {
|
|
1427
|
-
if (!e)
|
|
1428
|
-
return;
|
|
1429
|
-
const s = new URLSearchParams({
|
|
1430
|
-
url: e,
|
|
1431
|
-
w: (n ?? 400).toString(),
|
|
1432
|
-
h: (r ?? 400).toString()
|
|
1433
|
-
});
|
|
1434
|
-
return `${this.imageOptimizationUrl}?${s.toString()}`;
|
|
1435
|
-
}
|
|
1436
1355
|
mapItem(e, n) {
|
|
1437
1356
|
var s;
|
|
1438
1357
|
const r = e.name ?? e.tokenId;
|
|
@@ -1440,28 +1359,22 @@ class Su {
|
|
|
1440
1359
|
token_id: e.tokenId,
|
|
1441
1360
|
contract_address: e.contractAddress,
|
|
1442
1361
|
name: r,
|
|
1443
|
-
spec: "spec" in e ?
|
|
1362
|
+
spec: "spec" in e ? bi(e.spec) : void 0,
|
|
1444
1363
|
description: "",
|
|
1445
1364
|
best_bid_order: {
|
|
1446
1365
|
payment_amount: "bestListPrice" in e ? BigInt(e.bestListPrice) : void 0
|
|
1447
1366
|
},
|
|
1448
1367
|
properties: "properties" in e && e.properties.map((o) => ({ key: o.key, value: o.value })) || [],
|
|
1449
|
-
image_uri:
|
|
1450
|
-
|
|
1451
|
-
color: "#ffffff"
|
|
1452
|
-
}),
|
|
1453
|
-
image_url_copy: this.optimizeImage(e.imageUrls.full) ?? ee(r, {
|
|
1454
|
-
background: "#15192A",
|
|
1455
|
-
color: "#ffffff"
|
|
1456
|
-
}),
|
|
1368
|
+
image_uri: e.imageUrls.preview,
|
|
1369
|
+
image_url_copy: e.imageUrls.full,
|
|
1457
1370
|
owner: {
|
|
1458
1371
|
account_address: ((s = e.owner) == null ? void 0 : s.address) || n
|
|
1459
1372
|
},
|
|
1460
|
-
contract_name:
|
|
1373
|
+
contract_name: Yn(e.contractAddress)
|
|
1461
1374
|
};
|
|
1462
1375
|
}
|
|
1463
1376
|
}
|
|
1464
|
-
function
|
|
1377
|
+
function bi(t) {
|
|
1465
1378
|
switch (t) {
|
|
1466
1379
|
case "erc721":
|
|
1467
1380
|
case "starknetErc721":
|
|
@@ -1471,58 +1384,54 @@ function Ai(t) {
|
|
|
1471
1384
|
return "ERC1155";
|
|
1472
1385
|
}
|
|
1473
1386
|
}
|
|
1474
|
-
function
|
|
1387
|
+
function me(t, e) {
|
|
1475
1388
|
return {
|
|
1476
|
-
contractAddress:
|
|
1477
|
-
name: t.name ||
|
|
1389
|
+
contractAddress: te.parse(t.contractAddress),
|
|
1390
|
+
name: t.name || Yn(t.contractAddress),
|
|
1478
1391
|
description: t.description ?? "",
|
|
1479
|
-
imageUri: t.imageUrls.preview
|
|
1480
|
-
background: "#15192A",
|
|
1481
|
-
color: "#ffffff"
|
|
1482
|
-
}),
|
|
1392
|
+
imageUri: t.imageUrls.preview,
|
|
1483
1393
|
...e && {
|
|
1484
1394
|
owners: {
|
|
1485
1395
|
total: e.numberOfItems,
|
|
1486
1396
|
unique: e.uniqueOwners
|
|
1487
1397
|
},
|
|
1488
1398
|
...e.floorPrice && {
|
|
1489
|
-
//floorPrice: getEthTokenPrice(BigInt(metrics.floorPrice)),
|
|
1490
1399
|
floorPrice: BigInt(e.floorPrice)
|
|
1491
1400
|
}
|
|
1492
1401
|
}
|
|
1493
1402
|
};
|
|
1494
1403
|
}
|
|
1495
|
-
const
|
|
1404
|
+
const sr = async (t, e, n, r, s = 1) => {
|
|
1496
1405
|
const o = await t.getNfts(e, n, r, s);
|
|
1497
1406
|
if (s < o.totalPages) {
|
|
1498
|
-
const a = await
|
|
1407
|
+
const a = await sr(t, e, n, r, o.page + 1);
|
|
1499
1408
|
return {
|
|
1500
1409
|
...o,
|
|
1501
1410
|
nfts: o.nfts.concat(a.nfts)
|
|
1502
1411
|
};
|
|
1503
1412
|
}
|
|
1504
1413
|
return o;
|
|
1505
|
-
},
|
|
1506
|
-
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), {
|
|
1507
1416
|
refreshInterval: 3e5,
|
|
1508
1417
|
...s
|
|
1509
1418
|
});
|
|
1510
1419
|
return { nfts: o == null ? void 0 : o.nfts, ...a };
|
|
1511
|
-
},
|
|
1512
|
-
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), {
|
|
1513
1422
|
refreshInterval: 6e4,
|
|
1514
1423
|
...s
|
|
1515
1424
|
});
|
|
1516
1425
|
return { collection: o, ...a };
|
|
1517
|
-
},
|
|
1518
|
-
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, {
|
|
1519
1428
|
refreshInterval: 6e4,
|
|
1520
1429
|
revalidateOnFocus: !1,
|
|
1521
1430
|
revalidateOnMount: !1,
|
|
1522
1431
|
...o
|
|
1523
1432
|
});
|
|
1524
1433
|
return { nft: a, ...i };
|
|
1525
|
-
},
|
|
1434
|
+
}, xu = ({ image_uri: t, image_url_copy: e }) => {
|
|
1526
1435
|
if (t && e) {
|
|
1527
1436
|
if (!e.startsWith("ipfs://"))
|
|
1528
1437
|
return e;
|
|
@@ -1530,95 +1439,95 @@ const hr = async (t, e, n, r, s = 1) => {
|
|
|
1530
1439
|
return t;
|
|
1531
1440
|
}
|
|
1532
1441
|
return e || t;
|
|
1533
|
-
},
|
|
1534
|
-
function
|
|
1442
|
+
}, vu = (t, e) => t.token_id === e.token_id && nt(t.contract_address, e.contract_address);
|
|
1443
|
+
function yn(t) {
|
|
1535
1444
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
1536
1445
|
throw new Error(`Wrong positive integer: ${t}`);
|
|
1537
1446
|
}
|
|
1538
|
-
function
|
|
1447
|
+
function Si(t) {
|
|
1539
1448
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1540
1449
|
}
|
|
1541
|
-
function
|
|
1542
|
-
if (!
|
|
1450
|
+
function or(t, ...e) {
|
|
1451
|
+
if (!Si(t))
|
|
1543
1452
|
throw new Error("Expected Uint8Array");
|
|
1544
1453
|
if (e.length > 0 && !e.includes(t.length))
|
|
1545
1454
|
throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`);
|
|
1546
1455
|
}
|
|
1547
|
-
function
|
|
1456
|
+
function Xt(t, e = !0) {
|
|
1548
1457
|
if (t.destroyed)
|
|
1549
1458
|
throw new Error("Hash instance has been destroyed");
|
|
1550
1459
|
if (e && t.finished)
|
|
1551
1460
|
throw new Error("Hash#digest() has already been called");
|
|
1552
1461
|
}
|
|
1553
|
-
function
|
|
1554
|
-
|
|
1462
|
+
function ar(t, e) {
|
|
1463
|
+
or(t);
|
|
1555
1464
|
const n = e.outputLen;
|
|
1556
1465
|
if (t.length < n)
|
|
1557
1466
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
1558
1467
|
}
|
|
1559
|
-
const
|
|
1560
|
-
function
|
|
1561
|
-
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 };
|
|
1562
1471
|
}
|
|
1563
|
-
function
|
|
1472
|
+
function Ai(t, e = !1) {
|
|
1564
1473
|
let n = new Uint32Array(t.length), r = new Uint32Array(t.length);
|
|
1565
1474
|
for (let s = 0; s < t.length; s++) {
|
|
1566
|
-
const { h: o, l: a } =
|
|
1475
|
+
const { h: o, l: a } = Ei(t[s], e);
|
|
1567
1476
|
[n[s], r[s]] = [o, a];
|
|
1568
1477
|
}
|
|
1569
1478
|
return [n, r];
|
|
1570
1479
|
}
|
|
1571
|
-
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;
|
|
1572
1481
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1573
|
-
const
|
|
1574
|
-
function
|
|
1482
|
+
const _i = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
1483
|
+
function Bi(t) {
|
|
1575
1484
|
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1576
1485
|
}
|
|
1577
|
-
const
|
|
1578
|
-
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)
|
|
1579
1488
|
throw new Error("Non little-endian hardware is not supported");
|
|
1580
|
-
function
|
|
1489
|
+
function ir(t) {
|
|
1581
1490
|
if (typeof t != "string")
|
|
1582
1491
|
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1583
1492
|
return new Uint8Array(new TextEncoder().encode(t));
|
|
1584
1493
|
}
|
|
1585
|
-
function
|
|
1586
|
-
if (typeof t == "string" && (t =
|
|
1494
|
+
function Fe(t) {
|
|
1495
|
+
if (typeof t == "string" && (t = ir(t)), !Bi(t))
|
|
1587
1496
|
throw new Error(`expected Uint8Array, got ${typeof t}`);
|
|
1588
1497
|
return t;
|
|
1589
1498
|
}
|
|
1590
|
-
let
|
|
1499
|
+
let cr = class {
|
|
1591
1500
|
// Safe version that clones internal state
|
|
1592
1501
|
clone() {
|
|
1593
1502
|
return this._cloneInto();
|
|
1594
1503
|
}
|
|
1595
1504
|
};
|
|
1596
|
-
function
|
|
1597
|
-
const e = (r) => t().update(
|
|
1505
|
+
function lr(t) {
|
|
1506
|
+
const e = (r) => t().update(Fe(r)).digest(), n = t();
|
|
1598
1507
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1599
1508
|
}
|
|
1600
|
-
const [
|
|
1601
|
-
for (let t = 0, e =
|
|
1602
|
-
[n, r] = [r, (2 * n + 3 * r) % 5],
|
|
1603
|
-
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;
|
|
1604
1513
|
for (let o = 0; o < 7; o++)
|
|
1605
|
-
e = (e <<
|
|
1606
|
-
|
|
1514
|
+
e = (e << Ct ^ (e >> ki) * Ri) % Pi, e & Oi && (s ^= Ct << (Ct << /* @__PURE__ */ BigInt(o)) - Ct);
|
|
1515
|
+
fr.push(s);
|
|
1607
1516
|
}
|
|
1608
|
-
const [
|
|
1609
|
-
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) {
|
|
1610
1519
|
const n = new Uint32Array(10);
|
|
1611
1520
|
for (let r = 24 - e; r < 24; r++) {
|
|
1612
1521
|
for (let a = 0; a < 10; a++)
|
|
1613
1522
|
n[a] = t[a] ^ t[a + 10] ^ t[a + 20] ^ t[a + 30] ^ t[a + 40];
|
|
1614
1523
|
for (let a = 0; a < 10; a += 2) {
|
|
1615
|
-
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u =
|
|
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];
|
|
1616
1525
|
for (let m = 0; m < 50; m += 10)
|
|
1617
1526
|
t[a + m] ^= u, t[a + m + 1] ^= y;
|
|
1618
1527
|
}
|
|
1619
1528
|
let s = t[2], o = t[3];
|
|
1620
1529
|
for (let a = 0; a < 24; a++) {
|
|
1621
|
-
const i =
|
|
1530
|
+
const i = dr[a], c = Sn(s, o, i), l = En(s, o, i), d = ur[a];
|
|
1622
1531
|
s = t[d], o = t[d + 1], t[d] = c, t[d + 1] = l;
|
|
1623
1532
|
}
|
|
1624
1533
|
for (let a = 0; a < 50; a += 10) {
|
|
@@ -1627,24 +1536,24 @@ function Di(t, e = 24) {
|
|
|
1627
1536
|
for (let i = 0; i < 10; i++)
|
|
1628
1537
|
t[a + i] ^= ~n[(i + 2) % 10] & n[(i + 4) % 10];
|
|
1629
1538
|
}
|
|
1630
|
-
t[0] ^=
|
|
1539
|
+
t[0] ^= Fi[r], t[1] ^= $i[r];
|
|
1631
1540
|
}
|
|
1632
1541
|
n.fill(0);
|
|
1633
1542
|
}
|
|
1634
|
-
class
|
|
1543
|
+
class $e extends cr {
|
|
1635
1544
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1636
1545
|
constructor(e, n, r, s = !1, o = 24) {
|
|
1637
|
-
if (super(), this.blockLen = e, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = o, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1,
|
|
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)
|
|
1638
1547
|
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1639
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
1548
|
+
this.state = new Uint8Array(200), this.state32 = _i(this.state);
|
|
1640
1549
|
}
|
|
1641
1550
|
keccak() {
|
|
1642
|
-
|
|
1551
|
+
Ui(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
|
|
1643
1552
|
}
|
|
1644
1553
|
update(e) {
|
|
1645
|
-
|
|
1554
|
+
Xt(this);
|
|
1646
1555
|
const { blockLen: n, state: r } = this;
|
|
1647
|
-
e =
|
|
1556
|
+
e = Fe(e);
|
|
1648
1557
|
const s = e.length;
|
|
1649
1558
|
for (let o = 0; o < s; ) {
|
|
1650
1559
|
const a = Math.min(n - this.pos, s - o);
|
|
@@ -1662,7 +1571,7 @@ class Ge extends wr {
|
|
|
1662
1571
|
e[r] ^= n, n & 128 && r === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
1663
1572
|
}
|
|
1664
1573
|
writeInto(e) {
|
|
1665
|
-
|
|
1574
|
+
Xt(this, !1), or(e), this.finish();
|
|
1666
1575
|
const n = this.state, { blockLen: r } = this;
|
|
1667
1576
|
for (let s = 0, o = e.length; s < o; ) {
|
|
1668
1577
|
this.posOut >= r && this.keccak();
|
|
@@ -1677,10 +1586,10 @@ class Ge extends wr {
|
|
|
1677
1586
|
return this.writeInto(e);
|
|
1678
1587
|
}
|
|
1679
1588
|
xof(e) {
|
|
1680
|
-
return
|
|
1589
|
+
return yn(e), this.xofInto(new Uint8Array(e));
|
|
1681
1590
|
}
|
|
1682
1591
|
digestInto(e) {
|
|
1683
|
-
if (
|
|
1592
|
+
if (ar(e, this), this.finished)
|
|
1684
1593
|
throw new Error("digest() was already called");
|
|
1685
1594
|
return this.writeInto(e), this.destroy(), e;
|
|
1686
1595
|
}
|
|
@@ -1692,29 +1601,29 @@ class Ge extends wr {
|
|
|
1692
1601
|
}
|
|
1693
1602
|
_cloneInto(e) {
|
|
1694
1603
|
const { blockLen: n, suffix: r, outputLen: s, rounds: o, enableXOF: a } = this;
|
|
1695
|
-
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;
|
|
1696
1605
|
}
|
|
1697
1606
|
}
|
|
1698
|
-
const
|
|
1699
|
-
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) {
|
|
1700
1609
|
if (typeof t.setBigUint64 == "function")
|
|
1701
1610
|
return t.setBigUint64(e, n, r);
|
|
1702
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;
|
|
1703
1612
|
t.setUint32(e + c, a, r), t.setUint32(e + l, i, r);
|
|
1704
1613
|
}
|
|
1705
|
-
class
|
|
1614
|
+
class Hi extends cr {
|
|
1706
1615
|
constructor(e, n, r, s) {
|
|
1707
|
-
super(), this.blockLen = e, this.outputLen = n, this.padOffset = r, this.isLE = s, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view =
|
|
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);
|
|
1708
1617
|
}
|
|
1709
1618
|
update(e) {
|
|
1710
|
-
|
|
1619
|
+
Xt(this);
|
|
1711
1620
|
const { view: n, buffer: r, blockLen: s } = this;
|
|
1712
|
-
e =
|
|
1621
|
+
e = Fe(e);
|
|
1713
1622
|
const o = e.length;
|
|
1714
1623
|
for (let a = 0; a < o; ) {
|
|
1715
1624
|
const i = Math.min(s - this.pos, o - a);
|
|
1716
1625
|
if (i === s) {
|
|
1717
|
-
const c =
|
|
1626
|
+
const c = ge(e);
|
|
1718
1627
|
for (; s <= o - a; a += s)
|
|
1719
1628
|
this.process(c, a);
|
|
1720
1629
|
continue;
|
|
@@ -1724,14 +1633,14 @@ class Gi extends wr {
|
|
|
1724
1633
|
return this.length += e.length, this.roundClean(), this;
|
|
1725
1634
|
}
|
|
1726
1635
|
digestInto(e) {
|
|
1727
|
-
|
|
1636
|
+
Xt(this), ar(e, this), this.finished = !0;
|
|
1728
1637
|
const { buffer: n, view: r, blockLen: s, isLE: o } = this;
|
|
1729
1638
|
let { pos: a } = this;
|
|
1730
1639
|
n[a++] = 128, this.buffer.subarray(a).fill(0), this.padOffset > s - a && (this.process(r, 0), a = 0);
|
|
1731
1640
|
for (let u = a; u < s; u++)
|
|
1732
1641
|
n[u] = 0;
|
|
1733
|
-
|
|
1734
|
-
const i =
|
|
1642
|
+
Di(r, s - 8, BigInt(this.length * 8), o), this.process(r, 0);
|
|
1643
|
+
const i = ge(e), c = this.outputLen;
|
|
1735
1644
|
if (c % 4)
|
|
1736
1645
|
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
1737
1646
|
const l = c / 4, d = this.get();
|
|
@@ -1752,7 +1661,7 @@ class Gi extends wr {
|
|
|
1752
1661
|
return e.length = s, e.pos = i, e.finished = o, e.destroyed = a, s % n && e.buffer.set(r), e;
|
|
1753
1662
|
}
|
|
1754
1663
|
}
|
|
1755
|
-
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([
|
|
1756
1665
|
1116352408,
|
|
1757
1666
|
1899447441,
|
|
1758
1667
|
3049323471,
|
|
@@ -1827,7 +1736,7 @@ const zi = (t, e, n) => t & e ^ ~t & n, qi = (t, e, n) => t & e ^ t & n ^ e & n,
|
|
|
1827
1736
|
528734635,
|
|
1828
1737
|
1541459225
|
|
1829
1738
|
]), ct = /* @__PURE__ */ new Uint32Array(64);
|
|
1830
|
-
class
|
|
1739
|
+
class qi extends Hi {
|
|
1831
1740
|
constructor() {
|
|
1832
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;
|
|
1833
1742
|
}
|
|
@@ -1848,7 +1757,7 @@ class Ki extends Gi {
|
|
|
1848
1757
|
}
|
|
1849
1758
|
let { A: r, B: s, C: o, D: a, E: i, F: c, G: l, H: d } = this;
|
|
1850
1759
|
for (let u = 0; u < 64; u++) {
|
|
1851
|
-
const y = J(i, 6) ^ J(i, 11) ^ J(i, 25), m = d + y +
|
|
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;
|
|
1852
1761
|
d = l, l = c, c = i, i = a + m | 0, a = o, o = s, s = r, r = m + h | 0;
|
|
1853
1762
|
}
|
|
1854
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);
|
|
@@ -1860,22 +1769,22 @@ class Ki extends Gi {
|
|
|
1860
1769
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
|
|
1861
1770
|
}
|
|
1862
1771
|
}
|
|
1863
|
-
const
|
|
1772
|
+
const hr = /* @__PURE__ */ lr(() => new qi());
|
|
1864
1773
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1865
|
-
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"));
|
|
1866
1775
|
function ht(t) {
|
|
1867
|
-
if (!
|
|
1776
|
+
if (!ie(t))
|
|
1868
1777
|
throw new Error("Uint8Array expected");
|
|
1869
1778
|
let e = "";
|
|
1870
1779
|
for (let n = 0; n < t.length; n++)
|
|
1871
|
-
e +=
|
|
1780
|
+
e += zi[t[n]];
|
|
1872
1781
|
return e;
|
|
1873
1782
|
}
|
|
1874
|
-
function
|
|
1783
|
+
function mr(t) {
|
|
1875
1784
|
const e = t.toString(16);
|
|
1876
1785
|
return e.length & 1 ? `0${e}` : e;
|
|
1877
1786
|
}
|
|
1878
|
-
function
|
|
1787
|
+
function Ue(t) {
|
|
1879
1788
|
if (typeof t != "string")
|
|
1880
1789
|
throw new Error("hex string expected, got " + typeof t);
|
|
1881
1790
|
return BigInt(t === "" ? "0" : `0x${t}`);
|
|
@@ -1895,14 +1804,14 @@ function pt(t) {
|
|
|
1895
1804
|
return e;
|
|
1896
1805
|
}
|
|
1897
1806
|
function X(t) {
|
|
1898
|
-
return
|
|
1807
|
+
return Ue(ht(t));
|
|
1899
1808
|
}
|
|
1900
|
-
function
|
|
1901
|
-
if (!
|
|
1809
|
+
function je(t) {
|
|
1810
|
+
if (!ie(t))
|
|
1902
1811
|
throw new Error("Uint8Array expected");
|
|
1903
|
-
return
|
|
1812
|
+
return Ue(ht(Uint8Array.from(t).reverse()));
|
|
1904
1813
|
}
|
|
1905
|
-
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));
|
|
1906
1815
|
function V(t, e, n) {
|
|
1907
1816
|
let r;
|
|
1908
1817
|
if (typeof e == "string")
|
|
@@ -1911,7 +1820,7 @@ function V(t, e, n) {
|
|
|
1911
1820
|
} catch (o) {
|
|
1912
1821
|
throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`);
|
|
1913
1822
|
}
|
|
1914
|
-
else if (
|
|
1823
|
+
else if (ie(e))
|
|
1915
1824
|
r = Uint8Array.from(e);
|
|
1916
1825
|
else
|
|
1917
1826
|
throw new Error(`${t} must be hex string or Uint8Array`);
|
|
@@ -1920,16 +1829,16 @@ function V(t, e, n) {
|
|
|
1920
1829
|
throw new Error(`${t} expected ${n} bytes, got ${s}`);
|
|
1921
1830
|
return r;
|
|
1922
1831
|
}
|
|
1923
|
-
function
|
|
1832
|
+
function jt(...t) {
|
|
1924
1833
|
const e = new Uint8Array(t.reduce((r, s) => r + s.length, 0));
|
|
1925
1834
|
let n = 0;
|
|
1926
1835
|
return t.forEach((r) => {
|
|
1927
|
-
if (!
|
|
1836
|
+
if (!ie(r))
|
|
1928
1837
|
throw new Error("Uint8Array expected");
|
|
1929
1838
|
e.set(r, n), n += r.length;
|
|
1930
1839
|
}), e;
|
|
1931
1840
|
}
|
|
1932
|
-
function
|
|
1841
|
+
function Zi(t, e) {
|
|
1933
1842
|
if (t.length !== e.length)
|
|
1934
1843
|
return !1;
|
|
1935
1844
|
for (let n = 0; n < t.length; n++)
|
|
@@ -1937,30 +1846,30 @@ function Ji(t, e) {
|
|
|
1937
1846
|
return !1;
|
|
1938
1847
|
return !0;
|
|
1939
1848
|
}
|
|
1940
|
-
function
|
|
1849
|
+
function Yi(t) {
|
|
1941
1850
|
if (typeof t != "string")
|
|
1942
1851
|
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1943
1852
|
return new TextEncoder().encode(t);
|
|
1944
1853
|
}
|
|
1945
|
-
function
|
|
1854
|
+
function Xi(t) {
|
|
1946
1855
|
let e;
|
|
1947
|
-
for (e = 0; t >
|
|
1856
|
+
for (e = 0; t > pr; t >>= ae, e += 1)
|
|
1948
1857
|
;
|
|
1949
1858
|
return e;
|
|
1950
1859
|
}
|
|
1951
|
-
const
|
|
1952
|
-
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) {
|
|
1953
1862
|
if (typeof t != "number" || t < 2)
|
|
1954
1863
|
throw new Error("hashLen must be a number");
|
|
1955
1864
|
if (typeof e != "number" || e < 2)
|
|
1956
1865
|
throw new Error("qByteLen must be a number");
|
|
1957
1866
|
if (typeof n != "function")
|
|
1958
1867
|
throw new Error("hmacFn must be a function");
|
|
1959
|
-
let r =
|
|
1868
|
+
let r = we(t), s = we(t), o = 0;
|
|
1960
1869
|
const a = () => {
|
|
1961
1870
|
r.fill(1), s.fill(0), o = 0;
|
|
1962
|
-
}, i = (...u) => n(s, r, ...u), c = (u =
|
|
1963
|
-
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());
|
|
1964
1873
|
}, l = () => {
|
|
1965
1874
|
if (o++ >= 1e3)
|
|
1966
1875
|
throw new Error("drbg: tried 1000 values");
|
|
@@ -1971,7 +1880,7 @@ function Tr(t, e, n) {
|
|
|
1971
1880
|
const m = r.slice();
|
|
1972
1881
|
y.push(m), u += r.length;
|
|
1973
1882
|
}
|
|
1974
|
-
return
|
|
1883
|
+
return jt(...y);
|
|
1975
1884
|
};
|
|
1976
1885
|
return (u, y) => {
|
|
1977
1886
|
a(), c(u);
|
|
@@ -1981,7 +1890,7 @@ function Tr(t, e, n) {
|
|
|
1981
1890
|
return a(), m;
|
|
1982
1891
|
};
|
|
1983
1892
|
}
|
|
1984
|
-
const
|
|
1893
|
+
const tc = {
|
|
1985
1894
|
bigint: (t) => typeof t == "bigint",
|
|
1986
1895
|
function: (t) => typeof t == "function",
|
|
1987
1896
|
boolean: (t) => typeof t == "boolean",
|
|
@@ -1991,9 +1900,9 @@ const rc = {
|
|
|
1991
1900
|
field: (t, e) => e.Fp.isValid(t),
|
|
1992
1901
|
hash: (t) => typeof t == "function" && Number.isSafeInteger(t.outputLen)
|
|
1993
1902
|
};
|
|
1994
|
-
function
|
|
1903
|
+
function Ht(t, e, n = {}) {
|
|
1995
1904
|
const r = (s, o, a) => {
|
|
1996
|
-
const i =
|
|
1905
|
+
const i = tc[o];
|
|
1997
1906
|
if (typeof i != "function")
|
|
1998
1907
|
throw new Error(`Invalid validator "${o}", expected function`);
|
|
1999
1908
|
const c = t[s];
|
|
@@ -2006,67 +1915,67 @@ function zt(t, e, n = {}) {
|
|
|
2006
1915
|
r(s, o, !0);
|
|
2007
1916
|
return t;
|
|
2008
1917
|
}
|
|
2009
|
-
const
|
|
1918
|
+
const ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2010
1919
|
__proto__: null,
|
|
2011
|
-
bitGet:
|
|
2012
|
-
bitLen:
|
|
2013
|
-
bitMask:
|
|
2014
|
-
bitSet:
|
|
1920
|
+
bitGet: Ji,
|
|
1921
|
+
bitLen: Xi,
|
|
1922
|
+
bitMask: ce,
|
|
1923
|
+
bitSet: Qi,
|
|
2015
1924
|
bytesToHex: ht,
|
|
2016
1925
|
bytesToNumberBE: X,
|
|
2017
|
-
bytesToNumberLE:
|
|
2018
|
-
concatBytes:
|
|
2019
|
-
createHmacDrbg:
|
|
1926
|
+
bytesToNumberLE: je,
|
|
1927
|
+
concatBytes: jt,
|
|
1928
|
+
createHmacDrbg: wr,
|
|
2020
1929
|
ensureBytes: V,
|
|
2021
|
-
equalBytes:
|
|
1930
|
+
equalBytes: Zi,
|
|
2022
1931
|
hexToBytes: pt,
|
|
2023
|
-
hexToNumber:
|
|
1932
|
+
hexToNumber: Ue,
|
|
2024
1933
|
numberToBytesBE: Et,
|
|
2025
|
-
numberToBytesLE:
|
|
2026
|
-
numberToHexUnpadded:
|
|
2027
|
-
numberToVarBytesBE:
|
|
2028
|
-
utf8ToBytes:
|
|
2029
|
-
validateObject:
|
|
1934
|
+
numberToBytesLE: gr,
|
|
1935
|
+
numberToHexUnpadded: mr,
|
|
1936
|
+
numberToVarBytesBE: Ki,
|
|
1937
|
+
utf8ToBytes: Yi,
|
|
1938
|
+
validateObject: Ht
|
|
2030
1939
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2031
1940
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2032
|
-
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);
|
|
2033
1942
|
BigInt(9);
|
|
2034
1943
|
BigInt(16);
|
|
2035
1944
|
function M(t, e) {
|
|
2036
1945
|
const n = t % e;
|
|
2037
1946
|
return n >= U ? n : e + n;
|
|
2038
1947
|
}
|
|
2039
|
-
function
|
|
1948
|
+
function rc(t, e, n) {
|
|
2040
1949
|
if (n <= U || e < U)
|
|
2041
1950
|
throw new Error("Expected power/modulo > 0");
|
|
2042
|
-
if (n ===
|
|
1951
|
+
if (n === F)
|
|
2043
1952
|
return U;
|
|
2044
|
-
let r =
|
|
1953
|
+
let r = F;
|
|
2045
1954
|
for (; e > U; )
|
|
2046
|
-
e &
|
|
1955
|
+
e & F && (r = r * t % n), t = t * t % n, e >>= F;
|
|
2047
1956
|
return r;
|
|
2048
1957
|
}
|
|
2049
|
-
function
|
|
1958
|
+
function xe(t, e) {
|
|
2050
1959
|
if (t === U || e <= U)
|
|
2051
1960
|
throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);
|
|
2052
|
-
let n = M(t, e), r = e, s = U, o =
|
|
1961
|
+
let n = M(t, e), r = e, s = U, o = F;
|
|
2053
1962
|
for (; n !== U; ) {
|
|
2054
1963
|
const i = r / n, c = r % n, l = s - o * i;
|
|
2055
1964
|
r = n, n = c, s = o, o = l;
|
|
2056
1965
|
}
|
|
2057
|
-
if (r !==
|
|
1966
|
+
if (r !== F)
|
|
2058
1967
|
throw new Error("invert: does not exist");
|
|
2059
1968
|
return M(s, e);
|
|
2060
1969
|
}
|
|
2061
|
-
function
|
|
2062
|
-
const e = (t -
|
|
1970
|
+
function sc(t) {
|
|
1971
|
+
const e = (t - F) / ut;
|
|
2063
1972
|
let n, r, s;
|
|
2064
|
-
for (n = t -
|
|
1973
|
+
for (n = t - F, r = 0; n % ut === U; n /= ut, r++)
|
|
2065
1974
|
;
|
|
2066
|
-
for (s = ut; s < t &&
|
|
1975
|
+
for (s = ut; s < t && rc(s, e, t) !== t - F; s++)
|
|
2067
1976
|
;
|
|
2068
1977
|
if (r === 1) {
|
|
2069
|
-
const a = (t +
|
|
1978
|
+
const a = (t + F) / Ae;
|
|
2070
1979
|
return function(c, l) {
|
|
2071
1980
|
const d = c.pow(l, a);
|
|
2072
1981
|
if (!c.eql(c.sqr(d), l))
|
|
@@ -2074,7 +1983,7 @@ function ic(t) {
|
|
|
2074
1983
|
return d;
|
|
2075
1984
|
};
|
|
2076
1985
|
}
|
|
2077
|
-
const o = (n +
|
|
1986
|
+
const o = (n + F) / ut;
|
|
2078
1987
|
return function(i, c) {
|
|
2079
1988
|
if (i.pow(c, e) === i.neg(i.ONE))
|
|
2080
1989
|
throw new Error("Cannot find square root");
|
|
@@ -2085,15 +1994,15 @@ function ic(t) {
|
|
|
2085
1994
|
let m = 1;
|
|
2086
1995
|
for (let h = i.sqr(y); m < l && !i.eql(h, i.ONE); m++)
|
|
2087
1996
|
h = i.sqr(h);
|
|
2088
|
-
const S = i.pow(d,
|
|
1997
|
+
const S = i.pow(d, F << BigInt(l - m - 1));
|
|
2089
1998
|
d = i.sqr(S), u = i.mul(u, S), y = i.mul(y, d), l = m;
|
|
2090
1999
|
}
|
|
2091
2000
|
return u;
|
|
2092
2001
|
};
|
|
2093
2002
|
}
|
|
2094
|
-
function
|
|
2095
|
-
if (t %
|
|
2096
|
-
const e = (t +
|
|
2003
|
+
function oc(t) {
|
|
2004
|
+
if (t % Ae === nc) {
|
|
2005
|
+
const e = (t + F) / Ae;
|
|
2097
2006
|
return function(r, s) {
|
|
2098
2007
|
const o = r.pow(s, e);
|
|
2099
2008
|
if (!r.eql(r.sqr(o), s))
|
|
@@ -2101,8 +2010,8 @@ function cc(t) {
|
|
|
2101
2010
|
return o;
|
|
2102
2011
|
};
|
|
2103
2012
|
}
|
|
2104
|
-
if (t %
|
|
2105
|
-
const e = (t -
|
|
2013
|
+
if (t % vn === xn) {
|
|
2014
|
+
const e = (t - xn) / vn;
|
|
2106
2015
|
return function(r, s) {
|
|
2107
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));
|
|
2108
2017
|
if (!r.eql(r.sqr(l), s))
|
|
@@ -2110,9 +2019,9 @@ function cc(t) {
|
|
|
2110
2019
|
return l;
|
|
2111
2020
|
};
|
|
2112
2021
|
}
|
|
2113
|
-
return
|
|
2022
|
+
return sc(t);
|
|
2114
2023
|
}
|
|
2115
|
-
const
|
|
2024
|
+
const ac = [
|
|
2116
2025
|
"create",
|
|
2117
2026
|
"isValid",
|
|
2118
2027
|
"is0",
|
|
@@ -2131,48 +2040,48 @@ const lc = [
|
|
|
2131
2040
|
"mulN",
|
|
2132
2041
|
"sqrN"
|
|
2133
2042
|
];
|
|
2134
|
-
function
|
|
2043
|
+
function Le(t) {
|
|
2135
2044
|
const e = {
|
|
2136
2045
|
ORDER: "bigint",
|
|
2137
2046
|
MASK: "bigint",
|
|
2138
2047
|
BYTES: "isSafeInteger",
|
|
2139
2048
|
BITS: "isSafeInteger"
|
|
2140
|
-
}, n =
|
|
2141
|
-
return
|
|
2049
|
+
}, n = ac.reduce((r, s) => (r[s] = "function", r), e);
|
|
2050
|
+
return Ht(t, n);
|
|
2142
2051
|
}
|
|
2143
|
-
function
|
|
2052
|
+
function yr(t, e, n) {
|
|
2144
2053
|
if (n < U)
|
|
2145
2054
|
throw new Error("Expected power > 0");
|
|
2146
2055
|
if (n === U)
|
|
2147
2056
|
return t.ONE;
|
|
2148
|
-
if (n ===
|
|
2057
|
+
if (n === F)
|
|
2149
2058
|
return e;
|
|
2150
2059
|
let r = t.ONE, s = e;
|
|
2151
2060
|
for (; n > U; )
|
|
2152
|
-
n &
|
|
2061
|
+
n & F && (r = t.mul(r, s)), s = t.sqr(s), n >>= F;
|
|
2153
2062
|
return r;
|
|
2154
2063
|
}
|
|
2155
|
-
function
|
|
2064
|
+
function ic(t, e) {
|
|
2156
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);
|
|
2157
2066
|
return e.reduceRight((o, a, i) => t.is0(a) ? o : (n[i] = t.mul(o, n[i]), t.mul(o, a)), s), n;
|
|
2158
2067
|
}
|
|
2159
|
-
function
|
|
2068
|
+
function De(t, e) {
|
|
2160
2069
|
const n = e !== void 0 ? e : t.toString(2).length, r = Math.ceil(n / 8);
|
|
2161
2070
|
return { nBitLength: n, nByteLength: r };
|
|
2162
2071
|
}
|
|
2163
|
-
function
|
|
2072
|
+
function He(t, e, n = !1, r = {}) {
|
|
2164
2073
|
if (t <= U)
|
|
2165
2074
|
throw new Error(`Expected Fp ORDER > 0, got ${t}`);
|
|
2166
|
-
const { nBitLength: s, nByteLength: o } =
|
|
2075
|
+
const { nBitLength: s, nByteLength: o } = De(t, e);
|
|
2167
2076
|
if (o > 2048)
|
|
2168
2077
|
throw new Error("Field lengths over 2048 bytes are not supported");
|
|
2169
|
-
const a =
|
|
2078
|
+
const a = oc(t), i = Object.freeze({
|
|
2170
2079
|
ORDER: t,
|
|
2171
2080
|
BITS: s,
|
|
2172
2081
|
BYTES: o,
|
|
2173
|
-
MASK:
|
|
2082
|
+
MASK: ce(s),
|
|
2174
2083
|
ZERO: U,
|
|
2175
|
-
ONE:
|
|
2084
|
+
ONE: F,
|
|
2176
2085
|
create: (c) => M(c, t),
|
|
2177
2086
|
isValid: (c) => {
|
|
2178
2087
|
if (typeof c != "bigint")
|
|
@@ -2180,47 +2089,47 @@ function Ze(t, e, n = !1, r = {}) {
|
|
|
2180
2089
|
return U <= c && c < t;
|
|
2181
2090
|
},
|
|
2182
2091
|
is0: (c) => c === U,
|
|
2183
|
-
isOdd: (c) => (c &
|
|
2092
|
+
isOdd: (c) => (c & F) === F,
|
|
2184
2093
|
neg: (c) => M(-c, t),
|
|
2185
2094
|
eql: (c, l) => c === l,
|
|
2186
2095
|
sqr: (c) => M(c * c, t),
|
|
2187
2096
|
add: (c, l) => M(c + l, t),
|
|
2188
2097
|
sub: (c, l) => M(c - l, t),
|
|
2189
2098
|
mul: (c, l) => M(c * l, t),
|
|
2190
|
-
pow: (c, l) =>
|
|
2191
|
-
div: (c, l) => M(c *
|
|
2099
|
+
pow: (c, l) => yr(i, c, l),
|
|
2100
|
+
div: (c, l) => M(c * xe(l, t), t),
|
|
2192
2101
|
// Same as above, but doesn't normalize
|
|
2193
2102
|
sqrN: (c) => c * c,
|
|
2194
2103
|
addN: (c, l) => c + l,
|
|
2195
2104
|
subN: (c, l) => c - l,
|
|
2196
2105
|
mulN: (c, l) => c * l,
|
|
2197
|
-
inv: (c) =>
|
|
2106
|
+
inv: (c) => xe(c, t),
|
|
2198
2107
|
sqrt: r.sqrt || ((c) => a(i, c)),
|
|
2199
|
-
invertBatch: (c) =>
|
|
2108
|
+
invertBatch: (c) => ic(i, c),
|
|
2200
2109
|
// TODO: do we really need constant cmov?
|
|
2201
2110
|
// We don't have const-time bigints anyway, so probably will be not very useful
|
|
2202
2111
|
cmov: (c, l, d) => d ? l : c,
|
|
2203
|
-
toBytes: (c) => n ?
|
|
2112
|
+
toBytes: (c) => n ? gr(c, o) : Et(c, o),
|
|
2204
2113
|
fromBytes: (c) => {
|
|
2205
2114
|
if (c.length !== o)
|
|
2206
2115
|
throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);
|
|
2207
|
-
return n ?
|
|
2116
|
+
return n ? je(c) : X(c);
|
|
2208
2117
|
}
|
|
2209
2118
|
});
|
|
2210
2119
|
return Object.freeze(i);
|
|
2211
2120
|
}
|
|
2212
|
-
function
|
|
2121
|
+
function cc(t, e, n = !1) {
|
|
2213
2122
|
t = V("privateHash", t);
|
|
2214
|
-
const r = t.length, s =
|
|
2123
|
+
const r = t.length, s = De(e).nByteLength + 8;
|
|
2215
2124
|
if (s < 24 || r < s || r > 1024)
|
|
2216
2125
|
throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${r}`);
|
|
2217
|
-
const o = n ?
|
|
2218
|
-
return M(o, e -
|
|
2126
|
+
const o = n ? je(t) : X(t);
|
|
2127
|
+
return M(o, e - F) + F;
|
|
2219
2128
|
}
|
|
2220
2129
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2221
|
-
function
|
|
2130
|
+
function lc(t) {
|
|
2222
2131
|
const { Fp: e } = t;
|
|
2223
|
-
|
|
2132
|
+
Le(e);
|
|
2224
2133
|
for (const c of ["t", "roundsFull", "roundsPartial"])
|
|
2225
2134
|
if (typeof t[c] != "number" || !Number.isSafeInteger(t[c]))
|
|
2226
2135
|
throw new Error(`Poseidon: invalid param ${c}=${t[c]} (${typeof t[c]})`);
|
|
@@ -2230,7 +2139,7 @@ function fc(t) {
|
|
|
2230
2139
|
if (n === void 0 && (n = 5), typeof n != "number" || !Number.isSafeInteger(n))
|
|
2231
2140
|
throw new Error(`Poseidon wrong sboxPower=${n}`);
|
|
2232
2141
|
const r = BigInt(n);
|
|
2233
|
-
let s = (c) =>
|
|
2142
|
+
let s = (c) => yr(e, c, r);
|
|
2234
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)
|
|
2235
2144
|
throw new Error(`Poseidon roundsFull is not even: ${t.roundsFull}`);
|
|
2236
2145
|
const o = t.roundsFull + t.roundsPartial;
|
|
@@ -2258,8 +2167,8 @@ function fc(t) {
|
|
|
2258
2167
|
});
|
|
2259
2168
|
return Object.freeze({ ...t, rounds: o, sboxFn: s, roundConstants: a, mds: i });
|
|
2260
2169
|
}
|
|
2261
|
-
function
|
|
2262
|
-
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) {
|
|
2263
2172
|
if (!Array.isArray(u) || u.length !== e)
|
|
2264
2173
|
throw new Error(`Poseidon: wrong values (expected array of bigints with length ${e})`);
|
|
2265
2174
|
u = u.map((m) => {
|
|
@@ -2281,8 +2190,8 @@ function hc(t) {
|
|
|
2281
2190
|
return l.roundConstants = t.roundConstants, l;
|
|
2282
2191
|
}
|
|
2283
2192
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2284
|
-
const
|
|
2285
|
-
function
|
|
2193
|
+
const dc = BigInt(0), ye = BigInt(1);
|
|
2194
|
+
function fc(t, e) {
|
|
2286
2195
|
const n = (s, o) => {
|
|
2287
2196
|
const a = o.negate();
|
|
2288
2197
|
return s ? a : o;
|
|
@@ -2295,8 +2204,8 @@ function mc(t, e) {
|
|
|
2295
2204
|
// non-const time multiplication ladder
|
|
2296
2205
|
unsafeLadder(s, o) {
|
|
2297
2206
|
let a = t.ZERO, i = s;
|
|
2298
|
-
for (; o >
|
|
2299
|
-
o &
|
|
2207
|
+
for (; o > dc; )
|
|
2208
|
+
o & ye && (a = a.add(i)), i = i.double(), o >>= ye;
|
|
2300
2209
|
return a;
|
|
2301
2210
|
},
|
|
2302
2211
|
/**
|
|
@@ -2334,9 +2243,9 @@ function mc(t, e) {
|
|
|
2334
2243
|
for (let S = 0; S < i; S++) {
|
|
2335
2244
|
const h = S * c;
|
|
2336
2245
|
let g = Number(a & u);
|
|
2337
|
-
a >>= m, g > c && (g -= y, a +=
|
|
2338
|
-
const w = h, E = h + Math.abs(g) - 1, x = S % 2 !== 0,
|
|
2339
|
-
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]));
|
|
2340
2249
|
}
|
|
2341
2250
|
return { p: l, f: d };
|
|
2342
2251
|
},
|
|
@@ -2347,8 +2256,8 @@ function mc(t, e) {
|
|
|
2347
2256
|
}
|
|
2348
2257
|
};
|
|
2349
2258
|
}
|
|
2350
|
-
function
|
|
2351
|
-
return
|
|
2259
|
+
function br(t) {
|
|
2260
|
+
return Le(t.Fp), Ht(t, {
|
|
2352
2261
|
n: "bigint",
|
|
2353
2262
|
h: "bigint",
|
|
2354
2263
|
Gx: "field",
|
|
@@ -2357,15 +2266,15 @@ function _r(t) {
|
|
|
2357
2266
|
nBitLength: "isSafeInteger",
|
|
2358
2267
|
nByteLength: "isSafeInteger"
|
|
2359
2268
|
}), Object.freeze({
|
|
2360
|
-
...
|
|
2269
|
+
...De(t.n, t.nBitLength),
|
|
2361
2270
|
...t,
|
|
2362
2271
|
p: t.Fp.ORDER
|
|
2363
2272
|
});
|
|
2364
2273
|
}
|
|
2365
2274
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2366
|
-
function
|
|
2367
|
-
const e =
|
|
2368
|
-
|
|
2275
|
+
function hc(t) {
|
|
2276
|
+
const e = br(t);
|
|
2277
|
+
Ht(e, {
|
|
2369
2278
|
a: "field",
|
|
2370
2279
|
b: "field"
|
|
2371
2280
|
}, {
|
|
@@ -2386,7 +2295,7 @@ function gc(t) {
|
|
|
2386
2295
|
}
|
|
2387
2296
|
return Object.freeze({ ...e });
|
|
2388
2297
|
}
|
|
2389
|
-
const { bytesToNumberBE:
|
|
2298
|
+
const { bytesToNumberBE: pc, hexToBytes: mc } = ec, dt = {
|
|
2390
2299
|
// asn.1 DER encoding utils
|
|
2391
2300
|
Err: class extends Error {
|
|
2392
2301
|
constructor(e = "") {
|
|
@@ -2404,10 +2313,10 @@ const { bytesToNumberBE: wc, hexToBytes: yc } = sc, dt = {
|
|
|
2404
2313
|
throw new e("Invalid signature integer: negative");
|
|
2405
2314
|
if (r[0] === 0 && !(r[1] & 128))
|
|
2406
2315
|
throw new e("Invalid signature integer: unnecessary leading zero");
|
|
2407
|
-
return { d:
|
|
2316
|
+
return { d: pc(r), l: t.subarray(n + 2) };
|
|
2408
2317
|
},
|
|
2409
2318
|
toSig(t) {
|
|
2410
|
-
const { Err: e } = dt, n = typeof t == "string" ?
|
|
2319
|
+
const { Err: e } = dt, n = typeof t == "string" ? mc(t) : t;
|
|
2411
2320
|
if (!(n instanceof Uint8Array))
|
|
2412
2321
|
throw new Error("ui8a expected");
|
|
2413
2322
|
let r = n.length;
|
|
@@ -2427,14 +2336,14 @@ const { bytesToNumberBE: wc, hexToBytes: yc } = sc, dt = {
|
|
|
2427
2336
|
}, r = e(n(t.s)), s = e(n(t.r)), o = r.length / 2, a = s.length / 2, i = n(o), c = n(a);
|
|
2428
2337
|
return `30${n(a + o + 4)}02${c}${s}02${i}${r}`;
|
|
2429
2338
|
}
|
|
2430
|
-
}, et = BigInt(0),
|
|
2339
|
+
}, et = BigInt(0), W = BigInt(1);
|
|
2431
2340
|
BigInt(2);
|
|
2432
|
-
const
|
|
2341
|
+
const Tn = BigInt(3);
|
|
2433
2342
|
BigInt(4);
|
|
2434
|
-
function
|
|
2435
|
-
const e =
|
|
2343
|
+
function gc(t) {
|
|
2344
|
+
const e = hc(t), { Fp: n } = e, r = e.toBytes || ((S, h, g) => {
|
|
2436
2345
|
const w = h.toAffine();
|
|
2437
|
-
return
|
|
2346
|
+
return jt(Uint8Array.from([4]), n.toBytes(w.x), n.toBytes(w.y));
|
|
2438
2347
|
}), s = e.fromBytes || ((S) => {
|
|
2439
2348
|
const h = S.subarray(1), g = n.fromBytes(h.subarray(0, n.BYTES)), w = n.fromBytes(h.subarray(n.BYTES, 2 * n.BYTES));
|
|
2440
2349
|
return { x: g, y: w };
|
|
@@ -2551,7 +2460,7 @@ function bc(t) {
|
|
|
2551
2460
|
*/
|
|
2552
2461
|
equals(h) {
|
|
2553
2462
|
d(h);
|
|
2554
|
-
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));
|
|
2555
2464
|
return A && v;
|
|
2556
2465
|
}
|
|
2557
2466
|
/**
|
|
@@ -2565,9 +2474,9 @@ function bc(t) {
|
|
|
2565
2474
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
2566
2475
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
2567
2476
|
double() {
|
|
2568
|
-
const { a: h, b: g } = e, w = n.mul(g,
|
|
2569
|
-
let
|
|
2570
|
-
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);
|
|
2571
2480
|
}
|
|
2572
2481
|
// Renes-Costello-Batina exception-free addition formula.
|
|
2573
2482
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -2575,13 +2484,13 @@ function bc(t) {
|
|
|
2575
2484
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
2576
2485
|
add(h) {
|
|
2577
2486
|
d(h);
|
|
2578
|
-
const { px: g, py: w, pz: E } = this, { px: x, py:
|
|
2579
|
-
let A = n.ZERO, v = n.ZERO,
|
|
2580
|
-
const G = e.a, R = n.mul(e.b,
|
|
2581
|
-
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);
|
|
2582
2491
|
rt = n.mul(rt, p), p = n.add(N, L), rt = n.sub(rt, p), p = n.add(g, E);
|
|
2583
|
-
let b = n.add(x,
|
|
2584
|
-
return p = n.mul(p, b), b = n.add(N, D), p = n.sub(p, b), b = n.add(w, E), A = n.add(
|
|
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);
|
|
2585
2494
|
}
|
|
2586
2495
|
subtract(h) {
|
|
2587
2496
|
return this.add(h.negate());
|
|
@@ -2604,15 +2513,15 @@ function bc(t) {
|
|
|
2604
2513
|
const g = u.ZERO;
|
|
2605
2514
|
if (h === et)
|
|
2606
2515
|
return g;
|
|
2607
|
-
if (i(h), h ===
|
|
2516
|
+
if (i(h), h === W)
|
|
2608
2517
|
return this;
|
|
2609
2518
|
const { endo: w } = e;
|
|
2610
2519
|
if (!w)
|
|
2611
2520
|
return m.unsafeLadder(this, h);
|
|
2612
|
-
let { k1neg: E, k1: x, k2neg:
|
|
2613
|
-
for (; x > et ||
|
|
2614
|
-
x &
|
|
2615
|
-
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);
|
|
2616
2525
|
}
|
|
2617
2526
|
/**
|
|
2618
2527
|
* Constant time multiplication.
|
|
@@ -2628,12 +2537,12 @@ function bc(t) {
|
|
|
2628
2537
|
let g = h, w, E;
|
|
2629
2538
|
const { endo: x } = e;
|
|
2630
2539
|
if (x) {
|
|
2631
|
-
const { k1neg:
|
|
2632
|
-
let { p:
|
|
2633
|
-
|
|
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);
|
|
2634
2543
|
} else {
|
|
2635
|
-
const { p:
|
|
2636
|
-
w =
|
|
2544
|
+
const { p: B, f: _ } = this.wNAF(g);
|
|
2545
|
+
w = B, E = _;
|
|
2637
2546
|
}
|
|
2638
2547
|
return u.normalizeZ([w, E])[0];
|
|
2639
2548
|
}
|
|
@@ -2644,8 +2553,8 @@ function bc(t) {
|
|
|
2644
2553
|
* @returns non-zero affine point
|
|
2645
2554
|
*/
|
|
2646
2555
|
multiplyAndAddUnsafe(h, g, w) {
|
|
2647
|
-
const E = u.BASE, x = (
|
|
2648
|
-
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;
|
|
2649
2558
|
}
|
|
2650
2559
|
// Converts Projective point to affine (x, y) coordinates.
|
|
2651
2560
|
// Can accept precomputed Z^-1 - for example, from invertBatch.
|
|
@@ -2653,16 +2562,16 @@ function bc(t) {
|
|
|
2653
2562
|
toAffine(h) {
|
|
2654
2563
|
const { px: g, py: w, pz: E } = this, x = this.is0();
|
|
2655
2564
|
h == null && (h = x ? n.ONE : n.inv(E));
|
|
2656
|
-
const
|
|
2565
|
+
const B = n.mul(g, h), _ = n.mul(w, h), A = n.mul(E, h);
|
|
2657
2566
|
if (x)
|
|
2658
2567
|
return { x: n.ZERO, y: n.ZERO };
|
|
2659
2568
|
if (!n.eql(A, n.ONE))
|
|
2660
2569
|
throw new Error("invZ was invalid");
|
|
2661
|
-
return { x:
|
|
2570
|
+
return { x: B, y: _ };
|
|
2662
2571
|
}
|
|
2663
2572
|
isTorsionFree() {
|
|
2664
2573
|
const { h, isTorsionFree: g } = e;
|
|
2665
|
-
if (h ===
|
|
2574
|
+
if (h === W)
|
|
2666
2575
|
return !0;
|
|
2667
2576
|
if (g)
|
|
2668
2577
|
return g(u, this);
|
|
@@ -2670,7 +2579,7 @@ function bc(t) {
|
|
|
2670
2579
|
}
|
|
2671
2580
|
clearCofactor() {
|
|
2672
2581
|
const { h, clearCofactor: g } = e;
|
|
2673
|
-
return h ===
|
|
2582
|
+
return h === W ? this : g ? g(u, this) : this.multiplyUnsafe(e.h);
|
|
2674
2583
|
}
|
|
2675
2584
|
toRawBytes(h = !0) {
|
|
2676
2585
|
return this.assertValidity(), r(u, this, h);
|
|
@@ -2680,7 +2589,7 @@ function bc(t) {
|
|
|
2680
2589
|
}
|
|
2681
2590
|
}
|
|
2682
2591
|
u.BASE = new u(e.Gx, e.Gy, n.ONE), u.ZERO = new u(n.ZERO, n.ONE, n.ZERO);
|
|
2683
|
-
const y = e.nBitLength, m =
|
|
2592
|
+
const y = e.nBitLength, m = fc(u, e.endo ? Math.ceil(y / 2) : y);
|
|
2684
2593
|
return {
|
|
2685
2594
|
CURVE: e,
|
|
2686
2595
|
ProjectivePoint: u,
|
|
@@ -2689,9 +2598,9 @@ function bc(t) {
|
|
|
2689
2598
|
isWithinCurveOrder: a
|
|
2690
2599
|
};
|
|
2691
2600
|
}
|
|
2692
|
-
function
|
|
2693
|
-
const e =
|
|
2694
|
-
return
|
|
2601
|
+
function wc(t) {
|
|
2602
|
+
const e = br(t);
|
|
2603
|
+
return Ht(e, {
|
|
2695
2604
|
hash: "hash",
|
|
2696
2605
|
hmac: "function",
|
|
2697
2606
|
randomBytes: "function"
|
|
@@ -2701,8 +2610,8 @@ function Sc(t) {
|
|
|
2701
2610
|
lowS: "boolean"
|
|
2702
2611
|
}), Object.freeze({ lowS: !0, ...e });
|
|
2703
2612
|
}
|
|
2704
|
-
function
|
|
2705
|
-
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;
|
|
2706
2615
|
function a(p) {
|
|
2707
2616
|
return et < p && p < n.ORDER;
|
|
2708
2617
|
}
|
|
@@ -2710,53 +2619,53 @@ function Ec(t) {
|
|
|
2710
2619
|
return M(p, r);
|
|
2711
2620
|
}
|
|
2712
2621
|
function c(p) {
|
|
2713
|
-
return
|
|
2622
|
+
return xe(p, r);
|
|
2714
2623
|
}
|
|
2715
|
-
const { ProjectivePoint: l, normPrivateKeyToScalar: d, weierstrassEquation: u, isWithinCurveOrder: y } =
|
|
2624
|
+
const { ProjectivePoint: l, normPrivateKeyToScalar: d, weierstrassEquation: u, isWithinCurveOrder: y } = gc({
|
|
2716
2625
|
...e,
|
|
2717
|
-
toBytes(p, b,
|
|
2718
|
-
const
|
|
2719
|
-
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));
|
|
2720
2629
|
},
|
|
2721
2630
|
fromBytes(p) {
|
|
2722
|
-
const b = p.length,
|
|
2723
|
-
if (b === s && (
|
|
2724
|
-
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);
|
|
2725
2634
|
if (!a(C))
|
|
2726
2635
|
throw new Error("Point is not on curve");
|
|
2727
2636
|
const j = u(C);
|
|
2728
|
-
let
|
|
2729
|
-
const H = (
|
|
2730
|
-
return (
|
|
2731
|
-
} else if (b === o &&
|
|
2732
|
-
const C = n.fromBytes(
|
|
2637
|
+
let q = n.sqrt(j);
|
|
2638
|
+
const H = (q & W) === W;
|
|
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));
|
|
2733
2642
|
return { x: C, y: j };
|
|
2734
2643
|
} else
|
|
2735
2644
|
throw new Error(`Point of length ${b} was invalid. Expected ${s} compressed bytes or ${o} uncompressed bytes`);
|
|
2736
2645
|
}
|
|
2737
2646
|
}), m = (p) => ht(Et(p, e.nByteLength));
|
|
2738
2647
|
function S(p) {
|
|
2739
|
-
const b = r >>
|
|
2648
|
+
const b = r >> W;
|
|
2740
2649
|
return p > b;
|
|
2741
2650
|
}
|
|
2742
2651
|
function h(p) {
|
|
2743
2652
|
return S(p) ? i(-p) : p;
|
|
2744
2653
|
}
|
|
2745
|
-
const g = (p, b,
|
|
2654
|
+
const g = (p, b, T) => X(p.slice(b, T));
|
|
2746
2655
|
class w {
|
|
2747
|
-
constructor(b,
|
|
2748
|
-
this.r = b, this.s =
|
|
2656
|
+
constructor(b, T, k) {
|
|
2657
|
+
this.r = b, this.s = T, this.recovery = k, this.assertValidity();
|
|
2749
2658
|
}
|
|
2750
2659
|
// pair (bytes of r, bytes of s)
|
|
2751
2660
|
static fromCompact(b) {
|
|
2752
|
-
const
|
|
2753
|
-
return b = V("compactSignature", 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));
|
|
2754
2663
|
}
|
|
2755
2664
|
// DER encoded ECDSA signature
|
|
2756
2665
|
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
|
|
2757
2666
|
static fromDER(b) {
|
|
2758
|
-
const { r:
|
|
2759
|
-
return new w(
|
|
2667
|
+
const { r: T, s: k } = dt.toSig(V("DER", b));
|
|
2668
|
+
return new w(T, k);
|
|
2760
2669
|
}
|
|
2761
2670
|
assertValidity() {
|
|
2762
2671
|
if (!y(this.r))
|
|
@@ -2768,13 +2677,13 @@ function Ec(t) {
|
|
|
2768
2677
|
return new w(this.r, this.s, b);
|
|
2769
2678
|
}
|
|
2770
2679
|
recoverPublicKey(b) {
|
|
2771
|
-
const { r:
|
|
2680
|
+
const { r: T, s: k, recovery: C } = this, j = v(V("msgHash", b));
|
|
2772
2681
|
if (C == null || ![0, 1, 2, 3].includes(C))
|
|
2773
2682
|
throw new Error("recovery id invalid");
|
|
2774
|
-
const
|
|
2775
|
-
if (
|
|
2683
|
+
const q = C === 2 || C === 3 ? T + e.n : T;
|
|
2684
|
+
if (q >= n.ORDER)
|
|
2776
2685
|
throw new Error("recovery id 2 or 3 invalid");
|
|
2777
|
-
const H = C & 1 ? "03" : "02", st = l.fromHex(H + m(
|
|
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);
|
|
2778
2687
|
if (!at)
|
|
2779
2688
|
throw new Error("point at infinify");
|
|
2780
2689
|
return at.assertValidity(), at;
|
|
@@ -2815,7 +2724,7 @@ function Ec(t) {
|
|
|
2815
2724
|
* as per FIPS 186 B.4.1 with modulo bias being neglible.
|
|
2816
2725
|
*/
|
|
2817
2726
|
randomPrivateKey: () => {
|
|
2818
|
-
const p = e.randomBytes(n.BYTES + 8), b =
|
|
2727
|
+
const p = e.randomBytes(n.BYTES + 8), b = cc(p, r);
|
|
2819
2728
|
return Et(b, e.nByteLength);
|
|
2820
2729
|
},
|
|
2821
2730
|
/**
|
|
@@ -2833,100 +2742,100 @@ function Ec(t) {
|
|
|
2833
2742
|
function x(p, b = !0) {
|
|
2834
2743
|
return l.fromPrivateKey(p).toRawBytes(b);
|
|
2835
2744
|
}
|
|
2836
|
-
function
|
|
2837
|
-
const b = p instanceof Uint8Array,
|
|
2838
|
-
return b ?
|
|
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;
|
|
2839
2748
|
}
|
|
2840
|
-
function
|
|
2841
|
-
if (
|
|
2749
|
+
function _(p, b, T = !0) {
|
|
2750
|
+
if (B(p))
|
|
2842
2751
|
throw new Error("first arg must be private key");
|
|
2843
|
-
if (!
|
|
2752
|
+
if (!B(b))
|
|
2844
2753
|
throw new Error("second arg must be public key");
|
|
2845
|
-
return l.fromHex(b).multiply(d(p)).toRawBytes(
|
|
2754
|
+
return l.fromHex(b).multiply(d(p)).toRawBytes(T);
|
|
2846
2755
|
}
|
|
2847
2756
|
const A = e.bits2int || function(p) {
|
|
2848
|
-
const b = X(p),
|
|
2849
|
-
return
|
|
2757
|
+
const b = X(p), T = p.length * 8 - e.nBitLength;
|
|
2758
|
+
return T > 0 ? b >> BigInt(T) : b;
|
|
2850
2759
|
}, v = e.bits2int_modN || function(p) {
|
|
2851
2760
|
return i(A(p));
|
|
2852
|
-
},
|
|
2761
|
+
}, I = ce(e.nBitLength);
|
|
2853
2762
|
function G(p) {
|
|
2854
2763
|
if (typeof p != "bigint")
|
|
2855
2764
|
throw new Error("bigint expected");
|
|
2856
|
-
if (!(et <= p && p <
|
|
2765
|
+
if (!(et <= p && p < I))
|
|
2857
2766
|
throw new Error(`bigint expected < 2^${e.nBitLength}`);
|
|
2858
2767
|
return Et(p, e.nByteLength);
|
|
2859
2768
|
}
|
|
2860
|
-
function R(p, b,
|
|
2861
|
-
if (["recovered", "canonical"].some((lt) => lt in
|
|
2769
|
+
function R(p, b, T = N) {
|
|
2770
|
+
if (["recovered", "canonical"].some((lt) => lt in T))
|
|
2862
2771
|
throw new Error("sign() legacy options not supported");
|
|
2863
|
-
const { hash:
|
|
2864
|
-
let { lowS: j, prehash:
|
|
2865
|
-
j == null && (j = !0), p = V("msgHash", p),
|
|
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)));
|
|
2866
2775
|
const st = v(p), ot = d(b), gt = [G(ot), G(st)];
|
|
2867
2776
|
if (H != null) {
|
|
2868
2777
|
const lt = H === !0 ? C(n.BYTES) : H;
|
|
2869
2778
|
gt.push(V("extraEntropy", lt, n.BYTES));
|
|
2870
2779
|
}
|
|
2871
|
-
const
|
|
2872
|
-
function
|
|
2780
|
+
const It = jt(...gt), at = st;
|
|
2781
|
+
function de(lt) {
|
|
2873
2782
|
const wt = A(lt);
|
|
2874
2783
|
if (!y(wt))
|
|
2875
2784
|
return;
|
|
2876
|
-
const
|
|
2877
|
-
if (
|
|
2785
|
+
const Ge = c(wt), yt = l.BASE.multiply(wt).toAffine(), z = i(yt.x);
|
|
2786
|
+
if (z === et)
|
|
2878
2787
|
return;
|
|
2879
|
-
const bt = i(
|
|
2788
|
+
const bt = i(Ge * i(at + z * ot));
|
|
2880
2789
|
if (bt === et)
|
|
2881
2790
|
return;
|
|
2882
|
-
let
|
|
2883
|
-
return j && S(bt) && (
|
|
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);
|
|
2884
2793
|
}
|
|
2885
|
-
return { seed:
|
|
2794
|
+
return { seed: It, k2sig: de };
|
|
2886
2795
|
}
|
|
2887
2796
|
const N = { lowS: e.lowS, prehash: !1 }, L = { lowS: e.lowS, prehash: !1 };
|
|
2888
|
-
function D(p, b,
|
|
2889
|
-
const { seed:
|
|
2890
|
-
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);
|
|
2891
2800
|
}
|
|
2892
2801
|
l.BASE._setWindowSize(8);
|
|
2893
|
-
function rt(p, b,
|
|
2802
|
+
function rt(p, b, T, k = L) {
|
|
2894
2803
|
var yt;
|
|
2895
2804
|
const C = p;
|
|
2896
|
-
if (b = V("msgHash", b),
|
|
2805
|
+
if (b = V("msgHash", b), T = V("publicKey", T), "strict" in k)
|
|
2897
2806
|
throw new Error("options.strict was renamed to lowS");
|
|
2898
|
-
const { lowS: j, prehash:
|
|
2807
|
+
const { lowS: j, prehash: q } = k;
|
|
2899
2808
|
let H, st;
|
|
2900
2809
|
try {
|
|
2901
2810
|
if (typeof C == "string" || C instanceof Uint8Array)
|
|
2902
2811
|
try {
|
|
2903
2812
|
H = w.fromDER(C);
|
|
2904
|
-
} catch (
|
|
2905
|
-
if (!(
|
|
2906
|
-
throw
|
|
2813
|
+
} catch (z) {
|
|
2814
|
+
if (!(z instanceof dt.Err))
|
|
2815
|
+
throw z;
|
|
2907
2816
|
H = w.fromCompact(C);
|
|
2908
2817
|
}
|
|
2909
2818
|
else if (typeof C == "object" && typeof C.r == "bigint" && typeof C.s == "bigint") {
|
|
2910
|
-
const { r:
|
|
2911
|
-
H = new w(
|
|
2819
|
+
const { r: z, s: bt } = C;
|
|
2820
|
+
H = new w(z, bt);
|
|
2912
2821
|
} else
|
|
2913
2822
|
throw new Error("PARSE");
|
|
2914
|
-
st = l.fromHex(
|
|
2915
|
-
} catch (
|
|
2916
|
-
if (
|
|
2823
|
+
st = l.fromHex(T);
|
|
2824
|
+
} catch (z) {
|
|
2825
|
+
if (z.message === "PARSE")
|
|
2917
2826
|
throw new Error("signature must be Signature instance, Uint8Array or hex string");
|
|
2918
2827
|
return !1;
|
|
2919
2828
|
}
|
|
2920
2829
|
if (j && H.hasHighS())
|
|
2921
2830
|
return !1;
|
|
2922
|
-
|
|
2923
|
-
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();
|
|
2924
2833
|
return wt ? i(wt.x) === ot : !1;
|
|
2925
2834
|
}
|
|
2926
2835
|
return {
|
|
2927
2836
|
CURVE: e,
|
|
2928
2837
|
getPublicKey: x,
|
|
2929
|
-
getSharedSecret:
|
|
2838
|
+
getSharedSecret: _,
|
|
2930
2839
|
sign: D,
|
|
2931
2840
|
verify: rt,
|
|
2932
2841
|
ProjectivePoint: l,
|
|
@@ -2934,61 +2843,61 @@ function Ec(t) {
|
|
|
2934
2843
|
utils: E
|
|
2935
2844
|
};
|
|
2936
2845
|
}
|
|
2937
|
-
function
|
|
2846
|
+
function ve(t) {
|
|
2938
2847
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
2939
2848
|
throw new Error(`Wrong positive integer: ${t}`);
|
|
2940
2849
|
}
|
|
2941
|
-
function
|
|
2850
|
+
function bc(t) {
|
|
2942
2851
|
if (typeof t != "boolean")
|
|
2943
2852
|
throw new Error(`Expected boolean, not ${t}`);
|
|
2944
2853
|
}
|
|
2945
|
-
function
|
|
2854
|
+
function Sr(t, ...e) {
|
|
2946
2855
|
if (!(t instanceof Uint8Array))
|
|
2947
2856
|
throw new TypeError("Expected Uint8Array");
|
|
2948
2857
|
if (e.length > 0 && !e.includes(t.length))
|
|
2949
2858
|
throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`);
|
|
2950
2859
|
}
|
|
2951
|
-
function
|
|
2860
|
+
function Sc(t) {
|
|
2952
2861
|
if (typeof t != "function" || typeof t.create != "function")
|
|
2953
2862
|
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
|
2954
|
-
|
|
2863
|
+
ve(t.outputLen), ve(t.blockLen);
|
|
2955
2864
|
}
|
|
2956
|
-
function
|
|
2865
|
+
function Ec(t, e = !0) {
|
|
2957
2866
|
if (t.destroyed)
|
|
2958
2867
|
throw new Error("Hash instance has been destroyed");
|
|
2959
2868
|
if (e && t.finished)
|
|
2960
2869
|
throw new Error("Hash#digest() has already been called");
|
|
2961
2870
|
}
|
|
2962
|
-
function
|
|
2963
|
-
|
|
2871
|
+
function Ac(t, e) {
|
|
2872
|
+
Sr(t);
|
|
2964
2873
|
const n = e.outputLen;
|
|
2965
2874
|
if (t.length < n)
|
|
2966
2875
|
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
2967
2876
|
}
|
|
2968
|
-
const
|
|
2969
|
-
number:
|
|
2970
|
-
bool:
|
|
2971
|
-
bytes:
|
|
2972
|
-
hash:
|
|
2973
|
-
exists:
|
|
2974
|
-
output:
|
|
2975
|
-
},
|
|
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;
|
|
2976
2885
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2977
|
-
const
|
|
2978
|
-
if (!
|
|
2886
|
+
const xc = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
2887
|
+
if (!xc)
|
|
2979
2888
|
throw new Error("Non little-endian hardware is not supported");
|
|
2980
2889
|
Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
2981
|
-
function
|
|
2890
|
+
function vc(t) {
|
|
2982
2891
|
if (typeof t != "string")
|
|
2983
2892
|
throw new TypeError(`utf8ToBytes expected string, got ${typeof t}`);
|
|
2984
2893
|
return new TextEncoder().encode(t);
|
|
2985
2894
|
}
|
|
2986
|
-
function
|
|
2987
|
-
if (typeof t == "string" && (t =
|
|
2895
|
+
function Tc(t) {
|
|
2896
|
+
if (typeof t == "string" && (t = vc(t)), !(t instanceof Uint8Array))
|
|
2988
2897
|
throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);
|
|
2989
2898
|
return t;
|
|
2990
2899
|
}
|
|
2991
|
-
function
|
|
2900
|
+
function Ic(...t) {
|
|
2992
2901
|
if (!t.every((r) => r instanceof Uint8Array))
|
|
2993
2902
|
throw new Error("Uint8Array list expected");
|
|
2994
2903
|
if (t.length === 1)
|
|
@@ -3000,21 +2909,21 @@ function Nc(...t) {
|
|
|
3000
2909
|
}
|
|
3001
2910
|
return n;
|
|
3002
2911
|
}
|
|
3003
|
-
class
|
|
2912
|
+
class _c {
|
|
3004
2913
|
// Safe version that clones internal state
|
|
3005
2914
|
clone() {
|
|
3006
2915
|
return this._cloneInto();
|
|
3007
2916
|
}
|
|
3008
2917
|
}
|
|
3009
|
-
function
|
|
3010
|
-
if (
|
|
3011
|
-
return
|
|
2918
|
+
function Bc(t = 32) {
|
|
2919
|
+
if (be && typeof be.getRandomValues == "function")
|
|
2920
|
+
return be.getRandomValues(new Uint8Array(t));
|
|
3012
2921
|
throw new Error("crypto.getRandomValues must be defined");
|
|
3013
2922
|
}
|
|
3014
|
-
class
|
|
2923
|
+
class Er extends _c {
|
|
3015
2924
|
constructor(e, n) {
|
|
3016
|
-
super(), this.finished = !1, this.destroyed = !1,
|
|
3017
|
-
const r =
|
|
2925
|
+
super(), this.finished = !1, this.destroyed = !1, Wt.hash(e);
|
|
2926
|
+
const r = Tc(n);
|
|
3018
2927
|
if (this.iHash = e.create(), typeof this.iHash.update != "function")
|
|
3019
2928
|
throw new TypeError("Expected instance of class which extends utils.Hash");
|
|
3020
2929
|
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
@@ -3028,10 +2937,10 @@ class Cr extends Cc {
|
|
|
3028
2937
|
this.oHash.update(o), o.fill(0);
|
|
3029
2938
|
}
|
|
3030
2939
|
update(e) {
|
|
3031
|
-
return
|
|
2940
|
+
return Wt.exists(this), this.iHash.update(e), this;
|
|
3032
2941
|
}
|
|
3033
2942
|
digestInto(e) {
|
|
3034
|
-
|
|
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();
|
|
3035
2944
|
}
|
|
3036
2945
|
digest() {
|
|
3037
2946
|
const e = new Uint8Array(this.oHash.outputLen);
|
|
@@ -3046,61 +2955,61 @@ class Cr extends Cc {
|
|
|
3046
2955
|
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
3047
2956
|
}
|
|
3048
2957
|
}
|
|
3049
|
-
const
|
|
3050
|
-
|
|
2958
|
+
const Ar = (t, e, n) => new Er(t, e).update(n).digest();
|
|
2959
|
+
Ar.create = (t, e) => new Er(t, e);
|
|
3051
2960
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3052
|
-
function
|
|
2961
|
+
function Nc(t) {
|
|
3053
2962
|
return {
|
|
3054
2963
|
hash: t,
|
|
3055
|
-
hmac: (e, ...n) =>
|
|
3056
|
-
randomBytes:
|
|
2964
|
+
hmac: (e, ...n) => Ar(t, e, Ic(...n)),
|
|
2965
|
+
randomBytes: Bc
|
|
3057
2966
|
};
|
|
3058
2967
|
}
|
|
3059
|
-
const
|
|
3060
|
-
function
|
|
2968
|
+
const In = BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"), xr = 252;
|
|
2969
|
+
function _n(t) {
|
|
3061
2970
|
for (; t[0] === 0; )
|
|
3062
2971
|
t = t.subarray(1);
|
|
3063
|
-
const e = t.length * 8 -
|
|
2972
|
+
const e = t.length * 8 - xr, n = X(t);
|
|
3064
2973
|
return e > 0 ? n >> BigInt(e) : n;
|
|
3065
2974
|
}
|
|
3066
|
-
function
|
|
3067
|
-
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);
|
|
3068
2977
|
}
|
|
3069
|
-
const
|
|
2978
|
+
const Tr = yc({
|
|
3070
2979
|
a: BigInt(1),
|
|
3071
2980
|
b: BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),
|
|
3072
|
-
Fp:
|
|
3073
|
-
n:
|
|
3074
|
-
nBitLength:
|
|
2981
|
+
Fp: He(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),
|
|
2982
|
+
n: In,
|
|
2983
|
+
nBitLength: xr,
|
|
3075
2984
|
Gx: BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),
|
|
3076
2985
|
Gy: BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),
|
|
3077
2986
|
h: BigInt(1),
|
|
3078
2987
|
lowS: !1,
|
|
3079
|
-
...
|
|
3080
|
-
bits2int:
|
|
2988
|
+
...Nc(hr),
|
|
2989
|
+
bits2int: _n,
|
|
3081
2990
|
bits2int_modN: (t) => {
|
|
3082
2991
|
const e = X(t).toString(16);
|
|
3083
|
-
return e.length === 63 && (t =
|
|
2992
|
+
return e.length === 63 && (t = vr(e + "0")), M(_n(t), In);
|
|
3084
2993
|
}
|
|
3085
2994
|
});
|
|
3086
|
-
function
|
|
3087
|
-
return V("", typeof t == "string" ?
|
|
2995
|
+
function Cc(t) {
|
|
2996
|
+
return V("", typeof t == "string" ? vr(t) : t);
|
|
3088
2997
|
}
|
|
3089
|
-
const { CURVE: _u, ProjectivePoint:
|
|
3090
|
-
function
|
|
2998
|
+
const { CURVE: _u, ProjectivePoint: Ot, Signature: Bu, utils: Nu } = Tr;
|
|
2999
|
+
function Oc(t) {
|
|
3091
3000
|
return `0x${ht(t.subarray(1)).replace(/^0+/gm, "")}`;
|
|
3092
3001
|
}
|
|
3093
|
-
function
|
|
3002
|
+
function kc(t) {
|
|
3094
3003
|
return t.replace(/^0x/i, "");
|
|
3095
3004
|
}
|
|
3096
|
-
const
|
|
3097
|
-
new
|
|
3098
|
-
new
|
|
3099
|
-
new
|
|
3100
|
-
new
|
|
3101
|
-
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)
|
|
3102
3011
|
];
|
|
3103
|
-
function
|
|
3012
|
+
function Ir(t, e) {
|
|
3104
3013
|
const n = [];
|
|
3105
3014
|
let r = t;
|
|
3106
3015
|
for (let s = 0; s < 248; s++)
|
|
@@ -3110,8 +3019,8 @@ function $r(t, e) {
|
|
|
3110
3019
|
n.push(r), r = r.double();
|
|
3111
3020
|
return n;
|
|
3112
3021
|
}
|
|
3113
|
-
const
|
|
3114
|
-
function
|
|
3022
|
+
const Pc = Ir(Lt[1], Lt[2]), Rc = Ir(Lt[3], Lt[4]);
|
|
3023
|
+
function Fc(t) {
|
|
3115
3024
|
let e;
|
|
3116
3025
|
if (typeof t == "bigint")
|
|
3117
3026
|
e = t;
|
|
@@ -3120,13 +3029,13 @@ function jc(t) {
|
|
|
3120
3029
|
throw new Error(`Invalid pedersenArg: ${t}`);
|
|
3121
3030
|
e = BigInt(t);
|
|
3122
3031
|
} else
|
|
3123
|
-
e = X(
|
|
3124
|
-
if (!(0n <= e && e <
|
|
3032
|
+
e = X(Cc(t));
|
|
3033
|
+
if (!(0n <= e && e < Tr.CURVE.Fp.ORDER))
|
|
3125
3034
|
throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${e}`);
|
|
3126
3035
|
return e;
|
|
3127
3036
|
}
|
|
3128
|
-
function
|
|
3129
|
-
let r =
|
|
3037
|
+
function Bn(t, e, n) {
|
|
3038
|
+
let r = Fc(e);
|
|
3130
3039
|
for (let s = 0; s < 252; s++) {
|
|
3131
3040
|
const o = n[s];
|
|
3132
3041
|
if (o.equals(t))
|
|
@@ -3135,33 +3044,33 @@ function Fn(t, e, n) {
|
|
|
3135
3044
|
}
|
|
3136
3045
|
return t;
|
|
3137
3046
|
}
|
|
3138
|
-
function
|
|
3139
|
-
let n =
|
|
3140
|
-
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));
|
|
3141
3050
|
}
|
|
3142
|
-
const
|
|
3143
|
-
|
|
3144
|
-
const
|
|
3145
|
-
function
|
|
3146
|
-
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}`)));
|
|
3147
3056
|
return t.create(r);
|
|
3148
3057
|
}
|
|
3149
|
-
const
|
|
3058
|
+
const Hc = [
|
|
3150
3059
|
[3, 1, 1],
|
|
3151
3060
|
[1, -1, 1],
|
|
3152
3061
|
[1, 1, -2]
|
|
3153
3062
|
].map((t) => t.map(BigInt));
|
|
3154
|
-
function
|
|
3155
|
-
if (
|
|
3063
|
+
function Vc(t, e) {
|
|
3064
|
+
if (Le(t.Fp), !Number.isSafeInteger(t.rate) || !Number.isSafeInteger(t.capacity))
|
|
3156
3065
|
throw new Error(`Wrong poseidon opts: ${t}`);
|
|
3157
3066
|
const n = t.rate + t.capacity, r = t.roundsFull + t.roundsPartial, s = [];
|
|
3158
3067
|
for (let a = 0; a < r; a++) {
|
|
3159
3068
|
const i = [];
|
|
3160
3069
|
for (let c = 0; c < n; c++)
|
|
3161
|
-
i.push(
|
|
3070
|
+
i.push(Dc(t.Fp, "Hades", n * a + c));
|
|
3162
3071
|
s.push(i);
|
|
3163
3072
|
}
|
|
3164
|
-
const o =
|
|
3073
|
+
const o = uc({
|
|
3165
3074
|
...t,
|
|
3166
3075
|
t: n,
|
|
3167
3076
|
sboxPower: 3,
|
|
@@ -3171,42 +3080,42 @@ function zc(t, e) {
|
|
|
3171
3080
|
});
|
|
3172
3081
|
return o.m = n, o.rate = t.rate, o.capacity = t.capacity, o;
|
|
3173
3082
|
}
|
|
3174
|
-
|
|
3175
|
-
var
|
|
3083
|
+
Vc({ Fp: Lc, rate: 2, capacity: 1, roundsFull: 8, roundsPartial: 83 }, Hc);
|
|
3084
|
+
var Te;
|
|
3176
3085
|
(function(t) {
|
|
3177
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";
|
|
3178
|
-
})(
|
|
3179
|
-
const
|
|
3087
|
+
})(Te || (Te = {}));
|
|
3088
|
+
const Mc = f.object({
|
|
3180
3089
|
recoveryId: f.number()
|
|
3181
|
-
}),
|
|
3182
|
-
feeToken:
|
|
3090
|
+
}), Cu = f.object({
|
|
3091
|
+
feeToken: te,
|
|
3183
3092
|
signerSignature: f.object({
|
|
3184
3093
|
type: f.literal("StarknetKey"),
|
|
3185
3094
|
signer: f.object({
|
|
3186
|
-
publicKey:
|
|
3187
|
-
r:
|
|
3188
|
-
s:
|
|
3095
|
+
publicKey: kt,
|
|
3096
|
+
r: kt,
|
|
3097
|
+
s: kt
|
|
3189
3098
|
})
|
|
3190
3099
|
})
|
|
3191
|
-
}),
|
|
3100
|
+
}), Gc = f.nativeEnum(Te), _r = f.object({
|
|
3192
3101
|
recoveryId: f.number(),
|
|
3193
|
-
status:
|
|
3102
|
+
status: Gc,
|
|
3194
3103
|
completionTime: f.array(f.number()).optional()
|
|
3195
|
-
}),
|
|
3196
|
-
activeRecovery:
|
|
3104
|
+
}), qc = f.object({
|
|
3105
|
+
activeRecovery: _r.optional().or(f.null()).optional(),
|
|
3197
3106
|
minFees: f.record(f.number()).optional()
|
|
3198
|
-
}),
|
|
3199
|
-
recovery:
|
|
3107
|
+
}), Wc = f.object({
|
|
3108
|
+
recovery: _r.optional().or(f.null()).optional(),
|
|
3200
3109
|
minFees: f.record(f.number()).optional()
|
|
3201
3110
|
});
|
|
3202
|
-
var
|
|
3111
|
+
var Ie;
|
|
3203
3112
|
(function(t) {
|
|
3204
3113
|
t.UNDEPLOYED_ACCOUNT = "undeployedAccount", t.NOT_ENOUGH_TO_PAY_FEES = "notEnoughToPayFees", t.RECOVERY_ALREADY_EXISTS = "recoveryAlreadyExists";
|
|
3205
|
-
})(
|
|
3206
|
-
const
|
|
3207
|
-
status:
|
|
3114
|
+
})(Ie || (Ie = {}));
|
|
3115
|
+
const zc = f.nativeEnum(Ie), Ou = f.object({
|
|
3116
|
+
status: zc
|
|
3208
3117
|
});
|
|
3209
|
-
class
|
|
3118
|
+
class ku {
|
|
3210
3119
|
constructor(e, n) {
|
|
3211
3120
|
this.apiBase = e, this.httpService = n;
|
|
3212
3121
|
}
|
|
@@ -3218,7 +3127,7 @@ class Pu {
|
|
|
3218
3127
|
* @returns A promise that resolves to the on-chain recovery details.
|
|
3219
3128
|
*/
|
|
3220
3129
|
async getRecovery(e, n) {
|
|
3221
|
-
const r =
|
|
3130
|
+
const r = P(this.apiBase, "accounts", "starknet", e, "recovery", `${n}`), s = await this.httpService.get(r), o = Wc.safeParse(s);
|
|
3222
3131
|
return o.error ? null : o.data;
|
|
3223
3132
|
}
|
|
3224
3133
|
/**
|
|
@@ -3228,7 +3137,7 @@ class Pu {
|
|
|
3228
3137
|
* @returns A promise that resolves to the on-chain recovery details.
|
|
3229
3138
|
*/
|
|
3230
3139
|
async getActiveRecovery(e) {
|
|
3231
|
-
const n =
|
|
3140
|
+
const n = P(this.apiBase, "accounts", "starknet", e, "recovery"), r = await this.httpService.get(n), s = qc.safeParse(r);
|
|
3232
3141
|
return s.error ? null : s.data;
|
|
3233
3142
|
}
|
|
3234
3143
|
/**
|
|
@@ -3240,20 +3149,20 @@ class Pu {
|
|
|
3240
3149
|
* @returns A promise that resolves to the recovery details.
|
|
3241
3150
|
*/
|
|
3242
3151
|
async startRecovery(e, n, r, s) {
|
|
3243
|
-
const { r: o, s: a } =
|
|
3152
|
+
const { r: o, s: a } = vs.starkCurve.sign($c(jc(ks("utf8", "starknet:recovery")), r), s), i = {
|
|
3244
3153
|
feeToken: n,
|
|
3245
3154
|
signerSignature: {
|
|
3246
3155
|
type: "StarknetKey",
|
|
3247
3156
|
signer: {
|
|
3248
3157
|
publicKey: r,
|
|
3249
|
-
r:
|
|
3250
|
-
s:
|
|
3158
|
+
r: Rt.addHexPrefix(o.toString(16)),
|
|
3159
|
+
s: Rt.addHexPrefix(a.toString(16))
|
|
3251
3160
|
}
|
|
3252
3161
|
}
|
|
3253
3162
|
};
|
|
3254
3163
|
return await this.httpService.post(`${this.apiBase}/accounts/starknet/${e}/recovery`, {
|
|
3255
3164
|
body: JSON.stringify(i)
|
|
3256
|
-
},
|
|
3165
|
+
}, Mc);
|
|
3257
3166
|
}
|
|
3258
3167
|
/**
|
|
3259
3168
|
* Completes the recovery process for a given address and recovery ID.
|
|
@@ -3263,11 +3172,11 @@ class Pu {
|
|
|
3263
3172
|
*
|
|
3264
3173
|
*/
|
|
3265
3174
|
async completeRecovery(e, n) {
|
|
3266
|
-
const r =
|
|
3175
|
+
const r = P(this.apiBase, "accounts", "starknet", e, "recovery", `${n}`, "complete");
|
|
3267
3176
|
return await this.httpService.post(r);
|
|
3268
3177
|
}
|
|
3269
3178
|
}
|
|
3270
|
-
async function
|
|
3179
|
+
async function Pu() {
|
|
3271
3180
|
if ("brave" in navigator)
|
|
3272
3181
|
try {
|
|
3273
3182
|
return await navigator.brave.isBrave();
|
|
@@ -3275,26 +3184,26 @@ async function Ru() {
|
|
|
3275
3184
|
}
|
|
3276
3185
|
return !1;
|
|
3277
3186
|
}
|
|
3278
|
-
let
|
|
3279
|
-
function
|
|
3280
|
-
return
|
|
3187
|
+
let Se;
|
|
3188
|
+
function Kc() {
|
|
3189
|
+
return Se || (Se = new Ps(navigator.userAgent).getResult()), Se;
|
|
3281
3190
|
}
|
|
3282
|
-
function
|
|
3283
|
-
return
|
|
3191
|
+
function le(t) {
|
|
3192
|
+
return Kc().browser.name === t;
|
|
3284
3193
|
}
|
|
3285
|
-
function
|
|
3286
|
-
return
|
|
3194
|
+
function Ru() {
|
|
3195
|
+
return le("Firefox");
|
|
3287
3196
|
}
|
|
3288
3197
|
function Fu() {
|
|
3289
|
-
return
|
|
3198
|
+
return le("Chrome");
|
|
3290
3199
|
}
|
|
3291
|
-
function
|
|
3292
|
-
return
|
|
3200
|
+
function $u() {
|
|
3201
|
+
return le("Safari");
|
|
3293
3202
|
}
|
|
3294
|
-
function
|
|
3295
|
-
return
|
|
3203
|
+
function Uu() {
|
|
3204
|
+
return le("Edge");
|
|
3296
3205
|
}
|
|
3297
|
-
const
|
|
3206
|
+
const ju = f.string().refine((t) => Rs(t, Fs), "Invalid seedphrase"), Ve = [
|
|
3298
3207
|
{
|
|
3299
3208
|
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
3300
3209
|
name: "Ether",
|
|
@@ -3471,26 +3380,26 @@ const Lu = f.string().refine((t) => Ss(t, Es), "Invalid seedphrase"), Ye = [
|
|
|
3471
3380
|
networkId: "mainnet-alpha",
|
|
3472
3381
|
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/ekubo.png"
|
|
3473
3382
|
}
|
|
3474
|
-
],
|
|
3383
|
+
], Zc = async (t, e, n) => {
|
|
3475
3384
|
const r = await n.callContract({
|
|
3476
3385
|
contractAddress: t,
|
|
3477
3386
|
entrypoint: "balanceOf",
|
|
3478
3387
|
calldata: [e]
|
|
3479
3388
|
});
|
|
3480
|
-
return BigInt(O.toHex(
|
|
3389
|
+
return BigInt(O.toHex(Dt.uint256ToBN({
|
|
3481
3390
|
low: r[0],
|
|
3482
3391
|
high: r[1]
|
|
3483
3392
|
})));
|
|
3484
|
-
},
|
|
3485
|
-
const r =
|
|
3393
|
+
}, Lu = async (t, e, n) => {
|
|
3394
|
+
const r = Ve.filter((o) => o.networkId === t);
|
|
3486
3395
|
return (await Promise.allSettled(r.map((o) => e.callContract({
|
|
3487
3396
|
contractAddress: o.address,
|
|
3488
3397
|
entrypoint: "balanceOf",
|
|
3489
3398
|
calldata: [n]
|
|
3490
3399
|
})))).reduce((o, a, i) => {
|
|
3491
|
-
if (a.status === "fulfilled" &&
|
|
3400
|
+
if (a.status === "fulfilled" && Ns(a.value) || a.status === "rejected" || a.value[0] === "0x0" && a.value[1] === "0x0")
|
|
3492
3401
|
return o;
|
|
3493
|
-
const c = BigInt(O.toHex(
|
|
3402
|
+
const c = BigInt(O.toHex(Dt.uint256ToBN({
|
|
3494
3403
|
low: a.value[0],
|
|
3495
3404
|
high: a.value[1]
|
|
3496
3405
|
}))), l = {
|
|
@@ -3499,44 +3408,44 @@ const Lu = f.string().refine((t) => Ss(t, Es), "Invalid seedphrase"), Ye = [
|
|
|
3499
3408
|
};
|
|
3500
3409
|
return o.push(l), o;
|
|
3501
3410
|
}, []);
|
|
3502
|
-
},
|
|
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 }) => {
|
|
3503
3412
|
if (!Y(t) || !Y(e) || !Y(n))
|
|
3504
3413
|
return;
|
|
3505
|
-
const r = Number(e), s = BigInt(t) *
|
|
3506
|
-
return
|
|
3414
|
+
const r = Number(e), s = BigInt(t) * On(n.toString()).value;
|
|
3415
|
+
return Be({
|
|
3507
3416
|
value: s,
|
|
3508
|
-
decimals: r +
|
|
3417
|
+
decimals: r + Jr
|
|
3509
3418
|
});
|
|
3510
|
-
},
|
|
3419
|
+
}, Mu = ({ unitAmount: t, decimals: e }) => {
|
|
3511
3420
|
if (t === void 0 || !Y(t) || e === void 0 || !Y(e))
|
|
3512
3421
|
return;
|
|
3513
3422
|
const n = Number(e);
|
|
3514
|
-
return
|
|
3515
|
-
},
|
|
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) => {
|
|
3516
3425
|
if (t === void 0 || !Y(t))
|
|
3517
3426
|
return null;
|
|
3518
|
-
const r =
|
|
3427
|
+
const r = mi(t, n);
|
|
3519
3428
|
return [e, r].filter(Boolean).join("");
|
|
3520
|
-
},
|
|
3429
|
+
}, Jc = "Unlimited", Wu = ({ amount: t, decimals: e, symbol: n, showPlusSign: r = !1, withSymbol: s = !0, unlimitedText: o = Jc, prettyConfigOverrides: a }) => {
|
|
3521
3430
|
if (!Y(t))
|
|
3522
3431
|
return null;
|
|
3523
3432
|
let i, c = !1;
|
|
3524
|
-
if (
|
|
3433
|
+
if (Xc(t))
|
|
3525
3434
|
i = o;
|
|
3526
3435
|
else {
|
|
3527
3436
|
const d = Number(e), u = BigInt(t);
|
|
3528
3437
|
c = u > 0n;
|
|
3529
|
-
const y = d > 0 ?
|
|
3530
|
-
i = d > 0 ?
|
|
3438
|
+
const y = d > 0 ? Be({ value: u, decimals: d }) : u.toString();
|
|
3439
|
+
i = d > 0 ? gi(y, a) : y;
|
|
3531
3440
|
}
|
|
3532
3441
|
const l = [i, s && n].filter(Boolean).join(" ");
|
|
3533
3442
|
return r && c ? `+${l}` : l;
|
|
3534
3443
|
};
|
|
3535
|
-
var
|
|
3536
|
-
function
|
|
3444
|
+
var Qc = ys, tl = Qc;
|
|
3445
|
+
function el(t, e) {
|
|
3537
3446
|
function n(r, s) {
|
|
3538
3447
|
var o = e || {}, a;
|
|
3539
|
-
"randomize" in o || (o.randomize = !0), a =
|
|
3448
|
+
"randomize" in o || (o.randomize = !0), a = tl.operation(o);
|
|
3540
3449
|
function i(d) {
|
|
3541
3450
|
s(d || new Error("Aborted"));
|
|
3542
3451
|
}
|
|
@@ -3563,9 +3472,9 @@ function sl(t, e) {
|
|
|
3563
3472
|
}
|
|
3564
3473
|
return new Promise(n);
|
|
3565
3474
|
}
|
|
3566
|
-
var
|
|
3567
|
-
const
|
|
3568
|
-
class
|
|
3475
|
+
var nl = el;
|
|
3476
|
+
const rl = /* @__PURE__ */ ds(nl);
|
|
3477
|
+
class zu {
|
|
3569
3478
|
constructor(e, n) {
|
|
3570
3479
|
this.apiBase = e, this.httpService = n, this.TOKENS_INFO_URL = "/tokens/info", this.TOKENS_DEFI_DECOMPOSITION_URL = "/tokens/defi/decomposition";
|
|
3571
3480
|
}
|
|
@@ -3575,21 +3484,21 @@ class Ku {
|
|
|
3575
3484
|
* @returns {Promise<ApiTokenInfo[]>} - The fetched tokens or undefined if there was an error or not default network
|
|
3576
3485
|
*/
|
|
3577
3486
|
async fetchTokensInfoFromBackend(e) {
|
|
3578
|
-
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);
|
|
3579
3488
|
if (s.success)
|
|
3580
3489
|
return s.data.tokens;
|
|
3581
|
-
const o =
|
|
3490
|
+
const o = hs.safeParse(r);
|
|
3582
3491
|
if (o.success)
|
|
3583
3492
|
return [o.data];
|
|
3584
3493
|
}
|
|
3585
3494
|
/**
|
|
3586
3495
|
* Fetch list of tokens and balances for given account from backend
|
|
3587
3496
|
* @param {Address} address - The account address.
|
|
3588
|
-
* @returns {Promise<
|
|
3497
|
+
* @returns {Promise<WebBaseTokenWithBalance[]>} - The fetched balances for the account address.
|
|
3589
3498
|
*/
|
|
3590
3499
|
async fetchAddressTokenBalancesFromBackend(e, n, r) {
|
|
3591
|
-
const s =
|
|
3592
|
-
return (await
|
|
3500
|
+
const s = P(this.apiBase, "activity", "starknet", n, "account", e, "balance");
|
|
3501
|
+
return (await rl(
|
|
3593
3502
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3594
3503
|
async (i) => {
|
|
3595
3504
|
let c;
|
|
@@ -3598,7 +3507,7 @@ class Ku {
|
|
|
3598
3507
|
} catch {
|
|
3599
3508
|
return i(new Error("Error fetching")), [];
|
|
3600
3509
|
}
|
|
3601
|
-
const l =
|
|
3510
|
+
const l = ps.safeParse(c);
|
|
3602
3511
|
if (!l.success)
|
|
3603
3512
|
return i(new Error("Error parsing response")), [];
|
|
3604
3513
|
if (l.data.status !== "initialised")
|
|
@@ -3618,47 +3527,47 @@ class Ku {
|
|
|
3618
3527
|
}));
|
|
3619
3528
|
}
|
|
3620
3529
|
async fetchDefiDecomposition(e) {
|
|
3621
|
-
const n =
|
|
3622
|
-
if (!
|
|
3623
|
-
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" });
|
|
3624
3533
|
return r.dapps;
|
|
3625
3534
|
}
|
|
3626
3535
|
}
|
|
3627
|
-
const
|
|
3536
|
+
const Ku = (t, e, n, r) => ({
|
|
3628
3537
|
contractAddress: t,
|
|
3629
3538
|
entrypoint: "transfer",
|
|
3630
3539
|
calldata: mt.compile({
|
|
3631
3540
|
recipient: e,
|
|
3632
|
-
amount:
|
|
3541
|
+
amount: Ut(wi(n, r))
|
|
3633
3542
|
})
|
|
3634
|
-
}),
|
|
3543
|
+
}), Zu = (t, e, n, r) => ({
|
|
3635
3544
|
contractAddress: t,
|
|
3636
3545
|
entrypoint: "transferFrom",
|
|
3637
3546
|
calldata: mt.compile({
|
|
3638
3547
|
from_: e,
|
|
3639
3548
|
to: n,
|
|
3640
|
-
tokenId:
|
|
3549
|
+
tokenId: Ut(r)
|
|
3641
3550
|
// OZ specs need a uint256 as tokenId
|
|
3642
3551
|
})
|
|
3643
|
-
}),
|
|
3552
|
+
}), Yu = (t, e, n, r) => ({
|
|
3644
3553
|
contractAddress: t,
|
|
3645
3554
|
entrypoint: "safeTransferFrom",
|
|
3646
3555
|
calldata: mt.compile({
|
|
3647
3556
|
from_: e,
|
|
3648
3557
|
to: n,
|
|
3649
|
-
tokenId:
|
|
3650
|
-
amount:
|
|
3558
|
+
tokenId: Ut(r),
|
|
3559
|
+
amount: Ut(1),
|
|
3651
3560
|
data_len: "0"
|
|
3652
3561
|
})
|
|
3653
3562
|
});
|
|
3654
|
-
function
|
|
3655
|
-
return
|
|
3563
|
+
function Br(t) {
|
|
3564
|
+
return ke(t.unit) === "WEI";
|
|
3656
3565
|
}
|
|
3657
|
-
function
|
|
3658
|
-
return
|
|
3566
|
+
function sl(t) {
|
|
3567
|
+
return ke(t.unit) === "FRI";
|
|
3659
3568
|
}
|
|
3660
3569
|
function At(t, e) {
|
|
3661
|
-
return
|
|
3570
|
+
return Br(t) ? {
|
|
3662
3571
|
...t,
|
|
3663
3572
|
maxFee: e(t.maxFee),
|
|
3664
3573
|
overallFee: e(t.overallFee),
|
|
@@ -3673,22 +3582,22 @@ function At(t, e) {
|
|
|
3673
3582
|
maxPricePerUnit: e(t.maxPricePerUnit)
|
|
3674
3583
|
};
|
|
3675
3584
|
}
|
|
3676
|
-
function
|
|
3677
|
-
return
|
|
3585
|
+
function Pt(t) {
|
|
3586
|
+
return Br(t) ? {
|
|
3678
3587
|
maxFee: t.maxFee
|
|
3679
3588
|
} : {
|
|
3680
3589
|
amount: t.maxAmount,
|
|
3681
3590
|
pricePerUnit: t.maxPricePerUnit
|
|
3682
3591
|
};
|
|
3683
3592
|
}
|
|
3684
|
-
function
|
|
3685
|
-
return
|
|
3593
|
+
function Ee(t) {
|
|
3594
|
+
return sl({ unit: t }) ? Oe : Fn;
|
|
3686
3595
|
}
|
|
3687
|
-
function
|
|
3596
|
+
function Xu(t, e, n = 2) {
|
|
3688
3597
|
const r = BigInt(10 ** n), s = BigInt(Math.round(e * 10 ** n));
|
|
3689
3598
|
return t * s / r;
|
|
3690
3599
|
}
|
|
3691
|
-
const
|
|
3600
|
+
const Ju = [Oe], Nr = (t, e = ll) => {
|
|
3692
3601
|
if (t.max && "amount" in t.max)
|
|
3693
3602
|
return {
|
|
3694
3603
|
...t,
|
|
@@ -3697,7 +3606,7 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3697
3606
|
const n = 10000n, { amount: r, pricePerUnit: s, dataGasConsumed: o = 0n, dataGasPrice: a = 0n } = t, i = r * s + o * a;
|
|
3698
3607
|
if (i < 0)
|
|
3699
3608
|
throw Error("Cannot calculate max fee for negative fee");
|
|
3700
|
-
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)));
|
|
3701
3610
|
return {
|
|
3702
3611
|
...t,
|
|
3703
3612
|
amount: r * u / n,
|
|
@@ -3705,41 +3614,41 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3705
3614
|
dataGasConsumed: o * u / n,
|
|
3706
3615
|
dataGasPrice: a * u / n
|
|
3707
3616
|
};
|
|
3708
|
-
},
|
|
3617
|
+
}, Jt = (t) => {
|
|
3709
3618
|
const { amount: e, pricePerUnit: n, dataGasConsumed: r = 0n, dataGasPrice: s = 0n } = t;
|
|
3710
3619
|
return e * n + r * s;
|
|
3711
|
-
},
|
|
3620
|
+
}, ol = (t) => {
|
|
3712
3621
|
if (t.max)
|
|
3713
|
-
return "maxFee" in t.max ? t.max.maxFee :
|
|
3714
|
-
},
|
|
3715
|
-
const e =
|
|
3716
|
-
return e ||
|
|
3717
|
-
},
|
|
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) => {
|
|
3718
3627
|
if (t.deployment && !nt(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
3719
3628
|
throw Error("Cannot calculate estimated fees for different tokens");
|
|
3720
|
-
const e =
|
|
3629
|
+
const e = Jt(t.transactions), n = t.deployment ? Jt(t.deployment) : 0n;
|
|
3721
3630
|
return e + n;
|
|
3722
|
-
},
|
|
3631
|
+
}, td = (t) => {
|
|
3723
3632
|
if (t.deployment && !nt(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
3724
3633
|
throw Error("Cannot calculate estimated fees for different tokens");
|
|
3725
|
-
const e = t.deployment ?
|
|
3634
|
+
const e = t.deployment ? _e(t.deployment) : 0n, n = _e(t.transactions);
|
|
3726
3635
|
return e + n;
|
|
3727
|
-
},
|
|
3636
|
+
}, ed = (t, e) => [
|
|
3728
3637
|
{
|
|
3729
3638
|
contractAddress: t,
|
|
3730
3639
|
entrypoint: "transfer",
|
|
3731
|
-
calldata: mt.compile(
|
|
3640
|
+
calldata: mt.compile(gs.parse({
|
|
3732
3641
|
// We are using a dummy address (ETH here) as recipient to estimate the fee given we don't have a receipient yet
|
|
3733
3642
|
recipient: e,
|
|
3734
3643
|
// We are using the smallest possible amount to make sure this doesn't throw an error
|
|
3735
|
-
amount:
|
|
3644
|
+
amount: Dt.bnToUint256(BigInt(1))
|
|
3736
3645
|
}))
|
|
3737
3646
|
}
|
|
3738
|
-
],
|
|
3647
|
+
], al = (t, e) => {
|
|
3739
3648
|
if (!t)
|
|
3740
3649
|
return {
|
|
3741
3650
|
transactions: {
|
|
3742
|
-
feeTokenAddress: e ??
|
|
3651
|
+
feeTokenAddress: e ?? Fn,
|
|
3743
3652
|
amount: 0n,
|
|
3744
3653
|
pricePerUnit: 0n,
|
|
3745
3654
|
dataGasConsumed: 0n,
|
|
@@ -3749,44 +3658,44 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3749
3658
|
if (!Array.isArray(t))
|
|
3750
3659
|
throw Error(`Unexpected simulation response. Expected array. Got ${typeof t}`);
|
|
3751
3660
|
if (t.length === 1) {
|
|
3752
|
-
const n =
|
|
3661
|
+
const n = fe.parse(t[0].feeEstimation);
|
|
3753
3662
|
return {
|
|
3754
3663
|
transactions: {
|
|
3755
|
-
feeTokenAddress:
|
|
3664
|
+
feeTokenAddress: Ee(n.unit),
|
|
3756
3665
|
amount: O.toBigInt(n.gasUsage),
|
|
3757
3666
|
pricePerUnit: O.toBigInt(n.gasPrice),
|
|
3758
|
-
max:
|
|
3667
|
+
max: Pt(At(n, O.toBigInt)),
|
|
3759
3668
|
dataGasConsumed: n.dataGasConsumed ? O.toBigInt(n.dataGasConsumed) : 0n,
|
|
3760
3669
|
dataGasPrice: n.dataGasPrice ? O.toBigInt(n.dataGasPrice) : 0n
|
|
3761
3670
|
}
|
|
3762
3671
|
};
|
|
3763
3672
|
}
|
|
3764
3673
|
if (t.length === 2) {
|
|
3765
|
-
const n =
|
|
3674
|
+
const n = fe.parse(t[0].feeEstimation), r = fe.parse(t[1].feeEstimation);
|
|
3766
3675
|
return {
|
|
3767
3676
|
deployment: {
|
|
3768
|
-
feeTokenAddress:
|
|
3677
|
+
feeTokenAddress: Ee(n.unit),
|
|
3769
3678
|
amount: O.toBigInt(n.gasUsage),
|
|
3770
3679
|
pricePerUnit: O.toBigInt(n.gasPrice),
|
|
3771
|
-
max:
|
|
3680
|
+
max: Pt(At(n, O.toBigInt)),
|
|
3772
3681
|
dataGasConsumed: n.dataGasConsumed ? O.toBigInt(n.dataGasConsumed) : 0n,
|
|
3773
3682
|
dataGasPrice: n.dataGasPrice ? O.toBigInt(n.dataGasPrice) : 0n
|
|
3774
3683
|
},
|
|
3775
3684
|
transactions: {
|
|
3776
|
-
feeTokenAddress:
|
|
3685
|
+
feeTokenAddress: Ee(r.unit),
|
|
3777
3686
|
amount: O.toBigInt(r.gasUsage),
|
|
3778
3687
|
pricePerUnit: O.toBigInt(r.gasPrice),
|
|
3779
|
-
max:
|
|
3688
|
+
max: Pt(At(r, O.toBigInt)),
|
|
3780
3689
|
dataGasConsumed: r.dataGasConsumed ? O.toBigInt(r.dataGasConsumed) : 0n,
|
|
3781
3690
|
dataGasPrice: r.dataGasPrice ? O.toBigInt(r.dataGasPrice) : 0n
|
|
3782
3691
|
}
|
|
3783
3692
|
};
|
|
3784
3693
|
}
|
|
3785
3694
|
throw Error("Unexpected simulation response length");
|
|
3786
|
-
},
|
|
3695
|
+
}, il = ({ transaction: t, nonce: e, chainId: n, version: r, isDeploymentTransaction: s, cairoVersion: o, address: a, appDomain: i }) => {
|
|
3787
3696
|
let c = e;
|
|
3788
3697
|
s && t.type !== "DEPLOY_ACCOUNT" && (c = O.toHex(1));
|
|
3789
|
-
const l =
|
|
3698
|
+
const l = Ce(t.calls);
|
|
3790
3699
|
return {
|
|
3791
3700
|
type: t.type,
|
|
3792
3701
|
chainId: n,
|
|
@@ -3802,32 +3711,32 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3802
3711
|
appDomain: i
|
|
3803
3712
|
// appDomain: "https://starknetkit-blacked-listed.vercel.app", // to simulate blacklisted domain
|
|
3804
3713
|
};
|
|
3805
|
-
},
|
|
3714
|
+
}, cl = (t, e) => {
|
|
3806
3715
|
const { transactions: n } = t, r = n.map((c) => {
|
|
3807
3716
|
if (!c.simulation)
|
|
3808
|
-
throw new
|
|
3717
|
+
throw new Ss({ code: "SIMULATE_AND_REVIEW_FAILED" });
|
|
3809
3718
|
return c;
|
|
3810
3719
|
}), s = r.map((c) => ({
|
|
3811
3720
|
...c.simulation,
|
|
3812
3721
|
feeEstimation: At(c.simulation.feeEstimation, Number)
|
|
3813
|
-
})), o =
|
|
3722
|
+
})), o = al(s, e), [a, i] = r.length === 1 ? [r[0], void 0] : [r[1], r[0]];
|
|
3814
3723
|
return {
|
|
3815
3724
|
...o,
|
|
3816
3725
|
transactions: {
|
|
3817
3726
|
...o.transactions,
|
|
3818
3727
|
dataGasConsumed: o.transactions.dataGasConsumed ?? 0n,
|
|
3819
3728
|
dataGasPrice: o.transactions.dataGasPrice ?? 0n,
|
|
3820
|
-
max:
|
|
3729
|
+
max: Pt(At(a.simulation.feeEstimation, O.toBigInt))
|
|
3821
3730
|
},
|
|
3822
3731
|
deployment: o.deployment && i ? {
|
|
3823
3732
|
...o.deployment,
|
|
3824
3733
|
dataGasConsumed: o.deployment.dataGasConsumed ?? 0n,
|
|
3825
3734
|
dataGasPrice: o.deployment.dataGasPrice ?? 0n,
|
|
3826
|
-
max:
|
|
3735
|
+
max: Pt(At(i.simulation.feeEstimation, O.toBigInt))
|
|
3827
3736
|
} : void 0
|
|
3828
3737
|
};
|
|
3829
|
-
},
|
|
3830
|
-
const e =
|
|
3738
|
+
}, nd = (t) => {
|
|
3739
|
+
const e = Nr(t), n = _e(t);
|
|
3831
3740
|
return {
|
|
3832
3741
|
// for v1 transactions
|
|
3833
3742
|
maxFee: n,
|
|
@@ -3845,31 +3754,31 @@ const Qu = [$e], jr = (t, e = fl) => {
|
|
|
3845
3754
|
}
|
|
3846
3755
|
}
|
|
3847
3756
|
};
|
|
3848
|
-
},
|
|
3757
|
+
}, rd = (t) => {
|
|
3849
3758
|
const e = Math.sqrt(t);
|
|
3850
3759
|
return isNaN(e) ? Math.sqrt(2) : e;
|
|
3851
|
-
},
|
|
3760
|
+
}, ll = (t) => {
|
|
3852
3761
|
const e = Math.cbrt(t);
|
|
3853
3762
|
return isNaN(e) ? Math.cbrt(2) : e;
|
|
3854
|
-
},
|
|
3855
|
-
function
|
|
3856
|
-
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));
|
|
3857
3766
|
}
|
|
3858
|
-
function
|
|
3859
|
-
return t ?
|
|
3767
|
+
function od(t) {
|
|
3768
|
+
return t ? ba().some((e) => nt(e, t)) : !1;
|
|
3860
3769
|
}
|
|
3861
|
-
function
|
|
3862
|
-
return
|
|
3770
|
+
function Nn(t) {
|
|
3771
|
+
return Me({
|
|
3863
3772
|
address: t
|
|
3864
3773
|
}) ? Z.TRANSACTION_VERSION.V3 : Z.TRANSACTION_VERSION.V1;
|
|
3865
3774
|
}
|
|
3866
|
-
function
|
|
3867
|
-
return
|
|
3775
|
+
function ad(t) {
|
|
3776
|
+
return Me({ address: t }) ? Z.TRANSACTION_VERSION.F3 : Z.TRANSACTION_VERSION.F1;
|
|
3868
3777
|
}
|
|
3869
|
-
function
|
|
3870
|
-
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;
|
|
3871
3780
|
}
|
|
3872
|
-
class
|
|
3781
|
+
class cd {
|
|
3873
3782
|
constructor(e, n) {
|
|
3874
3783
|
this.apiBase = e, this.httpService = n;
|
|
3875
3784
|
}
|
|
@@ -3878,7 +3787,7 @@ class ld {
|
|
|
3878
3787
|
* @returns {Promise<TransactionReviewLabel[] | undefined>} The account activities.
|
|
3879
3788
|
*/
|
|
3880
3789
|
async getLabels() {
|
|
3881
|
-
const e =
|
|
3790
|
+
const e = P(this.apiBase, "reviewer", "labels");
|
|
3882
3791
|
return await this.httpService.get(e);
|
|
3883
3792
|
}
|
|
3884
3793
|
/**
|
|
@@ -3886,7 +3795,7 @@ class ld {
|
|
|
3886
3795
|
* @returns {Promise<TransactionReviewWarning[] | undefined>} The account activities.
|
|
3887
3796
|
*/
|
|
3888
3797
|
async getWarnings() {
|
|
3889
|
-
const e =
|
|
3798
|
+
const e = P(this.apiBase, "reviewer", "warnings/reasons");
|
|
3890
3799
|
return await this.httpService.get(e);
|
|
3891
3800
|
}
|
|
3892
3801
|
async simulateAndReview(e, n, r, s, o, a) {
|
|
@@ -3894,9 +3803,9 @@ class ld {
|
|
|
3894
3803
|
try {
|
|
3895
3804
|
if (!("getChainId" in e))
|
|
3896
3805
|
throw new Error("MISSING_METHOD");
|
|
3897
|
-
const c =
|
|
3806
|
+
const c = Nn(r), l = i ? "0x0" : await e.getNonce(), d = await e.getChainId(), u = {
|
|
3898
3807
|
transactions: n.map((w) => ({
|
|
3899
|
-
...
|
|
3808
|
+
...il({
|
|
3900
3809
|
transaction: w,
|
|
3901
3810
|
nonce: l,
|
|
3902
3811
|
version: c,
|
|
@@ -3908,16 +3817,16 @@ class ld {
|
|
|
3908
3817
|
}),
|
|
3909
3818
|
type: w.type
|
|
3910
3819
|
}))
|
|
3911
|
-
}, y =
|
|
3820
|
+
}, y = P(this.apiBase, "reviewer", "transactions", "v2", "review", "starknet"), m = a ? Qr(y, { delayedTransactions: "true" }) : y, S = await this.httpService.post(m, {
|
|
3912
3821
|
headers: {
|
|
3913
3822
|
Accept: "application/json",
|
|
3914
3823
|
"Content-Type": "application/json"
|
|
3915
3824
|
},
|
|
3916
3825
|
body: JSON.stringify(u)
|
|
3917
|
-
},
|
|
3918
|
-
if (S.transactions.some((w) =>
|
|
3826
|
+
}, As);
|
|
3827
|
+
if (S.transactions.some((w) => xs(w)))
|
|
3919
3828
|
return S;
|
|
3920
|
-
const g =
|
|
3829
|
+
const g = cl(S, r);
|
|
3921
3830
|
return {
|
|
3922
3831
|
...S,
|
|
3923
3832
|
enrichedFeeEstimation: g
|
|
@@ -3934,7 +3843,7 @@ class ld {
|
|
|
3934
3843
|
}
|
|
3935
3844
|
getCallsFromTx(e) {
|
|
3936
3845
|
let n;
|
|
3937
|
-
return e.calls && (n =
|
|
3846
|
+
return e.calls && (n = Ce(e.calls)), n;
|
|
3938
3847
|
}
|
|
3939
3848
|
async fallbackToOnchainFeeEstimation({ transactions: e, account: n, isDeploymentTransaction: r, feeTokenAddress: s, accountDeployTransaction: o }) {
|
|
3940
3849
|
try {
|
|
@@ -3964,7 +3873,7 @@ class ld {
|
|
|
3964
3873
|
}
|
|
3965
3874
|
async fetchFeesOnchain({ starknetAccount: e, calls: n, isDeployed: r, feeTokenAddress: s, accountDeployTransaction: o }) {
|
|
3966
3875
|
try {
|
|
3967
|
-
const a =
|
|
3876
|
+
const a = Nn(s), i = {
|
|
3968
3877
|
transactions: {
|
|
3969
3878
|
feeTokenAddress: s,
|
|
3970
3879
|
amount: 0n,
|
|
@@ -3977,7 +3886,7 @@ class ld {
|
|
|
3977
3886
|
if ("estimateFeeBulk" in e) {
|
|
3978
3887
|
const c = [
|
|
3979
3888
|
{
|
|
3980
|
-
type:
|
|
3889
|
+
type: tn.DEPLOY_ACCOUNT,
|
|
3981
3890
|
payload: {
|
|
3982
3891
|
classHash: o.classHash,
|
|
3983
3892
|
addressSalt: o.salt,
|
|
@@ -3986,7 +3895,7 @@ class ld {
|
|
|
3986
3895
|
}
|
|
3987
3896
|
},
|
|
3988
3897
|
{
|
|
3989
|
-
type:
|
|
3898
|
+
type: tn.INVOKE,
|
|
3990
3899
|
payload: n
|
|
3991
3900
|
}
|
|
3992
3901
|
], [l, d] = await e.estimateFeeBulk(c, {
|
|
@@ -4040,36 +3949,36 @@ class ld {
|
|
|
4040
3949
|
}
|
|
4041
3950
|
}
|
|
4042
3951
|
}
|
|
4043
|
-
const
|
|
3952
|
+
const ld = [
|
|
4044
3953
|
"account-upgrade",
|
|
4045
3954
|
"approve",
|
|
4046
3955
|
"set-approval-for-all",
|
|
4047
3956
|
"swap",
|
|
4048
3957
|
"transfer"
|
|
4049
|
-
],
|
|
4050
|
-
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));
|
|
4051
3960
|
return t && (n || r);
|
|
4052
|
-
}, [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 ? [
|
|
4053
3962
|
{
|
|
4054
3963
|
contractAddress: t.address,
|
|
4055
3964
|
entrypoint: "transfer",
|
|
4056
3965
|
calldata: mt.compile({
|
|
4057
3966
|
recipient: e,
|
|
4058
|
-
amount:
|
|
3967
|
+
amount: Ut(t.balance)
|
|
4059
3968
|
})
|
|
4060
3969
|
}
|
|
4061
|
-
] : [], [t, e]),
|
|
4062
|
-
const a =
|
|
3970
|
+
] : [], [t, e]), yd = ({ apiData: { apiBaseUrl: t, apiHeaders: e }, address: n, network: r, transactionReviewEnabled: s = !0, transactions: o }) => {
|
|
3971
|
+
const a = Ln(async () => {
|
|
4063
3972
|
if (!n || !r)
|
|
4064
3973
|
return;
|
|
4065
3974
|
if (!t)
|
|
4066
3975
|
throw "Transaction review endpoint is not defined";
|
|
4067
|
-
const c =
|
|
3976
|
+
const c = P(t, "reviewer/transactions/review/starknet"), l = Cs(o) ? o : [o], d = {
|
|
4068
3977
|
network: r,
|
|
4069
3978
|
account: n,
|
|
4070
3979
|
calls: l
|
|
4071
3980
|
};
|
|
4072
|
-
return
|
|
3981
|
+
return qn(c, {
|
|
4073
3982
|
method: "POST",
|
|
4074
3983
|
headers: {
|
|
4075
3984
|
"Content-Type": "application/json",
|
|
@@ -4077,32 +3986,32 @@ const ud = [
|
|
|
4077
3986
|
},
|
|
4078
3987
|
body: JSON.stringify(d)
|
|
4079
3988
|
});
|
|
4080
|
-
}, [n, r, o]), i =
|
|
4081
|
-
return
|
|
4082
|
-
},
|
|
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) => {
|
|
4083
3992
|
if (!t)
|
|
4084
3993
|
return {};
|
|
4085
|
-
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;
|
|
4086
3995
|
return {
|
|
4087
3996
|
warn: e,
|
|
4088
3997
|
reason: r
|
|
4089
3998
|
};
|
|
4090
|
-
},
|
|
3999
|
+
}, fl = (t) => {
|
|
4091
4000
|
var e;
|
|
4092
4001
|
if (t) {
|
|
4093
4002
|
for (const n of t.reviews)
|
|
4094
4003
|
if (((e = n.activity) == null ? void 0 : e.type) === "swap")
|
|
4095
4004
|
return n;
|
|
4096
4005
|
}
|
|
4097
|
-
},
|
|
4098
|
-
},
|
|
4006
|
+
}, Sd = (t) => {
|
|
4007
|
+
}, Ed = (t, e) => {
|
|
4099
4008
|
var n;
|
|
4100
4009
|
if (e) {
|
|
4101
4010
|
for (const r of e.reviews)
|
|
4102
4011
|
if (((n = r.activity) == null ? void 0 : n.type) === t)
|
|
4103
4012
|
return r.activity;
|
|
4104
4013
|
}
|
|
4105
|
-
},
|
|
4014
|
+
}, Ad = (t) => !!fl(t), xd = (t) => {
|
|
4106
4015
|
var e, n;
|
|
4107
4016
|
if (t) {
|
|
4108
4017
|
for (const r of t.reviews)
|
|
@@ -4112,21 +4021,21 @@ const ud = [
|
|
|
4112
4021
|
type: (n = r.activity) == null ? void 0 : n.type
|
|
4113
4022
|
};
|
|
4114
4023
|
}
|
|
4115
|
-
},
|
|
4024
|
+
}, hl = async ({ feeTokenAddress: t, calls: e, selectedAccount: n, transactionReviewService: r, appDomain: s, accountDeployTransaction: o, isDelayedTransaction: a }) => {
|
|
4116
4025
|
const i = {
|
|
4117
4026
|
type: "INVOKE",
|
|
4118
|
-
calls:
|
|
4027
|
+
calls: Ce(e)
|
|
4119
4028
|
};
|
|
4120
4029
|
if (!n || !t)
|
|
4121
4030
|
return;
|
|
4122
4031
|
const c = o ? [o, i] : [i];
|
|
4123
4032
|
return { result: await r.simulateAndReview(n, c, t, s, o, a) };
|
|
4124
|
-
},
|
|
4033
|
+
}, pl = async (t, e, n, r) => {
|
|
4125
4034
|
var y, m, S, h, g, w;
|
|
4126
4035
|
let s = !1;
|
|
4127
4036
|
const o = e.transactions.find((E) => {
|
|
4128
|
-
var x,
|
|
4129
|
-
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);
|
|
4130
4039
|
});
|
|
4131
4040
|
if (!o || !((y = o.simulation) != null && y.summary))
|
|
4132
4041
|
return s;
|
|
@@ -4136,32 +4045,32 @@ const ud = [
|
|
|
4136
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;
|
|
4137
4046
|
if (!c || !l)
|
|
4138
4047
|
return s;
|
|
4139
|
-
const d = await
|
|
4048
|
+
const d = await Zc(n, t, r) ?? 0n;
|
|
4140
4049
|
return BigInt(d) > c + BigInt(l) || (s = !0), s;
|
|
4141
|
-
},
|
|
4050
|
+
}, vd = () => Ln(async ({ feeTokenAddress: e, calls: n, selectedAccount: r, transactionReviewService: s, appDomain: o, accountDeployPayload: a, provider: i, isDelayedTransaction: c }) => {
|
|
4142
4051
|
if (!r)
|
|
4143
4052
|
return;
|
|
4144
|
-
const l = await
|
|
4053
|
+
const l = await hl({
|
|
4145
4054
|
feeTokenAddress: e,
|
|
4146
4055
|
calls: n,
|
|
4147
4056
|
selectedAccount: r,
|
|
4148
4057
|
transactionReviewService: s,
|
|
4149
4058
|
appDomain: o,
|
|
4150
|
-
accountDeployTransaction:
|
|
4059
|
+
accountDeployTransaction: ml(a),
|
|
4151
4060
|
isDelayedTransaction: c
|
|
4152
4061
|
});
|
|
4153
4062
|
if (!l || !l.result || !e)
|
|
4154
4063
|
return;
|
|
4155
|
-
const d = await
|
|
4064
|
+
const d = await pl(r.address, l.result, e, i);
|
|
4156
4065
|
return { ...l.result, isSendingMoreThanBalanceAndGas: d };
|
|
4157
|
-
}, []),
|
|
4066
|
+
}, []), ml = (t) => t ? {
|
|
4158
4067
|
type: "DEPLOY_ACCOUNT",
|
|
4159
4068
|
calldata: t.calldata,
|
|
4160
|
-
classHash:
|
|
4161
|
-
salt:
|
|
4069
|
+
classHash: kt.parse(t.class_hash),
|
|
4070
|
+
salt: kt.parse(t.salt),
|
|
4162
4071
|
signature: []
|
|
4163
4072
|
} : void 0;
|
|
4164
|
-
function
|
|
4073
|
+
function Cn() {
|
|
4165
4074
|
return { promise: Promise.resolve() };
|
|
4166
4075
|
}
|
|
4167
4076
|
function Td(t) {
|
|
@@ -4170,7 +4079,7 @@ function Td(t) {
|
|
|
4170
4079
|
super(), this.enabled = e, this.appVersion = n;
|
|
4171
4080
|
}
|
|
4172
4081
|
track(e, n) {
|
|
4173
|
-
return !this.enabled || !super.isLoaded ?
|
|
4082
|
+
return !this.enabled || !super.isLoaded ? Cn() : {
|
|
4174
4083
|
promise: super.track(e, {
|
|
4175
4084
|
app_version: this.appVersion,
|
|
4176
4085
|
...n
|
|
@@ -4179,354 +4088,364 @@ function Td(t) {
|
|
|
4179
4088
|
}
|
|
4180
4089
|
};
|
|
4181
4090
|
}
|
|
4182
|
-
const
|
|
4183
|
-
const [r, s] =
|
|
4091
|
+
const gl = Is({}), Id = ({ enabled: t, initialize: e, children: n }) => {
|
|
4092
|
+
const [r, s] = jn(!1);
|
|
4184
4093
|
return Ft(() => {
|
|
4185
4094
|
!r && t && e().then(() => s(!0));
|
|
4186
|
-
}, [r, t, e]), /* @__PURE__ */
|
|
4095
|
+
}, [r, t, e]), /* @__PURE__ */ Us(gl.Provider, { value: {}, children: n });
|
|
4187
4096
|
};
|
|
4188
4097
|
export {
|
|
4189
4098
|
tt as ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES,
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
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,
|
|
4203
4112
|
kd as EventEmitterProvider,
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4113
|
+
Nh as EventsBySelector,
|
|
4114
|
+
Ch as FEE_OVERHEAD,
|
|
4115
|
+
Gn as HTTPService,
|
|
4116
|
+
ze as HTTP_ERROR_MESSAGE,
|
|
4208
4117
|
K as HttpError,
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
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,
|
|
4229
4138
|
Td as WebAnalyticsServiceFactory,
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
sd as
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
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,
|
|
4287
4197
|
At as castFeeEstimation,
|
|
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
|
-
|
|
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,
|
|
4352
4262
|
ql as getAccountIdentifier,
|
|
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
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
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,
|
|
4408
4318
|
Fl as isAccountV4,
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
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,
|
|
4419
4329
|
Fu as isChromeBrowser,
|
|
4420
|
-
|
|
4421
|
-
|
|
4330
|
+
du as isContractDeployed,
|
|
4331
|
+
Uu as isEdgeBrowser,
|
|
4422
4332
|
nt as isEqualAddress,
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
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,
|
|
4430
4340
|
Y as isNumeric,
|
|
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
|
-
|
|
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,
|
|
4465
4375
|
qu as prettifyCurrencyValue,
|
|
4466
|
-
|
|
4467
|
-
|
|
4376
|
+
rr as prettifyNumber,
|
|
4377
|
+
Re as prettifyNumberConfig,
|
|
4468
4378
|
Wu as prettifyTokenAmount,
|
|
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
|
-
|
|
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,
|
|
4497
4407
|
Wl as swrRefetchDisabledConfig,
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
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,
|
|
4436
|
+
yd as useTransactionReview,
|
|
4437
|
+
vd as useTransactionReviewV2webFetcher,
|
|
4438
|
+
gh as validChecksumAddressSchema,
|
|
4439
|
+
wh as validateAddressRangeSchema,
|
|
4440
|
+
yu as voidify,
|
|
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
|
|
4532
4451
|
};
|