@nexus-cross/crossx-sdk-core 2.2.3-beta.3 → 2.2.3-beta.5
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/adapters/confirmation/BrowserConfirmationAdapter.d.ts.map +1 -1
- package/dist/crossx.global +163 -154
- package/dist/index.cjs +147 -138
- package/dist/index.js +1122 -1098
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ class f extends Error {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
var
|
|
19
|
+
var He = /* @__PURE__ */ ((s) => (s.MetaMask = "io.metamask", s.Binance = "com.binance.wallet", s.CROSSx = "crossx", s))(He || {});
|
|
20
20
|
const as = {
|
|
21
21
|
"io.metamask": "MetaMask",
|
|
22
22
|
"com.binance.wallet": "Binance Wallet",
|
|
@@ -33,7 +33,7 @@ function ls(s) {
|
|
|
33
33
|
function ds(s) {
|
|
34
34
|
return Array.isArray(s.connectOtherWallets) && s.connectOtherWallets.length > 0 ? [...s.connectOtherWallets] : s.showConnectOtherWallets === !0 ? [...cs] : [];
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const tt = {
|
|
37
37
|
// ─── CROSS ────────────────────────────────────────────
|
|
38
38
|
CROSS_MAINNET: {
|
|
39
39
|
caipId: "eip155:612055",
|
|
@@ -82,16 +82,16 @@ const et = {
|
|
|
82
82
|
rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
|
|
83
83
|
testnet: !0
|
|
84
84
|
}
|
|
85
|
-
},
|
|
86
|
-
Object.entries(
|
|
85
|
+
}, xo = Object.fromEntries(
|
|
86
|
+
Object.entries(tt).map(([s, e]) => [s, e.caipId])
|
|
87
87
|
), us = new Map(
|
|
88
|
-
Object.values(
|
|
88
|
+
Object.values(tt).map((s) => [s.caipId, s])
|
|
89
89
|
);
|
|
90
90
|
new Map(
|
|
91
|
-
Object.values(
|
|
91
|
+
Object.values(tt).map((s) => [s.chainId, s])
|
|
92
92
|
);
|
|
93
93
|
const hs = { symbol: "", decimals: 18 };
|
|
94
|
-
function
|
|
94
|
+
function it(s) {
|
|
95
95
|
var e;
|
|
96
96
|
return ((e = us.get(s)) == null ? void 0 : e.nativeCurrency) ?? hs;
|
|
97
97
|
}
|
|
@@ -460,7 +460,7 @@ function xe(s = "en", e) {
|
|
|
460
460
|
function gs(s) {
|
|
461
461
|
return s === "ko" || s === "en" ? s : typeof navigator < "u" && (navigator.language ?? "").toLowerCase().startsWith("ko") ? "ko" : "en";
|
|
462
462
|
}
|
|
463
|
-
const Bt = "crossx_access_token", Mt = "crossx_refresh_token", Ft = "crossx_user_info",
|
|
463
|
+
const Bt = "crossx_access_token", Mt = "crossx_refresh_token", Ft = "crossx_user_info", et = class et {
|
|
464
464
|
constructor(e, r, t, n, i, o, a, c, l = () => {
|
|
465
465
|
}) {
|
|
466
466
|
this.config = e, this.storage = r, this.crypto = t, this.oauth = n, this.transport = i, this.walletProvider = o, this.tokenStore = a, this.requestFreshTokenFromBridge = c, this.getLocale = l, this._refreshPromise = null, this._migrated = !1;
|
|
@@ -653,49 +653,49 @@ const Bt = "crossx_access_token", Mt = "crossx_refresh_token", Ft = "crossx_user
|
|
|
653
653
|
let t, n = !1;
|
|
654
654
|
try {
|
|
655
655
|
const { authApiUrl: u } = this.config, { accessToken: p, refreshToken: g } = await this.exchangeFirebaseToken(e, u);
|
|
656
|
-
let _, x,
|
|
656
|
+
let _, x, y;
|
|
657
657
|
try {
|
|
658
|
-
const
|
|
659
|
-
d.log("[CROSSx] Firebase JWT 필드:", Object.keys(
|
|
660
|
-
const
|
|
661
|
-
|
|
658
|
+
const A = this.crypto.decodeJWT(e);
|
|
659
|
+
d.log("[CROSSx] Firebase JWT 필드:", Object.keys(A).join(", ")), x = (i = A.firebase) == null ? void 0 : i.sign_in_provider;
|
|
660
|
+
const R = ((o = A.firebase) == null ? void 0 : o.identities) ?? {};
|
|
661
|
+
y = A.email ?? ((a = R.email) == null ? void 0 : a[0]), x === "google.com" ? _ = (c = R["google.com"]) == null ? void 0 : c[0] : x === "apple.com" && (_ = (l = R["apple.com"]) == null ? void 0 : l[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", x, "hasProviderSub:", !!_, "email:", y ?? "(없음)");
|
|
662
662
|
} catch {
|
|
663
663
|
d.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
|
|
664
664
|
}
|
|
665
665
|
if (p) {
|
|
666
|
-
const
|
|
667
|
-
d.log("[CROSSx] access_token 디코딩 — sub:",
|
|
668
|
-
const
|
|
669
|
-
if (n =
|
|
666
|
+
const A = this.crypto.decodeJWT(p);
|
|
667
|
+
d.log("[CROSSx] access_token 디코딩 — sub:", A.sub, "exp:", A.exp, "필드:", Object.keys(A).join(", "));
|
|
668
|
+
const R = await this.crypto.verifyJWT(p);
|
|
669
|
+
if (n = R.signatureVerified ?? !1, !R.valid)
|
|
670
670
|
throw d.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
|
|
671
|
-
const
|
|
671
|
+
const k = R.payload, L = k.email ?? y ?? r;
|
|
672
672
|
d.log(
|
|
673
673
|
"[CROSSx] email 소스 — CROSSx JWT:",
|
|
674
|
-
|
|
674
|
+
k.email ?? "(없음)",
|
|
675
675
|
"/ Firebase JWT:",
|
|
676
|
-
|
|
676
|
+
y ?? "(없음)",
|
|
677
677
|
"/ OAuth 콜백:",
|
|
678
678
|
r ?? "(없음)",
|
|
679
679
|
"→",
|
|
680
680
|
L ?? "(없음)"
|
|
681
681
|
), t = {
|
|
682
|
-
id:
|
|
682
|
+
id: k.sub,
|
|
683
683
|
email: L,
|
|
684
684
|
signInProvider: x,
|
|
685
685
|
providerSub: _
|
|
686
686
|
}, this.tokenStore.set(p), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, p), g && this.config.secureStorageAvailable !== !1 ? await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, g) : g && d.warn("[CROSSx] 안전한 스토리지 미사용 — refresh_token 영속 저장을 건너뜁니다"));
|
|
687
687
|
} else {
|
|
688
|
-
const
|
|
688
|
+
const A = this.crypto.decodeJWT(e);
|
|
689
689
|
t = {
|
|
690
|
-
id:
|
|
691
|
-
email:
|
|
690
|
+
id: A.sub,
|
|
691
|
+
email: A.email ?? r,
|
|
692
692
|
signInProvider: x,
|
|
693
693
|
providerSub: _
|
|
694
694
|
}, d.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", t.id);
|
|
695
695
|
}
|
|
696
696
|
d.log("[CROSSx] 사용자 정보 — id:", t.id, "email:", t.email ?? "(없음)");
|
|
697
|
-
const
|
|
698
|
-
await this.storage.set(this.STORAGE_KEY_USER,
|
|
697
|
+
const v = this.useCookieAuth ? { id: t.id, email: t.email, signInProvider: t.signInProvider, providerSub: t.providerSub } : t;
|
|
698
|
+
await this.storage.set(this.STORAGE_KEY_USER, v), d.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
|
|
699
699
|
} catch (u) {
|
|
700
700
|
return d.error("[CROSSx] SignIn 에러 (토큰 교환 단계):", u), {
|
|
701
701
|
success: !1,
|
|
@@ -893,7 +893,7 @@ const Bt = "crossx_access_token", Mt = "crossx_refresh_token", Ft = "crossx_user
|
|
|
893
893
|
d.log("[CROSSx] silentRefresh 응답 — status:", o.status);
|
|
894
894
|
const a = o.data, c = this.extractResponseErrorCode(a);
|
|
895
895
|
if (c) {
|
|
896
|
-
const u =
|
|
896
|
+
const u = et.REFRESH_RELOGIN_CODES.has(c.code);
|
|
897
897
|
throw new f(
|
|
898
898
|
u ? h.SESSION_EXPIRED : h.AUTH_FAILED,
|
|
899
899
|
`토큰 갱신 실패 (코드 ${c.code}): ${c.message}`
|
|
@@ -1029,8 +1029,8 @@ const Bt = "crossx_access_token", Mt = "crossx_refresh_token", Ft = "crossx_user
|
|
|
1029
1029
|
return d.log("[CROSSx] loadWallet 결과 — address:", t, "needsMigration:", n), { success: !0, address: t, user: e, needsMigration: n, tokenSignatureVerified: r };
|
|
1030
1030
|
}
|
|
1031
1031
|
};
|
|
1032
|
-
|
|
1033
|
-
let
|
|
1032
|
+
et.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
|
|
1033
|
+
let gt = et;
|
|
1034
1034
|
class xs {
|
|
1035
1035
|
constructor(e, r, t) {
|
|
1036
1036
|
this.config = e, this.storage = r, this.tokenStore = t;
|
|
@@ -1338,7 +1338,7 @@ class fe {
|
|
|
1338
1338
|
return !(!((t = this.context) != null && t.isActivated) || Date.now() - this.context.activatedAt > this.context.absoluteTtlMs);
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
|
-
const
|
|
1341
|
+
const Le = {
|
|
1342
1342
|
production: {
|
|
1343
1343
|
oauthServiceUrl: "https://cross-wallet-oauth.crosstoken.io",
|
|
1344
1344
|
authApiUrl: "https://cross-auth.crosstoken.io",
|
|
@@ -1360,7 +1360,7 @@ const Pe = {
|
|
|
1360
1360
|
};
|
|
1361
1361
|
function vs(s) {
|
|
1362
1362
|
const e = s.environment;
|
|
1363
|
-
return e && e in
|
|
1363
|
+
return e && e in Le ? Le[e] : null;
|
|
1364
1364
|
}
|
|
1365
1365
|
function fr() {
|
|
1366
1366
|
try {
|
|
@@ -1372,19 +1372,19 @@ function fr() {
|
|
|
1372
1372
|
}
|
|
1373
1373
|
try {
|
|
1374
1374
|
const s = process.env.NEXT_PUBLIC_CROSSX_ENVIRONMENT;
|
|
1375
|
-
if (s && s in
|
|
1376
|
-
return
|
|
1375
|
+
if (s && s in Le)
|
|
1376
|
+
return Le[s];
|
|
1377
1377
|
} catch {
|
|
1378
1378
|
}
|
|
1379
|
-
return
|
|
1379
|
+
return Le.production;
|
|
1380
1380
|
}
|
|
1381
|
-
const Ss = 2e3, Ut = 6e4, Es = 1e3, As = 1e4, Is = "0x77359400", Ht = "0x3B9ACA00", Wt = 130,
|
|
1381
|
+
const Ss = 2e3, Ut = 6e4, Es = 1e3, As = 1e4, Is = "0x77359400", Ht = "0x3B9ACA00", Wt = 130, At = 6, Gt = 18, qt = 3e4, Ts = 5 * 60 * 1e3, ks = 30 * 1e3, xt = 100, Rs = "crossx-sdk-js/2.2.3";
|
|
1382
1382
|
function gr(s) {
|
|
1383
1383
|
let e = s.length;
|
|
1384
1384
|
for (; e > 0 && s.charCodeAt(e - 1) === 48; ) e--;
|
|
1385
1385
|
return s.slice(0, e);
|
|
1386
1386
|
}
|
|
1387
|
-
function Ns(s, e =
|
|
1387
|
+
function Ns(s, e = At) {
|
|
1388
1388
|
if (!s || s === "0x0" || s === "0x") return "0";
|
|
1389
1389
|
try {
|
|
1390
1390
|
const r = BigInt(s);
|
|
@@ -1395,7 +1395,7 @@ function Ns(s, e = Et) {
|
|
|
1395
1395
|
return "?";
|
|
1396
1396
|
}
|
|
1397
1397
|
}
|
|
1398
|
-
function
|
|
1398
|
+
function qe(s, e, r, t = At) {
|
|
1399
1399
|
if (!(!s || s === "0x" || s === "0x0"))
|
|
1400
1400
|
try {
|
|
1401
1401
|
const n = BigInt(s);
|
|
@@ -1406,7 +1406,7 @@ function Ge(s, e, r, t = Et) {
|
|
|
1406
1406
|
return;
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
1409
|
-
function
|
|
1409
|
+
function Os(s) {
|
|
1410
1410
|
const e = s.startsWith("0x") ? s.slice(2) : s;
|
|
1411
1411
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
1412
1412
|
throw new f(
|
|
@@ -1419,7 +1419,7 @@ function Cs(s) {
|
|
|
1419
1419
|
`서명 길이가 유효하지 않습니다: ${Wt} hex 문자(65 바이트) 예상, 현재 ${e.length}`
|
|
1420
1420
|
);
|
|
1421
1421
|
}
|
|
1422
|
-
function
|
|
1422
|
+
function Cs(s) {
|
|
1423
1423
|
const e = s.startsWith("0x") ? s.slice(2) : s;
|
|
1424
1424
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
1425
1425
|
throw new f(
|
|
@@ -1466,7 +1466,7 @@ function Ls(s) {
|
|
|
1466
1466
|
const t = Number(r);
|
|
1467
1467
|
return Number.isFinite(t) ? t : void 0;
|
|
1468
1468
|
}
|
|
1469
|
-
class
|
|
1469
|
+
class Pe {
|
|
1470
1470
|
constructor(e) {
|
|
1471
1471
|
this.deps = e, this.verifyPinMutex = null;
|
|
1472
1472
|
}
|
|
@@ -1539,7 +1539,7 @@ class Oe {
|
|
|
1539
1539
|
if (u.code === h.PIN_INVALID)
|
|
1540
1540
|
return { ok: !1, error: u.message };
|
|
1541
1541
|
if (u.code === h.PIN_LOCKED)
|
|
1542
|
-
return
|
|
1542
|
+
return Pe.buildPinLockedResult(u, a);
|
|
1543
1543
|
}
|
|
1544
1544
|
throw u;
|
|
1545
1545
|
}
|
|
@@ -1573,7 +1573,7 @@ class Oe {
|
|
|
1573
1573
|
return await e();
|
|
1574
1574
|
} catch (n) {
|
|
1575
1575
|
if (n instanceof f) {
|
|
1576
|
-
if (t =
|
|
1576
|
+
if (t = Pe.parsePinError(n, r), !t) throw n;
|
|
1577
1577
|
} else
|
|
1578
1578
|
throw n;
|
|
1579
1579
|
}
|
|
@@ -1587,7 +1587,7 @@ class Oe {
|
|
|
1587
1587
|
try {
|
|
1588
1588
|
return await e();
|
|
1589
1589
|
} catch (n) {
|
|
1590
|
-
if (n instanceof f && (t =
|
|
1590
|
+
if (n instanceof f && (t = Pe.parsePinError(n, r), t))
|
|
1591
1591
|
continue;
|
|
1592
1592
|
throw n;
|
|
1593
1593
|
}
|
|
@@ -1612,7 +1612,7 @@ class Oe {
|
|
|
1612
1612
|
return null;
|
|
1613
1613
|
}
|
|
1614
1614
|
static buildPinLockedResult(e, r) {
|
|
1615
|
-
const t =
|
|
1615
|
+
const t = Pe.parsePinError(e, r);
|
|
1616
1616
|
if (!t) return { ok: !1, error: e.message };
|
|
1617
1617
|
const { errorMessage: n, ...i } = t;
|
|
1618
1618
|
return { ok: !1, error: n, ...i };
|
|
@@ -1831,12 +1831,12 @@ class Fs {
|
|
|
1831
1831
|
const _ = g.lockExpiresAt * 1e3, x = Math.max(
|
|
1832
1832
|
1,
|
|
1833
1833
|
Math.round((_ - Date.now()) / 1e3)
|
|
1834
|
-
),
|
|
1834
|
+
), y = x <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
|
|
1835
1835
|
d.warn(
|
|
1836
|
-
`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${x}초, 메시지: ${
|
|
1836
|
+
`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${x}초, 메시지: ${y}`
|
|
1837
1837
|
), await this.deps.confirmation.showRecoveryPinLockedPrompt(
|
|
1838
1838
|
x,
|
|
1839
|
-
|
|
1839
|
+
y
|
|
1840
1840
|
), i = 0, n = "Your account lock has been lifted. You may try again.";
|
|
1841
1841
|
} else
|
|
1842
1842
|
d.warn(
|
|
@@ -1873,12 +1873,12 @@ class Fs {
|
|
|
1873
1873
|
const _ = ((g == null ? void 0 : g.lockExpiresAt) ?? 0) * 1e3, x = Math.max(
|
|
1874
1874
|
1,
|
|
1875
1875
|
Math.round((_ - Date.now()) / 1e3)
|
|
1876
|
-
),
|
|
1876
|
+
), y = x <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
|
|
1877
1877
|
d.warn(
|
|
1878
1878
|
`[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${x}초`
|
|
1879
1879
|
), await this.deps.confirmation.showRecoveryPinLockedPrompt(
|
|
1880
1880
|
x,
|
|
1881
|
-
|
|
1881
|
+
y
|
|
1882
1882
|
), i = 0, n = "Your account lock has been lifted. You may try again.";
|
|
1883
1883
|
} else
|
|
1884
1884
|
throw d.error(
|
|
@@ -1916,19 +1916,19 @@ class Fs {
|
|
|
1916
1916
|
"[CROSSx][Migration Phase 5] 재로그인 성공 — 마이그레이션 재시도 (검증된 PIN 유지)"
|
|
1917
1917
|
);
|
|
1918
1918
|
try {
|
|
1919
|
-
const
|
|
1919
|
+
const y = await this.deps.executeMigrate(
|
|
1920
1920
|
a,
|
|
1921
1921
|
e
|
|
1922
1922
|
);
|
|
1923
1923
|
return d.log(
|
|
1924
1924
|
"[CROSSx][Migration Phase 5] 마이그레이션 재시도 성공 — address:",
|
|
1925
|
-
|
|
1926
|
-
),
|
|
1927
|
-
} catch (
|
|
1925
|
+
y.address
|
|
1926
|
+
), y;
|
|
1927
|
+
} catch (y) {
|
|
1928
1928
|
throw d.error(
|
|
1929
1929
|
"[CROSSx][Migration Phase 5] 마이그레이션 재시도 실패:",
|
|
1930
|
-
|
|
1931
|
-
),
|
|
1930
|
+
y
|
|
1931
|
+
), y;
|
|
1932
1932
|
}
|
|
1933
1933
|
}
|
|
1934
1934
|
throw this.deps.clearAuthState(), u;
|
|
@@ -2296,14 +2296,14 @@ class zs {
|
|
|
2296
2296
|
throw new f(n.code, n.message);
|
|
2297
2297
|
}
|
|
2298
2298
|
}
|
|
2299
|
-
function
|
|
2299
|
+
function ot(s, e = "Apple account") {
|
|
2300
2300
|
if (s.endsWith("@privaterelay.appleid.com")) return e;
|
|
2301
2301
|
const r = s.indexOf("@");
|
|
2302
2302
|
if (r < 0) return "*".repeat(s.length || 3);
|
|
2303
2303
|
const t = s.substring(0, r), n = s.substring(r);
|
|
2304
2304
|
return t.length <= 1 ? `${t}${"*".repeat(Math.max(t.length, 1))}${n}` : `${t[0]}${"*".repeat(t.length - 1)}${n}`;
|
|
2305
2305
|
}
|
|
2306
|
-
const
|
|
2306
|
+
const ke = class ke extends ys {
|
|
2307
2307
|
constructor(e, r, t, n, i, o, a, c, l, u, p) {
|
|
2308
2308
|
var g, _;
|
|
2309
2309
|
super(), this.storage = t, this.crypto = n, this.transport = i, this.oauth = o, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._rnBridgeService = null, this._providers = /* @__PURE__ */ new Map(), this._isAuthenticatedViaRNBridge = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = r, e.logger && $t(e.logger), this.confirmation = l, this.pinStore = p ?? new _r(), this.stateManager = new Gs({
|
|
@@ -2311,24 +2311,24 @@ const Te = class Te extends ys {
|
|
|
2311
2311
|
x.authenticated !== void 0 && (this.authenticated = x.authenticated), x.userId !== void 0 && (this.userId = x.userId), x.address !== void 0 && (this.address = x.address), x.activeWalletIndex !== void 0 && (this.activeWalletIndex = x.activeWalletIndex), x.userEmail !== void 0 && (this.userEmail = x.userEmail), x.providerSub !== void 0 && (this.providerSub = x.providerSub), x.loginType !== void 0 && (this.loginType = x.loginType), x.tokenSignatureVerified !== void 0 && (this.tokenSignatureVerified = x.tokenSignatureVerified);
|
|
2312
2312
|
},
|
|
2313
2313
|
getIsRecoveringSession: () => this._isRecoveringSession,
|
|
2314
|
-
emitAddressChanged: ({ address: x, index:
|
|
2315
|
-
const
|
|
2316
|
-
|
|
2314
|
+
emitAddressChanged: ({ address: x, index: y, walletName: v }) => {
|
|
2315
|
+
const A = { address: x, index: y };
|
|
2316
|
+
v !== void 0 && (A.walletName = v), this.emit("addressChanged", A);
|
|
2317
2317
|
},
|
|
2318
|
-
emitAuthChanged: ({ isAuthenticated: x, address:
|
|
2319
|
-
this.emit("authChanged", { isAuthenticated: x, address:
|
|
2318
|
+
emitAuthChanged: ({ isAuthenticated: x, address: y, userId: v }) => {
|
|
2319
|
+
this.emit("authChanged", { isAuthenticated: x, address: y, userId: v });
|
|
2320
2320
|
},
|
|
2321
2321
|
shouldPersistWalletPreference: () => this._config.persistWalletPreference !== !1,
|
|
2322
|
-
walletPreferenceKey:
|
|
2322
|
+
walletPreferenceKey: ke.WALLET_PREF_KEY,
|
|
2323
2323
|
storage: this.storage,
|
|
2324
2324
|
pinStore: this.pinStore
|
|
2325
|
-
}), this.pinOrchestrator = new
|
|
2325
|
+
}), this.pinOrchestrator = new Pe({
|
|
2326
2326
|
confirmation: this.confirmation,
|
|
2327
2327
|
walletProvider: this.walletProvider,
|
|
2328
2328
|
pinStore: this.pinStore,
|
|
2329
2329
|
getLocale: () => this._config.locale,
|
|
2330
2330
|
getUserEmail: () => this.userEmail,
|
|
2331
|
-
maskEmail:
|
|
2331
|
+
maskEmail: ot,
|
|
2332
2332
|
signInAgain: () => this.signInAgain()
|
|
2333
2333
|
}), this.signingOrchestrator = new Ds({
|
|
2334
2334
|
confirmation: this.confirmation,
|
|
@@ -2341,15 +2341,15 @@ const Te = class Te extends ys {
|
|
|
2341
2341
|
walletProvider: this.walletProvider,
|
|
2342
2342
|
pinOrchestrator: this.pinOrchestrator,
|
|
2343
2343
|
getUserId: () => this.userId,
|
|
2344
|
-
setActiveWallet: (x,
|
|
2344
|
+
setActiveWallet: (x, y, v) => this.setActiveWallet(x, y, v)
|
|
2345
2345
|
}), this.migrationOrchestrator = new Fs({
|
|
2346
2346
|
confirmation: this.confirmation,
|
|
2347
2347
|
walletProvider: this.walletProvider,
|
|
2348
2348
|
pinOrchestrator: this.pinOrchestrator,
|
|
2349
|
-
executeMigrate: (x,
|
|
2349
|
+
executeMigrate: (x, y) => this.migrateWalletUseCase.execute(x, y),
|
|
2350
2350
|
getLocale: () => this._config.locale,
|
|
2351
2351
|
getUserEmail: () => this.userEmail,
|
|
2352
|
-
maskEmail:
|
|
2352
|
+
maskEmail: ot,
|
|
2353
2353
|
signInAgain: () => this.signInAgain(),
|
|
2354
2354
|
clearAuthState: () => this.clearAuthState(),
|
|
2355
2355
|
getAllowSkip: () => {
|
|
@@ -2358,9 +2358,9 @@ const Te = class Te extends ys {
|
|
|
2358
2358
|
}
|
|
2359
2359
|
}), this.transactionLifecycleService = new Us({
|
|
2360
2360
|
getActiveAddress: () => this.address,
|
|
2361
|
-
estimateGas: (x,
|
|
2361
|
+
estimateGas: (x, y) => this.estimateGas(x, y),
|
|
2362
2362
|
getBaseFeePerGas: (x) => this.getBaseFeePerGas(x),
|
|
2363
|
-
jsonRpcCall: (x,
|
|
2363
|
+
jsonRpcCall: (x, y, v) => this.jsonRpc.call(x, y, v)
|
|
2364
2364
|
}), this.signatureVerifier = new Hs(this.crypto), this.addressResolverService = new qs({
|
|
2365
2365
|
walletProvider: this.walletProvider,
|
|
2366
2366
|
pinOrchestrator: this.pinOrchestrator,
|
|
@@ -2377,7 +2377,7 @@ const Te = class Te extends ys {
|
|
|
2377
2377
|
walletLifecycleService: this.walletLifecycleService,
|
|
2378
2378
|
getUserId: () => this.userId,
|
|
2379
2379
|
getProviderSub: () => this.providerSub,
|
|
2380
|
-
setActiveWallet: (x,
|
|
2380
|
+
setActiveWallet: (x, y) => this.setActiveWallet(x, y)
|
|
2381
2381
|
}), this.tokenHistoryService = new zs({
|
|
2382
2382
|
transport: i,
|
|
2383
2383
|
getApiBaseUrl: () => this.internalConfig.authApiUrl
|
|
@@ -2403,8 +2403,8 @@ const Te = class Te extends ys {
|
|
|
2403
2403
|
applyAuthResult: (x) => this.applyAuthResult(x),
|
|
2404
2404
|
loadWalletAfterAuth: () => this.walletLifecycleService.loadWalletAfterAuth(),
|
|
2405
2405
|
getLocale: () => this._config.locale,
|
|
2406
|
-
maskEmail:
|
|
2407
|
-
}), this.chainRegistry = u, this.jsonRpc = new ms(u, i), this.signInUseCase = new
|
|
2406
|
+
maskEmail: ot
|
|
2407
|
+
}), this.chainRegistry = u, this.jsonRpc = new ms(u, i), this.signInUseCase = new gt(
|
|
2408
2408
|
this.internalConfig,
|
|
2409
2409
|
t,
|
|
2410
2410
|
n,
|
|
@@ -2452,7 +2452,7 @@ const Te = class Te extends ys {
|
|
|
2452
2452
|
const n = fr();
|
|
2453
2453
|
this.internalConfig.oauthServiceUrl = n.oauthServiceUrl, this.internalConfig.authApiUrl = n.authApiUrl, this.internalConfig.walletGatewayUrl = n.walletGatewayUrl, this.adapterConfig.gatewayUrl = n.walletGatewayUrl, (t = (r = this.crypto).setJWKSEndpoint) == null || t.call(r, `${n.authApiUrl}/.well-known/jwks.json`);
|
|
2454
2454
|
const i = this._config.persistWalletPreference !== !1 ? await this.storage.get(
|
|
2455
|
-
|
|
2455
|
+
ke.WALLET_PREF_KEY
|
|
2456
2456
|
).catch(() => null) : null, o = (e == null ? void 0 : e.preferredWalletIndex) ?? (i == null ? void 0 : i.index);
|
|
2457
2457
|
let a = (e == null ? void 0 : e.preferredWalletAddress) ?? (i == null ? void 0 : i.address), c = await this.tryRNBridgeBootstrap();
|
|
2458
2458
|
if (this._rnBridgeWalletAddress && ((a == null ? void 0 : a.toLowerCase()) !== this._rnBridgeWalletAddress.toLowerCase() && d.log("[CROSSx] RN Bridge active wallet으로 preferredWalletAddress 갱신:", this._rnBridgeWalletAddress), a = this._rnBridgeWalletAddress), c || (c = await this.signInUseCase.restoreSession()), c != null && c.success) {
|
|
@@ -3174,7 +3174,7 @@ const Te = class Te extends ys {
|
|
|
3174
3174
|
n.address
|
|
3175
3175
|
)
|
|
3176
3176
|
});
|
|
3177
|
-
return
|
|
3177
|
+
return Os(i.signature), {
|
|
3178
3178
|
chainId: e,
|
|
3179
3179
|
signature: i.signature,
|
|
3180
3180
|
address: n.address
|
|
@@ -3203,7 +3203,7 @@ const Te = class Te extends ys {
|
|
|
3203
3203
|
* });
|
|
3204
3204
|
*/
|
|
3205
3205
|
async signTypedDataOffchain(e, r) {
|
|
3206
|
-
return this.signTypedData(
|
|
3206
|
+
return this.signTypedData(ke.OFFCHAIN_CHAIN_ID, e, r);
|
|
3207
3207
|
}
|
|
3208
3208
|
// ============================================================================
|
|
3209
3209
|
// 트랜잭션
|
|
@@ -3222,7 +3222,7 @@ const Te = class Te extends ys {
|
|
|
3222
3222
|
throw new f(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
3223
3223
|
const n = await this.transactionLifecycleService.withResolvedGasAndFee(r, e);
|
|
3224
3224
|
n.from || (n.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
|
|
3225
|
-
const i =
|
|
3225
|
+
const i = it(e);
|
|
3226
3226
|
try {
|
|
3227
3227
|
const o = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
|
|
3228
3228
|
confirmation: {
|
|
@@ -3252,7 +3252,7 @@ const Te = class Te extends ys {
|
|
|
3252
3252
|
a
|
|
3253
3253
|
)
|
|
3254
3254
|
});
|
|
3255
|
-
return
|
|
3255
|
+
return Cs(o.signature), {
|
|
3256
3256
|
chainId: e,
|
|
3257
3257
|
signedTx: o.signature,
|
|
3258
3258
|
txHash: o.txHash ?? ""
|
|
@@ -3281,7 +3281,7 @@ const Te = class Te extends ys {
|
|
|
3281
3281
|
throw new f(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
3282
3282
|
const n = await this.transactionLifecycleService.withResolvedGasAndFee(r, e);
|
|
3283
3283
|
n.from || (n.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
|
|
3284
|
-
const i =
|
|
3284
|
+
const i = it(e);
|
|
3285
3285
|
try {
|
|
3286
3286
|
const o = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
|
|
3287
3287
|
confirmation: {
|
|
@@ -3381,34 +3381,34 @@ const Te = class Te extends ys {
|
|
|
3381
3381
|
* logger.log(receipt.status); // '0x1' | '0x0'
|
|
3382
3382
|
*/
|
|
3383
3383
|
async sendTransactionWithWaitForReceipt(e, r, t = {}) {
|
|
3384
|
-
var
|
|
3384
|
+
var y, v;
|
|
3385
3385
|
if (this._isAuthenticatedViaRNBridge) {
|
|
3386
|
-
const
|
|
3387
|
-
if (
|
|
3388
|
-
return this.bridgeSendTransactionWithWaitForReceipt(
|
|
3386
|
+
const A = fe.getBridge();
|
|
3387
|
+
if (A != null && A.sendTransactionWithWaitForReceipt)
|
|
3388
|
+
return this.bridgeSendTransactionWithWaitForReceipt(A, e, r, t);
|
|
3389
3389
|
}
|
|
3390
|
-
const { intervalMs: n, timeoutMs: i, ...o } = t, { txHash: a } = await this.sendTransaction(e, r, o), c = n ?? ((
|
|
3390
|
+
const { intervalMs: n, timeoutMs: i, ...o } = t, { txHash: a } = await this.sendTransaction(e, r, o), c = n ?? ((y = this._config.receiptPolling) == null ? void 0 : y.intervalMs) ?? Ss, l = i ?? ((v = this._config.receiptPolling) == null ? void 0 : v.timeoutMs) ?? Ut, u = it(e), p = r.from ?? "";
|
|
3391
3391
|
let g, _;
|
|
3392
|
-
const x = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((
|
|
3393
|
-
g =
|
|
3394
|
-
const
|
|
3392
|
+
const x = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((A) => {
|
|
3393
|
+
g = A;
|
|
3394
|
+
const R = BigInt(A.gasUsed) * BigInt(A.effectiveGasPrice), k = r.value ? BigInt(r.value) : 0n, L = qe(r.value, u.symbol, u.decimals, this._config.displayDecimals), D = qe("0x" + R.toString(16), u.symbol, u.decimals, this._config.displayDecimals), z = qe("0x" + (k + R).toString(16), u.symbol, u.decimals, this._config.displayDecimals);
|
|
3395
3395
|
return {
|
|
3396
3396
|
chainId: e,
|
|
3397
3397
|
txHash: a,
|
|
3398
|
-
from:
|
|
3399
|
-
to:
|
|
3398
|
+
from: A.from,
|
|
3399
|
+
to: A.to ?? r.to,
|
|
3400
3400
|
amount: L,
|
|
3401
|
-
fees:
|
|
3402
|
-
total:
|
|
3401
|
+
fees: D,
|
|
3402
|
+
total: z,
|
|
3403
3403
|
nativeSymbol: u.symbol,
|
|
3404
|
-
status:
|
|
3404
|
+
status: A.status === "0x1" ? "success" : "reverted"
|
|
3405
3405
|
};
|
|
3406
|
-
}).catch((
|
|
3406
|
+
}).catch((A) => (_ = A instanceof Error ? A : new Error(String(A)), {
|
|
3407
3407
|
chainId: e,
|
|
3408
3408
|
txHash: a,
|
|
3409
3409
|
from: p,
|
|
3410
3410
|
to: r.to,
|
|
3411
|
-
amount:
|
|
3411
|
+
amount: qe(r.value, u.symbol, u.decimals, this._config.displayDecimals),
|
|
3412
3412
|
nativeSymbol: u.symbol,
|
|
3413
3413
|
status: "timeout"
|
|
3414
3414
|
}));
|
|
@@ -3891,8 +3891,8 @@ const Te = class Te extends ys {
|
|
|
3891
3891
|
};
|
|
3892
3892
|
}
|
|
3893
3893
|
};
|
|
3894
|
-
|
|
3895
|
-
let
|
|
3894
|
+
ke.WALLET_PREF_KEY = "wallet_preference", ke.OFFCHAIN_CHAIN_ID = "0";
|
|
3895
|
+
let wt = ke;
|
|
3896
3896
|
class js {
|
|
3897
3897
|
constructor() {
|
|
3898
3898
|
this.prefix = "crossx_";
|
|
@@ -3930,7 +3930,7 @@ class js {
|
|
|
3930
3930
|
}
|
|
3931
3931
|
}
|
|
3932
3932
|
}
|
|
3933
|
-
const
|
|
3933
|
+
const at = "crossx-sdk", Ys = 1, ue = "data", Ae = "keys", Ke = "aes-primary", Xs = 12;
|
|
3934
3934
|
class Vt {
|
|
3935
3935
|
constructor(e) {
|
|
3936
3936
|
this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
|
|
@@ -3943,7 +3943,7 @@ class Vt {
|
|
|
3943
3943
|
const n = indexedDB.open(e, Ys);
|
|
3944
3944
|
n.onupgradeneeded = () => {
|
|
3945
3945
|
const i = n.result;
|
|
3946
|
-
i.objectStoreNames.contains(ue) || i.createObjectStore(ue), i.objectStoreNames.contains(
|
|
3946
|
+
i.objectStoreNames.contains(ue) || i.createObjectStore(ue), i.objectStoreNames.contains(Ae) || i.createObjectStore(Ae);
|
|
3947
3947
|
}, n.onsuccess = () => r(n.result), n.onerror = () => t(n.error);
|
|
3948
3948
|
});
|
|
3949
3949
|
}
|
|
@@ -3973,7 +3973,7 @@ class Vt {
|
|
|
3973
3973
|
}
|
|
3974
3974
|
async init() {
|
|
3975
3975
|
this.db = await this.openDB();
|
|
3976
|
-
const e = await this.idbGet(
|
|
3976
|
+
const e = await this.idbGet(Ae, Ke);
|
|
3977
3977
|
if (e) {
|
|
3978
3978
|
this.cryptoKey = e;
|
|
3979
3979
|
return;
|
|
@@ -3987,16 +3987,16 @@ class Vt {
|
|
|
3987
3987
|
{ name: "AES-GCM", length: 256 },
|
|
3988
3988
|
!1,
|
|
3989
3989
|
["encrypt", "decrypt"]
|
|
3990
|
-
), await this.idbPut(
|
|
3990
|
+
), await this.idbPut(Ae, Ke, this.cryptoKey);
|
|
3991
3991
|
}
|
|
3992
3992
|
/**
|
|
3993
3993
|
* 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
|
|
3994
3994
|
* 마이그레이션 성공 시 레거시 DB 삭제.
|
|
3995
3995
|
*/
|
|
3996
3996
|
async migrateFromLegacyDB() {
|
|
3997
|
-
if (this.dbName ===
|
|
3997
|
+
if (this.dbName === at) return null;
|
|
3998
3998
|
try {
|
|
3999
|
-
const e = await this.openDB(
|
|
3999
|
+
const e = await this.openDB(at), r = e.transaction([Ae, ue], "readonly"), t = r.objectStore(Ae).get(Ke), n = await new Promise((l, u) => {
|
|
4000
4000
|
t.onsuccess = () => l(t.result), t.onerror = () => u(t.error);
|
|
4001
4001
|
});
|
|
4002
4002
|
if (!n)
|
|
@@ -4009,10 +4009,10 @@ class Vt {
|
|
|
4009
4009
|
o.onsuccess = () => l(o.result), o.onerror = () => u(o.error);
|
|
4010
4010
|
})
|
|
4011
4011
|
]);
|
|
4012
|
-
e.close(), await this.idbPut(
|
|
4012
|
+
e.close(), await this.idbPut(Ae, Ke, n);
|
|
4013
4013
|
for (let l = 0; l < c.length; l++)
|
|
4014
4014
|
await this.idbPut(ue, String(c[l]), a[l]);
|
|
4015
|
-
return indexedDB.deleteDatabase(
|
|
4015
|
+
return indexedDB.deleteDatabase(at), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
|
|
4016
4016
|
} catch (e) {
|
|
4017
4017
|
return d.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
|
|
4018
4018
|
}
|
|
@@ -4077,7 +4077,7 @@ class Vt {
|
|
|
4077
4077
|
}
|
|
4078
4078
|
}
|
|
4079
4079
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4080
|
-
function
|
|
4080
|
+
function It(s) {
|
|
4081
4081
|
return s instanceof Uint8Array || ArrayBuffer.isView(s) && s.constructor.name === "Uint8Array";
|
|
4082
4082
|
}
|
|
4083
4083
|
function me(s, e = "") {
|
|
@@ -4086,8 +4086,8 @@ function me(s, e = "") {
|
|
|
4086
4086
|
throw new Error(`${r}expected integer >= 0, got ${s}`);
|
|
4087
4087
|
}
|
|
4088
4088
|
}
|
|
4089
|
-
function
|
|
4090
|
-
const t =
|
|
4089
|
+
function X(s, e, r = "") {
|
|
4090
|
+
const t = It(s), n = s == null ? void 0 : s.length, i = e !== void 0;
|
|
4091
4091
|
if (!t || i && n !== e) {
|
|
4092
4092
|
const o = r && `"${r}" `, a = i ? ` of length ${e}` : "", c = t ? `length=${n}` : `type=${typeof s}`;
|
|
4093
4093
|
throw new Error(o + "expected Uint8Array" + a + ", got " + c);
|
|
@@ -4099,14 +4099,14 @@ function xr(s) {
|
|
|
4099
4099
|
throw new Error("Hash must wrapped by utils.createHasher");
|
|
4100
4100
|
me(s.outputLen), me(s.blockLen);
|
|
4101
4101
|
}
|
|
4102
|
-
function
|
|
4102
|
+
function $e(s, e = !0) {
|
|
4103
4103
|
if (s.destroyed)
|
|
4104
4104
|
throw new Error("Hash instance has been destroyed");
|
|
4105
4105
|
if (e && s.finished)
|
|
4106
4106
|
throw new Error("Hash#digest() has already been called");
|
|
4107
4107
|
}
|
|
4108
4108
|
function wr(s, e) {
|
|
4109
|
-
|
|
4109
|
+
X(s, void 0, "digestInto() output");
|
|
4110
4110
|
const r = e.outputLen;
|
|
4111
4111
|
if (s.length < r)
|
|
4112
4112
|
throw new Error('"digestInto() output" expected to be of length >=' + r);
|
|
@@ -4114,11 +4114,11 @@ function wr(s, e) {
|
|
|
4114
4114
|
function Js(s) {
|
|
4115
4115
|
return new Uint32Array(s.buffer, s.byteOffset, Math.floor(s.byteLength / 4));
|
|
4116
4116
|
}
|
|
4117
|
-
function
|
|
4117
|
+
function Be(...s) {
|
|
4118
4118
|
for (let e = 0; e < s.length; e++)
|
|
4119
4119
|
s[e].fill(0);
|
|
4120
4120
|
}
|
|
4121
|
-
function
|
|
4121
|
+
function ct(s) {
|
|
4122
4122
|
return new DataView(s.buffer, s.byteOffset, s.byteLength);
|
|
4123
4123
|
}
|
|
4124
4124
|
function he(s, e) {
|
|
@@ -4134,8 +4134,8 @@ function en(s) {
|
|
|
4134
4134
|
return s;
|
|
4135
4135
|
}
|
|
4136
4136
|
const zt = Zs ? (s) => s : en, mr = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", tn = /* @__PURE__ */ Array.from({ length: 256 }, (s, e) => e.toString(16).padStart(2, "0"));
|
|
4137
|
-
function
|
|
4138
|
-
if (
|
|
4137
|
+
function Ge(s) {
|
|
4138
|
+
if (X(s), mr)
|
|
4139
4139
|
return s.toHex();
|
|
4140
4140
|
let e = "";
|
|
4141
4141
|
for (let r = 0; r < s.length; r++)
|
|
@@ -4151,7 +4151,7 @@ function jt(s) {
|
|
|
4151
4151
|
if (s >= pe.a && s <= pe.f)
|
|
4152
4152
|
return s - (pe.a - 10);
|
|
4153
4153
|
}
|
|
4154
|
-
function
|
|
4154
|
+
function Xe(s) {
|
|
4155
4155
|
if (typeof s != "string")
|
|
4156
4156
|
throw new Error("hex string expected, got " + typeof s);
|
|
4157
4157
|
if (mr)
|
|
@@ -4174,7 +4174,7 @@ function Se(...s) {
|
|
|
4174
4174
|
let e = 0;
|
|
4175
4175
|
for (let t = 0; t < s.length; t++) {
|
|
4176
4176
|
const n = s[t];
|
|
4177
|
-
|
|
4177
|
+
X(n), e += n.length;
|
|
4178
4178
|
}
|
|
4179
4179
|
const r = new Uint8Array(e);
|
|
4180
4180
|
for (let t = 0, n = 0; t < s.length; t++) {
|
|
@@ -4215,15 +4215,15 @@ class on {
|
|
|
4215
4215
|
P(this, "length", 0);
|
|
4216
4216
|
P(this, "pos", 0);
|
|
4217
4217
|
P(this, "destroyed", !1);
|
|
4218
|
-
this.blockLen = e, this.outputLen = r, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view =
|
|
4218
|
+
this.blockLen = e, this.outputLen = r, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = ct(this.buffer);
|
|
4219
4219
|
}
|
|
4220
4220
|
update(e) {
|
|
4221
|
-
|
|
4221
|
+
$e(this), X(e);
|
|
4222
4222
|
const { view: r, buffer: t, blockLen: n } = this, i = e.length;
|
|
4223
4223
|
for (let o = 0; o < i; ) {
|
|
4224
4224
|
const a = Math.min(n - this.pos, i - o);
|
|
4225
4225
|
if (a === n) {
|
|
4226
|
-
const c =
|
|
4226
|
+
const c = ct(e);
|
|
4227
4227
|
for (; n <= i - o; o += n)
|
|
4228
4228
|
this.process(c, o);
|
|
4229
4229
|
continue;
|
|
@@ -4233,14 +4233,14 @@ class on {
|
|
|
4233
4233
|
return this.length += e.length, this.roundClean(), this;
|
|
4234
4234
|
}
|
|
4235
4235
|
digestInto(e) {
|
|
4236
|
-
|
|
4236
|
+
$e(this), wr(e, this), this.finished = !0;
|
|
4237
4237
|
const { buffer: r, view: t, blockLen: n, isLE: i } = this;
|
|
4238
4238
|
let { pos: o } = this;
|
|
4239
|
-
r[o++] = 128,
|
|
4239
|
+
r[o++] = 128, Be(this.buffer.subarray(o)), this.padOffset > n - o && (this.process(t, 0), o = 0);
|
|
4240
4240
|
for (let p = o; p < n; p++)
|
|
4241
4241
|
r[p] = 0;
|
|
4242
4242
|
t.setBigUint64(n - 8, BigInt(this.length * 8), i), this.process(t, 0);
|
|
4243
|
-
const a =
|
|
4243
|
+
const a = ct(e), c = this.outputLen;
|
|
4244
4244
|
if (c % 4)
|
|
4245
4245
|
throw new Error("_sha2: outputLen must be aligned to 32bit");
|
|
4246
4246
|
const l = c / 4, u = this.get();
|
|
@@ -4273,9 +4273,9 @@ const ye = /* @__PURE__ */ Uint32Array.from([
|
|
|
4273
4273
|
2600822924,
|
|
4274
4274
|
528734635,
|
|
4275
4275
|
1541459225
|
|
4276
|
-
]),
|
|
4276
|
+
]), Ve = /* @__PURE__ */ BigInt(2 ** 32 - 1), Yt = /* @__PURE__ */ BigInt(32);
|
|
4277
4277
|
function an(s, e = !1) {
|
|
4278
|
-
return e ? { h: Number(s &
|
|
4278
|
+
return e ? { h: Number(s & Ve), l: Number(s >> Yt & Ve) } : { h: Number(s >> Yt & Ve) | 0, l: Number(s & Ve) | 0 };
|
|
4279
4279
|
}
|
|
4280
4280
|
function cn(s, e = !1) {
|
|
4281
4281
|
const r = s.length;
|
|
@@ -4368,21 +4368,21 @@ class _n extends on {
|
|
|
4368
4368
|
for (let p = 0; p < 16; p++, r += 4)
|
|
4369
4369
|
be[p] = e.getUint32(r, !1);
|
|
4370
4370
|
for (let p = 16; p < 64; p++) {
|
|
4371
|
-
const g = be[p - 15], _ = be[p - 2], x = he(g, 7) ^ he(g, 18) ^ g >>> 3,
|
|
4372
|
-
be[p] =
|
|
4371
|
+
const g = be[p - 15], _ = be[p - 2], x = he(g, 7) ^ he(g, 18) ^ g >>> 3, y = he(_, 17) ^ he(_, 19) ^ _ >>> 10;
|
|
4372
|
+
be[p] = y + be[p - 7] + x + be[p - 16] | 0;
|
|
4373
4373
|
}
|
|
4374
4374
|
let { A: t, B: n, C: i, D: o, E: a, F: c, G: l, H: u } = this;
|
|
4375
4375
|
for (let p = 0; p < 64; p++) {
|
|
4376
|
-
const g = he(a, 6) ^ he(a, 11) ^ he(a, 25), _ = u + g + sn(a, c, l) + pn[p] + be[p] | 0,
|
|
4377
|
-
u = l, l = c, c = a, a = o + _ | 0, o = i, i = n, n = t, t = _ +
|
|
4376
|
+
const g = he(a, 6) ^ he(a, 11) ^ he(a, 25), _ = u + g + sn(a, c, l) + pn[p] + be[p] | 0, y = (he(t, 2) ^ he(t, 13) ^ he(t, 22)) + nn(t, n, i) | 0;
|
|
4377
|
+
u = l, l = c, c = a, a = o + _ | 0, o = i, i = n, n = t, t = _ + y | 0;
|
|
4378
4378
|
}
|
|
4379
4379
|
t = t + this.A | 0, n = n + this.B | 0, i = i + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, u = u + this.H | 0, this.set(t, n, i, o, a, c, l, u);
|
|
4380
4380
|
}
|
|
4381
4381
|
roundClean() {
|
|
4382
|
-
|
|
4382
|
+
Be(be);
|
|
4383
4383
|
}
|
|
4384
4384
|
destroy() {
|
|
4385
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0),
|
|
4385
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0), Be(this.buffer);
|
|
4386
4386
|
}
|
|
4387
4387
|
}
|
|
4388
4388
|
class fn extends _n {
|
|
@@ -4405,8 +4405,8 @@ const gn = /* @__PURE__ */ yr(
|
|
|
4405
4405
|
/* @__PURE__ */ rn(1)
|
|
4406
4406
|
);
|
|
4407
4407
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4408
|
-
const
|
|
4409
|
-
function
|
|
4408
|
+
const Tt = /* @__PURE__ */ BigInt(0), mt = /* @__PURE__ */ BigInt(1);
|
|
4409
|
+
function Je(s, e = "") {
|
|
4410
4410
|
if (typeof s != "boolean") {
|
|
4411
4411
|
const r = e && `"${e}" `;
|
|
4412
4412
|
throw new Error(r + "expected boolean, got type=" + typeof s);
|
|
@@ -4415,43 +4415,43 @@ function Xe(s, e = "") {
|
|
|
4415
4415
|
}
|
|
4416
4416
|
function vr(s) {
|
|
4417
4417
|
if (typeof s == "bigint") {
|
|
4418
|
-
if (!
|
|
4418
|
+
if (!Ye(s))
|
|
4419
4419
|
throw new Error("positive bigint expected, got " + s);
|
|
4420
4420
|
} else
|
|
4421
4421
|
me(s);
|
|
4422
4422
|
return s;
|
|
4423
4423
|
}
|
|
4424
|
-
function
|
|
4424
|
+
function ze(s) {
|
|
4425
4425
|
const e = vr(s).toString(16);
|
|
4426
4426
|
return e.length & 1 ? "0" + e : e;
|
|
4427
4427
|
}
|
|
4428
4428
|
function Sr(s) {
|
|
4429
4429
|
if (typeof s != "string")
|
|
4430
4430
|
throw new Error("hex string expected, got " + typeof s);
|
|
4431
|
-
return s === "" ?
|
|
4431
|
+
return s === "" ? Tt : BigInt("0x" + s);
|
|
4432
4432
|
}
|
|
4433
|
-
function
|
|
4434
|
-
return Sr(
|
|
4433
|
+
function rt(s) {
|
|
4434
|
+
return Sr(Ge(s));
|
|
4435
4435
|
}
|
|
4436
4436
|
function Er(s) {
|
|
4437
|
-
return Sr(
|
|
4437
|
+
return Sr(Ge(xn(X(s)).reverse()));
|
|
4438
4438
|
}
|
|
4439
|
-
function
|
|
4439
|
+
function kt(s, e) {
|
|
4440
4440
|
me(e), s = vr(s);
|
|
4441
|
-
const r =
|
|
4441
|
+
const r = Xe(s.toString(16).padStart(e * 2, "0"));
|
|
4442
4442
|
if (r.length !== e)
|
|
4443
4443
|
throw new Error("number too large");
|
|
4444
4444
|
return r;
|
|
4445
4445
|
}
|
|
4446
4446
|
function Ar(s, e) {
|
|
4447
|
-
return
|
|
4447
|
+
return kt(s, e).reverse();
|
|
4448
4448
|
}
|
|
4449
4449
|
function xn(s) {
|
|
4450
4450
|
return Uint8Array.from(s);
|
|
4451
4451
|
}
|
|
4452
|
-
const
|
|
4452
|
+
const Ye = (s) => typeof s == "bigint" && Tt <= s;
|
|
4453
4453
|
function wn(s, e, r) {
|
|
4454
|
-
return
|
|
4454
|
+
return Ye(s) && Ye(e) && Ye(r) && e <= s && s < r;
|
|
4455
4455
|
}
|
|
4456
4456
|
function mn(s, e, r, t) {
|
|
4457
4457
|
if (!wn(e, r, t))
|
|
@@ -4459,41 +4459,41 @@ function mn(s, e, r, t) {
|
|
|
4459
4459
|
}
|
|
4460
4460
|
function yn(s) {
|
|
4461
4461
|
let e;
|
|
4462
|
-
for (e = 0; s >
|
|
4462
|
+
for (e = 0; s > Tt; s >>= mt, e += 1)
|
|
4463
4463
|
;
|
|
4464
4464
|
return e;
|
|
4465
4465
|
}
|
|
4466
|
-
const
|
|
4466
|
+
const Rt = (s) => (mt << BigInt(s)) - mt;
|
|
4467
4467
|
function bn(s, e, r) {
|
|
4468
4468
|
if (me(s, "hashLen"), me(e, "qByteLen"), typeof r != "function")
|
|
4469
4469
|
throw new Error("hmacFn must be a function");
|
|
4470
|
-
const t = (
|
|
4470
|
+
const t = (v) => new Uint8Array(v), n = Uint8Array.of(), i = Uint8Array.of(0), o = Uint8Array.of(1), a = 1e3;
|
|
4471
4471
|
let c = t(s), l = t(s), u = 0;
|
|
4472
4472
|
const p = () => {
|
|
4473
4473
|
c.fill(1), l.fill(0), u = 0;
|
|
4474
|
-
}, g = (...
|
|
4475
|
-
l = g(i,
|
|
4474
|
+
}, g = (...v) => r(l, Se(c, ...v)), _ = (v = n) => {
|
|
4475
|
+
l = g(i, v), c = g(), v.length !== 0 && (l = g(o, v), c = g());
|
|
4476
4476
|
}, x = () => {
|
|
4477
4477
|
if (u++ >= a)
|
|
4478
4478
|
throw new Error("drbg: tried max amount of iterations");
|
|
4479
|
-
let
|
|
4480
|
-
const
|
|
4481
|
-
for (;
|
|
4479
|
+
let v = 0;
|
|
4480
|
+
const A = [];
|
|
4481
|
+
for (; v < e; ) {
|
|
4482
4482
|
c = g();
|
|
4483
|
-
const
|
|
4484
|
-
|
|
4483
|
+
const R = c.slice();
|
|
4484
|
+
A.push(R), v += c.length;
|
|
4485
4485
|
}
|
|
4486
|
-
return Se(...
|
|
4486
|
+
return Se(...A);
|
|
4487
4487
|
};
|
|
4488
|
-
return (
|
|
4489
|
-
p(), _(
|
|
4490
|
-
let
|
|
4491
|
-
for (; !(
|
|
4488
|
+
return (v, A) => {
|
|
4489
|
+
p(), _(v);
|
|
4490
|
+
let R;
|
|
4491
|
+
for (; !(R = A(x())); )
|
|
4492
4492
|
_();
|
|
4493
|
-
return p(),
|
|
4493
|
+
return p(), R;
|
|
4494
4494
|
};
|
|
4495
4495
|
}
|
|
4496
|
-
function
|
|
4496
|
+
function Nt(s, e = {}, r = {}) {
|
|
4497
4497
|
if (!s || typeof s != "object")
|
|
4498
4498
|
throw new Error("expected valid options object");
|
|
4499
4499
|
function t(i, o, a) {
|
|
@@ -4518,68 +4518,68 @@ function Xt(s) {
|
|
|
4518
4518
|
};
|
|
4519
4519
|
}
|
|
4520
4520
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4521
|
-
const
|
|
4521
|
+
const se = /* @__PURE__ */ BigInt(0), re = /* @__PURE__ */ BigInt(1), Re = /* @__PURE__ */ BigInt(2), Ir = /* @__PURE__ */ BigInt(3), Tr = /* @__PURE__ */ BigInt(4), kr = /* @__PURE__ */ BigInt(5), vn = /* @__PURE__ */ BigInt(7), Rr = /* @__PURE__ */ BigInt(8), Sn = /* @__PURE__ */ BigInt(9), Nr = /* @__PURE__ */ BigInt(16);
|
|
4522
4522
|
function le(s, e) {
|
|
4523
4523
|
const r = s % e;
|
|
4524
|
-
return r >=
|
|
4524
|
+
return r >= se ? r : e + r;
|
|
4525
4525
|
}
|
|
4526
4526
|
function oe(s, e, r) {
|
|
4527
4527
|
let t = s;
|
|
4528
|
-
for (; e-- >
|
|
4528
|
+
for (; e-- > se; )
|
|
4529
4529
|
t *= t, t %= r;
|
|
4530
4530
|
return t;
|
|
4531
4531
|
}
|
|
4532
4532
|
function Jt(s, e) {
|
|
4533
|
-
if (s ===
|
|
4533
|
+
if (s === se)
|
|
4534
4534
|
throw new Error("invert: expected non-zero number");
|
|
4535
|
-
if (e <=
|
|
4535
|
+
if (e <= se)
|
|
4536
4536
|
throw new Error("invert: expected positive modulus, got " + e);
|
|
4537
|
-
let r = le(s, e), t = e, n =
|
|
4538
|
-
for (; r !==
|
|
4537
|
+
let r = le(s, e), t = e, n = se, i = re;
|
|
4538
|
+
for (; r !== se; ) {
|
|
4539
4539
|
const a = t / r, c = t % r, l = n - i * a;
|
|
4540
4540
|
t = r, r = c, n = i, i = l;
|
|
4541
4541
|
}
|
|
4542
|
-
if (t !==
|
|
4542
|
+
if (t !== re)
|
|
4543
4543
|
throw new Error("invert: does not exist");
|
|
4544
4544
|
return le(n, e);
|
|
4545
4545
|
}
|
|
4546
|
-
function
|
|
4546
|
+
function Ot(s, e, r) {
|
|
4547
4547
|
if (!s.eql(s.sqr(e), r))
|
|
4548
4548
|
throw new Error("Cannot find square root");
|
|
4549
4549
|
}
|
|
4550
|
-
function
|
|
4551
|
-
const r = (s.ORDER +
|
|
4552
|
-
return
|
|
4550
|
+
function Or(s, e) {
|
|
4551
|
+
const r = (s.ORDER + re) / Tr, t = s.pow(e, r);
|
|
4552
|
+
return Ot(s, t, e), t;
|
|
4553
4553
|
}
|
|
4554
4554
|
function En(s, e) {
|
|
4555
|
-
const r = (s.ORDER - kr) / Rr, t = s.mul(e,
|
|
4556
|
-
return
|
|
4555
|
+
const r = (s.ORDER - kr) / Rr, t = s.mul(e, Re), n = s.pow(t, r), i = s.mul(e, n), o = s.mul(s.mul(i, Re), n), a = s.mul(i, s.sub(o, s.ONE));
|
|
4556
|
+
return Ot(s, a, e), a;
|
|
4557
4557
|
}
|
|
4558
4558
|
function An(s) {
|
|
4559
|
-
const e =
|
|
4559
|
+
const e = st(s), r = Cr(s), t = r(e, e.neg(e.ONE)), n = r(e, t), i = r(e, e.neg(t)), o = (s + vn) / Nr;
|
|
4560
4560
|
return (a, c) => {
|
|
4561
4561
|
let l = a.pow(c, o), u = a.mul(l, t);
|
|
4562
4562
|
const p = a.mul(l, n), g = a.mul(l, i), _ = a.eql(a.sqr(u), c), x = a.eql(a.sqr(p), c);
|
|
4563
4563
|
l = a.cmov(l, u, _), u = a.cmov(g, p, x);
|
|
4564
|
-
const
|
|
4565
|
-
return
|
|
4564
|
+
const y = a.eql(a.sqr(u), c), v = a.cmov(l, u, y);
|
|
4565
|
+
return Ot(a, v, c), v;
|
|
4566
4566
|
};
|
|
4567
4567
|
}
|
|
4568
|
-
function
|
|
4568
|
+
function Cr(s) {
|
|
4569
4569
|
if (s < Ir)
|
|
4570
4570
|
throw new Error("sqrt is not defined for small field");
|
|
4571
|
-
let e = s -
|
|
4572
|
-
for (; e %
|
|
4573
|
-
e /=
|
|
4574
|
-
let t =
|
|
4575
|
-
const n =
|
|
4571
|
+
let e = s - re, r = 0;
|
|
4572
|
+
for (; e % Re === se; )
|
|
4573
|
+
e /= Re, r++;
|
|
4574
|
+
let t = Re;
|
|
4575
|
+
const n = st(s);
|
|
4576
4576
|
for (; Zt(n, t) === 1; )
|
|
4577
4577
|
if (t++ > 1e3)
|
|
4578
4578
|
throw new Error("Cannot find square root: probably non-prime P");
|
|
4579
4579
|
if (r === 1)
|
|
4580
|
-
return
|
|
4580
|
+
return Or;
|
|
4581
4581
|
let i = n.pow(t, e);
|
|
4582
|
-
const o = (e +
|
|
4582
|
+
const o = (e + re) / Re;
|
|
4583
4583
|
return function(c, l) {
|
|
4584
4584
|
if (c.is0(l))
|
|
4585
4585
|
return l;
|
|
@@ -4589,18 +4589,18 @@ function Or(s) {
|
|
|
4589
4589
|
for (; !c.eql(g, c.ONE); ) {
|
|
4590
4590
|
if (c.is0(g))
|
|
4591
4591
|
return c.ZERO;
|
|
4592
|
-
let x = 1,
|
|
4593
|
-
for (; !c.eql(
|
|
4594
|
-
if (x++,
|
|
4592
|
+
let x = 1, y = c.sqr(g);
|
|
4593
|
+
for (; !c.eql(y, c.ONE); )
|
|
4594
|
+
if (x++, y = c.sqr(y), x === u)
|
|
4595
4595
|
throw new Error("Cannot find square root");
|
|
4596
|
-
const
|
|
4597
|
-
u = x, p = c.sqr(
|
|
4596
|
+
const v = re << BigInt(u - x - 1), A = c.pow(p, v);
|
|
4597
|
+
u = x, p = c.sqr(A), g = c.mul(g, p), _ = c.mul(_, A);
|
|
4598
4598
|
}
|
|
4599
4599
|
return _;
|
|
4600
4600
|
};
|
|
4601
4601
|
}
|
|
4602
4602
|
function In(s) {
|
|
4603
|
-
return s % Tr === Ir ?
|
|
4603
|
+
return s % Tr === Ir ? Or : s % Rr === kr ? En : s % Nr === Sn ? An(s) : Cr(s);
|
|
4604
4604
|
}
|
|
4605
4605
|
const Tn = [
|
|
4606
4606
|
"create",
|
|
@@ -4627,18 +4627,18 @@ function kn(s) {
|
|
|
4627
4627
|
BYTES: "number",
|
|
4628
4628
|
BITS: "number"
|
|
4629
4629
|
}, r = Tn.reduce((t, n) => (t[n] = "function", t), e);
|
|
4630
|
-
return
|
|
4630
|
+
return Nt(s, r), s;
|
|
4631
4631
|
}
|
|
4632
4632
|
function Rn(s, e, r) {
|
|
4633
|
-
if (r <
|
|
4633
|
+
if (r < se)
|
|
4634
4634
|
throw new Error("invalid exponent, negatives unsupported");
|
|
4635
|
-
if (r ===
|
|
4635
|
+
if (r === se)
|
|
4636
4636
|
return s.ONE;
|
|
4637
|
-
if (r ===
|
|
4637
|
+
if (r === re)
|
|
4638
4638
|
return e;
|
|
4639
4639
|
let t = s.ONE, n = e;
|
|
4640
|
-
for (; r >
|
|
4641
|
-
r &
|
|
4640
|
+
for (; r > se; )
|
|
4641
|
+
r & re && (t = s.mul(t, n)), n = s.sqr(n), r >>= re;
|
|
4642
4642
|
return t;
|
|
4643
4643
|
}
|
|
4644
4644
|
function Pr(s, e, r = !1) {
|
|
@@ -4646,7 +4646,7 @@ function Pr(s, e, r = !1) {
|
|
|
4646
4646
|
return e.reduceRight((o, a, c) => s.is0(a) ? o : (t[c] = s.mul(o, t[c]), s.mul(o, a)), i), t;
|
|
4647
4647
|
}
|
|
4648
4648
|
function Zt(s, e) {
|
|
4649
|
-
const r = (s.ORDER -
|
|
4649
|
+
const r = (s.ORDER - re) / Re, t = s.pow(e, r), n = s.eql(t, s.ONE), i = s.eql(t, s.ZERO), o = s.eql(t, s.neg(s.ONE));
|
|
4650
4650
|
if (!n && !i && !o)
|
|
4651
4651
|
throw new Error("invalid Legendre symbol result");
|
|
4652
4652
|
return n ? 1 : i ? 0 : -1;
|
|
@@ -4656,20 +4656,20 @@ function Nn(s, e) {
|
|
|
4656
4656
|
const r = e !== void 0 ? e : s.toString(2).length, t = Math.ceil(r / 8);
|
|
4657
4657
|
return { nBitLength: r, nByteLength: t };
|
|
4658
4658
|
}
|
|
4659
|
-
class
|
|
4659
|
+
class On {
|
|
4660
4660
|
constructor(e, r = {}) {
|
|
4661
4661
|
P(this, "ORDER");
|
|
4662
4662
|
P(this, "BITS");
|
|
4663
4663
|
P(this, "BYTES");
|
|
4664
4664
|
P(this, "isLE");
|
|
4665
|
-
P(this, "ZERO",
|
|
4666
|
-
P(this, "ONE",
|
|
4665
|
+
P(this, "ZERO", se);
|
|
4666
|
+
P(this, "ONE", re);
|
|
4667
4667
|
P(this, "_lengths");
|
|
4668
4668
|
P(this, "_sqrt");
|
|
4669
4669
|
// cached sqrt
|
|
4670
4670
|
P(this, "_mod");
|
|
4671
4671
|
var o;
|
|
4672
|
-
if (e <=
|
|
4672
|
+
if (e <= se)
|
|
4673
4673
|
throw new Error("invalid field: expected ORDER > 0, got " + e);
|
|
4674
4674
|
let t;
|
|
4675
4675
|
this.isLE = !1, r != null && typeof r == "object" && (typeof r.BITS == "number" && (t = r.BITS), typeof r.sqrt == "function" && (this.sqrt = r.sqrt), typeof r.isLE == "boolean" && (this.isLE = r.isLE), r.allowedLengths && (this._lengths = (o = r.allowedLengths) == null ? void 0 : o.slice()), typeof r.modFromBytes == "boolean" && (this._mod = r.modFromBytes));
|
|
@@ -4684,17 +4684,17 @@ class Cn {
|
|
|
4684
4684
|
isValid(e) {
|
|
4685
4685
|
if (typeof e != "bigint")
|
|
4686
4686
|
throw new Error("invalid field element: expected bigint, got " + typeof e);
|
|
4687
|
-
return
|
|
4687
|
+
return se <= e && e < this.ORDER;
|
|
4688
4688
|
}
|
|
4689
4689
|
is0(e) {
|
|
4690
|
-
return e ===
|
|
4690
|
+
return e === se;
|
|
4691
4691
|
}
|
|
4692
4692
|
// is valid and invertible
|
|
4693
4693
|
isValidNot0(e) {
|
|
4694
4694
|
return !this.is0(e) && this.isValid(e);
|
|
4695
4695
|
}
|
|
4696
4696
|
isOdd(e) {
|
|
4697
|
-
return (e &
|
|
4697
|
+
return (e & re) === re;
|
|
4698
4698
|
}
|
|
4699
4699
|
neg(e) {
|
|
4700
4700
|
return le(-e, this.ORDER);
|
|
@@ -4740,10 +4740,10 @@ class Cn {
|
|
|
4740
4740
|
return this._sqrt || (this._sqrt = In(this.ORDER)), this._sqrt(this, e);
|
|
4741
4741
|
}
|
|
4742
4742
|
toBytes(e) {
|
|
4743
|
-
return this.isLE ? Ar(e, this.BYTES) :
|
|
4743
|
+
return this.isLE ? Ar(e, this.BYTES) : kt(e, this.BYTES);
|
|
4744
4744
|
}
|
|
4745
4745
|
fromBytes(e, r = !1) {
|
|
4746
|
-
|
|
4746
|
+
X(e);
|
|
4747
4747
|
const { _lengths: t, BYTES: n, isLE: i, ORDER: o, _mod: a } = this;
|
|
4748
4748
|
if (t) {
|
|
4749
4749
|
if (!t.includes(e.length) || e.length > n)
|
|
@@ -4753,7 +4753,7 @@ class Cn {
|
|
|
4753
4753
|
}
|
|
4754
4754
|
if (e.length !== n)
|
|
4755
4755
|
throw new Error("Field.fromBytes: expected " + n + " bytes, got " + e.length);
|
|
4756
|
-
let c = i ? Er(e) :
|
|
4756
|
+
let c = i ? Er(e) : rt(e);
|
|
4757
4757
|
if (a && (c = le(c, o)), !r && !this.isValid(c))
|
|
4758
4758
|
throw new Error("invalid field element: outside of range 0..ORDER");
|
|
4759
4759
|
return c;
|
|
@@ -4768,8 +4768,8 @@ class Cn {
|
|
|
4768
4768
|
return t ? r : e;
|
|
4769
4769
|
}
|
|
4770
4770
|
}
|
|
4771
|
-
function
|
|
4772
|
-
return new
|
|
4771
|
+
function st(s, e = {}) {
|
|
4772
|
+
return new On(s, e);
|
|
4773
4773
|
}
|
|
4774
4774
|
function Lr(s) {
|
|
4775
4775
|
if (typeof s != "bigint")
|
|
@@ -4781,17 +4781,17 @@ function Dr(s) {
|
|
|
4781
4781
|
const e = Lr(s);
|
|
4782
4782
|
return e + Math.ceil(e / 2);
|
|
4783
4783
|
}
|
|
4784
|
-
function
|
|
4785
|
-
|
|
4784
|
+
function Cn(s, e, r = !1) {
|
|
4785
|
+
X(s);
|
|
4786
4786
|
const t = s.length, n = Lr(e), i = Dr(e);
|
|
4787
4787
|
if (t < 16 || t < i || t > 1024)
|
|
4788
4788
|
throw new Error("expected " + i + "-1024 bytes of input, got " + t);
|
|
4789
|
-
const o = r ? Er(s) :
|
|
4790
|
-
return r ? Ar(a, n) :
|
|
4789
|
+
const o = r ? Er(s) : rt(s), a = le(o, e - re) + re;
|
|
4790
|
+
return r ? Ar(a, n) : kt(a, n);
|
|
4791
4791
|
}
|
|
4792
4792
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4793
|
-
const
|
|
4794
|
-
function
|
|
4793
|
+
const Me = /* @__PURE__ */ BigInt(0), Ne = /* @__PURE__ */ BigInt(1);
|
|
4794
|
+
function Ze(s, e) {
|
|
4795
4795
|
const r = e.negate();
|
|
4796
4796
|
return s ? r : e;
|
|
4797
4797
|
}
|
|
@@ -4803,24 +4803,24 @@ function $r(s, e) {
|
|
|
4803
4803
|
if (!Number.isSafeInteger(s) || s <= 0 || s > e)
|
|
4804
4804
|
throw new Error("invalid window size, expected [1.." + e + "], got W=" + s);
|
|
4805
4805
|
}
|
|
4806
|
-
function
|
|
4806
|
+
function lt(s, e) {
|
|
4807
4807
|
$r(s, e);
|
|
4808
|
-
const r = Math.ceil(e / s) + 1, t = 2 ** (s - 1), n = 2 ** s, i =
|
|
4808
|
+
const r = Math.ceil(e / s) + 1, t = 2 ** (s - 1), n = 2 ** s, i = Rt(s), o = BigInt(s);
|
|
4809
4809
|
return { windows: r, windowSize: t, mask: i, maxNumber: n, shiftBy: o };
|
|
4810
4810
|
}
|
|
4811
4811
|
function er(s, e, r) {
|
|
4812
4812
|
const { windowSize: t, mask: n, maxNumber: i, shiftBy: o } = r;
|
|
4813
4813
|
let a = Number(s & n), c = s >> o;
|
|
4814
|
-
a > t && (a -= i, c +=
|
|
4814
|
+
a > t && (a -= i, c += Ne);
|
|
4815
4815
|
const l = e * t, u = l + Math.abs(a) - 1, p = a === 0, g = a < 0, _ = e % 2 !== 0;
|
|
4816
4816
|
return { nextN: c, offset: u, isZero: p, isNeg: g, isNegF: _, offsetF: l };
|
|
4817
4817
|
}
|
|
4818
|
-
const
|
|
4819
|
-
function
|
|
4818
|
+
const dt = /* @__PURE__ */ new WeakMap(), Br = /* @__PURE__ */ new WeakMap();
|
|
4819
|
+
function ut(s) {
|
|
4820
4820
|
return Br.get(s) || 1;
|
|
4821
4821
|
}
|
|
4822
4822
|
function tr(s) {
|
|
4823
|
-
if (s !==
|
|
4823
|
+
if (s !== Me)
|
|
4824
4824
|
throw new Error("invalid wNAF");
|
|
4825
4825
|
}
|
|
4826
4826
|
class Pn {
|
|
@@ -4835,8 +4835,8 @@ class Pn {
|
|
|
4835
4835
|
// non-const time multiplication ladder
|
|
4836
4836
|
_unsafeLadder(e, r, t = this.ZERO) {
|
|
4837
4837
|
let n = e;
|
|
4838
|
-
for (; r >
|
|
4839
|
-
r &
|
|
4838
|
+
for (; r > Me; )
|
|
4839
|
+
r & Ne && (t = t.add(n)), n = n.double(), r >>= Ne;
|
|
4840
4840
|
return t;
|
|
4841
4841
|
}
|
|
4842
4842
|
/**
|
|
@@ -4852,7 +4852,7 @@ class Pn {
|
|
|
4852
4852
|
* @returns precomputed point tables flattened to a single array
|
|
4853
4853
|
*/
|
|
4854
4854
|
precomputeWindow(e, r) {
|
|
4855
|
-
const { windows: t, windowSize: n } =
|
|
4855
|
+
const { windows: t, windowSize: n } = lt(r, this.bits), i = [];
|
|
4856
4856
|
let o = e, a = o;
|
|
4857
4857
|
for (let c = 0; c < t; c++) {
|
|
4858
4858
|
a = o, i.push(a);
|
|
@@ -4872,10 +4872,10 @@ class Pn {
|
|
|
4872
4872
|
if (!this.Fn.isValid(t))
|
|
4873
4873
|
throw new Error("invalid scalar");
|
|
4874
4874
|
let n = this.ZERO, i = this.BASE;
|
|
4875
|
-
const o =
|
|
4875
|
+
const o = lt(e, this.bits);
|
|
4876
4876
|
for (let a = 0; a < o.windows; a++) {
|
|
4877
4877
|
const { nextN: c, offset: l, isZero: u, isNeg: p, isNegF: g, offsetF: _ } = er(t, a, o);
|
|
4878
|
-
t = c, u ? i = i.add(
|
|
4878
|
+
t = c, u ? i = i.add(Ze(g, r[_])) : n = n.add(Ze(p, r[l]));
|
|
4879
4879
|
}
|
|
4880
4880
|
return tr(t), { p: n, f: i };
|
|
4881
4881
|
}
|
|
@@ -4885,8 +4885,8 @@ class Pn {
|
|
|
4885
4885
|
* @returns point
|
|
4886
4886
|
*/
|
|
4887
4887
|
wNAFUnsafe(e, r, t, n = this.ZERO) {
|
|
4888
|
-
const i =
|
|
4889
|
-
for (let o = 0; o < i.windows && t !==
|
|
4888
|
+
const i = lt(e, this.bits);
|
|
4889
|
+
for (let o = 0; o < i.windows && t !== Me; o++) {
|
|
4890
4890
|
const { nextN: a, offset: c, isZero: l, isNeg: u } = er(t, o, i);
|
|
4891
4891
|
if (t = a, !l) {
|
|
4892
4892
|
const p = r[c];
|
|
@@ -4896,31 +4896,31 @@ class Pn {
|
|
|
4896
4896
|
return tr(t), n;
|
|
4897
4897
|
}
|
|
4898
4898
|
getPrecomputes(e, r, t) {
|
|
4899
|
-
let n =
|
|
4900
|
-
return n || (n = this.precomputeWindow(r, e), e !== 1 && (typeof t == "function" && (n = t(n)),
|
|
4899
|
+
let n = dt.get(r);
|
|
4900
|
+
return n || (n = this.precomputeWindow(r, e), e !== 1 && (typeof t == "function" && (n = t(n)), dt.set(r, n))), n;
|
|
4901
4901
|
}
|
|
4902
4902
|
cached(e, r, t) {
|
|
4903
|
-
const n =
|
|
4903
|
+
const n = ut(e);
|
|
4904
4904
|
return this.wNAF(n, this.getPrecomputes(n, e, t), r);
|
|
4905
4905
|
}
|
|
4906
4906
|
unsafe(e, r, t, n) {
|
|
4907
|
-
const i =
|
|
4907
|
+
const i = ut(e);
|
|
4908
4908
|
return i === 1 ? this._unsafeLadder(e, r, n) : this.wNAFUnsafe(i, this.getPrecomputes(i, e, t), r, n);
|
|
4909
4909
|
}
|
|
4910
4910
|
// We calculate precomputes for elliptic curve point multiplication
|
|
4911
4911
|
// using windowed method. This specifies window size and
|
|
4912
4912
|
// stores precomputed values. Usually only base point would be precomputed.
|
|
4913
4913
|
createCache(e, r) {
|
|
4914
|
-
$r(r, this.bits), Br.set(e, r),
|
|
4914
|
+
$r(r, this.bits), Br.set(e, r), dt.delete(e);
|
|
4915
4915
|
}
|
|
4916
4916
|
hasCache(e) {
|
|
4917
|
-
return
|
|
4917
|
+
return ut(e) !== 1;
|
|
4918
4918
|
}
|
|
4919
4919
|
}
|
|
4920
4920
|
function Ln(s, e, r, t) {
|
|
4921
4921
|
let n = e, i = s.ZERO, o = s.ZERO;
|
|
4922
|
-
for (; r >
|
|
4923
|
-
r &
|
|
4922
|
+
for (; r > Me || t > Me; )
|
|
4923
|
+
r & Ne && (i = i.add(n)), t & Ne && (o = o.add(n)), n = n.double(), r >>= Ne, t >>= Ne;
|
|
4924
4924
|
return { p1: i, p2: o };
|
|
4925
4925
|
}
|
|
4926
4926
|
function rr(s, e, r) {
|
|
@@ -4929,14 +4929,14 @@ function rr(s, e, r) {
|
|
|
4929
4929
|
throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
|
|
4930
4930
|
return kn(e), e;
|
|
4931
4931
|
} else
|
|
4932
|
-
return
|
|
4932
|
+
return st(s, { isLE: r });
|
|
4933
4933
|
}
|
|
4934
4934
|
function Dn(s, e, r = {}, t) {
|
|
4935
4935
|
if (t === void 0 && (t = s === "edwards"), !e || typeof e != "object")
|
|
4936
4936
|
throw new Error(`expected valid ${s} CURVE object`);
|
|
4937
4937
|
for (const c of ["p", "n", "h"]) {
|
|
4938
4938
|
const l = e[c];
|
|
4939
|
-
if (!(typeof l == "bigint" && l >
|
|
4939
|
+
if (!(typeof l == "bigint" && l > Me))
|
|
4940
4940
|
throw new Error(`CURVE.${c} must be positive bigint`);
|
|
4941
4941
|
}
|
|
4942
4942
|
const n = rr(e.p, r.Fp, t), i = rr(e.n, r.Fn, t), a = ["Gx", "Gy", "a", "b"];
|
|
@@ -4959,7 +4959,7 @@ class Mr {
|
|
|
4959
4959
|
P(this, "outputLen");
|
|
4960
4960
|
P(this, "finished", !1);
|
|
4961
4961
|
P(this, "destroyed", !1);
|
|
4962
|
-
if (xr(e),
|
|
4962
|
+
if (xr(e), X(r, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
|
|
4963
4963
|
throw new Error("Expected instance of class which extends utils.Hash");
|
|
4964
4964
|
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
4965
4965
|
const t = this.blockLen, n = new Uint8Array(t);
|
|
@@ -4969,13 +4969,13 @@ class Mr {
|
|
|
4969
4969
|
this.iHash.update(n), this.oHash = e.create();
|
|
4970
4970
|
for (let i = 0; i < n.length; i++)
|
|
4971
4971
|
n[i] ^= 106;
|
|
4972
|
-
this.oHash.update(n),
|
|
4972
|
+
this.oHash.update(n), Be(n);
|
|
4973
4973
|
}
|
|
4974
4974
|
update(e) {
|
|
4975
|
-
return
|
|
4975
|
+
return $e(this), this.iHash.update(e), this;
|
|
4976
4976
|
}
|
|
4977
4977
|
digestInto(e) {
|
|
4978
|
-
|
|
4978
|
+
$e(this), X(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
|
|
4979
4979
|
}
|
|
4980
4980
|
digest() {
|
|
4981
4981
|
const e = new Uint8Array(this.oHash.outputLen);
|
|
@@ -5002,21 +5002,21 @@ function Bn(s, e, r) {
|
|
|
5002
5002
|
let l = s - a * t - c * i, u = -a * n - c * o;
|
|
5003
5003
|
const p = l < ge, g = u < ge;
|
|
5004
5004
|
p && (l = -l), g && (u = -u);
|
|
5005
|
-
const _ =
|
|
5005
|
+
const _ = Rt(Math.ceil(yn(r) / 2)) + De;
|
|
5006
5006
|
if (l < ge || l >= _ || u < ge || u >= _)
|
|
5007
5007
|
throw new Error("splitScalar (endomorphism): failed, k=" + s);
|
|
5008
5008
|
return { k1neg: p, k1: l, k2neg: g, k2: u };
|
|
5009
5009
|
}
|
|
5010
|
-
function
|
|
5010
|
+
function yt(s) {
|
|
5011
5011
|
if (!["compact", "recovered", "der"].includes(s))
|
|
5012
5012
|
throw new Error('Signature format must be "compact", "recovered", or "der"');
|
|
5013
5013
|
return s;
|
|
5014
5014
|
}
|
|
5015
|
-
function
|
|
5015
|
+
function ht(s, e) {
|
|
5016
5016
|
const r = {};
|
|
5017
5017
|
for (let t of Object.keys(e))
|
|
5018
5018
|
r[t] = s[t] === void 0 ? e[t] : s[t];
|
|
5019
|
-
return
|
|
5019
|
+
return Je(r.lowS, "lowS"), Je(r.prehash, "prehash"), r.format !== void 0 && yt(r.format), r;
|
|
5020
5020
|
}
|
|
5021
5021
|
class Mn extends Error {
|
|
5022
5022
|
constructor(e = "") {
|
|
@@ -5034,11 +5034,11 @@ const ve = {
|
|
|
5034
5034
|
throw new r("tlv.encode: wrong tag");
|
|
5035
5035
|
if (e.length & 1)
|
|
5036
5036
|
throw new r("tlv.encode: unpadded data");
|
|
5037
|
-
const t = e.length / 2, n =
|
|
5037
|
+
const t = e.length / 2, n = ze(t);
|
|
5038
5038
|
if (n.length / 2 & 128)
|
|
5039
5039
|
throw new r("tlv.encode: long form length too big");
|
|
5040
|
-
const i = t > 127 ?
|
|
5041
|
-
return
|
|
5040
|
+
const i = t > 127 ? ze(n.length / 2 | 128) : "";
|
|
5041
|
+
return ze(s) + i + n + e;
|
|
5042
5042
|
},
|
|
5043
5043
|
// v - value, l - left bytes (unparsed)
|
|
5044
5044
|
decode(s, e) {
|
|
@@ -5083,7 +5083,7 @@ const ve = {
|
|
|
5083
5083
|
const { Err: e } = ve;
|
|
5084
5084
|
if (s < ge)
|
|
5085
5085
|
throw new e("integer: negative integers are not allowed");
|
|
5086
|
-
let r =
|
|
5086
|
+
let r = ze(s);
|
|
5087
5087
|
if (Number.parseInt(r[0], 16) & 8 && (r = "00" + r), r.length & 1)
|
|
5088
5088
|
throw new e("unexpected DER parsing assertion: unpadded hex");
|
|
5089
5089
|
return r;
|
|
@@ -5094,11 +5094,11 @@ const ve = {
|
|
|
5094
5094
|
throw new e("invalid signature integer: negative");
|
|
5095
5095
|
if (s[0] === 0 && !(s[1] & 128))
|
|
5096
5096
|
throw new e("invalid signature integer: unnecessary leading zero");
|
|
5097
|
-
return
|
|
5097
|
+
return rt(s);
|
|
5098
5098
|
}
|
|
5099
5099
|
},
|
|
5100
5100
|
toSig(s) {
|
|
5101
|
-
const { Err: e, _int: r, _tlv: t } = ve, n =
|
|
5101
|
+
const { Err: e, _int: r, _tlv: t } = ve, n = X(s, void 0, "signature"), { v: i, l: o } = t.decode(48, n);
|
|
5102
5102
|
if (o.length)
|
|
5103
5103
|
throw new e("invalid signature: left bytes after parsing");
|
|
5104
5104
|
const { v: a, l: c } = t.decode(2, i), { v: l, l: u } = t.decode(2, c);
|
|
@@ -5110,12 +5110,12 @@ const ve = {
|
|
|
5110
5110
|
const { _tlv: e, _int: r } = ve, t = e.encode(2, r.encode(s.r)), n = e.encode(2, r.encode(s.s)), i = t + n;
|
|
5111
5111
|
return e.encode(48, i);
|
|
5112
5112
|
}
|
|
5113
|
-
}, ge = BigInt(0),
|
|
5113
|
+
}, ge = BigInt(0), De = BigInt(1), Ur = BigInt(2), je = BigInt(3), Fn = BigInt(4);
|
|
5114
5114
|
function Un(s, e = {}) {
|
|
5115
5115
|
const r = Dn("weierstrass", s, e), { Fp: t, Fn: n } = r;
|
|
5116
5116
|
let i = r.CURVE;
|
|
5117
5117
|
const { h: o, n: a } = i;
|
|
5118
|
-
|
|
5118
|
+
Nt(e, {}, {
|
|
5119
5119
|
allowInfinityPoint: "boolean",
|
|
5120
5120
|
clearCofactor: "function",
|
|
5121
5121
|
isTorsionFree: "function",
|
|
@@ -5131,125 +5131,125 @@ function Un(s, e = {}) {
|
|
|
5131
5131
|
if (!t.isOdd)
|
|
5132
5132
|
throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
5133
5133
|
}
|
|
5134
|
-
function p(
|
|
5135
|
-
const { x:
|
|
5136
|
-
if (
|
|
5134
|
+
function p(H, m, w) {
|
|
5135
|
+
const { x: T, y: O } = m.toAffine(), F = t.toBytes(T);
|
|
5136
|
+
if (Je(w, "isCompressed"), w) {
|
|
5137
5137
|
u();
|
|
5138
|
-
const
|
|
5139
|
-
return Se(Hr(
|
|
5138
|
+
const $ = !t.isOdd(O);
|
|
5139
|
+
return Se(Hr($), F);
|
|
5140
5140
|
} else
|
|
5141
|
-
return Se(Uint8Array.of(4),
|
|
5142
|
-
}
|
|
5143
|
-
function g(
|
|
5144
|
-
|
|
5145
|
-
const { publicKey: m, publicKeyUncompressed:
|
|
5146
|
-
if (
|
|
5147
|
-
const
|
|
5148
|
-
if (!t.isValid(
|
|
5141
|
+
return Se(Uint8Array.of(4), F, t.toBytes(O));
|
|
5142
|
+
}
|
|
5143
|
+
function g(H) {
|
|
5144
|
+
X(H, void 0, "Point");
|
|
5145
|
+
const { publicKey: m, publicKeyUncompressed: w } = l, T = H.length, O = H[0], F = H.subarray(1);
|
|
5146
|
+
if (T === m && (O === 2 || O === 3)) {
|
|
5147
|
+
const $ = t.fromBytes(F);
|
|
5148
|
+
if (!t.isValid($))
|
|
5149
5149
|
throw new Error("bad point: is not on curve, wrong x");
|
|
5150
|
-
const
|
|
5151
|
-
let
|
|
5150
|
+
const M = y($);
|
|
5151
|
+
let C;
|
|
5152
5152
|
try {
|
|
5153
|
-
|
|
5154
|
-
} catch (
|
|
5155
|
-
const
|
|
5156
|
-
throw new Error("bad point: is not on curve, sqrt error" +
|
|
5153
|
+
C = t.sqrt(M);
|
|
5154
|
+
} catch (E) {
|
|
5155
|
+
const N = E instanceof Error ? ": " + E.message : "";
|
|
5156
|
+
throw new Error("bad point: is not on curve, sqrt error" + N);
|
|
5157
5157
|
}
|
|
5158
5158
|
u();
|
|
5159
|
-
const
|
|
5160
|
-
return (O & 1) === 1 !==
|
|
5161
|
-
} else if (
|
|
5162
|
-
const
|
|
5163
|
-
if (!
|
|
5159
|
+
const W = t.isOdd(C);
|
|
5160
|
+
return (O & 1) === 1 !== W && (C = t.neg(C)), { x: $, y: C };
|
|
5161
|
+
} else if (T === w && O === 4) {
|
|
5162
|
+
const $ = t.BYTES, M = t.fromBytes(F.subarray(0, $)), C = t.fromBytes(F.subarray($, $ * 2));
|
|
5163
|
+
if (!v(M, C))
|
|
5164
5164
|
throw new Error("bad point: is not on curve");
|
|
5165
|
-
return { x:
|
|
5165
|
+
return { x: M, y: C };
|
|
5166
5166
|
} else
|
|
5167
|
-
throw new Error(`bad point: got length ${
|
|
5167
|
+
throw new Error(`bad point: got length ${T}, expected compressed=${m} or uncompressed=${w}`);
|
|
5168
5168
|
}
|
|
5169
5169
|
const _ = e.toBytes || p, x = e.fromBytes || g;
|
|
5170
|
-
function
|
|
5171
|
-
const m = t.sqr(
|
|
5172
|
-
return t.add(t.add(
|
|
5170
|
+
function y(H) {
|
|
5171
|
+
const m = t.sqr(H), w = t.mul(m, H);
|
|
5172
|
+
return t.add(t.add(w, t.mul(H, i.a)), i.b);
|
|
5173
5173
|
}
|
|
5174
|
-
function
|
|
5175
|
-
const
|
|
5176
|
-
return t.eql(
|
|
5174
|
+
function v(H, m) {
|
|
5175
|
+
const w = t.sqr(m), T = y(H);
|
|
5176
|
+
return t.eql(w, T);
|
|
5177
5177
|
}
|
|
5178
|
-
if (!
|
|
5178
|
+
if (!v(i.Gx, i.Gy))
|
|
5179
5179
|
throw new Error("bad curve params: generator point");
|
|
5180
|
-
const
|
|
5181
|
-
if (t.is0(t.add(
|
|
5180
|
+
const A = t.mul(t.pow(i.a, je), Fn), R = t.mul(t.sqr(i.b), BigInt(27));
|
|
5181
|
+
if (t.is0(t.add(A, R)))
|
|
5182
5182
|
throw new Error("bad curve params: a or b");
|
|
5183
|
-
function
|
|
5184
|
-
if (!t.isValid(m) ||
|
|
5185
|
-
throw new Error(`bad point coordinate ${
|
|
5183
|
+
function k(H, m, w = !1) {
|
|
5184
|
+
if (!t.isValid(m) || w && t.is0(m))
|
|
5185
|
+
throw new Error(`bad point coordinate ${H}`);
|
|
5186
5186
|
return m;
|
|
5187
5187
|
}
|
|
5188
|
-
function L(
|
|
5189
|
-
if (!(
|
|
5188
|
+
function L(H) {
|
|
5189
|
+
if (!(H instanceof J))
|
|
5190
5190
|
throw new Error("Weierstrass Point expected");
|
|
5191
5191
|
}
|
|
5192
|
-
function
|
|
5192
|
+
function D(H) {
|
|
5193
5193
|
if (!c || !c.basises)
|
|
5194
5194
|
throw new Error("no endo");
|
|
5195
|
-
return Bn(
|
|
5195
|
+
return Bn(H, c.basises, n.ORDER);
|
|
5196
5196
|
}
|
|
5197
|
-
const
|
|
5198
|
-
const { X:
|
|
5197
|
+
const z = Xt((H, m) => {
|
|
5198
|
+
const { X: w, Y: T, Z: O } = H;
|
|
5199
5199
|
if (t.eql(O, t.ONE))
|
|
5200
|
-
return { x:
|
|
5201
|
-
const
|
|
5202
|
-
m == null && (m =
|
|
5203
|
-
const
|
|
5204
|
-
if (
|
|
5200
|
+
return { x: w, y: T };
|
|
5201
|
+
const F = H.is0();
|
|
5202
|
+
m == null && (m = F ? t.ONE : t.inv(O));
|
|
5203
|
+
const $ = t.mul(w, m), M = t.mul(T, m), C = t.mul(O, m);
|
|
5204
|
+
if (F)
|
|
5205
5205
|
return { x: t.ZERO, y: t.ZERO };
|
|
5206
|
-
if (!t.eql(
|
|
5206
|
+
if (!t.eql(C, t.ONE))
|
|
5207
5207
|
throw new Error("invZ was invalid");
|
|
5208
|
-
return { x:
|
|
5209
|
-
}),
|
|
5210
|
-
if (
|
|
5211
|
-
if (e.allowInfinityPoint && !t.is0(
|
|
5208
|
+
return { x: $, y: M };
|
|
5209
|
+
}), Q = Xt((H) => {
|
|
5210
|
+
if (H.is0()) {
|
|
5211
|
+
if (e.allowInfinityPoint && !t.is0(H.Y))
|
|
5212
5212
|
return;
|
|
5213
5213
|
throw new Error("bad point: ZERO");
|
|
5214
5214
|
}
|
|
5215
|
-
const { x: m, y } =
|
|
5216
|
-
if (!t.isValid(m) || !t.isValid(
|
|
5215
|
+
const { x: m, y: w } = H.toAffine();
|
|
5216
|
+
if (!t.isValid(m) || !t.isValid(w))
|
|
5217
5217
|
throw new Error("bad point: x or y not field elements");
|
|
5218
|
-
if (!
|
|
5218
|
+
if (!v(m, w))
|
|
5219
5219
|
throw new Error("bad point: equation left != right");
|
|
5220
|
-
if (!
|
|
5220
|
+
if (!H.isTorsionFree())
|
|
5221
5221
|
throw new Error("bad point: not in prime-order subgroup");
|
|
5222
5222
|
return !0;
|
|
5223
5223
|
});
|
|
5224
|
-
function
|
|
5225
|
-
return
|
|
5224
|
+
function q(H, m, w, T, O) {
|
|
5225
|
+
return w = new J(t.mul(w.X, H), w.Y, w.Z), m = Ze(T, m), w = Ze(O, w), m.add(w);
|
|
5226
5226
|
}
|
|
5227
|
-
const
|
|
5227
|
+
const B = class B {
|
|
5228
5228
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
5229
|
-
constructor(m,
|
|
5229
|
+
constructor(m, w, T) {
|
|
5230
5230
|
P(this, "X");
|
|
5231
5231
|
P(this, "Y");
|
|
5232
5232
|
P(this, "Z");
|
|
5233
|
-
this.X =
|
|
5233
|
+
this.X = k("x", m), this.Y = k("y", w, !0), this.Z = k("z", T), Object.freeze(this);
|
|
5234
5234
|
}
|
|
5235
5235
|
static CURVE() {
|
|
5236
5236
|
return i;
|
|
5237
5237
|
}
|
|
5238
5238
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
5239
5239
|
static fromAffine(m) {
|
|
5240
|
-
const { x:
|
|
5241
|
-
if (!m || !t.isValid(
|
|
5240
|
+
const { x: w, y: T } = m || {};
|
|
5241
|
+
if (!m || !t.isValid(w) || !t.isValid(T))
|
|
5242
5242
|
throw new Error("invalid affine point");
|
|
5243
|
-
if (m instanceof
|
|
5243
|
+
if (m instanceof B)
|
|
5244
5244
|
throw new Error("projective point not allowed");
|
|
5245
|
-
return t.is0(
|
|
5245
|
+
return t.is0(w) && t.is0(T) ? B.ZERO : new B(w, T, t.ONE);
|
|
5246
5246
|
}
|
|
5247
5247
|
static fromBytes(m) {
|
|
5248
|
-
const
|
|
5249
|
-
return
|
|
5248
|
+
const w = B.fromAffine(x(X(m, void 0, "point")));
|
|
5249
|
+
return w.assertValidity(), w;
|
|
5250
5250
|
}
|
|
5251
5251
|
static fromHex(m) {
|
|
5252
|
-
return
|
|
5252
|
+
return B.fromBytes(Xe(m));
|
|
5253
5253
|
}
|
|
5254
5254
|
get x() {
|
|
5255
5255
|
return this.toAffine().x;
|
|
@@ -5263,13 +5263,13 @@ function Un(s, e = {}) {
|
|
|
5263
5263
|
* @param isLazy true will defer table computation until the first multiplication
|
|
5264
5264
|
* @returns
|
|
5265
5265
|
*/
|
|
5266
|
-
precompute(m = 8,
|
|
5267
|
-
return
|
|
5266
|
+
precompute(m = 8, w = !0) {
|
|
5267
|
+
return G.createCache(this, m), w || this.multiply(je), this;
|
|
5268
5268
|
}
|
|
5269
5269
|
// TODO: return `this`
|
|
5270
5270
|
/** A point on curve is valid if it conforms to equation. */
|
|
5271
5271
|
assertValidity() {
|
|
5272
|
-
|
|
5272
|
+
Q(this);
|
|
5273
5273
|
}
|
|
5274
5274
|
hasEvenY() {
|
|
5275
5275
|
const { y: m } = this.toAffine();
|
|
@@ -5280,21 +5280,21 @@ function Un(s, e = {}) {
|
|
|
5280
5280
|
/** Compare one point to another. */
|
|
5281
5281
|
equals(m) {
|
|
5282
5282
|
L(m);
|
|
5283
|
-
const { X:
|
|
5284
|
-
return
|
|
5283
|
+
const { X: w, Y: T, Z: O } = this, { X: F, Y: $, Z: M } = m, C = t.eql(t.mul(w, M), t.mul(F, O)), W = t.eql(t.mul(T, M), t.mul($, O));
|
|
5284
|
+
return C && W;
|
|
5285
5285
|
}
|
|
5286
5286
|
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
5287
5287
|
negate() {
|
|
5288
|
-
return new
|
|
5288
|
+
return new B(this.X, t.neg(this.Y), this.Z);
|
|
5289
5289
|
}
|
|
5290
5290
|
// Renes-Costello-Batina exception-free doubling formula.
|
|
5291
5291
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
5292
5292
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
5293
5293
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
5294
5294
|
double() {
|
|
5295
|
-
const { a: m, b:
|
|
5296
|
-
let
|
|
5297
|
-
return
|
|
5295
|
+
const { a: m, b: w } = i, T = t.mul(w, je), { X: O, Y: F, Z: $ } = this;
|
|
5296
|
+
let M = t.ZERO, C = t.ZERO, W = t.ZERO, b = t.mul(O, O), E = t.mul(F, F), N = t.mul($, $), I = t.mul(O, F);
|
|
5297
|
+
return I = t.add(I, I), W = t.mul(O, $), W = t.add(W, W), M = t.mul(m, W), C = t.mul(T, N), C = t.add(M, C), M = t.sub(E, C), C = t.add(E, C), C = t.mul(M, C), M = t.mul(I, M), W = t.mul(T, W), N = t.mul(m, N), I = t.sub(b, N), I = t.mul(m, I), I = t.add(I, W), W = t.add(b, b), b = t.add(W, b), b = t.add(b, N), b = t.mul(b, I), C = t.add(C, b), N = t.mul(F, $), N = t.add(N, N), b = t.mul(N, I), M = t.sub(M, b), W = t.mul(N, E), W = t.add(W, W), W = t.add(W, W), new B(M, C, W);
|
|
5298
5298
|
}
|
|
5299
5299
|
// Renes-Costello-Batina exception-free addition formula.
|
|
5300
5300
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -5302,19 +5302,19 @@ function Un(s, e = {}) {
|
|
|
5302
5302
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
5303
5303
|
add(m) {
|
|
5304
5304
|
L(m);
|
|
5305
|
-
const { X:
|
|
5306
|
-
let
|
|
5307
|
-
const
|
|
5308
|
-
let
|
|
5309
|
-
|
|
5310
|
-
let
|
|
5311
|
-
return
|
|
5305
|
+
const { X: w, Y: T, Z: O } = this, { X: F, Y: $, Z: M } = m;
|
|
5306
|
+
let C = t.ZERO, W = t.ZERO, b = t.ZERO;
|
|
5307
|
+
const E = i.a, N = t.mul(i.b, je);
|
|
5308
|
+
let I = t.mul(w, F), U = t.mul(T, $), K = t.mul(O, M), j = t.add(w, T), V = t.add(F, $);
|
|
5309
|
+
j = t.mul(j, V), V = t.add(I, U), j = t.sub(j, V), V = t.add(w, O);
|
|
5310
|
+
let Y = t.add(F, M);
|
|
5311
|
+
return V = t.mul(V, Y), Y = t.add(I, K), V = t.sub(V, Y), Y = t.add(T, O), C = t.add($, M), Y = t.mul(Y, C), C = t.add(U, K), Y = t.sub(Y, C), b = t.mul(E, V), C = t.mul(N, K), b = t.add(C, b), C = t.sub(U, b), b = t.add(U, b), W = t.mul(C, b), U = t.add(I, I), U = t.add(U, I), K = t.mul(E, K), V = t.mul(N, V), U = t.add(U, K), K = t.sub(I, K), K = t.mul(E, K), V = t.add(V, K), I = t.mul(U, V), W = t.add(W, I), I = t.mul(Y, V), C = t.mul(j, C), C = t.sub(C, I), I = t.mul(j, U), b = t.mul(Y, b), b = t.add(b, I), new B(C, W, b);
|
|
5312
5312
|
}
|
|
5313
5313
|
subtract(m) {
|
|
5314
5314
|
return this.add(m.negate());
|
|
5315
5315
|
}
|
|
5316
5316
|
is0() {
|
|
5317
|
-
return this.equals(
|
|
5317
|
+
return this.equals(B.ZERO);
|
|
5318
5318
|
}
|
|
5319
5319
|
/**
|
|
5320
5320
|
* Constant time multiplication.
|
|
@@ -5326,19 +5326,19 @@ function Un(s, e = {}) {
|
|
|
5326
5326
|
* @returns New point
|
|
5327
5327
|
*/
|
|
5328
5328
|
multiply(m) {
|
|
5329
|
-
const { endo:
|
|
5329
|
+
const { endo: w } = e;
|
|
5330
5330
|
if (!n.isValidNot0(m))
|
|
5331
5331
|
throw new Error("invalid scalar: out of range");
|
|
5332
|
-
let
|
|
5333
|
-
const
|
|
5334
|
-
if (
|
|
5335
|
-
const { k1neg:
|
|
5336
|
-
O =
|
|
5332
|
+
let T, O;
|
|
5333
|
+
const F = ($) => G.cached(this, $, (M) => Qt(B, M));
|
|
5334
|
+
if (w) {
|
|
5335
|
+
const { k1neg: $, k1: M, k2neg: C, k2: W } = D(m), { p: b, f: E } = F(M), { p: N, f: I } = F(W);
|
|
5336
|
+
O = E.add(I), T = q(w.beta, b, N, $, C);
|
|
5337
5337
|
} else {
|
|
5338
|
-
const { p:
|
|
5339
|
-
|
|
5338
|
+
const { p: $, f: M } = F(m);
|
|
5339
|
+
T = $, O = M;
|
|
5340
5340
|
}
|
|
5341
|
-
return Qt(
|
|
5341
|
+
return Qt(B, [T, O])[0];
|
|
5342
5342
|
}
|
|
5343
5343
|
/**
|
|
5344
5344
|
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
@@ -5346,27 +5346,27 @@ function Un(s, e = {}) {
|
|
|
5346
5346
|
* an exposed secret key e.g. sig verification, which works over *public* keys.
|
|
5347
5347
|
*/
|
|
5348
5348
|
multiplyUnsafe(m) {
|
|
5349
|
-
const { endo:
|
|
5349
|
+
const { endo: w } = e, T = this;
|
|
5350
5350
|
if (!n.isValid(m))
|
|
5351
5351
|
throw new Error("invalid scalar: out of range");
|
|
5352
|
-
if (m === ge ||
|
|
5353
|
-
return
|
|
5354
|
-
if (m ===
|
|
5355
|
-
return
|
|
5356
|
-
if (
|
|
5352
|
+
if (m === ge || T.is0())
|
|
5353
|
+
return B.ZERO;
|
|
5354
|
+
if (m === De)
|
|
5355
|
+
return T;
|
|
5356
|
+
if (G.hasCache(this))
|
|
5357
5357
|
return this.multiply(m);
|
|
5358
|
-
if (
|
|
5359
|
-
const { k1neg: O, k1:
|
|
5360
|
-
return
|
|
5358
|
+
if (w) {
|
|
5359
|
+
const { k1neg: O, k1: F, k2neg: $, k2: M } = D(m), { p1: C, p2: W } = Ln(B, T, F, M);
|
|
5360
|
+
return q(w.beta, C, W, O, $);
|
|
5361
5361
|
} else
|
|
5362
|
-
return
|
|
5362
|
+
return G.unsafe(T, m);
|
|
5363
5363
|
}
|
|
5364
5364
|
/**
|
|
5365
5365
|
* Converts Projective point to affine (x, y) coordinates.
|
|
5366
5366
|
* @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch
|
|
5367
5367
|
*/
|
|
5368
5368
|
toAffine(m) {
|
|
5369
|
-
return
|
|
5369
|
+
return z(this, m);
|
|
5370
5370
|
}
|
|
5371
5371
|
/**
|
|
5372
5372
|
* Checks whether Point is free of torsion elements (is in prime subgroup).
|
|
@@ -5374,34 +5374,34 @@ function Un(s, e = {}) {
|
|
|
5374
5374
|
*/
|
|
5375
5375
|
isTorsionFree() {
|
|
5376
5376
|
const { isTorsionFree: m } = e;
|
|
5377
|
-
return o ===
|
|
5377
|
+
return o === De ? !0 : m ? m(B, this) : G.unsafe(this, a).is0();
|
|
5378
5378
|
}
|
|
5379
5379
|
clearCofactor() {
|
|
5380
5380
|
const { clearCofactor: m } = e;
|
|
5381
|
-
return o ===
|
|
5381
|
+
return o === De ? this : m ? m(B, this) : this.multiplyUnsafe(o);
|
|
5382
5382
|
}
|
|
5383
5383
|
isSmallOrder() {
|
|
5384
5384
|
return this.multiplyUnsafe(o).is0();
|
|
5385
5385
|
}
|
|
5386
5386
|
toBytes(m = !0) {
|
|
5387
|
-
return
|
|
5387
|
+
return Je(m, "isCompressed"), this.assertValidity(), _(B, this, m);
|
|
5388
5388
|
}
|
|
5389
5389
|
toHex(m = !0) {
|
|
5390
|
-
return
|
|
5390
|
+
return Ge(this.toBytes(m));
|
|
5391
5391
|
}
|
|
5392
5392
|
toString() {
|
|
5393
5393
|
return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
|
|
5394
5394
|
}
|
|
5395
5395
|
};
|
|
5396
5396
|
// base / generator point
|
|
5397
|
-
P(
|
|
5398
|
-
P(
|
|
5397
|
+
P(B, "BASE", new B(i.Gx, i.Gy, t.ONE)), // zero / infinity / identity point
|
|
5398
|
+
P(B, "ZERO", new B(t.ZERO, t.ONE, t.ZERO)), // 0, 1, 0
|
|
5399
5399
|
// math field
|
|
5400
|
-
P(
|
|
5401
|
-
P(
|
|
5402
|
-
let
|
|
5403
|
-
const
|
|
5404
|
-
return
|
|
5400
|
+
P(B, "Fp", t), // scalar field
|
|
5401
|
+
P(B, "Fn", n);
|
|
5402
|
+
let J = B;
|
|
5403
|
+
const te = n.BITS, G = new Pn(J, e.endo ? Math.ceil(te / 2) : te);
|
|
5404
|
+
return J.BASE.precompute(8), J;
|
|
5405
5405
|
}
|
|
5406
5406
|
function Hr(s) {
|
|
5407
5407
|
return Uint8Array.of(s ? 2 : 3);
|
|
@@ -5426,34 +5426,34 @@ function Hn(s, e = {}) {
|
|
|
5426
5426
|
}
|
|
5427
5427
|
}
|
|
5428
5428
|
function o(_, x) {
|
|
5429
|
-
const { publicKey:
|
|
5429
|
+
const { publicKey: y, publicKeyUncompressed: v } = n;
|
|
5430
5430
|
try {
|
|
5431
|
-
const
|
|
5432
|
-
return x === !0 &&
|
|
5431
|
+
const A = _.length;
|
|
5432
|
+
return x === !0 && A !== y || x === !1 && A !== v ? !1 : !!s.fromBytes(_);
|
|
5433
5433
|
} catch {
|
|
5434
5434
|
return !1;
|
|
5435
5435
|
}
|
|
5436
5436
|
}
|
|
5437
5437
|
function a(_ = t(n.seed)) {
|
|
5438
|
-
return
|
|
5438
|
+
return Cn(X(_, n.seed, "seed"), r.ORDER);
|
|
5439
5439
|
}
|
|
5440
5440
|
function c(_, x = !0) {
|
|
5441
5441
|
return s.BASE.multiply(r.fromBytes(_)).toBytes(x);
|
|
5442
5442
|
}
|
|
5443
5443
|
function l(_) {
|
|
5444
|
-
const { secretKey: x, publicKey:
|
|
5445
|
-
if (!
|
|
5444
|
+
const { secretKey: x, publicKey: y, publicKeyUncompressed: v } = n;
|
|
5445
|
+
if (!It(_) || "_lengths" in r && r._lengths || x === y)
|
|
5446
5446
|
return;
|
|
5447
|
-
const
|
|
5448
|
-
return
|
|
5447
|
+
const A = X(_, void 0, "key").length;
|
|
5448
|
+
return A === y || A === v;
|
|
5449
5449
|
}
|
|
5450
|
-
function u(_, x,
|
|
5450
|
+
function u(_, x, y = !0) {
|
|
5451
5451
|
if (l(_) === !0)
|
|
5452
5452
|
throw new Error("first arg must be private key");
|
|
5453
5453
|
if (l(x) === !1)
|
|
5454
5454
|
throw new Error("second arg must be public key");
|
|
5455
|
-
const
|
|
5456
|
-
return s.fromBytes(x).multiply(
|
|
5455
|
+
const v = r.fromBytes(_);
|
|
5456
|
+
return s.fromBytes(x).multiply(v).toBytes(y);
|
|
5457
5457
|
}
|
|
5458
5458
|
const p = {
|
|
5459
5459
|
isValidSecretKey: i,
|
|
@@ -5463,160 +5463,160 @@ function Hn(s, e = {}) {
|
|
|
5463
5463
|
return Object.freeze({ getPublicKey: c, getSharedSecret: u, keygen: g, Point: s, utils: p, lengths: n });
|
|
5464
5464
|
}
|
|
5465
5465
|
function Wn(s, e, r = {}) {
|
|
5466
|
-
xr(e),
|
|
5466
|
+
xr(e), Nt(r, {}, {
|
|
5467
5467
|
hmac: "function",
|
|
5468
5468
|
lowS: "boolean",
|
|
5469
5469
|
randomBytes: "function",
|
|
5470
5470
|
bits2int: "function",
|
|
5471
5471
|
bits2int_modN: "function"
|
|
5472
5472
|
}), r = Object.assign({}, r);
|
|
5473
|
-
const t = r.randomBytes || br, n = r.hmac || ((m,
|
|
5473
|
+
const t = r.randomBytes || br, n = r.hmac || ((m, w) => Fr(e, m, w)), { Fp: i, Fn: o } = s, { ORDER: a, BITS: c } = o, { keygen: l, getPublicKey: u, getSharedSecret: p, utils: g, lengths: _ } = Hn(s, r), x = {
|
|
5474
5474
|
prehash: !0,
|
|
5475
5475
|
lowS: typeof r.lowS == "boolean" ? r.lowS : !0,
|
|
5476
5476
|
format: "compact",
|
|
5477
5477
|
extraEntropy: !1
|
|
5478
|
-
},
|
|
5479
|
-
function
|
|
5480
|
-
const
|
|
5481
|
-
return m >
|
|
5478
|
+
}, y = a * Ur < i.ORDER;
|
|
5479
|
+
function v(m) {
|
|
5480
|
+
const w = a >> De;
|
|
5481
|
+
return m > w;
|
|
5482
5482
|
}
|
|
5483
|
-
function
|
|
5484
|
-
if (!o.isValidNot0(
|
|
5483
|
+
function A(m, w) {
|
|
5484
|
+
if (!o.isValidNot0(w))
|
|
5485
5485
|
throw new Error(`invalid signature ${m}: out of range 1..Point.Fn.ORDER`);
|
|
5486
|
-
return
|
|
5486
|
+
return w;
|
|
5487
5487
|
}
|
|
5488
|
-
function
|
|
5489
|
-
if (
|
|
5488
|
+
function R() {
|
|
5489
|
+
if (y)
|
|
5490
5490
|
throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
|
|
5491
5491
|
}
|
|
5492
|
-
function
|
|
5493
|
-
|
|
5494
|
-
const
|
|
5495
|
-
return
|
|
5492
|
+
function k(m, w) {
|
|
5493
|
+
yt(w);
|
|
5494
|
+
const T = _.signature, O = w === "compact" ? T : w === "recovered" ? T + 1 : void 0;
|
|
5495
|
+
return X(m, O);
|
|
5496
5496
|
}
|
|
5497
5497
|
class L {
|
|
5498
|
-
constructor(
|
|
5498
|
+
constructor(w, T, O) {
|
|
5499
5499
|
P(this, "r");
|
|
5500
5500
|
P(this, "s");
|
|
5501
5501
|
P(this, "recovery");
|
|
5502
|
-
if (this.r =
|
|
5503
|
-
if (
|
|
5502
|
+
if (this.r = A("r", w), this.s = A("s", T), O != null) {
|
|
5503
|
+
if (R(), ![0, 1, 2, 3].includes(O))
|
|
5504
5504
|
throw new Error("invalid recovery id");
|
|
5505
5505
|
this.recovery = O;
|
|
5506
5506
|
}
|
|
5507
5507
|
Object.freeze(this);
|
|
5508
5508
|
}
|
|
5509
|
-
static fromBytes(
|
|
5510
|
-
|
|
5509
|
+
static fromBytes(w, T = x.format) {
|
|
5510
|
+
k(w, T);
|
|
5511
5511
|
let O;
|
|
5512
|
-
if (
|
|
5513
|
-
const { r:
|
|
5514
|
-
return new L(
|
|
5512
|
+
if (T === "der") {
|
|
5513
|
+
const { r: C, s: W } = ve.toSig(X(w));
|
|
5514
|
+
return new L(C, W);
|
|
5515
5515
|
}
|
|
5516
|
-
|
|
5517
|
-
const
|
|
5518
|
-
return new L(o.fromBytes(
|
|
5516
|
+
T === "recovered" && (O = w[0], T = "compact", w = w.subarray(1));
|
|
5517
|
+
const F = _.signature / 2, $ = w.subarray(0, F), M = w.subarray(F, F * 2);
|
|
5518
|
+
return new L(o.fromBytes($), o.fromBytes(M), O);
|
|
5519
5519
|
}
|
|
5520
|
-
static fromHex(
|
|
5521
|
-
return this.fromBytes(
|
|
5520
|
+
static fromHex(w, T) {
|
|
5521
|
+
return this.fromBytes(Xe(w), T);
|
|
5522
5522
|
}
|
|
5523
5523
|
assertRecovery() {
|
|
5524
|
-
const { recovery:
|
|
5525
|
-
if (
|
|
5524
|
+
const { recovery: w } = this;
|
|
5525
|
+
if (w == null)
|
|
5526
5526
|
throw new Error("invalid recovery id: must be present");
|
|
5527
|
-
return
|
|
5527
|
+
return w;
|
|
5528
5528
|
}
|
|
5529
|
-
addRecoveryBit(
|
|
5530
|
-
return new L(this.r, this.s,
|
|
5529
|
+
addRecoveryBit(w) {
|
|
5530
|
+
return new L(this.r, this.s, w);
|
|
5531
5531
|
}
|
|
5532
|
-
recoverPublicKey(
|
|
5533
|
-
const { r:
|
|
5534
|
-
if (!i.isValid(
|
|
5532
|
+
recoverPublicKey(w) {
|
|
5533
|
+
const { r: T, s: O } = this, F = this.assertRecovery(), $ = F === 2 || F === 3 ? T + a : T;
|
|
5534
|
+
if (!i.isValid($))
|
|
5535
5535
|
throw new Error("invalid recovery id: sig.r+curve.n != R.x");
|
|
5536
|
-
const
|
|
5537
|
-
if (
|
|
5536
|
+
const M = i.toBytes($), C = s.fromBytes(Se(Hr((F & 1) === 0), M)), W = o.inv($), b = z(X(w, void 0, "msgHash")), E = o.create(-b * W), N = o.create(O * W), I = s.BASE.multiplyUnsafe(E).add(C.multiplyUnsafe(N));
|
|
5537
|
+
if (I.is0())
|
|
5538
5538
|
throw new Error("invalid recovery: point at infinify");
|
|
5539
|
-
return
|
|
5539
|
+
return I.assertValidity(), I;
|
|
5540
5540
|
}
|
|
5541
5541
|
// Signatures should be low-s, to prevent malleability.
|
|
5542
5542
|
hasHighS() {
|
|
5543
|
-
return
|
|
5543
|
+
return v(this.s);
|
|
5544
5544
|
}
|
|
5545
|
-
toBytes(
|
|
5546
|
-
if (
|
|
5547
|
-
return
|
|
5548
|
-
const { r:
|
|
5549
|
-
return
|
|
5545
|
+
toBytes(w = x.format) {
|
|
5546
|
+
if (yt(w), w === "der")
|
|
5547
|
+
return Xe(ve.hexFromSig(this));
|
|
5548
|
+
const { r: T, s: O } = this, F = o.toBytes(T), $ = o.toBytes(O);
|
|
5549
|
+
return w === "recovered" ? (R(), Se(Uint8Array.of(this.assertRecovery()), F, $)) : Se(F, $);
|
|
5550
5550
|
}
|
|
5551
|
-
toHex(
|
|
5552
|
-
return
|
|
5551
|
+
toHex(w) {
|
|
5552
|
+
return Ge(this.toBytes(w));
|
|
5553
5553
|
}
|
|
5554
5554
|
}
|
|
5555
|
-
const
|
|
5556
|
-
if (
|
|
5555
|
+
const D = r.bits2int || function(w) {
|
|
5556
|
+
if (w.length > 8192)
|
|
5557
5557
|
throw new Error("input is too large");
|
|
5558
|
-
const
|
|
5559
|
-
return O > 0 ?
|
|
5560
|
-
},
|
|
5561
|
-
return o.create(
|
|
5562
|
-
},
|
|
5563
|
-
function
|
|
5564
|
-
return mn("num < 2^" + c, m, ge,
|
|
5565
|
-
}
|
|
5566
|
-
function
|
|
5567
|
-
return
|
|
5568
|
-
}
|
|
5569
|
-
function
|
|
5570
|
-
const { lowS: O, prehash:
|
|
5571
|
-
m =
|
|
5572
|
-
const
|
|
5573
|
-
if (!o.isValidNot0(
|
|
5558
|
+
const T = rt(w), O = w.length * 8 - c;
|
|
5559
|
+
return O > 0 ? T >> BigInt(O) : T;
|
|
5560
|
+
}, z = r.bits2int_modN || function(w) {
|
|
5561
|
+
return o.create(D(w));
|
|
5562
|
+
}, Q = Rt(c);
|
|
5563
|
+
function q(m) {
|
|
5564
|
+
return mn("num < 2^" + c, m, ge, Q), o.toBytes(m);
|
|
5565
|
+
}
|
|
5566
|
+
function J(m, w) {
|
|
5567
|
+
return X(m, void 0, "message"), w ? X(e(m), void 0, "prehashed message") : m;
|
|
5568
|
+
}
|
|
5569
|
+
function te(m, w, T) {
|
|
5570
|
+
const { lowS: O, prehash: F, extraEntropy: $ } = ht(T, x);
|
|
5571
|
+
m = J(m, F);
|
|
5572
|
+
const M = z(m), C = o.fromBytes(w);
|
|
5573
|
+
if (!o.isValidNot0(C))
|
|
5574
5574
|
throw new Error("invalid private key");
|
|
5575
|
-
const
|
|
5576
|
-
if (
|
|
5577
|
-
const
|
|
5578
|
-
|
|
5579
|
-
}
|
|
5580
|
-
const
|
|
5581
|
-
function
|
|
5582
|
-
const
|
|
5583
|
-
if (!o.isValidNot0(
|
|
5575
|
+
const W = [q(C), q(M)];
|
|
5576
|
+
if ($ != null && $ !== !1) {
|
|
5577
|
+
const I = $ === !0 ? t(_.secretKey) : $;
|
|
5578
|
+
W.push(X(I, void 0, "extraEntropy"));
|
|
5579
|
+
}
|
|
5580
|
+
const b = Se(...W), E = M;
|
|
5581
|
+
function N(I) {
|
|
5582
|
+
const U = D(I);
|
|
5583
|
+
if (!o.isValidNot0(U))
|
|
5584
5584
|
return;
|
|
5585
|
-
const
|
|
5586
|
-
if (
|
|
5585
|
+
const K = o.inv(U), j = s.BASE.multiply(U).toAffine(), V = o.create(j.x);
|
|
5586
|
+
if (V === ge)
|
|
5587
5587
|
return;
|
|
5588
|
-
const
|
|
5589
|
-
if (
|
|
5588
|
+
const Y = o.create(K * o.create(E + V * C));
|
|
5589
|
+
if (Y === ge)
|
|
5590
5590
|
return;
|
|
5591
|
-
let
|
|
5592
|
-
return O &&
|
|
5591
|
+
let Ee = (j.x === V ? 0 : 2) | Number(j.y & De), Dt = Y;
|
|
5592
|
+
return O && v(Y) && (Dt = o.neg(Y), Ee ^= 1), new L(V, Dt, y ? void 0 : Ee);
|
|
5593
5593
|
}
|
|
5594
|
-
return { seed:
|
|
5594
|
+
return { seed: b, k2sig: N };
|
|
5595
5595
|
}
|
|
5596
|
-
function
|
|
5597
|
-
const { seed: O, k2sig:
|
|
5598
|
-
return bn(e.outputLen, o.BYTES, n)(O,
|
|
5596
|
+
function G(m, w, T = {}) {
|
|
5597
|
+
const { seed: O, k2sig: F } = te(m, w, T);
|
|
5598
|
+
return bn(e.outputLen, o.BYTES, n)(O, F).toBytes(T.format);
|
|
5599
5599
|
}
|
|
5600
|
-
function
|
|
5601
|
-
const { lowS:
|
|
5602
|
-
if (
|
|
5603
|
-
const
|
|
5604
|
-
throw new Error("verify expects Uint8Array signature" +
|
|
5600
|
+
function B(m, w, T, O = {}) {
|
|
5601
|
+
const { lowS: F, prehash: $, format: M } = ht(O, x);
|
|
5602
|
+
if (T = X(T, void 0, "publicKey"), w = J(w, $), !It(m)) {
|
|
5603
|
+
const C = m instanceof L ? ", use sig.toBytes()" : "";
|
|
5604
|
+
throw new Error("verify expects Uint8Array signature" + C);
|
|
5605
5605
|
}
|
|
5606
|
-
|
|
5606
|
+
k(m, M);
|
|
5607
5607
|
try {
|
|
5608
|
-
const
|
|
5609
|
-
if (
|
|
5608
|
+
const C = L.fromBytes(m, M), W = s.fromBytes(T);
|
|
5609
|
+
if (F && C.hasHighS())
|
|
5610
5610
|
return !1;
|
|
5611
|
-
const { r:
|
|
5612
|
-
return
|
|
5611
|
+
const { r: b, s: E } = C, N = z(w), I = o.inv(E), U = o.create(N * I), K = o.create(b * I), j = s.BASE.multiplyUnsafe(U).add(W.multiplyUnsafe(K));
|
|
5612
|
+
return j.is0() ? !1 : o.create(j.x) === b;
|
|
5613
5613
|
} catch {
|
|
5614
5614
|
return !1;
|
|
5615
5615
|
}
|
|
5616
5616
|
}
|
|
5617
|
-
function
|
|
5618
|
-
const { prehash: O } =
|
|
5619
|
-
return
|
|
5617
|
+
function H(m, w, T = {}) {
|
|
5618
|
+
const { prehash: O } = ht(T, x);
|
|
5619
|
+
return w = J(w, O), L.fromBytes(m, "recovered").recoverPublicKey(w).toBytes();
|
|
5620
5620
|
}
|
|
5621
5621
|
return Object.freeze({
|
|
5622
5622
|
keygen: l,
|
|
@@ -5625,9 +5625,9 @@ function Wn(s, e, r = {}) {
|
|
|
5625
5625
|
utils: g,
|
|
5626
5626
|
lengths: _,
|
|
5627
5627
|
Point: s,
|
|
5628
|
-
sign:
|
|
5629
|
-
verify:
|
|
5630
|
-
recoverPublicKey:
|
|
5628
|
+
sign: G,
|
|
5629
|
+
verify: B,
|
|
5630
|
+
recoverPublicKey: H,
|
|
5631
5631
|
Signature: L,
|
|
5632
5632
|
hash: e
|
|
5633
5633
|
});
|
|
@@ -5649,20 +5649,20 @@ const Ct = {
|
|
|
5649
5649
|
]
|
|
5650
5650
|
}, nr = /* @__PURE__ */ BigInt(2);
|
|
5651
5651
|
function qn(s) {
|
|
5652
|
-
const e = Ct.p, r = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = s * s * s % e, u = l * l * s % e, p = oe(u, r, e) * u % e, g = oe(p, r, e) * u % e, _ = oe(g, nr, e) * l % e, x = oe(_, n, e) * _ % e,
|
|
5653
|
-
if (!
|
|
5652
|
+
const e = Ct.p, r = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = s * s * s % e, u = l * l * s % e, p = oe(u, r, e) * u % e, g = oe(p, r, e) * u % e, _ = oe(g, nr, e) * l % e, x = oe(_, n, e) * _ % e, y = oe(x, i, e) * x % e, v = oe(y, a, e) * y % e, A = oe(v, c, e) * v % e, R = oe(A, a, e) * y % e, k = oe(R, r, e) * u % e, L = oe(k, o, e) * x % e, D = oe(L, t, e) * l % e, z = oe(D, nr, e);
|
|
5653
|
+
if (!bt.eql(bt.sqr(z), s))
|
|
5654
5654
|
throw new Error("Cannot find square root");
|
|
5655
|
-
return
|
|
5655
|
+
return z;
|
|
5656
5656
|
}
|
|
5657
|
-
const
|
|
5658
|
-
Fp:
|
|
5657
|
+
const bt = st(Ct.p, { sqrt: qn }), Kn = /* @__PURE__ */ Un(Ct, {
|
|
5658
|
+
Fp: bt,
|
|
5659
5659
|
endo: Gn
|
|
5660
|
-
}), Vn = /* @__PURE__ */ Wn(Kn, gn), zn = BigInt(0),
|
|
5661
|
-
for (let s = 0, e =
|
|
5660
|
+
}), Vn = /* @__PURE__ */ Wn(Kn, gn), zn = BigInt(0), Fe = BigInt(1), jn = BigInt(2), Yn = BigInt(7), Xn = BigInt(256), Jn = BigInt(113), Gr = [], qr = [], Kr = [];
|
|
5661
|
+
for (let s = 0, e = Fe, r = 1, t = 0; s < 24; s++) {
|
|
5662
5662
|
[r, t] = [t, (2 * r + 3 * t) % 5], Gr.push(2 * (5 * t + r)), qr.push((s + 1) * (s + 2) / 2 % 64);
|
|
5663
5663
|
let n = zn;
|
|
5664
5664
|
for (let i = 0; i < 7; i++)
|
|
5665
|
-
e = (e <<
|
|
5665
|
+
e = (e << Fe ^ (e >> Yn) * Jn) % Xn, e & jn && (n ^= Fe << (Fe << BigInt(i)) - Fe);
|
|
5666
5666
|
Kr.push(n);
|
|
5667
5667
|
}
|
|
5668
5668
|
const Vr = cn(Kr, !0), Zn = Vr[0], Qn = Vr[1], ir = (s, e, r) => r > 32 ? un(s, e, r) : ln(s, e, r), or = (s, e, r) => r > 32 ? hn(s, e, r) : dn(s, e, r);
|
|
@@ -5689,9 +5689,9 @@ function ei(s, e = 24) {
|
|
|
5689
5689
|
}
|
|
5690
5690
|
s[0] ^= Zn[t], s[1] ^= Qn[t];
|
|
5691
5691
|
}
|
|
5692
|
-
|
|
5692
|
+
Be(r);
|
|
5693
5693
|
}
|
|
5694
|
-
class
|
|
5694
|
+
class Pt {
|
|
5695
5695
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
5696
5696
|
constructor(e, r, t, n = !1, i = 24) {
|
|
5697
5697
|
P(this, "state");
|
|
@@ -5716,7 +5716,7 @@ class Ot {
|
|
|
5716
5716
|
zt(this.state32), ei(this.state32, this.rounds), zt(this.state32), this.posOut = 0, this.pos = 0;
|
|
5717
5717
|
}
|
|
5718
5718
|
update(e) {
|
|
5719
|
-
|
|
5719
|
+
$e(this), X(e);
|
|
5720
5720
|
const { blockLen: r, state: t } = this, n = e.length;
|
|
5721
5721
|
for (let i = 0; i < n; ) {
|
|
5722
5722
|
const o = Math.min(r - this.pos, n - i);
|
|
@@ -5734,7 +5734,7 @@ class Ot {
|
|
|
5734
5734
|
e[t] ^= r, r & 128 && t === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
|
|
5735
5735
|
}
|
|
5736
5736
|
writeInto(e) {
|
|
5737
|
-
|
|
5737
|
+
$e(this, !1), X(e), this.finish();
|
|
5738
5738
|
const r = this.state, { blockLen: t } = this;
|
|
5739
5739
|
for (let n = 0, i = e.length; n < i; ) {
|
|
5740
5740
|
this.posOut >= t && this.keccak();
|
|
@@ -5760,14 +5760,14 @@ class Ot {
|
|
|
5760
5760
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
5761
5761
|
}
|
|
5762
5762
|
destroy() {
|
|
5763
|
-
this.destroyed = !0,
|
|
5763
|
+
this.destroyed = !0, Be(this.state);
|
|
5764
5764
|
}
|
|
5765
5765
|
_cloneInto(e) {
|
|
5766
5766
|
const { blockLen: r, suffix: t, outputLen: n, rounds: i, enableXOF: o } = this;
|
|
5767
|
-
return e || (e = new
|
|
5767
|
+
return e || (e = new Pt(r, t, n, o, i)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = i, e.suffix = t, e.outputLen = n, e.enableXOF = o, e.destroyed = this.destroyed, e;
|
|
5768
5768
|
}
|
|
5769
5769
|
}
|
|
5770
|
-
const ti = (s, e, r, t = {}) => yr(() => new
|
|
5770
|
+
const ti = (s, e, r, t = {}) => yr(() => new Pt(e, s, r), t), ar = /* @__PURE__ */ ti(1, 136, 32), ri = 60;
|
|
5771
5771
|
class si {
|
|
5772
5772
|
constructor() {
|
|
5773
5773
|
this.jwks = null;
|
|
@@ -5835,11 +5835,11 @@ ${t.length}`
|
|
|
5835
5835
|
const o = ar(i), a = r.startsWith("0x") ? r.slice(2) : r;
|
|
5836
5836
|
if (a.length !== 130)
|
|
5837
5837
|
throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${a.length}`);
|
|
5838
|
-
const c = ni(a), l = c.slice(0, 32), u = c.slice(32, 64), p = c[64], g = p >= 27 ? p - 27 : p,
|
|
5838
|
+
const c = ni(a), l = c.slice(0, 32), u = c.slice(32, 64), p = c[64], g = p >= 27 ? p - 27 : p, y = new Vn.Signature(
|
|
5839
5839
|
cr(l),
|
|
5840
5840
|
cr(u)
|
|
5841
|
-
).addRecoveryBit(g).recoverPublicKey(o).toBytes(!1).slice(1),
|
|
5842
|
-
return "0x" +
|
|
5841
|
+
).addRecoveryBit(g).recoverPublicKey(o).toBytes(!1).slice(1), v = ar(y);
|
|
5842
|
+
return "0x" + Ge(v.slice(12));
|
|
5843
5843
|
}
|
|
5844
5844
|
}
|
|
5845
5845
|
function ni(s) {
|
|
@@ -5905,7 +5905,7 @@ const ci = /* @__PURE__ */ new Set([
|
|
|
5905
5905
|
"https://stg-cross-wallet-oauth.crosstoken.io",
|
|
5906
5906
|
"https://dev-cross-wallet-oauth.crosstoken.io"
|
|
5907
5907
|
]);
|
|
5908
|
-
class
|
|
5908
|
+
class Ie {
|
|
5909
5909
|
static generateRandom16Hex() {
|
|
5910
5910
|
const e = new Uint8Array(16);
|
|
5911
5911
|
return crypto.getRandomValues(e), Array.from(e, (r) => r.toString(16).padStart(2, "0")).join("");
|
|
@@ -5929,7 +5929,7 @@ class Ae {
|
|
|
5929
5929
|
* - Google 및 기타: originalNonce === jwt.nonce
|
|
5930
5930
|
*/
|
|
5931
5931
|
static async verifyIdTokenNonce(e, r) {
|
|
5932
|
-
const t =
|
|
5932
|
+
const t = Ie.parseJwtPayload(e), n = t.nonce, i = typeof t.iss == "string" ? t.iss : "(unknown)";
|
|
5933
5933
|
if (d.log("[CROSSx] nonce 검증 시작 —", {
|
|
5934
5934
|
iss: i,
|
|
5935
5935
|
nonceClaimType: typeof n,
|
|
@@ -5951,7 +5951,7 @@ class Ae {
|
|
|
5951
5951
|
return;
|
|
5952
5952
|
}
|
|
5953
5953
|
if (i.includes("appleid.apple.com")) {
|
|
5954
|
-
const o = await
|
|
5954
|
+
const o = await Ie.sha256Hex(r);
|
|
5955
5955
|
if (d.log("[CROSSx] Apple nonce 검증 —", {
|
|
5956
5956
|
expectedHashLength: o.length,
|
|
5957
5957
|
receivedHashLength: n.length,
|
|
@@ -5968,7 +5968,7 @@ class Ae {
|
|
|
5968
5968
|
}
|
|
5969
5969
|
openAuth(e) {
|
|
5970
5970
|
return new Promise((r, t) => {
|
|
5971
|
-
const n = Math.max(e.width ?? 500, 500), i = Math.max(e.height ?? 700, 700), o = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - i) / 2, c =
|
|
5971
|
+
const n = Math.max(e.width ?? 500, 500), i = Math.max(e.height ?? 700, 700), o = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - i) / 2, c = Ie.generateRandom16Hex(), l = Ie.generateRandom16Hex(), u = e.authUrl.includes("?") ? "&" : "?", p = `${e.authUrl}${u}state=${c}&nonce=${l}`;
|
|
5972
5972
|
d.log("[CROSSx] OAuth 팝업 열기 — state, nonce 생성 완료:", {
|
|
5973
5973
|
stateLength: c.length,
|
|
5974
5974
|
nonceLength: l.length,
|
|
@@ -5985,72 +5985,72 @@ class Ae {
|
|
|
5985
5985
|
}
|
|
5986
5986
|
const _ = setTimeout(() => {
|
|
5987
5987
|
d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), L(), t(new Error("Authentication timeout"));
|
|
5988
|
-
}, 5 * 60 * 1e3), x = 10,
|
|
5989
|
-
let
|
|
5990
|
-
const
|
|
5991
|
-
clearInterval(
|
|
5988
|
+
}, 5 * 60 * 1e3), x = 10, y = 30;
|
|
5989
|
+
let v = 0, A = null;
|
|
5990
|
+
const R = () => {
|
|
5991
|
+
clearInterval(k), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + y + "초간 대기합니다"), A = setTimeout(() => {
|
|
5992
5992
|
L(), t(new Error(
|
|
5993
5993
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
5994
5994
|
));
|
|
5995
|
-
},
|
|
5996
|
-
},
|
|
5997
|
-
|
|
5995
|
+
}, y * 1e3);
|
|
5996
|
+
}, k = setInterval(() => {
|
|
5997
|
+
v++;
|
|
5998
5998
|
try {
|
|
5999
|
-
g.closed && (
|
|
5999
|
+
g.closed && (v <= x ? R() : (L(), t(new Error("로그인이 취소되었습니다"))));
|
|
6000
6000
|
} catch {
|
|
6001
|
-
|
|
6001
|
+
R();
|
|
6002
6002
|
}
|
|
6003
6003
|
}, 1e3), L = () => {
|
|
6004
|
-
clearTimeout(_), clearInterval(
|
|
6005
|
-
},
|
|
6006
|
-
if (
|
|
6007
|
-
if (!ci.has(
|
|
6008
|
-
d.error("[CROSSx] postMessage origin이 허용 목록에 없음:",
|
|
6004
|
+
clearTimeout(_), clearInterval(k), A && clearTimeout(A), window.removeEventListener("message", D);
|
|
6005
|
+
}, D = (z) => {
|
|
6006
|
+
if (z.origin !== e.expectedOrigin) return;
|
|
6007
|
+
if (!ci.has(z.origin)) {
|
|
6008
|
+
d.error("[CROSSx] postMessage origin이 허용 목록에 없음:", z.origin), L(), t(new Error("Unauthorized OAuth origin"));
|
|
6009
6009
|
return;
|
|
6010
6010
|
}
|
|
6011
6011
|
L();
|
|
6012
|
-
const
|
|
6012
|
+
const Q = typeof z.data.status == "string", q = Q ? z.data.data ?? {} : z.data;
|
|
6013
6013
|
d.log("[CROSSx] OAuth postMessage 수신 —", {
|
|
6014
|
-
format:
|
|
6015
|
-
status:
|
|
6014
|
+
format: Q ? "wrapped" : "flat",
|
|
6015
|
+
status: Q ? z.data.status : "(flat)"
|
|
6016
6016
|
});
|
|
6017
|
-
const
|
|
6018
|
-
if (!
|
|
6017
|
+
const J = (q == null ? void 0 : q.state) ?? z.data.state;
|
|
6018
|
+
if (!J || J !== c) {
|
|
6019
6019
|
t(new Error("OAuth state mismatch — possible CSRF attack"));
|
|
6020
6020
|
return;
|
|
6021
6021
|
}
|
|
6022
|
-
if (
|
|
6023
|
-
d.error("[CROSSx] OAuth 실패:",
|
|
6022
|
+
if (Q && z.data.status !== "success") {
|
|
6023
|
+
d.error("[CROSSx] OAuth 실패:", q == null ? void 0 : q.error), t(new Error((q == null ? void 0 : q.error) || "Authentication failed"));
|
|
6024
6024
|
return;
|
|
6025
6025
|
}
|
|
6026
|
-
if (!
|
|
6027
|
-
d.error("[CROSSx] OAuth 실패:",
|
|
6026
|
+
if (!Q && (q != null && q.error)) {
|
|
6027
|
+
d.error("[CROSSx] OAuth 실패:", q.error), t(new Error(q.error || "Authentication failed"));
|
|
6028
6028
|
return;
|
|
6029
6029
|
}
|
|
6030
|
-
const
|
|
6030
|
+
const te = q == null ? void 0 : q.idToken, G = q == null ? void 0 : q.accessToken, B = G ?? te, H = (q == null ? void 0 : q.email) || void 0;
|
|
6031
6031
|
if (d.log("[CROSSx] OAuth 토큰 수신:", {
|
|
6032
|
-
hasAccessToken: !!
|
|
6033
|
-
hasIdToken: !!
|
|
6034
|
-
hasEmail: !!
|
|
6035
|
-
}), !
|
|
6036
|
-
d.error("[CROSSx] 토큰을 찾을 수 없음:",
|
|
6032
|
+
hasAccessToken: !!G,
|
|
6033
|
+
hasIdToken: !!te,
|
|
6034
|
+
hasEmail: !!H
|
|
6035
|
+
}), !B) {
|
|
6036
|
+
d.error("[CROSSx] 토큰을 찾을 수 없음:", z.data), t(new Error("Token not found in response"));
|
|
6037
6037
|
return;
|
|
6038
6038
|
}
|
|
6039
|
-
const m = { token:
|
|
6040
|
-
|
|
6039
|
+
const m = { token: B, email: H }, w = (T) => {
|
|
6040
|
+
Ie.verifyIdTokenNonce(T, l).then(() => r(m)).catch((O) => {
|
|
6041
6041
|
d.error("[CROSSx] nonce 검증 실패:", O), t(O instanceof Error ? O : new Error("nonce verification failed"));
|
|
6042
6042
|
});
|
|
6043
6043
|
};
|
|
6044
|
-
|
|
6044
|
+
G ? G.split(".").length === 3 ? w(G) : te ? w(te) : (d.warn(
|
|
6045
6045
|
"[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
|
|
6046
6046
|
"서버 측 nonce 검증이 필요합니다."
|
|
6047
|
-
), r(m)) :
|
|
6047
|
+
), r(m)) : te ? w(te) : t(new Error("Token not found in response"));
|
|
6048
6048
|
};
|
|
6049
|
-
window.addEventListener("message",
|
|
6049
|
+
window.addEventListener("message", D);
|
|
6050
6050
|
});
|
|
6051
6051
|
}
|
|
6052
6052
|
}
|
|
6053
|
-
const
|
|
6053
|
+
const Ue = "crossx_wallet_data", Oe = "crossx_mock_pin_hash";
|
|
6054
6054
|
class li {
|
|
6055
6055
|
constructor(e, r) {
|
|
6056
6056
|
this.storage = e, this.pinStore = r ?? null;
|
|
@@ -6064,13 +6064,13 @@ class li {
|
|
|
6064
6064
|
async checkWallet() {
|
|
6065
6065
|
if (this.migrateScenario !== void 0)
|
|
6066
6066
|
return d.log("[Mock] checkWallet → migration_required"), "migration_required";
|
|
6067
|
-
const r = await this.storage.get(
|
|
6067
|
+
const r = await this.storage.get(Ue) ? "exists" : "not_found";
|
|
6068
6068
|
return d.log(`[Mock] checkWallet → ${r}`), r;
|
|
6069
6069
|
}
|
|
6070
6070
|
async getOrCreateWallet(e) {
|
|
6071
6071
|
var r;
|
|
6072
6072
|
try {
|
|
6073
|
-
const t = await this.storage.get(
|
|
6073
|
+
const t = await this.storage.get(Ue);
|
|
6074
6074
|
if (t) return t;
|
|
6075
6075
|
const n = {
|
|
6076
6076
|
id: e,
|
|
@@ -6078,16 +6078,16 @@ class li {
|
|
|
6078
6078
|
derivationPath: "m/44'/60'/0'/0/0",
|
|
6079
6079
|
createdAt: Date.now()
|
|
6080
6080
|
};
|
|
6081
|
-
await this.storage.set(
|
|
6081
|
+
await this.storage.set(Ue, n);
|
|
6082
6082
|
const i = (r = this.pinStore) == null ? void 0 : r.get();
|
|
6083
|
-
return i && (await this.storage.set(
|
|
6083
|
+
return i && (await this.storage.set(Oe, i), d.log("[Mock] 지갑 생성 — PIN 저장됨")), n;
|
|
6084
6084
|
} catch (t) {
|
|
6085
6085
|
throw new f(h.WALLET_CREATION_FAILED, "지갑 생성에 실패했습니다", t);
|
|
6086
6086
|
}
|
|
6087
6087
|
}
|
|
6088
6088
|
/** GET /mnemonic/addresses 모킹 — PIN 불필요, 캐시된 주소 반환 */
|
|
6089
6089
|
async getAddresses(e) {
|
|
6090
|
-
const r = await this.storage.get(
|
|
6090
|
+
const r = await this.storage.get(Ue);
|
|
6091
6091
|
return r ? [{ address: r.address, index: 0 }] : [];
|
|
6092
6092
|
}
|
|
6093
6093
|
async getAddress(e, r) {
|
|
@@ -6122,8 +6122,8 @@ class li {
|
|
|
6122
6122
|
var t;
|
|
6123
6123
|
if (d.log("[Mock] verifyPin"), this.pinScenario === "wrong")
|
|
6124
6124
|
return !1;
|
|
6125
|
-
const r = await this.storage.get(
|
|
6126
|
-
return r && r !== e ? !1 : (r || await this.storage.set(
|
|
6125
|
+
const r = await this.storage.get(Oe);
|
|
6126
|
+
return r && r !== e ? !1 : (r || await this.storage.set(Oe, e), (t = this.pinStore) == null || t.set(e), d.log("[Mock] verifyPin → 성공"), !0);
|
|
6127
6127
|
}
|
|
6128
6128
|
/**
|
|
6129
6129
|
* POST /mnemonic/change-password 모킹
|
|
@@ -6133,10 +6133,10 @@ class li {
|
|
|
6133
6133
|
var i;
|
|
6134
6134
|
if (d.log("[Mock] changePin"), this.pinScenario === "wrong")
|
|
6135
6135
|
throw new f(h.PIN_WRONG, "Incorrect PIN.");
|
|
6136
|
-
const t = (i = this.pinStore) == null ? void 0 : i.get(), n = await this.storage.get(
|
|
6136
|
+
const t = (i = this.pinStore) == null ? void 0 : i.get(), n = await this.storage.get(Oe);
|
|
6137
6137
|
if (n && t && n !== t)
|
|
6138
6138
|
throw new f(h.PIN_WRONG, "Incorrect PIN.");
|
|
6139
|
-
await this.storage.set(
|
|
6139
|
+
await this.storage.set(Oe, r), d.log("[Mock] changePin 완료");
|
|
6140
6140
|
}
|
|
6141
6141
|
async migrateWallet(e, r) {
|
|
6142
6142
|
var i;
|
|
@@ -6167,9 +6167,9 @@ class li {
|
|
|
6167
6167
|
derivationPath: "m/44'/60'/0'/0/0",
|
|
6168
6168
|
createdAt: Date.now()
|
|
6169
6169
|
};
|
|
6170
|
-
await this.storage.set(
|
|
6170
|
+
await this.storage.set(Ue, t);
|
|
6171
6171
|
const n = (i = this.pinStore) == null ? void 0 : i.get();
|
|
6172
|
-
return n && (await this.storage.set(
|
|
6172
|
+
return n && (await this.storage.set(Oe, n), d.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
|
|
6173
6173
|
}
|
|
6174
6174
|
/**
|
|
6175
6175
|
* POST /mnemonic/share-c 모킹
|
|
@@ -6196,7 +6196,7 @@ class li {
|
|
|
6196
6196
|
).join("");
|
|
6197
6197
|
}
|
|
6198
6198
|
}
|
|
6199
|
-
class
|
|
6199
|
+
class Te {
|
|
6200
6200
|
constructor(e, r, t, n, i) {
|
|
6201
6201
|
this._refreshPromise = null, this._walletStatusCache = null, this.adapterConfig = e, this.projectId = e.projectId, this.storage = r, this.transport = t, this.tokenStore = n, this.pinStore = i ?? null;
|
|
6202
6202
|
}
|
|
@@ -6273,20 +6273,20 @@ class Ie {
|
|
|
6273
6273
|
url: o,
|
|
6274
6274
|
method: e
|
|
6275
6275
|
});
|
|
6276
|
-
const
|
|
6277
|
-
if (
|
|
6276
|
+
const y = Te.mapGatewayError(_.code, _.data);
|
|
6277
|
+
if (y === h.AUTH_NOT_AUTHENTICATED && !n && this._onTokenRefresh) {
|
|
6278
6278
|
if (d.warn("[CROSSx] Gateway -10002 감지 — 토큰 갱신 후 재시도"), await this.deduplicatedRefresh())
|
|
6279
6279
|
return this.request(e, r, t, !0);
|
|
6280
6280
|
throw new f(h.SESSION_EXPIRED, "인증 세션이 만료되었습니다. 다시 로그인해 주세요.");
|
|
6281
6281
|
}
|
|
6282
|
-
if (
|
|
6282
|
+
if (y === h.USER_NOT_FOUND)
|
|
6283
6283
|
throw d.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (c = this._onUnauthorized) == null || c.call(this), new f(
|
|
6284
6284
|
h.USER_NOT_FOUND,
|
|
6285
|
-
|
|
6285
|
+
Te.getGatewayErrorMessage(_.code, x)
|
|
6286
6286
|
);
|
|
6287
|
-
const
|
|
6288
|
-
let
|
|
6289
|
-
throw
|
|
6287
|
+
const v = y === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : y, A = v === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Te.getGatewayErrorMessage(_.code, x), R = _.data;
|
|
6288
|
+
let k;
|
|
6289
|
+
throw y === h.PIN_LOCKED ? k = Te.extractLockDetails(R) : y === h.ADDRESS_LIMIT_EXCEEDED ? k = { limit: xt, raw: R } : k = R ?? void 0, new f(v, A, k);
|
|
6290
6290
|
}
|
|
6291
6291
|
return d.log("[CROSSx] Wallet Gateway API 성공:", { code: _.code, url: o, method: e }), _.data ?? _;
|
|
6292
6292
|
}
|
|
@@ -6303,16 +6303,16 @@ class Ie {
|
|
|
6303
6303
|
);
|
|
6304
6304
|
}
|
|
6305
6305
|
if ((u = g.response) != null && u.data) {
|
|
6306
|
-
const x = g.response.data,
|
|
6306
|
+
const x = g.response.data, y = x.message || x.data || "API 요청에 실패했습니다", v = x.code || "UNKNOWN";
|
|
6307
6307
|
throw d.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
|
|
6308
|
-
code:
|
|
6309
|
-
message:
|
|
6308
|
+
code: v,
|
|
6309
|
+
message: y,
|
|
6310
6310
|
url: o,
|
|
6311
6311
|
method: e,
|
|
6312
6312
|
status: (p = g.response) == null ? void 0 : p.status
|
|
6313
6313
|
}), new f(
|
|
6314
6314
|
h.UNKNOWN_ERROR,
|
|
6315
|
-
`Wallet Gateway 오류 (${
|
|
6315
|
+
`Wallet Gateway 오류 (${v}): ${y}`
|
|
6316
6316
|
);
|
|
6317
6317
|
}
|
|
6318
6318
|
throw g;
|
|
@@ -6603,7 +6603,7 @@ class Ie {
|
|
|
6603
6603
|
case -10025:
|
|
6604
6604
|
return h.INVALID_APP_TYPE;
|
|
6605
6605
|
case -10028:
|
|
6606
|
-
return
|
|
6606
|
+
return Te.hasLockInfo(r) ? h.PIN_LOCKED : h.PIN_WRONG;
|
|
6607
6607
|
case -10029:
|
|
6608
6608
|
return h.PIN_INVALID;
|
|
6609
6609
|
case -10031:
|
|
@@ -6674,7 +6674,7 @@ class Ie {
|
|
|
6674
6674
|
case -10033:
|
|
6675
6675
|
return "User not found. You have been signed out.";
|
|
6676
6676
|
case -10036:
|
|
6677
|
-
return `Account limit reached. Maximum ${
|
|
6677
|
+
return `Account limit reached. Maximum ${xt} accounts allowed.`;
|
|
6678
6678
|
case -10040:
|
|
6679
6679
|
return "HMAC signature header is required.";
|
|
6680
6680
|
case -10041:
|
|
@@ -6791,7 +6791,7 @@ class di {
|
|
|
6791
6791
|
(t = (r = this.inner).setTokenRefresher) == null || t.call(r, e);
|
|
6792
6792
|
}
|
|
6793
6793
|
}
|
|
6794
|
-
class
|
|
6794
|
+
class We {
|
|
6795
6795
|
constructor(e, r) {
|
|
6796
6796
|
this.cache = /* @__PURE__ */ new Map(), this.loadedAt = 0, this.usingFallback = !1, this._fetchPromise = null, this.adapterConfig = e, this.projectId = e.projectId, this.transport = r;
|
|
6797
6797
|
}
|
|
@@ -6812,7 +6812,7 @@ class He {
|
|
|
6812
6812
|
const r = e.data.chains;
|
|
6813
6813
|
return this.populateCache(r, !1), r;
|
|
6814
6814
|
} catch {
|
|
6815
|
-
const e =
|
|
6815
|
+
const e = We.fallbackChains();
|
|
6816
6816
|
return this.populateCache(e, !0), e;
|
|
6817
6817
|
}
|
|
6818
6818
|
}
|
|
@@ -6848,13 +6848,13 @@ class He {
|
|
|
6848
6848
|
if (e.code < 0) {
|
|
6849
6849
|
const r = typeof e.data == "string" ? e.data : e.message ?? "체인 레지스트리 요청에 실패했습니다";
|
|
6850
6850
|
throw new f(
|
|
6851
|
-
|
|
6851
|
+
We.mapErrorCode(e.code),
|
|
6852
6852
|
r
|
|
6853
6853
|
);
|
|
6854
6854
|
}
|
|
6855
6855
|
}
|
|
6856
6856
|
fallbackOrThrow(e) {
|
|
6857
|
-
const r =
|
|
6857
|
+
const r = We.fallbackChains().find(
|
|
6858
6858
|
(t) => t.chainId === e
|
|
6859
6859
|
);
|
|
6860
6860
|
if (r) return r;
|
|
@@ -6864,7 +6864,7 @@ class He {
|
|
|
6864
6864
|
);
|
|
6865
6865
|
}
|
|
6866
6866
|
static fallbackChains() {
|
|
6867
|
-
return Object.values(
|
|
6867
|
+
return Object.values(tt).map((e) => ({
|
|
6868
6868
|
chainId: e.caipId,
|
|
6869
6869
|
rpcUrl: e.rpcUrl
|
|
6870
6870
|
}));
|
|
@@ -6888,7 +6888,7 @@ class He {
|
|
|
6888
6888
|
}
|
|
6889
6889
|
}
|
|
6890
6890
|
}
|
|
6891
|
-
const lr = "__crossx-confirm-style",
|
|
6891
|
+
const lr = "__crossx-confirm-style", ee = "__crossx-confirm-overlay", ui = {
|
|
6892
6892
|
light: {
|
|
6893
6893
|
bg: "#FFFFFF",
|
|
6894
6894
|
border: "rgba(18,18,18,0.05)",
|
|
@@ -6980,7 +6980,7 @@ function dr(s, e) {
|
|
|
6980
6980
|
const hi = `
|
|
6981
6981
|
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap');
|
|
6982
6982
|
|
|
6983
|
-
#${
|
|
6983
|
+
#${ee} {
|
|
6984
6984
|
position: fixed;
|
|
6985
6985
|
inset: 0;
|
|
6986
6986
|
z-index: 2147483647;
|
|
@@ -8366,7 +8366,18 @@ button.__crossx-connect-other-block:active {
|
|
|
8366
8366
|
}
|
|
8367
8367
|
/* ── Mobile bottom sheet ───────────────────────────────────── */
|
|
8368
8368
|
@media (max-width: 480px) {
|
|
8369
|
-
#${
|
|
8369
|
+
#${ee} {
|
|
8370
|
+
align-items: flex-end;
|
|
8371
|
+
/*
|
|
8372
|
+
* iOS Safari 는 soft keyboard 가 떠도 layout viewport 를 축소시키지 않아
|
|
8373
|
+
* \`position: fixed; inset: 0\` 인 overlay 의 하단 docking card 가 키보드에
|
|
8374
|
+
* 가려집니다. mountOverlay 의 visualViewport listener 가 매 resize 마다
|
|
8375
|
+
* layoutH - visualBottom 을 \`--cx-keyboard-inset\` 으로 publish 하므로,
|
|
8376
|
+
* 여기서 padding-bottom 으로 받아 카드 정렬축을 키보드 위로 끌어올립니다.
|
|
8377
|
+
* 키보드 닫히면 inset=0 으로 자동 복귀.
|
|
8378
|
+
*/
|
|
8379
|
+
padding-bottom: var(--cx-keyboard-inset, 0px);
|
|
8380
|
+
}
|
|
8370
8381
|
.__crossx-safe-area-fill {
|
|
8371
8382
|
display: block;
|
|
8372
8383
|
position: fixed;
|
|
@@ -8580,7 +8591,7 @@ button.__crossx-connect-other-block:active {
|
|
|
8580
8591
|
|
|
8581
8592
|
/* ── Landscape for signing/transaction modals ──────────── */
|
|
8582
8593
|
@media (orientation: landscape) and (max-height: 500px) {
|
|
8583
|
-
#${
|
|
8594
|
+
#${ee} { align-items: center !important; overflow: hidden; }
|
|
8584
8595
|
.__crossx-card--send-tx,
|
|
8585
8596
|
.__crossx-card--sign-tx,
|
|
8586
8597
|
.__crossx-card--sign-msg,
|
|
@@ -8829,8 +8840,6 @@ button.__crossx-connect-other-block:active {
|
|
|
8829
8840
|
letter-spacing: 0;
|
|
8830
8841
|
-webkit-tap-highlight-color: transparent;
|
|
8831
8842
|
transition: background 0.12s, box-shadow 0.12s;
|
|
8832
|
-
-webkit-text-security: disc;
|
|
8833
|
-
text-security: disc;
|
|
8834
8843
|
}
|
|
8835
8844
|
.__crossx-pin6-box:focus {
|
|
8836
8845
|
background: var(--cx-input-border);
|
|
@@ -9106,7 +9115,7 @@ function ae() {
|
|
|
9106
9115
|
s || (s = document.createElement("style"), s.id = lr, document.head.appendChild(s)), s.textContent = hi;
|
|
9107
9116
|
}
|
|
9108
9117
|
function pi() {
|
|
9109
|
-
const s = `#${
|
|
9118
|
+
const s = `#${ee}`, e = (t) => {
|
|
9110
9119
|
var n, i;
|
|
9111
9120
|
(i = (n = t.target) == null ? void 0 : n.closest) != null && i.call(n, s) && t.stopImmediatePropagation();
|
|
9112
9121
|
}, r = (t) => {
|
|
@@ -9120,37 +9129,52 @@ function pi() {
|
|
|
9120
9129
|
function ce(s) {
|
|
9121
9130
|
const e = s.querySelector(".__crossx-card");
|
|
9122
9131
|
if (e) {
|
|
9123
|
-
const
|
|
9124
|
-
if (
|
|
9125
|
-
const
|
|
9126
|
-
s.style.setProperty("--cx-bg",
|
|
9127
|
-
const
|
|
9128
|
-
|
|
9132
|
+
const a = (e.getAttribute("style") ?? "").match(/--cx-bg:\s*([^;]+)/);
|
|
9133
|
+
if (a) {
|
|
9134
|
+
const c = a[1].trim();
|
|
9135
|
+
s.style.setProperty("--cx-bg", c);
|
|
9136
|
+
const l = document.createElement("div");
|
|
9137
|
+
l.className = "__crossx-safe-area-fill", l.style.background = c, s.appendChild(l);
|
|
9129
9138
|
}
|
|
9130
9139
|
}
|
|
9131
|
-
const r = (
|
|
9132
|
-
for (const
|
|
9133
|
-
s.addEventListener(
|
|
9140
|
+
const r = (o) => o.stopPropagation();
|
|
9141
|
+
for (const o of ["pointerdown", "pointerup", "mousedown", "mouseup", "click"])
|
|
9142
|
+
s.addEventListener(o, r);
|
|
9134
9143
|
s.setAttribute("data-vaul-no-drag", "");
|
|
9135
|
-
for (const
|
|
9136
|
-
s.addEventListener(
|
|
9137
|
-
s.addEventListener("touchmove", (
|
|
9138
|
-
|
|
9139
|
-
let
|
|
9140
|
-
for (;
|
|
9141
|
-
const
|
|
9142
|
-
if ((
|
|
9144
|
+
for (const o of ["touchstart", "touchend"])
|
|
9145
|
+
s.addEventListener(o, r);
|
|
9146
|
+
s.addEventListener("touchmove", (o) => {
|
|
9147
|
+
o.stopPropagation();
|
|
9148
|
+
let a = o.target;
|
|
9149
|
+
for (; a && a !== s; ) {
|
|
9150
|
+
const c = window.getComputedStyle(a);
|
|
9151
|
+
if ((c.overflowY === "auto" || c.overflowY === "scroll") && a.scrollHeight > a.clientHeight)
|
|
9143
9152
|
return;
|
|
9144
|
-
|
|
9153
|
+
a = a.parentElement;
|
|
9145
9154
|
}
|
|
9146
|
-
|
|
9155
|
+
o.preventDefault();
|
|
9147
9156
|
}, { passive: !1 });
|
|
9148
|
-
const t = pi(), n = s.remove.bind(s);
|
|
9157
|
+
const t = pi(), n = _i(s), i = s.remove.bind(s);
|
|
9149
9158
|
s.remove = () => {
|
|
9150
|
-
t(),
|
|
9159
|
+
n(), t(), i();
|
|
9151
9160
|
}, document.body.appendChild(s);
|
|
9152
9161
|
}
|
|
9153
9162
|
function _i(s) {
|
|
9163
|
+
if (typeof window > "u") return () => {
|
|
9164
|
+
};
|
|
9165
|
+
const e = window.visualViewport;
|
|
9166
|
+
if (!e) return () => {
|
|
9167
|
+
};
|
|
9168
|
+
let r = -1;
|
|
9169
|
+
const t = () => {
|
|
9170
|
+
const n = window.innerHeight, i = e.offsetTop + e.height, o = Math.max(0, Math.round(n - i));
|
|
9171
|
+
o !== r && (r = o, s.style.setProperty("--cx-keyboard-inset", `${o}px`));
|
|
9172
|
+
};
|
|
9173
|
+
return t(), e.addEventListener("resize", t), e.addEventListener("scroll", t), () => {
|
|
9174
|
+
e.removeEventListener("resize", t), e.removeEventListener("scroll", t), s.style.removeProperty("--cx-keyboard-inset");
|
|
9175
|
+
};
|
|
9176
|
+
}
|
|
9177
|
+
function fi(s) {
|
|
9154
9178
|
const e = Array.from(s.querySelectorAll(".__crossx-amount-tip"));
|
|
9155
9179
|
if (!e.length) return;
|
|
9156
9180
|
const r = document.createElement("div");
|
|
@@ -9174,9 +9198,9 @@ function _i(s) {
|
|
|
9174
9198
|
o.target.closest(".__crossx-amount-tip") || i();
|
|
9175
9199
|
}, { passive: !0 });
|
|
9176
9200
|
}
|
|
9177
|
-
const
|
|
9201
|
+
const gi = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
9178
9202
|
function Ce() {
|
|
9179
|
-
if (
|
|
9203
|
+
if (gi()) {
|
|
9180
9204
|
const e = window.scrollY;
|
|
9181
9205
|
return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
|
|
9182
9206
|
document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.body.style.right = "", window.scrollTo(0, e);
|
|
@@ -9195,10 +9219,10 @@ function zr(s, e = "CROSS", r = 18, t = 6) {
|
|
|
9195
9219
|
try {
|
|
9196
9220
|
const n = BigInt(s);
|
|
9197
9221
|
if (n === 0n) return null;
|
|
9198
|
-
const i =
|
|
9222
|
+
const i = Et(n, r, t);
|
|
9199
9223
|
if (i === "0") return null;
|
|
9200
|
-
const o =
|
|
9201
|
-
return
|
|
9224
|
+
const o = vt(n, r);
|
|
9225
|
+
return St(`${i} ${e}`, `${o} ${e}`);
|
|
9202
9226
|
} catch {
|
|
9203
9227
|
return null;
|
|
9204
9228
|
}
|
|
@@ -9230,20 +9254,20 @@ function jr(s) {
|
|
|
9230
9254
|
const e = parseInt(s.split(":")[1] ?? "", 10);
|
|
9231
9255
|
return !isNaN(e) && ur[e] ? ur[e] : s;
|
|
9232
9256
|
}
|
|
9233
|
-
function
|
|
9257
|
+
function vt(s, e) {
|
|
9234
9258
|
if (s === 0n) return "0";
|
|
9235
9259
|
const r = 10n ** BigInt(e), t = s / r, i = (s % r).toString().padStart(e, "0").replace(/0+$/, "");
|
|
9236
9260
|
return i ? `${t}.${i}` : `${t}`;
|
|
9237
9261
|
}
|
|
9238
|
-
function
|
|
9239
|
-
return s === e ?
|
|
9262
|
+
function St(s, e) {
|
|
9263
|
+
return s === e ? S(s) : `<span class="__crossx-amount-tip" data-full="${S(e)}">${S(s)}</span>`;
|
|
9240
9264
|
}
|
|
9241
|
-
function
|
|
9265
|
+
function Et(s, e, r) {
|
|
9242
9266
|
if (s === 0n) return "0";
|
|
9243
9267
|
const t = 10n ** BigInt(e), n = s / t, a = (s % t).toString().padStart(e, "0").slice(0, r).replace(/0+$/, "");
|
|
9244
9268
|
return a ? `${n}.${a}` : `${n}`;
|
|
9245
9269
|
}
|
|
9246
|
-
function
|
|
9270
|
+
function pt(s) {
|
|
9247
9271
|
try {
|
|
9248
9272
|
const e = BigInt(s), r = e / 1000000000n, n = (e % 1000000000n).toString().padStart(9, "0").slice(0, 2).replace(/0+$/, "");
|
|
9249
9273
|
return n ? `${r}.${n}` : `${r}`;
|
|
@@ -9251,28 +9275,28 @@ function ht(s) {
|
|
|
9251
9275
|
return s;
|
|
9252
9276
|
}
|
|
9253
9277
|
}
|
|
9254
|
-
function
|
|
9278
|
+
function xi(s) {
|
|
9255
9279
|
try {
|
|
9256
9280
|
return BigInt(s).toLocaleString();
|
|
9257
9281
|
} catch {
|
|
9258
9282
|
return s;
|
|
9259
9283
|
}
|
|
9260
9284
|
}
|
|
9261
|
-
function
|
|
9285
|
+
function wi(s, e) {
|
|
9262
9286
|
const { gasLimit: r, gasPrice: t, maxFeePerGas: n, maxPriorityFeePerGas: i, nativeSymbol: o = "ETH", nativeDecimals: a = 18 } = s;
|
|
9263
9287
|
if (!r) return null;
|
|
9264
9288
|
try {
|
|
9265
|
-
const c = BigInt(r), l =
|
|
9289
|
+
const c = BigInt(r), l = xi(r);
|
|
9266
9290
|
if (n) {
|
|
9267
9291
|
const u = c * BigInt(n);
|
|
9268
9292
|
return {
|
|
9269
9293
|
isDynamic: !0,
|
|
9270
|
-
estTxFee:
|
|
9271
|
-
`${
|
|
9272
|
-
`${
|
|
9294
|
+
estTxFee: St(
|
|
9295
|
+
`${Et(u, a, e)} ${o}`,
|
|
9296
|
+
`${vt(u, a)} ${o}`
|
|
9273
9297
|
),
|
|
9274
|
-
maxFeeGwei:
|
|
9275
|
-
maxPriorityFeeGwei: i ?
|
|
9298
|
+
maxFeeGwei: pt(n),
|
|
9299
|
+
maxPriorityFeeGwei: i ? pt(i) : void 0,
|
|
9276
9300
|
gasLimitFormatted: l
|
|
9277
9301
|
};
|
|
9278
9302
|
}
|
|
@@ -9280,11 +9304,11 @@ function xi(s, e) {
|
|
|
9280
9304
|
const u = c * BigInt(t);
|
|
9281
9305
|
return {
|
|
9282
9306
|
isDynamic: !1,
|
|
9283
|
-
estTxFee:
|
|
9284
|
-
`${
|
|
9285
|
-
`${
|
|
9307
|
+
estTxFee: St(
|
|
9308
|
+
`${Et(u, a, e)} ${o}`,
|
|
9309
|
+
`${vt(u, a)} ${o}`
|
|
9286
9310
|
),
|
|
9287
|
-
gasPriceGwei:
|
|
9311
|
+
gasPriceGwei: pt(t),
|
|
9288
9312
|
gasLimitFormatted: l
|
|
9289
9313
|
};
|
|
9290
9314
|
}
|
|
@@ -9294,27 +9318,27 @@ function xi(s, e) {
|
|
|
9294
9318
|
}
|
|
9295
9319
|
}
|
|
9296
9320
|
function Yr(s, e, r) {
|
|
9297
|
-
const t =
|
|
9298
|
-
if (!t) return
|
|
9299
|
-
let n =
|
|
9300
|
-
return t.isDynamic ? (t.maxPriorityFeeGwei !== void 0 && (n +=
|
|
9321
|
+
const t = wi(s, e);
|
|
9322
|
+
if (!t) return Z((r == null ? void 0 : r.label_estimated_fee) ?? "Estimated fee", "<span>—</span>");
|
|
9323
|
+
let n = Z((r == null ? void 0 : r.label_est_tx_fee) ?? "Est. Tx Fee", `<span>${t.estTxFee}</span>`);
|
|
9324
|
+
return t.isDynamic ? (t.maxPriorityFeeGwei !== void 0 && (n += Z((r == null ? void 0 : r.label_max_priority_fee) ?? "Max Priority Fee", `<span>${t.maxPriorityFeeGwei} Gwei</span>`)), t.maxFeeGwei !== void 0 && (n += Z((r == null ? void 0 : r.label_max_gas_fee) ?? "Max Gas Fee", `<span>${t.maxFeeGwei} Gwei</span>`))) : t.gasPriceGwei !== void 0 && (n += Z((r == null ? void 0 : r.label_gas_price) ?? "Gas Price", `<span>${t.gasPriceGwei} Gwei</span>`)), t.gasLimitFormatted && (n += Z((r == null ? void 0 : r.label_gas_limit) ?? "Gas Limit", `<span>${t.gasLimitFormatted}</span>`)), n;
|
|
9301
9325
|
}
|
|
9302
9326
|
const we = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
9303
9327
|
<rect x="9" y="9" width="13" height="13" rx="2"/>
|
|
9304
9328
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
|
9305
|
-
</svg>`,
|
|
9329
|
+
</svg>`, ne = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
|
9306
9330
|
<line x1="18" y1="6" x2="6" y2="18"/>
|
|
9307
9331
|
<line x1="6" y1="6" x2="18" y2="18"/>
|
|
9308
|
-
</svg>`,
|
|
9332
|
+
</svg>`, mi = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9309
9333
|
<circle cx="20" cy="20" r="20" fill="#00D5AA"/>
|
|
9310
9334
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z" fill="#121212"/>
|
|
9311
|
-
</svg>`,
|
|
9312
|
-
[
|
|
9313
|
-
[
|
|
9314
|
-
[
|
|
9315
|
-
}, Xr = '<path d="M22.6667 11.8333V10.1667C22.6667 9.2475 21.9192 8.5 21.0001 8.5H10.1667C8.78841 8.5 7.66675 9.62167 7.66675 11V21C7.66675 22.8342 9.16175 23.5 10.1667 23.5H22.6667C23.5859 23.5 24.3334 22.7525 24.3334 21.8333V13.5C24.3334 12.5808 23.5859 11.8333 22.6667 11.8333ZM21.0001 19.3333H19.3334V16H21.0001V19.3333ZM10.1667 11.8333C9.95218 11.8237 9.74959 11.7317 9.60114 11.5765C9.4527 11.4213 9.36986 11.2148 9.36986 11C9.36986 10.7852 9.4527 10.5787 9.60114 10.4235C9.74959 10.2683 9.95218 10.1763 10.1667 10.1667H21.0001V11.8333H10.1667Z"/>',
|
|
9335
|
+
</svg>`, yi = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 318.6 318.6" aria-hidden="true"><style>.st1,.st6{fill:#e4761b;stroke:#e4761b;stroke-linecap:round;stroke-linejoin:round}.st6{fill:#f6851b;stroke:#f6851b}</style><path fill="#e2761b" stroke="#e2761b" stroke-linecap="round" stroke-linejoin="round" d="m274.1 35.5-99.5 73.9L193 65.8z"/><path d="m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z" class="st1"/><path d="m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z" class="st1"/><path fill="#d7c1b3" stroke="#d7c1b3" stroke-linecap="round" stroke-linejoin="round" d="m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"/><path fill="#233447" stroke="#233447" stroke-linecap="round" stroke-linejoin="round" d="m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"/><path fill="#cd6116" stroke="#cd6116" stroke-linecap="round" stroke-linejoin="round" d="m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"/><path fill="#e4751f" stroke="#e4751f" stroke-linecap="round" stroke-linejoin="round" d="m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"/><path d="m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z" class="st6"/><path fill="#c0ad9e" stroke="#c0ad9e" stroke-linecap="round" stroke-linejoin="round" d="m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"/><path fill="#161616" stroke="#161616" stroke-linecap="round" stroke-linejoin="round" d="m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"/><path fill="#763d16" stroke="#763d16" stroke-linecap="round" stroke-linejoin="round" d="m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"/><path d="m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z" class="st6"/></svg>', bi = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 126.611 126.611" aria-hidden="true"><polygon fill="#F3BA2F" points="38.171,53.203 62.759,28.616 87.36,53.216 101.667,38.909 62.759,0 23.864,38.896 "/><rect x="3.644" y="53.188" transform="matrix(0.7071 0.7071 -0.7071 0.7071 48.7933 8.8106)" fill="#F3BA2F" width="20.233" height="20.234"/><polygon fill="#F3BA2F" points="38.171,73.408 62.759,97.995 87.359,73.396 101.674,87.695 101.667,87.703 62.759,126.611 23.863,87.716 23.843,87.696 "/><rect x="101.64" y="53.189" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 235.5457 29.0503)" fill="#F3BA2F" width="20.234" height="20.233"/><polygon fill="#F3BA2F" points="77.271,63.298 77.277,63.298 62.759,48.78 52.03,59.509 52.029,59.509 50.797,60.742 48.254,63.285 48.254,63.285 48.234,63.305 48.254,63.326 62.759,77.831 77.277,63.313 77.284,63.305 "/></svg>', vi = '<svg width="16" height="16" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="20" cy="20" r="20" fill="#00D5AA"/><path fill-rule="evenodd" clip-rule="evenodd" d="M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z" fill="#121212"/></svg>', Si = {
|
|
9336
|
+
[He.MetaMask]: yi,
|
|
9337
|
+
[He.Binance]: bi,
|
|
9338
|
+
[He.CROSSx]: vi
|
|
9339
|
+
}, Xr = '<path d="M22.6667 11.8333V10.1667C22.6667 9.2475 21.9192 8.5 21.0001 8.5H10.1667C8.78841 8.5 7.66675 9.62167 7.66675 11V21C7.66675 22.8342 9.16175 23.5 10.1667 23.5H22.6667C23.5859 23.5 24.3334 22.7525 24.3334 21.8333V13.5C24.3334 12.5808 23.5859 11.8333 22.6667 11.8333ZM21.0001 19.3333H19.3334V16H21.0001V19.3333ZM10.1667 11.8333C9.95218 11.8237 9.74959 11.7317 9.60114 11.5765C9.4527 11.4213 9.36986 11.2148 9.36986 11C9.36986 10.7852 9.4527 10.5787 9.60114 10.4235C9.74959 10.2683 9.95218 10.1763 10.1667 10.1667H21.0001V11.8333H10.1667Z"/>', Lt = `<svg width="20" height="20" viewBox="0 0 32 32" fill="currentColor" xmlns="http://www.w3.org/2000/svg">${Xr}</svg>`, Ei = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
9316
9340
|
<path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="var(--cx-error)"/>
|
|
9317
|
-
</svg>`,
|
|
9341
|
+
</svg>`, Ai = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
9318
9342
|
<circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
|
|
9319
9343
|
<circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
|
|
9320
9344
|
<path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
|
|
@@ -9345,72 +9369,72 @@ function ie(s) {
|
|
|
9345
9369
|
`--cx-on-primary:${s.onPrimary}`
|
|
9346
9370
|
].join(";");
|
|
9347
9371
|
}
|
|
9348
|
-
function
|
|
9372
|
+
function Z(s, e) {
|
|
9349
9373
|
return `
|
|
9350
9374
|
<div class="__crossx-row">
|
|
9351
9375
|
<span class="__crossx-row-label">${s}</span>
|
|
9352
9376
|
<div class="__crossx-row-value">${e}</div>
|
|
9353
9377
|
</div>`;
|
|
9354
9378
|
}
|
|
9355
|
-
function
|
|
9356
|
-
const n = e, i = s.nativeSymbol ?? "ETH", o = s.nativeDecimals ?? 18, a =
|
|
9357
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9358
|
-
return _.id =
|
|
9379
|
+
function Ii(s, e, r, t) {
|
|
9380
|
+
const n = e, i = s.nativeSymbol ?? "ETH", o = s.nativeDecimals ?? 18, a = nt(s.dappName), c = s.to ? `<span class="__crossx-addr-text">${de(s.to)}</span>
|
|
9381
|
+
<button class="__crossx-copy-btn" data-copy="${S(s.to)}" title="Copy address">${we}</button>` : "<span>—</span>", l = Yr(s, r, t), u = zr(s.value, i, o, r), p = u ? Z((t == null ? void 0 : t.label_value) ?? "Value", `<span>${u}</span>`) : "", g = s.data ?? "0x", _ = document.createElement("div");
|
|
9382
|
+
return _.id = ee, _.innerHTML = `
|
|
9359
9383
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${ie(n)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9360
9384
|
<div class="__crossx-header">
|
|
9361
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9362
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9385
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((t == null ? void 0 : t.sign_transaction_title) ?? "Signature Request")}</p>
|
|
9386
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9363
9387
|
</div>
|
|
9364
9388
|
<hr class="__crossx-divider">
|
|
9365
9389
|
<div class="__crossx-body">
|
|
9366
9390
|
<div class="__crossx-body-cols">
|
|
9367
9391
|
<div class="__crossx-col-left">
|
|
9368
9392
|
<p class="__crossx-sig-subtitle">
|
|
9369
|
-
<span class="__crossx-sig-origin">${
|
|
9393
|
+
<span class="__crossx-sig-origin">${S(a)}</span>${S((t == null ? void 0 : t.signature_requesting) ?? " is requesting a Signature")}
|
|
9370
9394
|
</p>
|
|
9371
9395
|
<div class="__crossx-addr-pill">
|
|
9372
|
-
${
|
|
9396
|
+
${Lt}
|
|
9373
9397
|
<span class="__crossx-addr-pill-text">${de(s.from)}</span>
|
|
9374
9398
|
</div>
|
|
9375
|
-
<p class="__crossx-warning">${
|
|
9399
|
+
<p class="__crossx-warning">${S((t == null ? void 0 : t.signature_warning) ?? "After you sign, changes or cancellations are not possible.")}</p>
|
|
9376
9400
|
</div>
|
|
9377
9401
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
9378
9402
|
<div class="__crossx-col-right-sign">
|
|
9379
9403
|
<div class="__crossx-rows">
|
|
9380
|
-
${
|
|
9381
|
-
${
|
|
9404
|
+
${Z((t == null ? void 0 : t.label_to) ?? "To", c)}
|
|
9405
|
+
${Z((t == null ? void 0 : t.label_network) ?? "Network", `<span>${jr(s.chainId)}</span>`)}
|
|
9382
9406
|
${p}
|
|
9383
9407
|
${l}
|
|
9384
9408
|
</div>
|
|
9385
|
-
<pre class="__crossx-raw-tx">${
|
|
9409
|
+
<pre class="__crossx-raw-tx">${S(g)}</pre>
|
|
9386
9410
|
</div>
|
|
9387
9411
|
</div>
|
|
9388
9412
|
<div class="__crossx-btn-row">
|
|
9389
|
-
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${
|
|
9390
|
-
<button class="__crossx-confirm-btn" id="__crossx-confirm-btn">${
|
|
9413
|
+
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${S((t == null ? void 0 : t.cancel) ?? "Cancel")}</button>
|
|
9414
|
+
<button class="__crossx-confirm-btn" id="__crossx-confirm-btn">${S((t == null ? void 0 : t.signature_sign_button) ?? "Sign")}</button>
|
|
9391
9415
|
</div>
|
|
9392
9416
|
</div>
|
|
9393
9417
|
</div>
|
|
9394
9418
|
`, _;
|
|
9395
9419
|
}
|
|
9396
|
-
function
|
|
9397
|
-
const n = e, i = s.nativeSymbol ?? "ETH", o = s.nativeDecimals ?? 18, a =
|
|
9398
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9399
|
-
return g.id =
|
|
9420
|
+
function Ti(s, e, r, t) {
|
|
9421
|
+
const n = e, i = s.nativeSymbol ?? "ETH", o = s.nativeDecimals ?? 18, a = nt(s.dappName), c = s.to ? `<span class="__crossx-addr-text">${de(s.to)}</span>
|
|
9422
|
+
<button class="__crossx-copy-btn" data-copy="${S(s.to)}" title="Copy address">${we}</button>` : "<span>—</span>", l = Yr(s, r, t), p = zr(s.value, i, o, r) ?? "—", g = document.createElement("div");
|
|
9423
|
+
return g.id = ee, g.innerHTML = `
|
|
9400
9424
|
<div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ie(n)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9401
9425
|
<div class="__crossx-header">
|
|
9402
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9403
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9426
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((t == null ? void 0 : t.send_transaction_title) ?? "Approve transaction")}</p>
|
|
9427
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9404
9428
|
</div>
|
|
9405
9429
|
<hr class="__crossx-divider">
|
|
9406
9430
|
<div class="__crossx-body">
|
|
9407
9431
|
<p class="__crossx-tx-subtitle">
|
|
9408
|
-
<span class="__crossx-sig-origin">${
|
|
9432
|
+
<span class="__crossx-sig-origin">${S(a)}</span>${S((t == null ? void 0 : t.send_tx_permission_text) ?? " wants your permission to approve the following transaction.")}
|
|
9409
9433
|
</p>
|
|
9410
9434
|
<div class="__crossx-body-cols">
|
|
9411
9435
|
<div class="__crossx-rows">
|
|
9412
|
-
${
|
|
9413
|
-
${
|
|
9436
|
+
${Z((t == null ? void 0 : t.label_to) ?? "To", c)}
|
|
9437
|
+
${Z((t == null ? void 0 : t.label_network) ?? "Network", `<span>${jr(s.chainId)}</span>`)}
|
|
9414
9438
|
${l}
|
|
9415
9439
|
</div>
|
|
9416
9440
|
<div class="__crossx-pill">
|
|
@@ -9418,12 +9442,12 @@ function Ii(s, e, r, t) {
|
|
|
9418
9442
|
<span class="__crossx-pill-amount">${p}</span>
|
|
9419
9443
|
</div>
|
|
9420
9444
|
</div>
|
|
9421
|
-
<button class="__crossx-approve-btn" id="__crossx-confirm-btn">${
|
|
9445
|
+
<button class="__crossx-approve-btn" id="__crossx-confirm-btn">${S((t == null ? void 0 : t.send_tx_approve_button) ?? "Approve")}</button>
|
|
9422
9446
|
</div>
|
|
9423
9447
|
</div>
|
|
9424
9448
|
`, g;
|
|
9425
9449
|
}
|
|
9426
|
-
function
|
|
9450
|
+
function nt(s) {
|
|
9427
9451
|
var e;
|
|
9428
9452
|
if (s) return s;
|
|
9429
9453
|
try {
|
|
@@ -9432,55 +9456,55 @@ function st(s) {
|
|
|
9432
9456
|
return "This site";
|
|
9433
9457
|
}
|
|
9434
9458
|
}
|
|
9435
|
-
function
|
|
9459
|
+
function S(s) {
|
|
9436
9460
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
9437
9461
|
}
|
|
9438
|
-
function
|
|
9462
|
+
function ki(s) {
|
|
9439
9463
|
return typeof s == "string" && /^0x[0-9a-fA-F]{40}$/i.test(s);
|
|
9440
9464
|
}
|
|
9441
|
-
function
|
|
9442
|
-
if (typeof s == "string") return
|
|
9465
|
+
function Ri(s) {
|
|
9466
|
+
if (typeof s == "string") return S(s);
|
|
9443
9467
|
if (typeof s == "number" || typeof s == "bigint" || typeof s == "boolean") return String(s);
|
|
9444
9468
|
try {
|
|
9445
|
-
return
|
|
9469
|
+
return S(JSON.stringify(s));
|
|
9446
9470
|
} catch {
|
|
9447
9471
|
return String(s);
|
|
9448
9472
|
}
|
|
9449
9473
|
}
|
|
9450
|
-
function
|
|
9474
|
+
function Ni(s) {
|
|
9451
9475
|
return s.includes(":") ? s.split(":")[1] ?? s : s;
|
|
9452
9476
|
}
|
|
9453
|
-
function
|
|
9477
|
+
function Oi(s) {
|
|
9454
9478
|
return `https://www.crossscan.io/address/${s}?tab=txs`;
|
|
9455
9479
|
}
|
|
9456
9480
|
function Ci(s, e) {
|
|
9457
|
-
return `https://explorer.crosstoken.io/${
|
|
9481
|
+
return `https://explorer.crosstoken.io/${Ni(s)}/tx/${e}`;
|
|
9458
9482
|
}
|
|
9459
9483
|
function Jr(s, e) {
|
|
9460
|
-
return `<a class="__crossx-addr-text __crossx-row-link" href="${
|
|
9484
|
+
return `<a class="__crossx-addr-text __crossx-row-link" href="${S(e)}" target="_blank" rel="noopener noreferrer">${S(s)}</a>`;
|
|
9461
9485
|
}
|
|
9462
|
-
function
|
|
9463
|
-
return Jr(de(s),
|
|
9486
|
+
function Qe(s) {
|
|
9487
|
+
return Jr(de(s), Oi(s));
|
|
9464
9488
|
}
|
|
9465
9489
|
function Zr(s, e) {
|
|
9466
9490
|
return Jr(de(e), Ci(s, e));
|
|
9467
9491
|
}
|
|
9468
|
-
function
|
|
9469
|
-
const t =
|
|
9492
|
+
function Pi(s, e, r) {
|
|
9493
|
+
const t = Z(
|
|
9470
9494
|
(r == null ? void 0 : r.label_from) ?? "From",
|
|
9471
|
-
`${
|
|
9472
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9473
|
-
), n = s.to ?
|
|
9474
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9475
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9476
|
-
<span class="__crossx-total-label">${
|
|
9477
|
-
<span class="__crossx-total-amount">${
|
|
9495
|
+
`${Qe(s.from)}
|
|
9496
|
+
<button class="__crossx-copy-btn" data-copy="${S(s.from)}" title="Copy address">${we}</button>`
|
|
9497
|
+
), n = s.to ? Z((r == null ? void 0 : r.label_to) ?? "To", `${Qe(s.to)}
|
|
9498
|
+
<button class="__crossx-copy-btn" data-copy="${S(s.to)}" title="Copy address">${we}</button>`) : "", i = s.amount ? Z((r == null ? void 0 : r.label_transfer) ?? "Transfer", `<span>${S(s.amount)}</span>`) : "", o = s.fees ? Z((r == null ? void 0 : r.label_tx_fee) ?? "Tx Fee", `<span>${S(s.fees)}</span>`) : "", a = s.txHash ? Z((r == null ? void 0 : r.label_tx_hash) ?? "Tx Hash", `${Zr(s.chainId, s.txHash)}
|
|
9499
|
+
<button class="__crossx-copy-btn" data-copy="${S(s.txHash)}" title="Copy hash">${we}</button>`) : "", c = s.total ? `<div class="__crossx-total-pill">
|
|
9500
|
+
<span class="__crossx-total-label">${S((r == null ? void 0 : r.label_total) ?? "Total")}<br>${S((r == null ? void 0 : r.label_including_fees) ?? "(including fees)")}</span>
|
|
9501
|
+
<span class="__crossx-total-amount">${S(s.total)}</span>
|
|
9478
9502
|
</div>` : "", l = document.createElement("div");
|
|
9479
|
-
return l.id =
|
|
9503
|
+
return l.id = ee, l.innerHTML = `
|
|
9480
9504
|
<div class="__crossx-card __crossx-card--migration" style="${ie(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9481
9505
|
<div class="__crossx-header">
|
|
9482
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9483
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9506
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((r == null ? void 0 : r.tx_success) ?? "Transaction complete")}</p>
|
|
9507
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9484
9508
|
</div>
|
|
9485
9509
|
<hr class="__crossx-divider">
|
|
9486
9510
|
<div class="__crossx-body">
|
|
@@ -9492,46 +9516,46 @@ function Oi(s, e, r) {
|
|
|
9492
9516
|
${a}
|
|
9493
9517
|
</div>
|
|
9494
9518
|
${c}
|
|
9495
|
-
<button class="__crossx-approve-btn" id="__crossx-done-btn">${
|
|
9519
|
+
<button class="__crossx-approve-btn" id="__crossx-done-btn">${S((r == null ? void 0 : r.tx_complete_done_button) ?? "All Done")}</button>
|
|
9496
9520
|
</div>
|
|
9497
9521
|
</div>
|
|
9498
9522
|
`, l;
|
|
9499
9523
|
}
|
|
9500
|
-
function
|
|
9524
|
+
function Li(s, e, r) {
|
|
9501
9525
|
const t = document.createElement("div");
|
|
9502
|
-
return t.id =
|
|
9526
|
+
return t.id = ee, t.innerHTML = `
|
|
9503
9527
|
<div class="__crossx-card __crossx-card--migration" style="${ie(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9504
9528
|
<div class="__crossx-header">
|
|
9505
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9529
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((r == null ? void 0 : r.tx_progress_waiting_title) ?? "Waiting for confirmation")}</p>
|
|
9506
9530
|
</div>
|
|
9507
9531
|
<hr class="__crossx-divider">
|
|
9508
9532
|
<div class="__crossx-body" id="__crossx-progress-body">
|
|
9509
9533
|
<div class="__crossx-progress-center">
|
|
9510
9534
|
<div class="__crossx-spinner"></div>
|
|
9511
|
-
<p class="__crossx-progress-text">${
|
|
9535
|
+
<p class="__crossx-progress-text">${S((r == null ? void 0 : r.tx_progress_waiting_text) ?? "Waiting for transaction receipt...")}</p>
|
|
9512
9536
|
</div>
|
|
9513
9537
|
</div>
|
|
9514
9538
|
</div>
|
|
9515
9539
|
`, t;
|
|
9516
9540
|
}
|
|
9517
|
-
function
|
|
9541
|
+
function Di(s, e, r, t) {
|
|
9518
9542
|
const n = e.status !== "reverted" && e.status !== "timeout", i = e.status === "timeout", o = s.querySelector("#__crossx-ttl"), a = s.querySelector(".__crossx-header");
|
|
9519
9543
|
if (o) {
|
|
9520
|
-
const
|
|
9521
|
-
|
|
9544
|
+
const y = i ? Ai : n ? "" : Ei, v = i ? (t == null ? void 0 : t.tx_timeout) ?? "Transaction timeout" : n ? (t == null ? void 0 : t.tx_success) ?? "Transaction complete" : (t == null ? void 0 : t.tx_failed) ?? "Transaction failed";
|
|
9545
|
+
y ? (o.style.display = "flex", o.style.alignItems = "center", o.style.gap = "8px", o.innerHTML = `${y}<span>${S(v)}</span>`) : o.textContent = v;
|
|
9522
9546
|
}
|
|
9523
9547
|
if (a && !s.querySelector("#__crossx-close-btn")) {
|
|
9524
|
-
const
|
|
9525
|
-
|
|
9548
|
+
const y = document.createElement("button");
|
|
9549
|
+
y.className = "__crossx-close", y.id = "__crossx-close-btn", y.setAttribute("aria-label", "Close"), y.innerHTML = ne, a.appendChild(y);
|
|
9526
9550
|
}
|
|
9527
9551
|
const c = s.querySelector("#__crossx-progress-body");
|
|
9528
9552
|
if (!c) return;
|
|
9529
|
-
const l = e.from ?
|
|
9530
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9531
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9532
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9533
|
-
<span class="__crossx-total-label">${
|
|
9534
|
-
<span class="__crossx-total-amount">${
|
|
9553
|
+
const l = e.from ? Z((t == null ? void 0 : t.label_from) ?? "From", `${Qe(e.from)}
|
|
9554
|
+
<button class="__crossx-copy-btn" data-copy="${S(e.from)}" title="Copy address">${we}</button>`) : "", u = e.to ? Z((t == null ? void 0 : t.label_to) ?? "To", `${Qe(e.to)}
|
|
9555
|
+
<button class="__crossx-copy-btn" data-copy="${S(e.to)}" title="Copy address">${we}</button>`) : "", p = e.amount ? Z((t == null ? void 0 : t.label_transfer) ?? "Transfer", `<span>${S(e.amount)}</span>`) : "", g = e.fees ? Z((t == null ? void 0 : t.label_tx_fee) ?? "Tx Fee", `<span>${S(e.fees)}</span>`) : "", _ = e.txHash ? Z((t == null ? void 0 : t.label_tx_hash) ?? "Tx Hash", `${Zr(e.chainId, e.txHash)}
|
|
9556
|
+
<button class="__crossx-copy-btn" data-copy="${S(e.txHash)}" title="Copy hash">${we}</button>`) : "", x = e.total ? `<div class="__crossx-total-pill">
|
|
9557
|
+
<span class="__crossx-total-label">${S((t == null ? void 0 : t.label_total) ?? "Total")}<br>${S((t == null ? void 0 : t.label_including_fees) ?? "(including fees)")}</span>
|
|
9558
|
+
<span class="__crossx-total-amount">${S(e.total)}</span>
|
|
9535
9559
|
</div>` : "";
|
|
9536
9560
|
c.innerHTML = `
|
|
9537
9561
|
<div class="__crossx-rows">
|
|
@@ -9542,51 +9566,51 @@ function Li(s, e, r, t) {
|
|
|
9542
9566
|
${_}
|
|
9543
9567
|
</div>
|
|
9544
9568
|
${x}
|
|
9545
|
-
<button class="__crossx-approve-btn" id="__crossx-done-btn">${
|
|
9546
|
-
`, c.querySelectorAll(".__crossx-copy-btn").forEach((
|
|
9547
|
-
|
|
9548
|
-
var
|
|
9549
|
-
|
|
9550
|
-
const
|
|
9551
|
-
|
|
9569
|
+
<button class="__crossx-approve-btn" id="__crossx-done-btn">${S((t == null ? void 0 : t.tx_complete_done_button) ?? (n ? "All Done" : "Done"))}</button>
|
|
9570
|
+
`, c.querySelectorAll(".__crossx-copy-btn").forEach((y) => {
|
|
9571
|
+
y.addEventListener("click", (v) => {
|
|
9572
|
+
var R;
|
|
9573
|
+
v.stopPropagation();
|
|
9574
|
+
const A = y.dataset.copy;
|
|
9575
|
+
A && ((R = navigator.clipboard) == null || R.writeText(A).catch(() => {
|
|
9552
9576
|
}));
|
|
9553
9577
|
});
|
|
9554
9578
|
});
|
|
9555
9579
|
}
|
|
9556
|
-
function
|
|
9557
|
-
const t = e, n =
|
|
9558
|
-
return o.id =
|
|
9580
|
+
function $i(s, e, r) {
|
|
9581
|
+
const t = e, n = nt(s.dappName), i = S(s.message), o = document.createElement("div");
|
|
9582
|
+
return o.id = ee, o.innerHTML = `
|
|
9559
9583
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9560
9584
|
<div class="__crossx-header">
|
|
9561
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9562
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9585
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((r == null ? void 0 : r.sign_message_title) ?? "Signature Request")}</p>
|
|
9586
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9563
9587
|
</div>
|
|
9564
9588
|
<hr class="__crossx-divider">
|
|
9565
9589
|
<div class="__crossx-body">
|
|
9566
9590
|
<div class="__crossx-body-cols">
|
|
9567
9591
|
<div class="__crossx-col-left">
|
|
9568
9592
|
<p class="__crossx-sig-subtitle">
|
|
9569
|
-
<span class="__crossx-sig-origin">${
|
|
9593
|
+
<span class="__crossx-sig-origin">${S(n)}</span>${S((r == null ? void 0 : r.signature_requesting) ?? " is requesting a Signature")}
|
|
9570
9594
|
</p>
|
|
9571
9595
|
<div class="__crossx-addr-pill">
|
|
9572
|
-
${
|
|
9596
|
+
${Lt}
|
|
9573
9597
|
<span class="__crossx-addr-pill-text">${de(s.from)}</span>
|
|
9574
9598
|
</div>
|
|
9575
|
-
<p class="__crossx-warning">${
|
|
9599
|
+
<p class="__crossx-warning">${S((r == null ? void 0 : r.signature_warning) ?? "After you sign, changes or cancellations are not possible.")}</p>
|
|
9576
9600
|
</div>
|
|
9577
9601
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
9578
9602
|
<div class="__crossx-msg-raw">${i}</div>
|
|
9579
9603
|
</div>
|
|
9580
9604
|
<div class="__crossx-btn-row">
|
|
9581
|
-
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${
|
|
9582
|
-
<button class="__crossx-confirm-btn" id="__crossx-confirm-btn">${
|
|
9605
|
+
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${S((r == null ? void 0 : r.cancel) ?? "Cancel")}</button>
|
|
9606
|
+
<button class="__crossx-confirm-btn" id="__crossx-confirm-btn">${S((r == null ? void 0 : r.confirm) ?? "Confirm")}</button>
|
|
9583
9607
|
</div>
|
|
9584
9608
|
</div>
|
|
9585
9609
|
</div>
|
|
9586
9610
|
`, o;
|
|
9587
9611
|
}
|
|
9588
|
-
function
|
|
9589
|
-
const t = e, n =
|
|
9612
|
+
function Bi(s, e, r) {
|
|
9613
|
+
const t = e, n = nt(s.dappName);
|
|
9590
9614
|
let i = {};
|
|
9591
9615
|
if (typeof s.typedData == "string")
|
|
9592
9616
|
try {
|
|
@@ -9597,91 +9621,91 @@ function $i(s, e, r) {
|
|
|
9597
9621
|
const o = i.primaryType ?? "—", a = i.message ?? {};
|
|
9598
9622
|
let c = `
|
|
9599
9623
|
<div class="__crossx-td-row">
|
|
9600
|
-
<span class="__crossx-td-label">${
|
|
9601
|
-
<span class="__crossx-td-value">${
|
|
9624
|
+
<span class="__crossx-td-label">${S((r == null ? void 0 : r.label_primary_type) ?? "Primary Type")}</span>
|
|
9625
|
+
<span class="__crossx-td-value">${S(o)}</span>
|
|
9602
9626
|
</div>`;
|
|
9603
9627
|
for (const [u, p] of Object.entries(a)) {
|
|
9604
|
-
const g =
|
|
9605
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9628
|
+
const g = Ri(p), x = ki(p) ? `<span class="__crossx-addr-text">${de(p)}</span>
|
|
9629
|
+
<button class="__crossx-copy-btn" data-copy="${S(String(p))}" title="Copy">${we}</button>` : `<span>${g}</span>`;
|
|
9606
9630
|
c += `
|
|
9607
9631
|
<div class="__crossx-td-row">
|
|
9608
|
-
<span class="__crossx-td-label">${
|
|
9632
|
+
<span class="__crossx-td-label">${S(u)}</span>
|
|
9609
9633
|
<div class="__crossx-td-value">${x}</div>
|
|
9610
9634
|
</div>`;
|
|
9611
9635
|
}
|
|
9612
9636
|
const l = document.createElement("div");
|
|
9613
|
-
return l.id =
|
|
9637
|
+
return l.id = ee, l.innerHTML = `
|
|
9614
9638
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-typed" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9615
9639
|
<div class="__crossx-header">
|
|
9616
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9617
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9640
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((r == null ? void 0 : r.sign_typed_data_title) ?? "Signature Request")}</p>
|
|
9641
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9618
9642
|
</div>
|
|
9619
9643
|
<hr class="__crossx-divider">
|
|
9620
9644
|
<div class="__crossx-body">
|
|
9621
9645
|
<div class="__crossx-body-cols">
|
|
9622
9646
|
<div class="__crossx-col-left">
|
|
9623
9647
|
<p class="__crossx-sig-subtitle">
|
|
9624
|
-
<span class="__crossx-sig-origin">${
|
|
9648
|
+
<span class="__crossx-sig-origin">${S(n)}</span>${S((r == null ? void 0 : r.signature_requesting) ?? " is requesting a Signature")}
|
|
9625
9649
|
</p>
|
|
9626
9650
|
<div class="__crossx-addr-pill">
|
|
9627
|
-
${
|
|
9651
|
+
${Lt}
|
|
9628
9652
|
<span class="__crossx-addr-pill-text">${de(s.from)}</span>
|
|
9629
9653
|
</div>
|
|
9630
|
-
<p class="__crossx-warning">${
|
|
9654
|
+
<p class="__crossx-warning">${S((r == null ? void 0 : r.signature_warning) ?? "After you sign, changes or cancellations are not possible.")}</p>
|
|
9631
9655
|
</div>
|
|
9632
9656
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
9633
9657
|
<div class="__crossx-td-rows">${c}</div>
|
|
9634
9658
|
</div>
|
|
9635
9659
|
<div class="__crossx-btn-row">
|
|
9636
|
-
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${
|
|
9637
|
-
<button class="__crossx-confirm-btn" id="__crossx-confirm-btn">${
|
|
9660
|
+
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${S((r == null ? void 0 : r.cancel) ?? "Cancel")}</button>
|
|
9661
|
+
<button class="__crossx-confirm-btn" id="__crossx-confirm-btn">${S((r == null ? void 0 : r.confirm) ?? "Confirm")}</button>
|
|
9638
9662
|
</div>
|
|
9639
9663
|
</div>
|
|
9640
9664
|
</div>
|
|
9641
9665
|
`, l;
|
|
9642
9666
|
}
|
|
9643
|
-
const
|
|
9667
|
+
const Mi = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
|
9644
9668
|
<line x1="12" y1="5" x2="12" y2="19"/>
|
|
9645
9669
|
<line x1="5" y1="12" x2="19" y2="12"/>
|
|
9646
|
-
</svg>`,
|
|
9670
|
+
</svg>`, Fi = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="var(--cx-primary, #019d92)"/><path d="M7.5 12.5L10.5 15.5L16.5 8.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
9647
9671
|
function Qr(s) {
|
|
9648
9672
|
return s.name || `Account ${s.index + 1}`;
|
|
9649
9673
|
}
|
|
9650
|
-
function
|
|
9674
|
+
function Ui() {
|
|
9651
9675
|
return `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="#121212" fill-opacity="0.1"/><g fill="#121212" fill-opacity="0.5">${Xr}</g></svg>`;
|
|
9652
9676
|
}
|
|
9653
|
-
const
|
|
9654
|
-
function
|
|
9677
|
+
const Hi = fr().portraitBaseUrl;
|
|
9678
|
+
function Wi(s, e) {
|
|
9655
9679
|
const r = e.replace("#", "");
|
|
9656
|
-
return `${
|
|
9680
|
+
return `${Hi}/portrait/evm/${s}.png?size=256&bg=${r}`;
|
|
9657
9681
|
}
|
|
9658
9682
|
function es(s, e, r) {
|
|
9659
|
-
const t =
|
|
9683
|
+
const t = Wi(s, r), i = Ui().replace(/"/g, """);
|
|
9660
9684
|
return `<span class="__crossx-wallet-avatar"><img class="__crossx-wallet-avatar-img" src="${t}" alt="" onerror="this.style.display='none';this.nextElementSibling.innerHTML='${i}';this.nextElementSibling.style.display='flex';"><span class="__crossx-wallet-avatar-fallback"></span></span>`;
|
|
9661
9685
|
}
|
|
9662
|
-
function
|
|
9686
|
+
function Gi(s, e, r, t) {
|
|
9663
9687
|
const n = r == null ? void 0 : r.toLowerCase(), i = s.map((a) => {
|
|
9664
|
-
const c = n && a.address.toLowerCase() === n, l = c ? " __crossx-wallet-item--selected" : "", u = c ? `<span class="__crossx-wallet-selected">${
|
|
9665
|
-
return `<button class="__crossx-wallet-item${l}" data-wallet-index="${a.index}" data-wallet-address="${
|
|
9666
|
-
${es(a.address, a.index, e.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${
|
|
9688
|
+
const c = n && a.address.toLowerCase() === n, l = c ? " __crossx-wallet-item--selected" : "", u = c ? `<span class="__crossx-wallet-selected">${S((t == null ? void 0 : t.wallet_selector_selected) ?? "Selected")}</span><span class="__crossx-wallet-check">${Fi}</span>` : "";
|
|
9689
|
+
return `<button class="__crossx-wallet-item${l}" data-wallet-index="${a.index}" data-wallet-address="${S(a.address)}">
|
|
9690
|
+
${es(a.address, a.index, e.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${S(Qr(a))}</span><span class="__crossx-wallet-addr">${de(a.address)}</span></span>${u}
|
|
9667
9691
|
</button>`;
|
|
9668
9692
|
}).join(""), o = document.createElement("div");
|
|
9669
|
-
return o.id =
|
|
9693
|
+
return o.id = ee, o.innerHTML = `
|
|
9670
9694
|
<div class="__crossx-card __crossx-card--migration __crossx-card--wallet-selector" style="${ie(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9671
9695
|
<div class="__crossx-header">
|
|
9672
9696
|
<div style="display:flex;flex-direction:column;gap:4px;padding-right:36px;">
|
|
9673
|
-
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:0;">${
|
|
9674
|
-
<p class="__crossx-subtitle--body">${
|
|
9697
|
+
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:0;">${S((t == null ? void 0 : t.wallet_selector_title) ?? "Select Connected Wallet")}</p>
|
|
9698
|
+
<p class="__crossx-subtitle--body">${S((t == null ? void 0 : t.wallet_selector_description) ?? "Please select the wallet you previously used for this game to continue.")}</p>
|
|
9675
9699
|
</div>
|
|
9676
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9700
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9677
9701
|
</div>
|
|
9678
9702
|
<hr class="__crossx-divider">
|
|
9679
9703
|
<div class="__crossx-body">
|
|
9680
9704
|
<div class="__crossx-body-cols">
|
|
9681
9705
|
<div class="__crossx-col-left">
|
|
9682
9706
|
<div class="__crossx-mig-info">
|
|
9683
|
-
<p class="__crossx-mig-info-title">${
|
|
9684
|
-
<p class="__crossx-mig-info-desc">${
|
|
9707
|
+
<p class="__crossx-mig-info-title">${S((t == null ? void 0 : t.wallet_selector_info_title) ?? "Why do I need to select a wallet?")}</p>
|
|
9708
|
+
<p class="__crossx-mig-info-desc">${S((t == null ? void 0 : t.wallet_selector_info_desc) ?? "Identifying your previously linked wallet ensures your game progress and assets are synced correctly.")}</p>
|
|
9685
9709
|
</div>
|
|
9686
9710
|
</div>
|
|
9687
9711
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
@@ -9690,8 +9714,8 @@ function Wi(s, e, r, t) {
|
|
|
9690
9714
|
${i}
|
|
9691
9715
|
</div>
|
|
9692
9716
|
<button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
|
|
9693
|
-
<span class="__crossx-wallet-add-icon">${
|
|
9694
|
-
<span class="__crossx-wallet-add-label">${
|
|
9717
|
+
<span class="__crossx-wallet-add-icon">${Mi}</span>
|
|
9718
|
+
<span class="__crossx-wallet-add-label">${S((t == null ? void 0 : t.wallet_selector_add_button) ?? "add a wallet")}</span>
|
|
9695
9719
|
</button>
|
|
9696
9720
|
<p class="__crossx-wallet-add-error" id="__crossx-add-wallet-error" role="alert" aria-live="polite" hidden></p>
|
|
9697
9721
|
</div>
|
|
@@ -9700,22 +9724,22 @@ function Wi(s, e, r, t) {
|
|
|
9700
9724
|
</div>
|
|
9701
9725
|
`, o;
|
|
9702
9726
|
}
|
|
9703
|
-
const
|
|
9727
|
+
const qi = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9704
9728
|
<path d="M26.693 21.193c-.028-3.168 2.587-4.712 2.706-4.786-1.477-2.16-3.77-2.454-4.58-2.484-1.944-.197-3.804 1.148-4.793 1.148-.992 0-2.52-1.12-4.147-1.09-2.13.032-4.1 1.239-5.198 3.133-2.222 3.855-.569 9.562 1.593 12.69 1.061 1.535 2.318 3.258 3.975 3.196 1.6-.064 2.2-1.03 4.133-1.03 1.928 0 2.48 1.03 4.172.997 1.72-.03 2.806-1.56 3.862-3.1 1.211-1.779 1.713-3.495 1.74-3.583-.037-.017-3.427-1.316-3.463-5.09z" fill="currentColor"/>
|
|
9705
9729
|
<path d="M23.527 11.876c.877-1.065 1.471-2.545 1.31-4.024-1.266.053-2.807.845-3.718 1.907-.813.946-1.53 2.468-1.34 3.915 1.41.107 2.852-.716 3.748-1.798z" fill="currentColor"/>
|
|
9706
|
-
</svg>`,
|
|
9730
|
+
</svg>`, Ki = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9707
9731
|
<path d="M38.06 20.44c0-1.34-.12-2.63-.34-3.87H20.5v7.32h9.84c-.42 2.28-1.71 4.21-3.65 5.51v4.57h5.91c3.46-3.19 5.46-7.88 5.46-13.53z" fill="#4285F4"/>
|
|
9708
9732
|
<path d="M20.5 38.5c4.94 0 9.09-1.64 12.12-4.44l-5.91-4.57c-1.64 1.1-3.73 1.75-6.21 1.75-4.77 0-8.82-3.22-10.26-7.55H4.16v4.72A18.49 18.49 0 0 0 20.5 38.5z" fill="#34A853"/>
|
|
9709
9733
|
<path d="M10.24 23.69A11.16 11.16 0 0 1 9.66 20c0-1.28.22-2.52.58-3.69v-4.72H4.16A18.49 18.49 0 0 0 2 20c0 2.97.71 5.78 1.97 8.28l6.27-4.59z" fill="#FBBC05"/>
|
|
9710
9734
|
<path d="M20.5 8.76c2.69 0 5.1.92 7 2.73l5.24-5.24C29.58 3.36 25.43 1.5 20.5 1.5A18.49 18.49 0 0 0 4.16 11.59l6.08 4.72C11.68 11.98 15.73 8.76 20.5 8.76z" fill="#EA4335"/>
|
|
9711
9735
|
</svg>`;
|
|
9712
|
-
function
|
|
9736
|
+
function Vi(s) {
|
|
9713
9737
|
const e = ls(s);
|
|
9714
|
-
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${
|
|
9738
|
+
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${Si[s] ?? ""}</span><span class="__crossx-connect-other-wallet-name">${S(e)}</span></span>`;
|
|
9715
9739
|
}
|
|
9716
|
-
function
|
|
9740
|
+
function zi(s) {
|
|
9717
9741
|
if (s.length === 0) return "";
|
|
9718
|
-
const e = (n) =>
|
|
9742
|
+
const e = (n) => Vi(s[n]), r = "Supported wallets include ";
|
|
9719
9743
|
if (s.length === 1)
|
|
9720
9744
|
return `${r}${e(0)}.`;
|
|
9721
9745
|
if (s.length === 2)
|
|
@@ -9725,76 +9749,76 @@ function Vi(s) {
|
|
|
9725
9749
|
const t = s.length - 3;
|
|
9726
9750
|
return `${r}${e(0)}, ${e(1)}, ${e(2)}, and ${t} more.`;
|
|
9727
9751
|
}
|
|
9728
|
-
function
|
|
9729
|
-
const t = s, n =
|
|
9752
|
+
function ji(s, e = [], r) {
|
|
9753
|
+
const t = s, n = S(String(e[0])), i = S((r == null ? void 0 : r.login_selector_or) ?? "or"), o = e.length > 0 ? `
|
|
9730
9754
|
<div class="__crossx-login-or-divider">
|
|
9731
9755
|
<hr><span>${i}</span><hr>
|
|
9732
9756
|
</div>
|
|
9733
9757
|
<button type="button" class="__crossx-connect-other-block" id="__crossx-connect-other-wallet-btn" data-wallet-id="${n}" aria-labelledby="__crossx-connect-other-heading">
|
|
9734
9758
|
<span class="__crossx-connect-other-text">
|
|
9735
|
-
<span class="__crossx-connect-other-title" id="__crossx-connect-other-heading">${
|
|
9736
|
-
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${
|
|
9759
|
+
<span class="__crossx-connect-other-title" id="__crossx-connect-other-heading">${S((r == null ? void 0 : r.login_selector_connect_other_wallets) ?? "Connect with Other Wallets")}</span>
|
|
9760
|
+
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${zi(e)}</span>
|
|
9737
9761
|
</span>
|
|
9738
9762
|
</button>` : "", a = document.createElement("div");
|
|
9739
|
-
return a.id =
|
|
9763
|
+
return a.id = ee, a.innerHTML = `
|
|
9740
9764
|
<div class="__crossx-card __crossx-card--migration" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9741
9765
|
<div class="__crossx-header">
|
|
9742
9766
|
<div style="display:flex;flex-direction:column;gap:4px;padding-right:36px;">
|
|
9743
|
-
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:0;">${
|
|
9744
|
-
<p class="__crossx-subtitle">${
|
|
9767
|
+
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:0;">${S((r == null ? void 0 : r.login_selector_title) ?? "CROSS Wallet")}</p>
|
|
9768
|
+
<p class="__crossx-subtitle">${S((r == null ? void 0 : r.login_selector_subtitle) ?? "Sign in instantly with your social account")}</p>
|
|
9745
9769
|
</div>
|
|
9746
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9770
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9747
9771
|
</div>
|
|
9748
9772
|
<hr class="__crossx-divider">
|
|
9749
9773
|
<div class="__crossx-body">
|
|
9750
9774
|
<div class="__crossx-login-btn-row">
|
|
9751
9775
|
<button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
|
|
9752
|
-
<span class="__crossx-login-icon" style="color:var(--cx-value);">${
|
|
9753
|
-
<span class="__crossx-login-btn-label">${
|
|
9776
|
+
<span class="__crossx-login-icon" style="color:var(--cx-value);">${qi}</span>
|
|
9777
|
+
<span class="__crossx-login-btn-label">${S((r == null ? void 0 : r.login_selector_apple) ?? "Sign in with Apple")}</span>
|
|
9754
9778
|
</button>
|
|
9755
9779
|
<button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
|
|
9756
|
-
<span class="__crossx-login-icon">${
|
|
9757
|
-
<span class="__crossx-login-btn-label">${
|
|
9780
|
+
<span class="__crossx-login-icon">${Ki}</span>
|
|
9781
|
+
<span class="__crossx-login-btn-label">${S((r == null ? void 0 : r.login_selector_google) ?? "Sign in with Google")}</span>
|
|
9758
9782
|
</button>
|
|
9759
9783
|
</div>${o}
|
|
9760
9784
|
<p class="__crossx-login-terms">
|
|
9761
|
-
${((r == null ? void 0 : r.login_selector_terms_template) ?? "By continuing, you agree to NEXUS {tos} and consent to its {pp}").replace("{tos}", `<a class="__crossx-login-terms-link" href="https://terms.crosstoken.io/docs/cross-terms-of-use" target="_blank" rel="noopener noreferrer">${
|
|
9785
|
+
${((r == null ? void 0 : r.login_selector_terms_template) ?? "By continuing, you agree to NEXUS {tos} and consent to its {pp}").replace("{tos}", `<a class="__crossx-login-terms-link" href="https://terms.crosstoken.io/docs/cross-terms-of-use" target="_blank" rel="noopener noreferrer">${S((r == null ? void 0 : r.login_selector_terms_tos) ?? "Terms of Service")}</a>`).replace("{pp}", `<a class="__crossx-login-terms-link" href="https://terms.crosstoken.io/docs/nexus-privacy-policy" target="_blank" rel="noopener noreferrer">${S((r == null ? void 0 : r.login_selector_terms_pp) ?? "Privacy Policy.")}</a>`)}
|
|
9762
9786
|
</p>
|
|
9763
9787
|
</div>
|
|
9764
9788
|
</div>
|
|
9765
9789
|
`, a;
|
|
9766
9790
|
}
|
|
9767
|
-
function
|
|
9791
|
+
function Yi(s, e) {
|
|
9768
9792
|
const r = s, t = document.createElement("div");
|
|
9769
|
-
t.id =
|
|
9770
|
-
const n =
|
|
9771
|
-
<p class="__crossx-session-account-label">${
|
|
9772
|
-
<p class="__crossx-session-account-email">${
|
|
9793
|
+
t.id = ee;
|
|
9794
|
+
const n = S(e.message).replace(/\n/g, "<br>"), i = e.email ? `<div class="__crossx-session-account-card">
|
|
9795
|
+
<p class="__crossx-session-account-label">${S(e.accountLabel)}</p>
|
|
9796
|
+
<p class="__crossx-session-account-email">${S(e.email)}</p>
|
|
9773
9797
|
</div>` : "";
|
|
9774
9798
|
return t.innerHTML = `
|
|
9775
9799
|
<div class="__crossx-card __crossx-card--migration" style="${ie(r)}" role="alertdialog" aria-modal="true" aria-labelledby="__crossx-session-header-title" aria-describedby="__crossx-session-msg">
|
|
9776
9800
|
<div class="__crossx-header">
|
|
9777
|
-
<p class="__crossx-title" id="__crossx-session-header-title">${
|
|
9778
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9801
|
+
<p class="__crossx-title" id="__crossx-session-header-title">${S(e.title)}</p>
|
|
9802
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9779
9803
|
</div>
|
|
9780
9804
|
<hr class="__crossx-divider">
|
|
9781
9805
|
<div class="__crossx-body" style="padding:20px 24px 24px;display:flex;flex-direction:column;gap:16px;">
|
|
9782
9806
|
<div class="__crossx-session-hero">
|
|
9783
|
-
<p class="__crossx-session-hero-title">${
|
|
9807
|
+
<p class="__crossx-session-hero-title">${S(e.title)}</p>
|
|
9784
9808
|
<p class="__crossx-session-hero-message" id="__crossx-session-msg">${n}</p>
|
|
9785
9809
|
</div>
|
|
9786
9810
|
${i}
|
|
9787
9811
|
<div class="__crossx-btn-row">
|
|
9788
|
-
<button class="__crossx-cancel-btn" id="__crossx-session-signout">${
|
|
9789
|
-
<button class="__crossx-confirm-btn" id="__crossx-session-signin">${
|
|
9812
|
+
<button class="__crossx-cancel-btn" id="__crossx-session-signout">${S(e.signOutLabel)}</button>
|
|
9813
|
+
<button class="__crossx-confirm-btn" id="__crossx-session-signin">${S(e.signInAgainLabel)}</button>
|
|
9790
9814
|
</div>
|
|
9791
9815
|
</div>
|
|
9792
9816
|
</div>
|
|
9793
9817
|
`, t;
|
|
9794
9818
|
}
|
|
9795
|
-
function
|
|
9796
|
-
const r = s, t = e ? `<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9797
|
-
return i.id =
|
|
9819
|
+
function Xi(s, e = !0) {
|
|
9820
|
+
const r = s, t = e ? `<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>` : "", n = e ? '<button class="__crossx-skip-btn" id="__crossx-skip-btn">Skip for Now</button>' : "", i = document.createElement("div");
|
|
9821
|
+
return i.id = ee, i.innerHTML = `
|
|
9798
9822
|
<div class="__crossx-card __crossx-card--migration" style="${ie(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9799
9823
|
<div class="__crossx-header">
|
|
9800
9824
|
<p class="__crossx-title" id="__crossx-ttl">Wallet Found on Social Account 🎉</p>
|
|
@@ -9808,7 +9832,7 @@ function Yi(s, e = !0) {
|
|
|
9808
9832
|
<p class="__crossx-mig-info-desc">It safely restores and integrates all your previous assets. Simply verify your PIN to get started.</p>
|
|
9809
9833
|
</div>
|
|
9810
9834
|
<button class="__crossx-recover-btn" id="__crossx-recover-btn">
|
|
9811
|
-
<span class="__crossx-recover-icon">${
|
|
9835
|
+
<span class="__crossx-recover-icon">${mi}</span>
|
|
9812
9836
|
<span class="__crossx-recover-label">Import from Social Backup</span>
|
|
9813
9837
|
</button>
|
|
9814
9838
|
${n}
|
|
@@ -9816,13 +9840,13 @@ function Yi(s, e = !0) {
|
|
|
9816
9840
|
</div>
|
|
9817
9841
|
`, i;
|
|
9818
9842
|
}
|
|
9819
|
-
function
|
|
9843
|
+
function Ji(s, e) {
|
|
9820
9844
|
const r = s, { errorMessage: t, attemptCount: n, maxAttempts: i = 5 } = e ?? {}, o = !!t, a = o ? " --error" : "", c = n != null && n > 0 ? `<p class="__crossx-pin-attempt">${n}/${i}</p>` : "", l = n != null && n >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "", u = o ? `<p class="__crossx-pin-error-text">${t}</p>` : "", p = document.createElement("div");
|
|
9821
|
-
return p.id =
|
|
9845
|
+
return p.id = ee, p.innerHTML = `
|
|
9822
9846
|
<div class="__crossx-card __crossx-card--migration" style="${ie(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9823
9847
|
<div class="__crossx-header">
|
|
9824
9848
|
<p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
|
|
9825
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9849
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9826
9850
|
</div>
|
|
9827
9851
|
<hr class="__crossx-divider">
|
|
9828
9852
|
<div class="__crossx-pin-center">
|
|
@@ -9840,17 +9864,17 @@ function Xi(s, e) {
|
|
|
9840
9864
|
</div>
|
|
9841
9865
|
`, p;
|
|
9842
9866
|
}
|
|
9843
|
-
function
|
|
9867
|
+
function Zi(s) {
|
|
9844
9868
|
const e = new Date(s), r = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], t = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], n = r[e.getDay()], i = t[e.getMonth()], o = e.getDate(), a = String(e.getHours()).padStart(2, "0"), c = String(e.getMinutes()).padStart(2, "0");
|
|
9845
9869
|
return `${n}, ${i} ${o} ${a}:${c}`;
|
|
9846
9870
|
}
|
|
9847
|
-
function
|
|
9848
|
-
const t = s, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ?
|
|
9849
|
-
return a.id =
|
|
9871
|
+
function Qi(s, e, r) {
|
|
9872
|
+
const t = s, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ? Zi(i) : null, a = document.createElement("div");
|
|
9873
|
+
return a.id = ee, a.innerHTML = `
|
|
9850
9874
|
<div class="__crossx-card __crossx-card--migration" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9851
9875
|
<div class="__crossx-header">
|
|
9852
9876
|
<p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
|
|
9853
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9877
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9854
9878
|
</div>
|
|
9855
9879
|
<hr class="__crossx-divider">
|
|
9856
9880
|
<div class="__crossx-pin-center">
|
|
@@ -9875,52 +9899,52 @@ function Zi(s, e, r) {
|
|
|
9875
9899
|
return () => clearInterval(p);
|
|
9876
9900
|
} };
|
|
9877
9901
|
}
|
|
9878
|
-
function
|
|
9902
|
+
function eo(s) {
|
|
9879
9903
|
const r = [s.check1, s.check2].map((t, n) => `
|
|
9880
9904
|
<div class="__crossx-pw-notice-item" data-check-index="${n}" role="checkbox" aria-checked="false" tabindex="0">
|
|
9881
|
-
<div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${
|
|
9882
|
-
<span class="__crossx-pw-notice-item-text">${
|
|
9905
|
+
<div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${no}</div>
|
|
9906
|
+
<span class="__crossx-pw-notice-item-text">${S(t)}</span>
|
|
9883
9907
|
</div>
|
|
9884
9908
|
`).join("");
|
|
9885
9909
|
return `
|
|
9886
9910
|
<div class="__crossx-header">
|
|
9887
|
-
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${
|
|
9888
|
-
<p class="__crossx-pw-subtitle">${
|
|
9889
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9911
|
+
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${S(s.title)}</p>
|
|
9912
|
+
<p class="__crossx-pw-subtitle">${S(s.headerSubtitle)}</p>
|
|
9913
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9890
9914
|
</div>
|
|
9891
9915
|
<hr class="__crossx-divider">
|
|
9892
9916
|
<div class="__crossx-pw-body">
|
|
9893
9917
|
<div class="__crossx-pw-fields __crossx-pw-fields--notice">
|
|
9894
9918
|
<div class="__crossx-pw-notice-header">
|
|
9895
9919
|
<div class="__crossx-pw-notice-title-row">
|
|
9896
|
-
<span class="__crossx-pw-notice-icon">${
|
|
9897
|
-
<p class="__crossx-pw-notice-title">${
|
|
9920
|
+
<span class="__crossx-pw-notice-icon">${io}</span>
|
|
9921
|
+
<p class="__crossx-pw-notice-title">${S(s.noticeTitle)}</p>
|
|
9898
9922
|
</div>
|
|
9899
|
-
<p class="__crossx-pw-notice-desc">${
|
|
9923
|
+
<p class="__crossx-pw-notice-desc">${S(s.noticeDesc)}</p>
|
|
9900
9924
|
</div>
|
|
9901
9925
|
<div class="__crossx-pw-notice-checks" id="__crossx-notice-checks">
|
|
9902
9926
|
${r}
|
|
9903
9927
|
</div>
|
|
9904
9928
|
</div>
|
|
9905
9929
|
<button class="__crossx-pw-btn --disabled" id="__crossx-pin-notice-next"
|
|
9906
|
-
data-next-label="${
|
|
9907
|
-
data-submit-label="${
|
|
9908
|
-
${
|
|
9930
|
+
data-next-label="${S(s.nextButton)}"
|
|
9931
|
+
data-submit-label="${S(s.submitButton)}">
|
|
9932
|
+
${S(s.nextButton)}
|
|
9909
9933
|
</button>
|
|
9910
9934
|
</div>
|
|
9911
9935
|
<div class="__crossx-home-indicator"></div>
|
|
9912
9936
|
`;
|
|
9913
9937
|
}
|
|
9914
|
-
function
|
|
9915
|
-
const e = !!s.lockExpiresAt && s.lockExpiresAt > Date.now(), r = s.lockExpiresAt ? ` data-lock-expires="${s.lockExpiresAt}"` : "", t = s.headerSubtitle ? `<p class="__crossx-pin6-header-sub">${
|
|
9938
|
+
function _t(s) {
|
|
9939
|
+
const e = !!s.lockExpiresAt && s.lockExpiresAt > Date.now(), r = s.lockExpiresAt ? ` data-lock-expires="${s.lockExpiresAt}"` : "", t = s.headerSubtitle ? `<p class="__crossx-pin6-header-sub">${S(s.headerSubtitle)}</p>` : "", n = s.subtitle ? `<p class="__crossx-pin6-subtitle">${S(s.subtitle)}</p>` : "", i = s.errorMessage ? `<p class="__crossx-pin6-error" id="__crossx-pin6-error">${S(s.errorMessage)}</p>` : '<p class="__crossx-pin6-error" id="__crossx-pin6-error"></p>', o = e ? `<p class="__crossx-pin6-lock-msg" id="__crossx-pin6-lock-msg">
|
|
9916
9940
|
${ts}
|
|
9917
9941
|
<span id="__crossx-pin6-lock-countdown"></span>
|
|
9918
|
-
</p>` : "", a = s.warningMessage && s.attemptCount != null && s.attemptCount > 0 ? `<p class="__crossx-pin6-warning" id="__crossx-pin6-warning">${
|
|
9942
|
+
</p>` : "", a = s.warningMessage && s.attemptCount != null && s.attemptCount > 0 ? `<p class="__crossx-pin6-warning" id="__crossx-pin6-warning">${S(s.warningMessage)}</p>` : '<p class="__crossx-pin6-warning" id="__crossx-pin6-warning"></p>', c = s.attemptCount != null && s.attemptCount > 0 ? `<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt">${s.attemptCount}/${s.maxAttempts ?? "?"}</p>` : '<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt"></p>', l = e ? " --locked" : "", u = Array.from(
|
|
9919
9943
|
{ length: 6 },
|
|
9920
|
-
(
|
|
9944
|
+
(y, v) => `<input class="__crossx-pin6-box${l}" type="tel" maxlength="1" inputmode="numeric" pattern="[0-9]" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" aria-label="PIN digit ${v + 1}"${e ? " disabled" : ""}>`
|
|
9921
9945
|
).join(""), p = e ? " --locked" : "", g = Array.from(
|
|
9922
9946
|
{ length: 6 },
|
|
9923
|
-
(
|
|
9947
|
+
(y, v) => `<div class="__crossx-pin6-dot${p}" data-dot-index="${v}" aria-label="PIN digit ${v + 1}"></div>`
|
|
9924
9948
|
).join(""), _ = e ? " --disabled" : "", x = `
|
|
9925
9949
|
<div class="__crossx-pin6-numpad" id="__crossx-pin6-numpad">
|
|
9926
9950
|
<div class="__crossx-pin6-numpad-row">
|
|
@@ -9941,14 +9965,14 @@ function pt(s) {
|
|
|
9941
9965
|
<div class="__crossx-pin6-numpad-row">
|
|
9942
9966
|
<button type="button" class="__crossx-pin6-numpad-key --empty" aria-hidden="true"></button>
|
|
9943
9967
|
<button type="button" class="__crossx-pin6-numpad-key${_}" data-key="0">0</button>
|
|
9944
|
-
<button type="button" class="__crossx-pin6-numpad-key --delete${_}" data-key="backspace" aria-label="Delete">${
|
|
9968
|
+
<button type="button" class="__crossx-pin6-numpad-key --delete${_}" data-key="backspace" aria-label="Delete">${so}</button>
|
|
9945
9969
|
</div>
|
|
9946
9970
|
</div>`;
|
|
9947
9971
|
return `
|
|
9948
9972
|
<div class="__crossx-header">
|
|
9949
|
-
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${
|
|
9973
|
+
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${S(s.title)}</p>
|
|
9950
9974
|
${t}
|
|
9951
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9975
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9952
9976
|
</div>
|
|
9953
9977
|
<hr class="__crossx-divider">
|
|
9954
9978
|
<div class="__crossx-pin6-body"${r}>
|
|
@@ -9969,210 +9993,210 @@ function pt(s) {
|
|
|
9969
9993
|
}
|
|
9970
9994
|
function hr(s, e) {
|
|
9971
9995
|
const r = document.createElement("div");
|
|
9972
|
-
return r.id =
|
|
9996
|
+
return r.id = ee, r.innerHTML = `
|
|
9973
9997
|
<div class="__crossx-card __crossx-card--pin6" style="${ie(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9974
9998
|
${e}
|
|
9975
9999
|
</div>
|
|
9976
10000
|
`, r;
|
|
9977
10001
|
}
|
|
9978
|
-
function
|
|
10002
|
+
function to(s, e) {
|
|
9979
10003
|
if (s.length !== 6) return e.tooShort;
|
|
9980
10004
|
if (!/^\d+$/.test(s)) return e.numbersOnly;
|
|
9981
10005
|
if (/(.)\1{2}/.test(s)) return e.repeatingDigit;
|
|
9982
10006
|
const r = s.split("").map(Number), t = r.every((i, o) => o === 0 || i === (r[o - 1] + 1) % 10), n = r.every((i, o) => o === 0 || i === (r[o - 1] + 9) % 10);
|
|
9983
10007
|
return t || n ? e.sequential : s[0] !== s[1] && s === s.slice(0, 2).repeat(3) ? e.alternatingPattern : null;
|
|
9984
10008
|
}
|
|
9985
|
-
function
|
|
10009
|
+
function ro(s) {
|
|
9986
10010
|
const e = Math.max(0, Math.ceil(s / 1e3)), r = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
|
|
9987
10011
|
return r > 0 ? `${r}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
|
|
9988
10012
|
}
|
|
9989
|
-
function
|
|
9990
|
-
var
|
|
10013
|
+
function ft(s, e, r, t, n, i, o) {
|
|
10014
|
+
var C, W;
|
|
9991
10015
|
let a = !!(i && i > Date.now()), c = !1;
|
|
9992
|
-
const l = () => Array.from(s.querySelectorAll(".__crossx-pin6-box")), u = () => s.querySelector("#__crossx-pin6-boxes"), p = () => s.querySelector("#__crossx-pin6-error"), g = () => s.querySelector("#__crossx-pin6-lock-msg"), _ = () => s.querySelector("#__crossx-pin6-lock-countdown"), x = () => s.querySelector(".__crossx-pin6-body"),
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
10016
|
+
const l = () => Array.from(s.querySelectorAll(".__crossx-pin6-box")), u = () => s.querySelector("#__crossx-pin6-boxes"), p = () => s.querySelector("#__crossx-pin6-error"), g = () => s.querySelector("#__crossx-pin6-lock-msg"), _ = () => s.querySelector("#__crossx-pin6-lock-countdown"), x = () => s.querySelector(".__crossx-pin6-body"), y = "●", v = (b, E) => {
|
|
10017
|
+
b.dataset.digit = E, b.value = y;
|
|
10018
|
+
}, A = (b) => {
|
|
10019
|
+
delete b.dataset.digit, b.value = "";
|
|
10020
|
+
}, R = (b) => b.dataset.digit ?? "", k = () => l().map(R).join(""), L = () => Array.from(s.querySelectorAll(".__crossx-pin6-dot")), D = () => {
|
|
10021
|
+
var N;
|
|
10022
|
+
const b = l(), E = L();
|
|
10023
|
+
if (E.length && (E.forEach((I, U) => {
|
|
10024
|
+
const K = !!(b[U] && R(b[U]));
|
|
10025
|
+
I.classList.toggle("--filled", K), I.classList.toggle("--active", !1);
|
|
9998
10026
|
}), !a && !c)) {
|
|
9999
|
-
const
|
|
10000
|
-
(
|
|
10001
|
-
}
|
|
10002
|
-
},
|
|
10003
|
-
s.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((
|
|
10004
|
-
},
|
|
10005
|
-
a = b, l().forEach((
|
|
10006
|
-
|
|
10027
|
+
const I = b.findIndex((K) => !R(K));
|
|
10028
|
+
(N = E[I === -1 ? 5 : I]) == null || N.classList.add("--active");
|
|
10029
|
+
}
|
|
10030
|
+
}, z = () => {
|
|
10031
|
+
s.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((E) => E.classList.toggle("--disabled", a)), L().forEach((E) => E.classList.toggle("--locked", a)), D();
|
|
10032
|
+
}, Q = (b) => {
|
|
10033
|
+
a = b, l().forEach((E) => {
|
|
10034
|
+
E.disabled = b, E.classList.toggle("--locked", b);
|
|
10007
10035
|
});
|
|
10008
|
-
},
|
|
10036
|
+
}, q = () => s.querySelector("#__crossx-pin6-attempt"), J = () => {
|
|
10009
10037
|
const b = p();
|
|
10010
10038
|
b && (b.textContent = "");
|
|
10011
|
-
},
|
|
10012
|
-
var
|
|
10013
|
-
let
|
|
10014
|
-
if (!v) {
|
|
10015
|
-
v = document.createElement("p"), v.className = "__crossx-pin6-warning", v.id = "__crossx-pin6-warning";
|
|
10016
|
-
const T = p();
|
|
10017
|
-
T ? T.insertAdjacentElement("afterend", v) : (E = x()) == null || E.appendChild(v);
|
|
10018
|
-
}
|
|
10019
|
-
v.textContent = b;
|
|
10020
|
-
}, X = () => {
|
|
10021
|
-
const b = J();
|
|
10022
|
-
b && (b.textContent = "");
|
|
10023
|
-
}, Q = (b, v) => {
|
|
10024
|
-
var T;
|
|
10025
|
-
let E = L();
|
|
10039
|
+
}, te = () => o ?? "Your account will be locked after further failures.", G = () => s.querySelector("#__crossx-pin6-warning"), B = (b) => {
|
|
10040
|
+
var N;
|
|
10041
|
+
let E = G();
|
|
10026
10042
|
if (!E) {
|
|
10027
|
-
E = document.createElement("p"), E.className = "__crossx-pin6-
|
|
10028
|
-
const
|
|
10029
|
-
|
|
10043
|
+
E = document.createElement("p"), E.className = "__crossx-pin6-warning", E.id = "__crossx-pin6-warning";
|
|
10044
|
+
const I = p();
|
|
10045
|
+
I ? I.insertAdjacentElement("afterend", E) : (N = x()) == null || N.appendChild(E);
|
|
10030
10046
|
}
|
|
10031
|
-
E.textContent =
|
|
10047
|
+
E.textContent = b;
|
|
10032
10048
|
}, H = () => {
|
|
10033
|
-
const b =
|
|
10049
|
+
const b = G();
|
|
10034
10050
|
b && (b.textContent = "");
|
|
10035
|
-
},
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10051
|
+
}, m = (b, E) => {
|
|
10052
|
+
var I;
|
|
10053
|
+
let N = q();
|
|
10054
|
+
if (!N) {
|
|
10055
|
+
N = document.createElement("p"), N.className = "__crossx-pin6-attempt", N.id = "__crossx-pin6-attempt";
|
|
10056
|
+
const U = G() ?? p();
|
|
10057
|
+
U ? U.insertAdjacentElement("afterend", N) : (I = x()) == null || I.appendChild(N);
|
|
10058
|
+
}
|
|
10059
|
+
N.textContent = `${b}/${E}`;
|
|
10060
|
+
}, w = () => {
|
|
10061
|
+
const b = q();
|
|
10062
|
+
b && (b.textContent = "");
|
|
10063
|
+
}, T = (b) => {
|
|
10064
|
+
const E = p();
|
|
10065
|
+
E && (E.textContent = b);
|
|
10066
|
+
const N = u();
|
|
10067
|
+
N == null || N.classList.add("--shake"), setTimeout(() => N == null ? void 0 : N.classList.remove("--shake"), 500), l().forEach(A), setTimeout(() => {
|
|
10068
|
+
var I;
|
|
10069
|
+
(I = l()[0]) == null || I.focus(), D();
|
|
10044
10070
|
}, 50);
|
|
10045
|
-
},
|
|
10046
|
-
var
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
const
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
const N = new MutationObserver(() => {
|
|
10067
|
-
document.contains(s) || (clearInterval(T), N.disconnect());
|
|
10071
|
+
}, O = (b) => {
|
|
10072
|
+
var K;
|
|
10073
|
+
Q(!0), l().forEach(A), z();
|
|
10074
|
+
const E = p();
|
|
10075
|
+
if (E && (E.textContent = "Too many failed attempts. Please wait."), !g()) {
|
|
10076
|
+
const j = document.createElement("p");
|
|
10077
|
+
j.className = "__crossx-pin6-lock-msg", j.id = "__crossx-pin6-lock-msg", j.innerHTML = `${ts}<span id="__crossx-pin6-lock-countdown"></span>`;
|
|
10078
|
+
const V = p();
|
|
10079
|
+
V ? V.insertAdjacentElement("afterend", j) : (K = x()) == null || K.appendChild(j);
|
|
10080
|
+
}
|
|
10081
|
+
const N = () => {
|
|
10082
|
+
var Y;
|
|
10083
|
+
const j = b - Date.now(), V = _();
|
|
10084
|
+
j <= 0 ? (clearInterval(I), Q(!1), (Y = g()) == null || Y.remove(), E && (E.textContent = ""), z(), setTimeout(() => {
|
|
10085
|
+
var Ee;
|
|
10086
|
+
return (Ee = l()[0]) == null ? void 0 : Ee.focus();
|
|
10087
|
+
}, 50)) : V && (V.textContent = ` ${ro(j)}`);
|
|
10088
|
+
}, I = setInterval(N, 1e3);
|
|
10089
|
+
N();
|
|
10090
|
+
const U = new MutationObserver(() => {
|
|
10091
|
+
document.contains(s) || (clearInterval(I), U.disconnect());
|
|
10068
10092
|
});
|
|
10069
|
-
|
|
10070
|
-
},
|
|
10093
|
+
U.observe(document.body, { childList: !0, subtree: !1 });
|
|
10094
|
+
}, F = async () => {
|
|
10071
10095
|
if (a || c) return;
|
|
10072
|
-
const b =
|
|
10096
|
+
const b = k();
|
|
10073
10097
|
if (b.length === 6) {
|
|
10074
|
-
c = !0, l().forEach((
|
|
10075
|
-
|
|
10098
|
+
c = !0, l().forEach((E) => {
|
|
10099
|
+
E.disabled = !0;
|
|
10076
10100
|
});
|
|
10077
10101
|
try {
|
|
10078
10102
|
if (n) {
|
|
10079
|
-
const
|
|
10080
|
-
|
|
10103
|
+
const E = await n(b);
|
|
10104
|
+
E.ok ? e(b) : E.lockExpiresAt ? (w(), O(E.lockExpiresAt)) : (T(E.error ?? "Incorrect PIN. Please try again."), E.attemptCount != null && E.maxAttempts != null ? (B(te()), m(E.attemptCount, E.maxAttempts)) : (H(), w()));
|
|
10081
10105
|
} else
|
|
10082
10106
|
e(b);
|
|
10083
|
-
} catch (
|
|
10084
|
-
t && t(
|
|
10107
|
+
} catch (E) {
|
|
10108
|
+
t && t(E);
|
|
10085
10109
|
} finally {
|
|
10086
|
-
c = !1, a || l().forEach((
|
|
10087
|
-
|
|
10088
|
-
}),
|
|
10110
|
+
c = !1, a || l().forEach((E) => {
|
|
10111
|
+
E.disabled = !1;
|
|
10112
|
+
}), D();
|
|
10089
10113
|
}
|
|
10090
10114
|
}
|
|
10091
10115
|
};
|
|
10092
|
-
i && i > Date.now() ?
|
|
10116
|
+
i && i > Date.now() ? O(i) : setTimeout(() => {
|
|
10093
10117
|
var b;
|
|
10094
10118
|
return (b = l()[0]) == null ? void 0 : b.focus();
|
|
10095
10119
|
}, 100);
|
|
10096
|
-
const
|
|
10120
|
+
const $ = () => {
|
|
10097
10121
|
if (a || c) return;
|
|
10098
|
-
const b = l(),
|
|
10099
|
-
|
|
10122
|
+
const b = l(), E = b.find((N) => !R(N)) ?? b[b.length - 1];
|
|
10123
|
+
E == null || E.focus();
|
|
10100
10124
|
};
|
|
10101
|
-
(
|
|
10102
|
-
b.target.classList.contains("__crossx-pin6-box") ||
|
|
10103
|
-
}), (
|
|
10104
|
-
const
|
|
10105
|
-
|
|
10106
|
-
}), l().forEach((b,
|
|
10125
|
+
(C = u()) == null || C.addEventListener("click", (b) => {
|
|
10126
|
+
b.target.classList.contains("__crossx-pin6-box") || $();
|
|
10127
|
+
}), (W = x()) == null || W.addEventListener("click", (b) => {
|
|
10128
|
+
const E = b.target;
|
|
10129
|
+
E.classList.contains("__crossx-pin6-box") || E.closest("button") || $();
|
|
10130
|
+
}), l().forEach((b, E) => {
|
|
10107
10131
|
b.addEventListener("input", () => {
|
|
10108
|
-
var
|
|
10109
|
-
const
|
|
10110
|
-
b
|
|
10111
|
-
}), b.addEventListener("keydown", (
|
|
10112
|
-
var
|
|
10113
|
-
if (
|
|
10114
|
-
if (
|
|
10115
|
-
b
|
|
10116
|
-
else if (
|
|
10117
|
-
const
|
|
10118
|
-
|
|
10132
|
+
var I;
|
|
10133
|
+
const N = b.value.replace(/\D/g, "").slice(-1);
|
|
10134
|
+
N ? v(b, N) : A(b), J(), N && E < 5 && ((I = l()[E + 1]) == null || I.focus()), D(), k().length === 6 && setTimeout(F, 80);
|
|
10135
|
+
}), b.addEventListener("keydown", (N) => {
|
|
10136
|
+
var I, U;
|
|
10137
|
+
if (N.key === "Backspace") {
|
|
10138
|
+
if (N.preventDefault(), R(b))
|
|
10139
|
+
A(b);
|
|
10140
|
+
else if (E > 0) {
|
|
10141
|
+
const K = l()[E - 1];
|
|
10142
|
+
A(K), K.focus();
|
|
10119
10143
|
}
|
|
10120
|
-
|
|
10121
|
-
} else
|
|
10122
|
-
}), b.addEventListener("paste", (
|
|
10123
|
-
var
|
|
10124
|
-
|
|
10125
|
-
const
|
|
10126
|
-
if (!
|
|
10127
|
-
const
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
}), (
|
|
10144
|
+
D();
|
|
10145
|
+
} else N.key === "ArrowLeft" && E > 0 ? (N.preventDefault(), (I = l()[E - 1]) == null || I.focus()) : N.key === "ArrowRight" && E < 5 ? (N.preventDefault(), (U = l()[E + 1]) == null || U.focus()) : N.key === "Escape" && r();
|
|
10146
|
+
}), b.addEventListener("paste", (N) => {
|
|
10147
|
+
var K, j;
|
|
10148
|
+
N.preventDefault();
|
|
10149
|
+
const I = (((K = N.clipboardData) == null ? void 0 : K.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
|
|
10150
|
+
if (!I) return;
|
|
10151
|
+
const U = l();
|
|
10152
|
+
I.split("").forEach((V, Y) => {
|
|
10153
|
+
U[Y] && v(U[Y], V);
|
|
10154
|
+
}), (j = U[Math.min(I.length - 1, 5)]) == null || j.focus(), J(), D(), k().length === 6 && setTimeout(F, 80);
|
|
10131
10155
|
}), b.addEventListener("focus", () => b.select());
|
|
10132
10156
|
});
|
|
10133
|
-
const
|
|
10134
|
-
if (
|
|
10157
|
+
const M = s.querySelector("#__crossx-pin6-numpad");
|
|
10158
|
+
if (M) {
|
|
10135
10159
|
let b = null;
|
|
10136
|
-
const
|
|
10160
|
+
const E = () => {
|
|
10137
10161
|
b && (b.classList.remove("--pressed"), b = null);
|
|
10138
10162
|
};
|
|
10139
|
-
|
|
10140
|
-
const
|
|
10141
|
-
!
|
|
10163
|
+
M.addEventListener("pointerdown", (I) => {
|
|
10164
|
+
const U = I.target.closest(".__crossx-pin6-numpad-key");
|
|
10165
|
+
!U || a || c || (E(), b = U, U.classList.add("--pressed"), U.setPointerCapture(I.pointerId));
|
|
10142
10166
|
});
|
|
10143
|
-
const
|
|
10144
|
-
const
|
|
10145
|
-
if (!
|
|
10146
|
-
if (
|
|
10147
|
-
const
|
|
10148
|
-
|
|
10167
|
+
const N = (I) => {
|
|
10168
|
+
const U = I.dataset.key;
|
|
10169
|
+
if (!U) return;
|
|
10170
|
+
if (U === "backspace") {
|
|
10171
|
+
const Y = [...l()].reverse().find((Ee) => R(Ee));
|
|
10172
|
+
Y && (A(Y), J()), D();
|
|
10149
10173
|
return;
|
|
10150
10174
|
}
|
|
10151
|
-
if (!/^\d$/.test(
|
|
10152
|
-
const
|
|
10153
|
-
|
|
10175
|
+
if (!/^\d$/.test(U)) return;
|
|
10176
|
+
const j = l().find((V) => !R(V));
|
|
10177
|
+
j && (v(j, U), J(), D(), k().length === 6 && setTimeout(F, 80));
|
|
10154
10178
|
};
|
|
10155
|
-
|
|
10179
|
+
M.addEventListener("pointerup", (I) => {
|
|
10156
10180
|
if (!b) return;
|
|
10157
|
-
const
|
|
10158
|
-
|
|
10159
|
-
const
|
|
10160
|
-
|
|
10161
|
-
}),
|
|
10181
|
+
const U = b;
|
|
10182
|
+
E();
|
|
10183
|
+
const K = U.getBoundingClientRect();
|
|
10184
|
+
I.clientX >= K.left && I.clientX <= K.right && I.clientY >= K.top && I.clientY <= K.bottom && !a && !c && N(U);
|
|
10185
|
+
}), M.addEventListener("pointercancel", E), M.addEventListener("pointerleave", E, !0), D(), i && i > Date.now() && z();
|
|
10162
10186
|
}
|
|
10163
10187
|
}
|
|
10164
|
-
const
|
|
10188
|
+
const so = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
10165
10189
|
<path d="M7.36 0.5H19.5C20.6046 0.5 21.5 1.39543 21.5 2.5V14.5C21.5 15.6046 20.6046 16.5 19.5 16.5H7.36C6.76 16.5 6.19 16.24 5.8 15.79L0.94 10.02C0.35 9.32 0.35 8.3 0.94 7.6L5.8 1.71C6.19 1.26 6.76 0.5 7.36 0.5Z" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
|
10166
10190
|
<line x1="10" y1="5.5" x2="16" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
10167
10191
|
<line x1="16" y1="5.5" x2="10" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
10168
10192
|
</svg>`, ts = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
10169
10193
|
<path d="M14.5 8.5H14V6.5C14 4.015 11.985 2 9.5 2C7.015 2 5 4.015 5 6.5V8.5H4.5C3.672 8.5 3 9.172 3 10V16.5C3 17.328 3.672 18 4.5 18H14.5C15.328 18 16 17.328 16 16.5V10C16 9.172 15.328 8.5 14.5 8.5ZM10.5 13.415V15C10.5 15.276 10.276 15.5 10 15.5H9C8.724 15.5 8.5 15.276 8.5 15V13.415C8.187 13.196 8 12.847 8 12.5C8 11.672 8.672 11 9.5 11C10.328 11 11 11.672 11 12.5C11 12.847 10.813 13.196 10.5 13.415ZM12.5 8.5H6.5V6.5C6.5 4.843 7.843 3.5 9.5 3.5C11.157 3.5 12.5 4.843 12.5 6.5V8.5Z" fill="currentColor"/>
|
|
10170
|
-
</svg>`,
|
|
10194
|
+
</svg>`, no = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
10171
10195
|
<path d="M1 4.5L4 7.5L10 1" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
10172
|
-
</svg>`,
|
|
10196
|
+
</svg>`, io = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
10173
10197
|
<path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="currentColor"/>
|
|
10174
10198
|
</svg>`;
|
|
10175
|
-
function
|
|
10199
|
+
function oo(s, e, r) {
|
|
10176
10200
|
var i;
|
|
10177
10201
|
const t = s.querySelectorAll(".__crossx-pin-input");
|
|
10178
10202
|
t.forEach((o, a) => {
|
|
@@ -10205,8 +10229,8 @@ function io(s, e, r) {
|
|
|
10205
10229
|
}
|
|
10206
10230
|
}), (i = t[0]) == null || i.focus();
|
|
10207
10231
|
}
|
|
10208
|
-
class
|
|
10209
|
-
constructor(e = "light", r, t =
|
|
10232
|
+
class ao {
|
|
10233
|
+
constructor(e = "light", r, t = At, n) {
|
|
10210
10234
|
this.theme = e, this.overrides = r, this.tokens = dr(e, r), this.displayDecimals = t, this.pinKeyboard = n;
|
|
10211
10235
|
}
|
|
10212
10236
|
setPinKeyboard(e) {
|
|
@@ -10248,55 +10272,55 @@ class oo {
|
|
|
10248
10272
|
*/
|
|
10249
10273
|
showWalletSelector(e, r, t) {
|
|
10250
10274
|
return new Promise((n, i) => {
|
|
10251
|
-
var
|
|
10275
|
+
var R;
|
|
10252
10276
|
ae();
|
|
10253
|
-
const o = [...e], a =
|
|
10277
|
+
const o = [...e], a = Gi(o, this.tokens, t, this.messages), c = Ce();
|
|
10254
10278
|
ce(a);
|
|
10255
10279
|
let l = !1;
|
|
10256
10280
|
const u = () => {
|
|
10257
10281
|
l || (l = !0, a.remove(), c());
|
|
10258
10282
|
};
|
|
10259
10283
|
let p = null;
|
|
10260
|
-
const g = (
|
|
10261
|
-
u(), n(
|
|
10284
|
+
const g = (k) => {
|
|
10285
|
+
u(), n(k);
|
|
10262
10286
|
}, _ = () => {
|
|
10263
10287
|
u(), p ? i(p) : n(null);
|
|
10264
10288
|
};
|
|
10265
10289
|
(() => {
|
|
10266
|
-
a.querySelectorAll(".__crossx-wallet-item").forEach((
|
|
10267
|
-
|
|
10268
|
-
const L =
|
|
10269
|
-
g({ address: L, index:
|
|
10290
|
+
a.querySelectorAll(".__crossx-wallet-item").forEach((k) => {
|
|
10291
|
+
k.addEventListener("click", () => {
|
|
10292
|
+
const L = k.dataset.walletAddress ?? "", D = parseInt(k.dataset.walletIndex ?? "0", 10), z = o.find((Q) => Q.index === D);
|
|
10293
|
+
g({ address: L, index: D, name: z == null ? void 0 : z.name });
|
|
10270
10294
|
});
|
|
10271
10295
|
});
|
|
10272
10296
|
})();
|
|
10273
|
-
const
|
|
10274
|
-
|
|
10275
|
-
|
|
10297
|
+
const y = a.querySelector("#__crossx-add-wallet-error"), v = a.querySelector("#__crossx-add-wallet-btn");
|
|
10298
|
+
v && v.addEventListener("click", async () => {
|
|
10299
|
+
v.disabled = !0, y && (y.hidden = !0, y.textContent = "");
|
|
10276
10300
|
try {
|
|
10277
|
-
const
|
|
10278
|
-
o.push(
|
|
10301
|
+
const k = await r();
|
|
10302
|
+
o.push(k);
|
|
10279
10303
|
const L = a.querySelector("#__crossx-wallet-list");
|
|
10280
10304
|
if (L) {
|
|
10281
|
-
const
|
|
10282
|
-
|
|
10305
|
+
const D = document.createElement("button");
|
|
10306
|
+
D.className = "__crossx-wallet-item", D.dataset.walletIndex = String(k.index), D.dataset.walletAddress = k.address, D.innerHTML = `${es(k.address, k.index, this.tokens.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${S(Qr(k))}</span><span class="__crossx-wallet-addr">${de(k.address)}</span></span>`, D.addEventListener("click", () => g(k)), L.appendChild(D);
|
|
10283
10307
|
try {
|
|
10284
|
-
|
|
10308
|
+
D.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
10285
10309
|
} catch {
|
|
10286
10310
|
}
|
|
10287
10311
|
}
|
|
10288
|
-
|
|
10289
|
-
} catch (
|
|
10290
|
-
const L =
|
|
10291
|
-
|
|
10312
|
+
v.disabled = !1;
|
|
10313
|
+
} catch (k) {
|
|
10314
|
+
const L = k instanceof f && k.code === h.ADDRESS_LIMIT_EXCEEDED, D = this.resolveAddWalletErrorMessage(k);
|
|
10315
|
+
y && (y.textContent = D, y.hidden = !1), L ? (v.disabled = !0, v.setAttribute("aria-disabled", "true")) : v.disabled = !1, p = k;
|
|
10292
10316
|
}
|
|
10293
|
-
}), (
|
|
10294
|
-
|
|
10317
|
+
}), (R = a.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", _), a.addEventListener("click", (k) => {
|
|
10318
|
+
k.target === a && _();
|
|
10295
10319
|
});
|
|
10296
|
-
const
|
|
10297
|
-
|
|
10320
|
+
const A = (k) => {
|
|
10321
|
+
k.key === "Escape" && (document.removeEventListener("keydown", A), _());
|
|
10298
10322
|
};
|
|
10299
|
-
document.addEventListener("keydown",
|
|
10323
|
+
document.addEventListener("keydown", A);
|
|
10300
10324
|
});
|
|
10301
10325
|
}
|
|
10302
10326
|
/**
|
|
@@ -10309,7 +10333,7 @@ class oo {
|
|
|
10309
10333
|
resolveAddWalletErrorMessage(e) {
|
|
10310
10334
|
const r = this.messages;
|
|
10311
10335
|
if (e instanceof f && e.code === h.ADDRESS_LIMIT_EXCEEDED) {
|
|
10312
|
-
const n = e.details, i = typeof (n == null ? void 0 : n.limit) == "number" ? n.limit :
|
|
10336
|
+
const n = e.details, i = typeof (n == null ? void 0 : n.limit) == "number" ? n.limit : xt;
|
|
10313
10337
|
return ((r == null ? void 0 : r.wallet_selector_add_error_limit_exceeded) ?? "Account limit reached. Maximum {limit} accounts allowed.").replace("{limit}", String(i));
|
|
10314
10338
|
}
|
|
10315
10339
|
return (r == null ? void 0 : r.wallet_selector_add_error_generic) ?? "Failed to add a new account. Please try again.";
|
|
@@ -10322,32 +10346,32 @@ class oo {
|
|
|
10322
10346
|
showLoginSelector(e) {
|
|
10323
10347
|
var t;
|
|
10324
10348
|
const r = ((t = e == null ? void 0 : e.connectOtherWallets) == null ? void 0 : t.filter(
|
|
10325
|
-
(n) => Object.values(
|
|
10349
|
+
(n) => Object.values(He).includes(n) && String(n).trim() !== ""
|
|
10326
10350
|
)) ?? [];
|
|
10327
10351
|
return new Promise((n) => {
|
|
10328
|
-
var g, _, x,
|
|
10352
|
+
var g, _, x, y;
|
|
10329
10353
|
ae();
|
|
10330
|
-
const i =
|
|
10354
|
+
const i = ji(this.tokens, r, this.messages), o = Ce();
|
|
10331
10355
|
ce(i);
|
|
10332
10356
|
const a = () => {
|
|
10333
10357
|
i.remove(), o();
|
|
10334
|
-
}, c = (
|
|
10335
|
-
a(), n({ type: "oauth", provider:
|
|
10336
|
-
}, l = (
|
|
10337
|
-
a(), n({ type: "external", walletId:
|
|
10358
|
+
}, c = (v) => {
|
|
10359
|
+
a(), n({ type: "oauth", provider: v });
|
|
10360
|
+
}, l = (v) => {
|
|
10361
|
+
a(), n({ type: "external", walletId: v });
|
|
10338
10362
|
}, u = () => {
|
|
10339
10363
|
a(), n(null);
|
|
10340
10364
|
};
|
|
10341
|
-
(g = i.querySelector("#__crossx-apple-btn")) == null || g.addEventListener("click", () => c("apple")), (_ = i.querySelector("#__crossx-google-btn")) == null || _.addEventListener("click", () => c("google")), (x = i.querySelector("#__crossx-connect-other-wallet-btn")) == null || x.addEventListener("click", (
|
|
10342
|
-
const
|
|
10343
|
-
|
|
10344
|
-
}), (
|
|
10345
|
-
|
|
10346
|
-
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((
|
|
10347
|
-
|
|
10365
|
+
(g = i.querySelector("#__crossx-apple-btn")) == null || g.addEventListener("click", () => c("apple")), (_ = i.querySelector("#__crossx-google-btn")) == null || _.addEventListener("click", () => c("google")), (x = i.querySelector("#__crossx-connect-other-wallet-btn")) == null || x.addEventListener("click", (v) => {
|
|
10366
|
+
const R = v.currentTarget.dataset.walletId ?? "";
|
|
10367
|
+
R && l(R);
|
|
10368
|
+
}), (y = i.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", u), i.addEventListener("click", (v) => {
|
|
10369
|
+
v.target === i && u();
|
|
10370
|
+
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((v) => {
|
|
10371
|
+
v.addEventListener("click", (A) => A.stopPropagation());
|
|
10348
10372
|
});
|
|
10349
|
-
const p = (
|
|
10350
|
-
|
|
10373
|
+
const p = (v) => {
|
|
10374
|
+
v.key === "Escape" && (document.removeEventListener("keydown", p), u());
|
|
10351
10375
|
};
|
|
10352
10376
|
document.addEventListener("keydown", p);
|
|
10353
10377
|
});
|
|
@@ -10356,7 +10380,7 @@ class oo {
|
|
|
10356
10380
|
return new Promise((r) => {
|
|
10357
10381
|
var u, p, g;
|
|
10358
10382
|
ae();
|
|
10359
|
-
const t = this.messages, n =
|
|
10383
|
+
const t = this.messages, n = Yi(this.tokens, {
|
|
10360
10384
|
title: e.title,
|
|
10361
10385
|
message: e.message,
|
|
10362
10386
|
email: e.email,
|
|
@@ -10386,7 +10410,7 @@ class oo {
|
|
|
10386
10410
|
return new Promise((t) => {
|
|
10387
10411
|
var a, c, l;
|
|
10388
10412
|
ae();
|
|
10389
|
-
const n =
|
|
10413
|
+
const n = Xi(this.tokens, r);
|
|
10390
10414
|
ce(n);
|
|
10391
10415
|
const i = () => n.remove(), o = () => {
|
|
10392
10416
|
i(), t("recover");
|
|
@@ -10432,13 +10456,13 @@ class oo {
|
|
|
10432
10456
|
}, o = {
|
|
10433
10457
|
title: (t == null ? void 0 : t.pin_setup_confirm_title) ?? "Confirm PIN",
|
|
10434
10458
|
headerSubtitle: (t == null ? void 0 : t.pin_setup_confirm_subtitle) ?? "Enter your PIN again to confirm."
|
|
10435
|
-
}, a = hr(this.tokens,
|
|
10459
|
+
}, a = hr(this.tokens, eo(n)), c = Ce();
|
|
10436
10460
|
ce(a);
|
|
10437
10461
|
let l = !1;
|
|
10438
10462
|
const u = () => {
|
|
10439
10463
|
l || (l = !0, a.remove(), c());
|
|
10440
|
-
}, p = (
|
|
10441
|
-
u(), r(
|
|
10464
|
+
}, p = (R) => {
|
|
10465
|
+
u(), r(R);
|
|
10442
10466
|
}, g = () => {
|
|
10443
10467
|
u(), r(null);
|
|
10444
10468
|
}, _ = a.querySelector(".__crossx-card"), x = {
|
|
@@ -10447,66 +10471,66 @@ class oo {
|
|
|
10447
10471
|
repeatingDigit: (t == null ? void 0 : t.pin_validation_repeating_digit) ?? "Cannot use the same number 3+ times in a row.",
|
|
10448
10472
|
sequential: (t == null ? void 0 : t.pin_validation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
|
|
10449
10473
|
alternatingPattern: (t == null ? void 0 : t.pin_validation_alternating_pattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
10450
|
-
},
|
|
10451
|
-
var
|
|
10452
|
-
_.innerHTML =
|
|
10474
|
+
}, y = (R) => {
|
|
10475
|
+
var k;
|
|
10476
|
+
_.innerHTML = _t({
|
|
10453
10477
|
title: o.title,
|
|
10454
10478
|
headerSubtitle: o.headerSubtitle
|
|
10455
|
-
}), this.applyPinKeyboardMode(_), (
|
|
10456
|
-
L ===
|
|
10479
|
+
}), this.applyPinKeyboardMode(_), (k = _.querySelector("#__crossx-close-btn")) == null || k.addEventListener("click", g), ft(_, (L) => {
|
|
10480
|
+
L === R ? p(R) : v(i.mismatchError);
|
|
10457
10481
|
}, g);
|
|
10458
|
-
},
|
|
10459
|
-
var
|
|
10460
|
-
_.innerHTML =
|
|
10482
|
+
}, v = (R) => {
|
|
10483
|
+
var k;
|
|
10484
|
+
_.innerHTML = _t({
|
|
10461
10485
|
title: i.title,
|
|
10462
10486
|
headerSubtitle: i.headerSubtitle,
|
|
10463
10487
|
subtitle: i.subtitle,
|
|
10464
|
-
errorMessage:
|
|
10465
|
-
}), this.applyPinKeyboardMode(_), (
|
|
10466
|
-
const
|
|
10467
|
-
|
|
10488
|
+
errorMessage: R
|
|
10489
|
+
}), this.applyPinKeyboardMode(_), (k = _.querySelector("#__crossx-close-btn")) == null || k.addEventListener("click", g), ft(_, (L) => {
|
|
10490
|
+
const D = to(L, x);
|
|
10491
|
+
D ? v(D) : y(L);
|
|
10468
10492
|
}, g);
|
|
10469
10493
|
};
|
|
10470
10494
|
(() => {
|
|
10471
|
-
var
|
|
10472
|
-
const
|
|
10473
|
-
|
|
10474
|
-
const
|
|
10475
|
-
const
|
|
10476
|
-
|
|
10477
|
-
},
|
|
10478
|
-
if (L.has(
|
|
10479
|
-
const
|
|
10480
|
-
L.add(
|
|
10481
|
-
},
|
|
10482
|
-
if (!L.has(
|
|
10483
|
-
const
|
|
10484
|
-
L.delete(
|
|
10495
|
+
var te;
|
|
10496
|
+
const R = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), k = _.querySelector("#__crossx-pin-notice-next"), L = /* @__PURE__ */ new Set();
|
|
10497
|
+
k.removeAttribute("disabled");
|
|
10498
|
+
const D = k.dataset.nextLabel ?? "Next", z = k.dataset.submitLabel ?? "I Understand", Q = () => {
|
|
10499
|
+
const G = L.size === R.length;
|
|
10500
|
+
k.classList.toggle("--disabled", !G), k.textContent = G ? z : D;
|
|
10501
|
+
}, q = (G, B) => {
|
|
10502
|
+
if (L.has(B)) return;
|
|
10503
|
+
const H = G.querySelector(`#__crossx-notice-check-${B}`);
|
|
10504
|
+
L.add(B), H.classList.add("--checked"), G.setAttribute("aria-checked", "true"), Q();
|
|
10505
|
+
}, J = (G, B) => {
|
|
10506
|
+
if (!L.has(B)) return;
|
|
10507
|
+
const H = G.querySelector(`#__crossx-notice-check-${B}`);
|
|
10508
|
+
L.delete(B), H.classList.remove("--checked"), G.setAttribute("aria-checked", "false"), Q();
|
|
10485
10509
|
};
|
|
10486
|
-
|
|
10487
|
-
const
|
|
10488
|
-
|
|
10489
|
-
L.has(
|
|
10490
|
-
}),
|
|
10491
|
-
(
|
|
10510
|
+
R.forEach((G) => {
|
|
10511
|
+
const B = parseInt(G.dataset.checkIndex ?? "0", 10);
|
|
10512
|
+
G.addEventListener("click", () => {
|
|
10513
|
+
L.has(B) ? J(G, B) : q(G, B);
|
|
10514
|
+
}), G.addEventListener("keydown", (H) => {
|
|
10515
|
+
(H.key === " " || H.key === "Enter") && (H.preventDefault(), L.has(B) ? J(G, B) : q(G, B));
|
|
10492
10516
|
});
|
|
10493
|
-
}),
|
|
10494
|
-
if (L.size ===
|
|
10495
|
-
|
|
10517
|
+
}), k.addEventListener("click", () => {
|
|
10518
|
+
if (L.size === R.length) {
|
|
10519
|
+
v(e == null ? void 0 : e.errorMessage);
|
|
10496
10520
|
return;
|
|
10497
10521
|
}
|
|
10498
|
-
const
|
|
10499
|
-
const m = parseInt(
|
|
10522
|
+
const G = R.find((H) => {
|
|
10523
|
+
const m = parseInt(H.dataset.checkIndex ?? "0", 10);
|
|
10500
10524
|
return !L.has(m);
|
|
10501
10525
|
});
|
|
10502
|
-
if (!
|
|
10503
|
-
const
|
|
10504
|
-
|
|
10505
|
-
|
|
10526
|
+
if (!G) return;
|
|
10527
|
+
const B = parseInt(G.dataset.checkIndex ?? "0", 10);
|
|
10528
|
+
G.scrollIntoView({ behavior: "smooth", block: "nearest" }), G.classList.add("--highlight"), setTimeout(() => {
|
|
10529
|
+
G.classList.remove("--highlight"), q(G, B);
|
|
10506
10530
|
}, 400);
|
|
10507
|
-
}), (
|
|
10508
|
-
})(), a.addEventListener("click", (
|
|
10509
|
-
|
|
10531
|
+
}), (te = _.querySelector("#__crossx-close-btn")) == null || te.addEventListener("click", g);
|
|
10532
|
+
})(), a.addEventListener("click", (R) => {
|
|
10533
|
+
R.target === a && g();
|
|
10510
10534
|
});
|
|
10511
10535
|
});
|
|
10512
10536
|
}
|
|
@@ -10517,11 +10541,11 @@ class oo {
|
|
|
10517
10541
|
*/
|
|
10518
10542
|
showPinInputPrompt(e) {
|
|
10519
10543
|
return new Promise((r, t) => {
|
|
10520
|
-
var
|
|
10544
|
+
var A;
|
|
10521
10545
|
ae();
|
|
10522
10546
|
const n = this.messages, i = (e == null ? void 0 : e.verifyMode) === !0, o = i ? (n == null ? void 0 : n.verify_pin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pin_input_title) ?? "Enter PIN", a = i ? (n == null ? void 0 : n.verify_pin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pin_input_subtitle) ?? "Enter your 6-digit PIN to continue.", c = (n == null ? void 0 : n.pin_locked_failure_warning) ?? "Your account will be locked after further failures.", l = hr(
|
|
10523
10547
|
this.tokens,
|
|
10524
|
-
|
|
10548
|
+
_t({
|
|
10525
10549
|
title: o,
|
|
10526
10550
|
headerSubtitle: a,
|
|
10527
10551
|
errorMessage: e == null ? void 0 : e.errorMessage,
|
|
@@ -10535,15 +10559,15 @@ class oo {
|
|
|
10535
10559
|
let p = !1;
|
|
10536
10560
|
const g = () => {
|
|
10537
10561
|
p || (p = !0, l.remove(), u());
|
|
10538
|
-
}, _ = (
|
|
10539
|
-
g(), r(
|
|
10562
|
+
}, _ = (R) => {
|
|
10563
|
+
g(), r(R);
|
|
10540
10564
|
}, x = () => {
|
|
10541
10565
|
g(), r(null);
|
|
10542
|
-
},
|
|
10543
|
-
g(), t(
|
|
10544
|
-
},
|
|
10545
|
-
this.applyPinKeyboardMode(
|
|
10546
|
-
|
|
10566
|
+
}, y = (R) => {
|
|
10567
|
+
g(), t(R);
|
|
10568
|
+
}, v = l.querySelector(".__crossx-card");
|
|
10569
|
+
this.applyPinKeyboardMode(v), (A = v.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x), ft(v, _, x, y, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, c), l.addEventListener("click", (R) => {
|
|
10570
|
+
R.target === l && x();
|
|
10547
10571
|
});
|
|
10548
10572
|
});
|
|
10549
10573
|
}
|
|
@@ -10558,14 +10582,14 @@ class oo {
|
|
|
10558
10582
|
return new Promise((r) => {
|
|
10559
10583
|
var c;
|
|
10560
10584
|
ae();
|
|
10561
|
-
const t =
|
|
10585
|
+
const t = Ji(this.tokens, e);
|
|
10562
10586
|
ce(t);
|
|
10563
10587
|
const n = () => t.remove(), i = (l) => {
|
|
10564
10588
|
n(), r(l);
|
|
10565
10589
|
}, o = () => {
|
|
10566
10590
|
n(), r(null);
|
|
10567
10591
|
}, a = t.querySelector(".__crossx-card");
|
|
10568
|
-
a && this.applyPinKeyboardMode(a),
|
|
10592
|
+
a && this.applyPinKeyboardMode(a), oo(t, i, o), (c = t.querySelector("#__crossx-close-btn")) == null || c.addEventListener("click", o), t.addEventListener("click", (l) => {
|
|
10569
10593
|
l.target === t && o();
|
|
10570
10594
|
});
|
|
10571
10595
|
});
|
|
@@ -10580,7 +10604,7 @@ class oo {
|
|
|
10580
10604
|
return new Promise((t) => {
|
|
10581
10605
|
var l;
|
|
10582
10606
|
ae();
|
|
10583
|
-
const { overlay: n, startCountdown: i } =
|
|
10607
|
+
const { overlay: n, startCountdown: i } = Qi(this.tokens, e, r);
|
|
10584
10608
|
ce(n);
|
|
10585
10609
|
const o = () => {
|
|
10586
10610
|
c(), n.remove();
|
|
@@ -10600,7 +10624,7 @@ class oo {
|
|
|
10600
10624
|
return new Promise((r) => {
|
|
10601
10625
|
var a, c;
|
|
10602
10626
|
ae();
|
|
10603
|
-
const t =
|
|
10627
|
+
const t = Pi(e, this.tokens, this.messages);
|
|
10604
10628
|
ce(t);
|
|
10605
10629
|
const n = () => t.remove(), i = () => {
|
|
10606
10630
|
n(), r();
|
|
@@ -10629,7 +10653,7 @@ class oo {
|
|
|
10629
10653
|
showTransactionProgress(e, r) {
|
|
10630
10654
|
return new Promise((t) => {
|
|
10631
10655
|
ae();
|
|
10632
|
-
const n =
|
|
10656
|
+
const n = Li(e, this.tokens, this.messages);
|
|
10633
10657
|
ce(n);
|
|
10634
10658
|
const i = () => n.remove();
|
|
10635
10659
|
let o = !1;
|
|
@@ -10646,7 +10670,7 @@ class oo {
|
|
|
10646
10670
|
document.addEventListener("keydown", l);
|
|
10647
10671
|
};
|
|
10648
10672
|
r.then((l) => {
|
|
10649
|
-
o || (
|
|
10673
|
+
o || (Di(n, l, this.tokens, this.messages), c());
|
|
10650
10674
|
});
|
|
10651
10675
|
});
|
|
10652
10676
|
}
|
|
@@ -10655,7 +10679,7 @@ class oo {
|
|
|
10655
10679
|
var l, u, p;
|
|
10656
10680
|
ae();
|
|
10657
10681
|
let t;
|
|
10658
|
-
e.type === "sign-message" ? t =
|
|
10682
|
+
e.type === "sign-message" ? t = $i(e, this.tokens, this.messages) : e.type === "sign-typed-data" ? t = Bi(e, this.tokens, this.messages) : e.type === "sign" ? t = Ii(e, this.tokens, this.displayDecimals, this.messages) : t = Ti(e, this.tokens, this.displayDecimals, this.messages);
|
|
10659
10683
|
const n = Ce();
|
|
10660
10684
|
ce(t);
|
|
10661
10685
|
const i = () => {
|
|
@@ -10667,13 +10691,13 @@ class oo {
|
|
|
10667
10691
|
};
|
|
10668
10692
|
(l = t.querySelector("#__crossx-confirm-btn")) == null || l.addEventListener("click", o), (u = t.querySelector("#__crossx-cancel-btn")) == null || u.addEventListener("click", a), (p = t.querySelector("#__crossx-close-btn")) == null || p.addEventListener("click", a), t.querySelectorAll(".__crossx-copy-btn").forEach((g) => {
|
|
10669
10693
|
g.addEventListener("click", (_) => {
|
|
10670
|
-
var
|
|
10694
|
+
var y;
|
|
10671
10695
|
_.stopPropagation();
|
|
10672
10696
|
const x = g.dataset.copy;
|
|
10673
|
-
x && ((
|
|
10697
|
+
x && ((y = navigator.clipboard) == null || y.writeText(x).catch(() => {
|
|
10674
10698
|
}));
|
|
10675
10699
|
});
|
|
10676
|
-
}),
|
|
10700
|
+
}), fi(t), t.addEventListener("click", (g) => {
|
|
10677
10701
|
g.target === t && a();
|
|
10678
10702
|
});
|
|
10679
10703
|
const c = (g) => {
|
|
@@ -10683,7 +10707,7 @@ class oo {
|
|
|
10683
10707
|
});
|
|
10684
10708
|
}
|
|
10685
10709
|
}
|
|
10686
|
-
class
|
|
10710
|
+
class co {
|
|
10687
10711
|
constructor(e, r, t, n = () => !1) {
|
|
10688
10712
|
this.browserConfirmation = e, this.getBridge = r, this.getOrigin = t, this.isAuthenticatedViaRNBridge = n;
|
|
10689
10713
|
}
|
|
@@ -10848,7 +10872,7 @@ class ao {
|
|
|
10848
10872
|
(t = (r = this.browserConfirmation).setPinKeyboard) == null || t.call(r, e);
|
|
10849
10873
|
}
|
|
10850
10874
|
}
|
|
10851
|
-
class
|
|
10875
|
+
class lo {
|
|
10852
10876
|
constructor() {
|
|
10853
10877
|
this._accessToken = null, this._expiresAt = 0;
|
|
10854
10878
|
}
|
|
@@ -10880,7 +10904,7 @@ class co {
|
|
|
10880
10904
|
return !this._accessToken || this._expiresAt <= 0 ? !0 : Date.now() >= this._expiresAt - e;
|
|
10881
10905
|
}
|
|
10882
10906
|
}
|
|
10883
|
-
function
|
|
10907
|
+
function wo(s, e) {
|
|
10884
10908
|
if (!s.projectId)
|
|
10885
10909
|
throw new Error(
|
|
10886
10910
|
`[CROSSx] Fatal: projectId is required but was not provided.
|
|
@@ -10888,7 +10912,7 @@ Set the projectId field in SDKConfig when calling createCROSSxSDK().
|
|
|
10888
10912
|
Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
10889
10913
|
);
|
|
10890
10914
|
s.debug;
|
|
10891
|
-
const r =
|
|
10915
|
+
const r = Le.production, t = {
|
|
10892
10916
|
...s,
|
|
10893
10917
|
oauthServiceUrl: r.oauthServiceUrl,
|
|
10894
10918
|
authApiUrl: r.authApiUrl,
|
|
@@ -10902,9 +10926,9 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10902
10926
|
"refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
|
|
10903
10927
|
"IndexedDB를 지원하는 브라우저 사용을 권장합니다."
|
|
10904
10928
|
), t.secureStorageAvailable = i;
|
|
10905
|
-
const o = i ? new Vt(s.projectId) : new js(), a = new si(), c = new ai(), l = new
|
|
10929
|
+
const o = i ? new Vt(s.projectId) : new js(), a = new si(), c = new ai(), l = new Ie(), u = new lo(), p = new _r();
|
|
10906
10930
|
let g;
|
|
10907
|
-
s.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), g = new li(o, p)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), g = new
|
|
10931
|
+
s.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), g = new li(o, p)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), g = new Te(
|
|
10908
10932
|
n,
|
|
10909
10933
|
o,
|
|
10910
10934
|
c,
|
|
@@ -10913,31 +10937,31 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10913
10937
|
));
|
|
10914
10938
|
let _ = null;
|
|
10915
10939
|
const x = () => {
|
|
10916
|
-
var
|
|
10917
|
-
return ((
|
|
10940
|
+
var D;
|
|
10941
|
+
return ((D = _ == null ? void 0 : _.isAuthenticatedViaRNBridge) == null ? void 0 : D.call(_)) ?? !1;
|
|
10918
10942
|
};
|
|
10919
10943
|
g = new di(
|
|
10920
10944
|
g,
|
|
10921
10945
|
() => {
|
|
10922
|
-
var
|
|
10923
|
-
return (
|
|
10946
|
+
var D;
|
|
10947
|
+
return (D = _ == null ? void 0 : _.getRNBridge) == null ? void 0 : D.call(_);
|
|
10924
10948
|
},
|
|
10925
10949
|
x
|
|
10926
10950
|
);
|
|
10927
|
-
const
|
|
10951
|
+
const y = new We(n, c), v = new ao(
|
|
10928
10952
|
s.theme ?? "light",
|
|
10929
10953
|
s.themeTokens,
|
|
10930
10954
|
s.displayDecimals,
|
|
10931
10955
|
s.pinKeyboard
|
|
10932
|
-
),
|
|
10933
|
-
|
|
10956
|
+
), A = new co(
|
|
10957
|
+
v,
|
|
10934
10958
|
() => {
|
|
10935
|
-
var
|
|
10936
|
-
return (
|
|
10959
|
+
var D;
|
|
10960
|
+
return (D = _ == null ? void 0 : _.getRNBridge) == null ? void 0 : D.call(_);
|
|
10937
10961
|
},
|
|
10938
10962
|
() => typeof window < "u" ? window.location.origin : "http://localhost",
|
|
10939
10963
|
x
|
|
10940
|
-
),
|
|
10964
|
+
), R = e != null && e.wrapConfirmation ? e.wrapConfirmation(A) : A, k = new wt(
|
|
10941
10965
|
t,
|
|
10942
10966
|
n,
|
|
10943
10967
|
o,
|
|
@@ -10946,17 +10970,17 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10946
10970
|
l,
|
|
10947
10971
|
g,
|
|
10948
10972
|
u,
|
|
10949
|
-
|
|
10950
|
-
|
|
10973
|
+
R,
|
|
10974
|
+
y,
|
|
10951
10975
|
p
|
|
10952
10976
|
);
|
|
10953
|
-
_ =
|
|
10954
|
-
const L =
|
|
10955
|
-
return L && typeof L.setFreshTokenCallback == "function" && L.setFreshTokenCallback(() =>
|
|
10977
|
+
_ = k;
|
|
10978
|
+
const L = k.signInUseCase;
|
|
10979
|
+
return L && typeof L.setFreshTokenCallback == "function" && L.setFreshTokenCallback(() => k.requestFreshFirebaseIdTokenFromBridge()), typeof window < "u" && (window.__crossxSDK = k), k;
|
|
10956
10980
|
}
|
|
10957
|
-
function
|
|
10958
|
-
const e =
|
|
10959
|
-
|
|
10981
|
+
function mo(s) {
|
|
10982
|
+
const e = uo(s), r = ho(e), t = JSON.parse(r);
|
|
10983
|
+
_o(t);
|
|
10960
10984
|
const { data: n } = t;
|
|
10961
10985
|
return {
|
|
10962
10986
|
status: t.status,
|
|
@@ -10970,7 +10994,7 @@ function wo(s) {
|
|
|
10970
10994
|
raw: t
|
|
10971
10995
|
};
|
|
10972
10996
|
}
|
|
10973
|
-
function
|
|
10997
|
+
function uo(s) {
|
|
10974
10998
|
if (s.includes("://") && s.includes("?")) {
|
|
10975
10999
|
const e = new URL(s), r = e.searchParams.get("crossx_oauth_result");
|
|
10976
11000
|
if (r) return r;
|
|
@@ -10980,22 +11004,22 @@ function lo(s) {
|
|
|
10980
11004
|
}
|
|
10981
11005
|
return s;
|
|
10982
11006
|
}
|
|
10983
|
-
function
|
|
11007
|
+
function ho(s) {
|
|
10984
11008
|
if (s.startsWith("{"))
|
|
10985
11009
|
return s;
|
|
10986
11010
|
if (s.startsWith("%7B") || s.startsWith("%7b"))
|
|
10987
11011
|
return decodeURIComponent(s);
|
|
10988
|
-
const e =
|
|
11012
|
+
const e = po(s);
|
|
10989
11013
|
return decodeURIComponent(e);
|
|
10990
11014
|
}
|
|
10991
|
-
function
|
|
11015
|
+
function po(s) {
|
|
10992
11016
|
if (typeof atob == "function")
|
|
10993
11017
|
return atob(s);
|
|
10994
11018
|
if (typeof Buffer < "u")
|
|
10995
11019
|
return Buffer.from(s, "base64").toString("utf-8");
|
|
10996
11020
|
throw new Error("Base64 디코딩을 지원하는 환경이 아닙니다");
|
|
10997
11021
|
}
|
|
10998
|
-
function
|
|
11022
|
+
function _o(s) {
|
|
10999
11023
|
if (typeof s != "object" || s === null)
|
|
11000
11024
|
throw new Error("Deeplink payload가 유효한 객체가 아닙니다");
|
|
11001
11025
|
const e = s;
|
|
@@ -11015,14 +11039,14 @@ export {
|
|
|
11015
11039
|
cs as CONNECT_OTHER_WALLET_DISPLAY_ORDER,
|
|
11016
11040
|
f as CROSSxError,
|
|
11017
11041
|
ps as CROSSxEthereumProvider,
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11042
|
+
wt as CROSSxSDK,
|
|
11043
|
+
xo as ChainId,
|
|
11044
|
+
He as ConnectOtherWalletItem,
|
|
11021
11045
|
h as ErrorCode,
|
|
11022
|
-
|
|
11046
|
+
xt as MNEMONIC_ADDRESS_LIMIT,
|
|
11023
11047
|
_r as PinMemoryStore,
|
|
11024
|
-
|
|
11025
|
-
|
|
11048
|
+
lo as TokenMemoryStore,
|
|
11049
|
+
wo as createCROSSxSDK,
|
|
11026
11050
|
ls as getConnectOtherWalletLabel,
|
|
11027
|
-
|
|
11051
|
+
mo as parseOAuthDeeplink
|
|
11028
11052
|
};
|