@nexus-cross/crossx-sdk-core 2.2.3-beta.3 → 2.2.3-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/confirmation/BrowserConfirmationAdapter.d.ts.map +1 -1
- package/dist/crossx.global +135 -137
- package/dist/index.cjs +119 -121
- package/dist/index.js +988 -990
- 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",
|
|
@@ -83,15 +83,15 @@ const et = {
|
|
|
83
83
|
testnet: !0
|
|
84
84
|
}
|
|
85
85
|
}, go = Object.fromEntries(
|
|
86
|
-
Object.entries(
|
|
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);
|
|
@@ -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) {
|
|
@@ -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: {
|
|
@@ -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 Ct(s, e, r) {
|
|
4547
4547
|
if (!s.eql(s.sqr(e), r))
|
|
4548
4548
|
throw new Error("Cannot find square root");
|
|
4549
4549
|
}
|
|
4550
4550
|
function Cr(s, e) {
|
|
4551
|
-
const r = (s.ORDER +
|
|
4552
|
-
return
|
|
4551
|
+
const r = (s.ORDER + re) / Tr, t = s.pow(e, r);
|
|
4552
|
+
return Ct(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 Ct(s, a, e), a;
|
|
4557
4557
|
}
|
|
4558
4558
|
function An(s) {
|
|
4559
|
-
const e =
|
|
4559
|
+
const e = st(s), r = Or(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 Ct(a, v, c), v;
|
|
4566
4566
|
};
|
|
4567
4567
|
}
|
|
4568
4568
|
function Or(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
4580
|
return Cr;
|
|
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,12 +4589,12 @@ 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
|
};
|
|
@@ -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;
|
|
@@ -4662,14 +4662,14 @@ class Cn {
|
|
|
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,7 +4768,7 @@ class Cn {
|
|
|
4768
4768
|
return t ? r : e;
|
|
4769
4769
|
}
|
|
4770
4770
|
}
|
|
4771
|
-
function
|
|
4771
|
+
function st(s, e = {}) {
|
|
4772
4772
|
return new Cn(s, e);
|
|
4773
4773
|
}
|
|
4774
4774
|
function Lr(s) {
|
|
@@ -4782,16 +4782,16 @@ function Dr(s) {
|
|
|
4782
4782
|
return e + Math.ceil(e / 2);
|
|
4783
4783
|
}
|
|
4784
4784
|
function On(s, e, r = !1) {
|
|
4785
|
-
|
|
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: C } = 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(C);
|
|
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(C));
|
|
5142
|
+
}
|
|
5143
|
+
function g(H) {
|
|
5144
|
+
X(H, void 0, "Point");
|
|
5145
|
+
const { publicKey: m, publicKeyUncompressed: w } = l, T = H.length, C = H[0], F = H.subarray(1);
|
|
5146
|
+
if (T === m && (C === 2 || C === 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 O;
|
|
5152
5152
|
try {
|
|
5153
|
-
|
|
5154
|
-
} catch (
|
|
5155
|
-
const
|
|
5156
|
-
throw new Error("bad point: is not on curve, sqrt error" +
|
|
5153
|
+
O = 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 (
|
|
5161
|
-
} else if (
|
|
5162
|
-
const
|
|
5163
|
-
if (!
|
|
5159
|
+
const W = t.isOdd(O);
|
|
5160
|
+
return (C & 1) === 1 !== W && (O = t.neg(O)), { x: $, y: O };
|
|
5161
|
+
} else if (T === w && C === 4) {
|
|
5162
|
+
const $ = t.BYTES, M = t.fromBytes(F.subarray(0, $)), O = t.fromBytes(F.subarray($, $ * 2));
|
|
5163
|
+
if (!v(M, O))
|
|
5164
5164
|
throw new Error("bad point: is not on curve");
|
|
5165
|
-
return { x:
|
|
5165
|
+
return { x: M, y: O };
|
|
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(
|
|
5196
|
-
}
|
|
5197
|
-
const
|
|
5198
|
-
const { X:
|
|
5199
|
-
if (t.eql(
|
|
5200
|
-
return { x:
|
|
5201
|
-
const
|
|
5202
|
-
m == null && (m =
|
|
5203
|
-
const
|
|
5204
|
-
if (
|
|
5195
|
+
return Bn(H, c.basises, n.ORDER);
|
|
5196
|
+
}
|
|
5197
|
+
const z = Xt((H, m) => {
|
|
5198
|
+
const { X: w, Y: T, Z: C } = H;
|
|
5199
|
+
if (t.eql(C, t.ONE))
|
|
5200
|
+
return { x: w, y: T };
|
|
5201
|
+
const F = H.is0();
|
|
5202
|
+
m == null && (m = F ? t.ONE : t.inv(C));
|
|
5203
|
+
const $ = t.mul(w, m), M = t.mul(T, m), O = t.mul(C, m);
|
|
5204
|
+
if (F)
|
|
5205
5205
|
return { x: t.ZERO, y: t.ZERO };
|
|
5206
|
-
if (!t.eql(
|
|
5206
|
+
if (!t.eql(O, 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, C) {
|
|
5225
|
+
return w = new J(t.mul(w.X, H), w.Y, w.Z), m = Ze(T, m), w = Ze(C, 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: C } = this, { X: F, Y: $, Z: M } = m, O = t.eql(t.mul(w, M), t.mul(F, C)), W = t.eql(t.mul(T, M), t.mul($, C));
|
|
5284
|
+
return O && 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: C, Y: F, Z: $ } = this;
|
|
5296
|
+
let M = t.ZERO, O = t.ZERO, W = t.ZERO, b = t.mul(C, C), E = t.mul(F, F), N = t.mul($, $), I = t.mul(C, F);
|
|
5297
|
+
return I = t.add(I, I), W = t.mul(C, $), W = t.add(W, W), M = t.mul(m, W), O = t.mul(T, N), O = t.add(M, O), M = t.sub(E, O), O = t.add(E, O), O = t.mul(M, O), 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), O = t.add(O, 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, O, 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: C } = this, { X: F, Y: $, Z: M } = m;
|
|
5306
|
+
let O = 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(C, 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, C);
|
|
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, C), O = t.add($, M), Y = t.mul(Y, O), O = t.add(U, K), Y = t.sub(Y, O), b = t.mul(E, V), O = t.mul(N, K), b = t.add(O, b), O = t.sub(U, b), b = t.add(U, b), W = t.mul(O, 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), O = t.mul(j, O), O = t.sub(O, I), I = t.mul(j, U), b = t.mul(Y, b), b = t.add(b, I), new B(O, 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
|
-
|
|
5332
|
+
let T, C;
|
|
5333
|
+
const F = ($) => G.cached(this, $, (M) => Qt(B, M));
|
|
5334
|
+
if (w) {
|
|
5335
|
+
const { k1neg: $, k1: M, k2neg: O, k2: W } = D(m), { p: b, f: E } = F(M), { p: N, f: I } = F(W);
|
|
5336
|
+
C = E.add(I), T = q(w.beta, b, N, $, O);
|
|
5337
5337
|
} else {
|
|
5338
|
-
const { p:
|
|
5339
|
-
|
|
5338
|
+
const { p: $, f: M } = F(m);
|
|
5339
|
+
T = $, C = M;
|
|
5340
5340
|
}
|
|
5341
|
-
return Qt(
|
|
5341
|
+
return Qt(B, [T, C])[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:
|
|
5360
|
-
return
|
|
5358
|
+
if (w) {
|
|
5359
|
+
const { k1neg: C, k1: F, k2neg: $, k2: M } = D(m), { p1: O, p2: W } = Ln(B, T, F, M);
|
|
5360
|
+
return q(w.beta, O, W, C, $);
|
|
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 On(
|
|
5438
|
+
return On(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, C = w === "compact" ? T : w === "recovered" ? T + 1 : void 0;
|
|
5495
|
+
return X(m, C);
|
|
5496
5496
|
}
|
|
5497
5497
|
class L {
|
|
5498
|
-
constructor(
|
|
5498
|
+
constructor(w, T, C) {
|
|
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), C != null) {
|
|
5503
|
+
if (R(), ![0, 1, 2, 3].includes(C))
|
|
5504
5504
|
throw new Error("invalid recovery id");
|
|
5505
|
-
this.recovery =
|
|
5505
|
+
this.recovery = C;
|
|
5506
5506
|
}
|
|
5507
5507
|
Object.freeze(this);
|
|
5508
5508
|
}
|
|
5509
|
-
static fromBytes(
|
|
5510
|
-
|
|
5511
|
-
let
|
|
5512
|
-
if (
|
|
5513
|
-
const { r:
|
|
5514
|
-
return new L(
|
|
5509
|
+
static fromBytes(w, T = x.format) {
|
|
5510
|
+
k(w, T);
|
|
5511
|
+
let C;
|
|
5512
|
+
if (T === "der") {
|
|
5513
|
+
const { r: O, s: W } = ve.toSig(X(w));
|
|
5514
|
+
return new L(O, W);
|
|
5515
5515
|
}
|
|
5516
|
-
|
|
5517
|
-
const
|
|
5518
|
-
return new L(o.fromBytes(
|
|
5516
|
+
T === "recovered" && (C = 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), C);
|
|
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: C } = 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($), O = 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(C * W), I = s.BASE.multiplyUnsafe(E).add(O.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: C } = this, F = o.toBytes(T), $ = o.toBytes(C);
|
|
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
|
|
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:
|
|
5571
|
-
m =
|
|
5572
|
-
const
|
|
5573
|
-
if (!o.isValidNot0(
|
|
5558
|
+
const T = rt(w), C = w.length * 8 - c;
|
|
5559
|
+
return C > 0 ? T >> BigInt(C) : 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: C, prehash: F, extraEntropy: $ } = ht(T, x);
|
|
5571
|
+
m = J(m, F);
|
|
5572
|
+
const M = z(m), O = o.fromBytes(w);
|
|
5573
|
+
if (!o.isValidNot0(O))
|
|
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(O), 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 * O));
|
|
5589
|
+
if (Y === ge)
|
|
5590
5590
|
return;
|
|
5591
|
-
let
|
|
5592
|
-
return
|
|
5591
|
+
let Ee = (j.x === V ? 0 : 2) | Number(j.y & De), Dt = Y;
|
|
5592
|
+
return C && 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:
|
|
5598
|
-
return bn(e.outputLen, o.BYTES, n)(
|
|
5596
|
+
function G(m, w, T = {}) {
|
|
5597
|
+
const { seed: C, k2sig: F } = te(m, w, T);
|
|
5598
|
+
return bn(e.outputLen, o.BYTES, n)(C, 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, C = {}) {
|
|
5601
|
+
const { lowS: F, prehash: $, format: M } = ht(C, x);
|
|
5602
|
+
if (T = X(T, void 0, "publicKey"), w = J(w, $), !It(m)) {
|
|
5603
|
+
const O = m instanceof L ? ", use sig.toBytes()" : "";
|
|
5604
|
+
throw new Error("verify expects Uint8Array signature" + O);
|
|
5605
5605
|
}
|
|
5606
|
-
|
|
5606
|
+
k(m, M);
|
|
5607
5607
|
try {
|
|
5608
|
-
const
|
|
5609
|
-
if (
|
|
5608
|
+
const O = L.fromBytes(m, M), W = s.fromBytes(T);
|
|
5609
|
+
if (F && O.hasHighS())
|
|
5610
5610
|
return !1;
|
|
5611
|
-
const { r:
|
|
5612
|
-
return
|
|
5611
|
+
const { r: b, s: E } = O, 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:
|
|
5619
|
-
return
|
|
5617
|
+
function H(m, w, T = {}) {
|
|
5618
|
+
const { prehash: C } = ht(T, x);
|
|
5619
|
+
return w = J(w, C), L.fromBytes(m, "recovered").recoverPublicKey(w).toBytes();
|
|
5620
5620
|
}
|
|
5621
5621
|
return Object.freeze({
|
|
5622
5622
|
keygen: l,
|
|
@@ -5625,15 +5625,15 @@ 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
|
});
|
|
5634
5634
|
}
|
|
5635
5635
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5636
|
-
const
|
|
5636
|
+
const Ot = {
|
|
5637
5637
|
p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
|
|
5638
5638
|
n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
|
|
5639
5639
|
h: BigInt(1),
|
|
@@ -5649,20 +5649,20 @@ const Ct = {
|
|
|
5649
5649
|
]
|
|
5650
5650
|
}, nr = /* @__PURE__ */ BigInt(2);
|
|
5651
5651
|
function qn(s) {
|
|
5652
|
-
const e =
|
|
5653
|
-
if (!
|
|
5652
|
+
const e = Ot.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(Ot.p, { sqrt: qn }), Kn = /* @__PURE__ */ Un(Ot, {
|
|
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
|
-
|
|
6041
|
-
d.error("[CROSSx] nonce 검증 실패:",
|
|
6039
|
+
const m = { token: B, email: H }, w = (T) => {
|
|
6040
|
+
Ie.verifyIdTokenNonce(T, l).then(() => r(m)).catch((C) => {
|
|
6041
|
+
d.error("[CROSSx] nonce 검증 실패:", C), t(C instanceof Error ? C : 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", Ce = "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(Ce, 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(Ce);
|
|
6126
|
+
return r && r !== e ? !1 : (r || await this.storage.set(Ce, 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(Ce);
|
|
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(Ce, 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(Ce, 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,7 @@ button.__crossx-connect-other-block:active {
|
|
|
8366
8366
|
}
|
|
8367
8367
|
/* ── Mobile bottom sheet ───────────────────────────────────── */
|
|
8368
8368
|
@media (max-width: 480px) {
|
|
8369
|
-
#${
|
|
8369
|
+
#${ee} { align-items: flex-end; }
|
|
8370
8370
|
.__crossx-safe-area-fill {
|
|
8371
8371
|
display: block;
|
|
8372
8372
|
position: fixed;
|
|
@@ -8580,7 +8580,7 @@ button.__crossx-connect-other-block:active {
|
|
|
8580
8580
|
|
|
8581
8581
|
/* ── Landscape for signing/transaction modals ──────────── */
|
|
8582
8582
|
@media (orientation: landscape) and (max-height: 500px) {
|
|
8583
|
-
#${
|
|
8583
|
+
#${ee} { align-items: center !important; overflow: hidden; }
|
|
8584
8584
|
.__crossx-card--send-tx,
|
|
8585
8585
|
.__crossx-card--sign-tx,
|
|
8586
8586
|
.__crossx-card--sign-msg,
|
|
@@ -8829,8 +8829,6 @@ button.__crossx-connect-other-block:active {
|
|
|
8829
8829
|
letter-spacing: 0;
|
|
8830
8830
|
-webkit-tap-highlight-color: transparent;
|
|
8831
8831
|
transition: background 0.12s, box-shadow 0.12s;
|
|
8832
|
-
-webkit-text-security: disc;
|
|
8833
|
-
text-security: disc;
|
|
8834
8832
|
}
|
|
8835
8833
|
.__crossx-pin6-box:focus {
|
|
8836
8834
|
background: var(--cx-input-border);
|
|
@@ -9106,7 +9104,7 @@ function ae() {
|
|
|
9106
9104
|
s || (s = document.createElement("style"), s.id = lr, document.head.appendChild(s)), s.textContent = hi;
|
|
9107
9105
|
}
|
|
9108
9106
|
function pi() {
|
|
9109
|
-
const s = `#${
|
|
9107
|
+
const s = `#${ee}`, e = (t) => {
|
|
9110
9108
|
var n, i;
|
|
9111
9109
|
(i = (n = t.target) == null ? void 0 : n.closest) != null && i.call(n, s) && t.stopImmediatePropagation();
|
|
9112
9110
|
}, r = (t) => {
|
|
@@ -9175,7 +9173,7 @@ function _i(s) {
|
|
|
9175
9173
|
}, { passive: !0 });
|
|
9176
9174
|
}
|
|
9177
9175
|
const fi = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
9178
|
-
function
|
|
9176
|
+
function Oe() {
|
|
9179
9177
|
if (fi()) {
|
|
9180
9178
|
const e = window.scrollY;
|
|
9181
9179
|
return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
|
|
@@ -9195,10 +9193,10 @@ function zr(s, e = "CROSS", r = 18, t = 6) {
|
|
|
9195
9193
|
try {
|
|
9196
9194
|
const n = BigInt(s);
|
|
9197
9195
|
if (n === 0n) return null;
|
|
9198
|
-
const i =
|
|
9196
|
+
const i = Et(n, r, t);
|
|
9199
9197
|
if (i === "0") return null;
|
|
9200
|
-
const o =
|
|
9201
|
-
return
|
|
9198
|
+
const o = vt(n, r);
|
|
9199
|
+
return St(`${i} ${e}`, `${o} ${e}`);
|
|
9202
9200
|
} catch {
|
|
9203
9201
|
return null;
|
|
9204
9202
|
}
|
|
@@ -9230,20 +9228,20 @@ function jr(s) {
|
|
|
9230
9228
|
const e = parseInt(s.split(":")[1] ?? "", 10);
|
|
9231
9229
|
return !isNaN(e) && ur[e] ? ur[e] : s;
|
|
9232
9230
|
}
|
|
9233
|
-
function
|
|
9231
|
+
function vt(s, e) {
|
|
9234
9232
|
if (s === 0n) return "0";
|
|
9235
9233
|
const r = 10n ** BigInt(e), t = s / r, i = (s % r).toString().padStart(e, "0").replace(/0+$/, "");
|
|
9236
9234
|
return i ? `${t}.${i}` : `${t}`;
|
|
9237
9235
|
}
|
|
9238
|
-
function
|
|
9239
|
-
return s === e ?
|
|
9236
|
+
function St(s, e) {
|
|
9237
|
+
return s === e ? S(s) : `<span class="__crossx-amount-tip" data-full="${S(e)}">${S(s)}</span>`;
|
|
9240
9238
|
}
|
|
9241
|
-
function
|
|
9239
|
+
function Et(s, e, r) {
|
|
9242
9240
|
if (s === 0n) return "0";
|
|
9243
9241
|
const t = 10n ** BigInt(e), n = s / t, a = (s % t).toString().padStart(e, "0").slice(0, r).replace(/0+$/, "");
|
|
9244
9242
|
return a ? `${n}.${a}` : `${n}`;
|
|
9245
9243
|
}
|
|
9246
|
-
function
|
|
9244
|
+
function pt(s) {
|
|
9247
9245
|
try {
|
|
9248
9246
|
const e = BigInt(s), r = e / 1000000000n, n = (e % 1000000000n).toString().padStart(9, "0").slice(0, 2).replace(/0+$/, "");
|
|
9249
9247
|
return n ? `${r}.${n}` : `${r}`;
|
|
@@ -9267,12 +9265,12 @@ function xi(s, e) {
|
|
|
9267
9265
|
const u = c * BigInt(n);
|
|
9268
9266
|
return {
|
|
9269
9267
|
isDynamic: !0,
|
|
9270
|
-
estTxFee:
|
|
9271
|
-
`${
|
|
9272
|
-
`${
|
|
9268
|
+
estTxFee: St(
|
|
9269
|
+
`${Et(u, a, e)} ${o}`,
|
|
9270
|
+
`${vt(u, a)} ${o}`
|
|
9273
9271
|
),
|
|
9274
|
-
maxFeeGwei:
|
|
9275
|
-
maxPriorityFeeGwei: i ?
|
|
9272
|
+
maxFeeGwei: pt(n),
|
|
9273
|
+
maxPriorityFeeGwei: i ? pt(i) : void 0,
|
|
9276
9274
|
gasLimitFormatted: l
|
|
9277
9275
|
};
|
|
9278
9276
|
}
|
|
@@ -9280,11 +9278,11 @@ function xi(s, e) {
|
|
|
9280
9278
|
const u = c * BigInt(t);
|
|
9281
9279
|
return {
|
|
9282
9280
|
isDynamic: !1,
|
|
9283
|
-
estTxFee:
|
|
9284
|
-
`${
|
|
9285
|
-
`${
|
|
9281
|
+
estTxFee: St(
|
|
9282
|
+
`${Et(u, a, e)} ${o}`,
|
|
9283
|
+
`${vt(u, a)} ${o}`
|
|
9286
9284
|
),
|
|
9287
|
-
gasPriceGwei:
|
|
9285
|
+
gasPriceGwei: pt(t),
|
|
9288
9286
|
gasLimitFormatted: l
|
|
9289
9287
|
};
|
|
9290
9288
|
}
|
|
@@ -9295,24 +9293,24 @@ function xi(s, e) {
|
|
|
9295
9293
|
}
|
|
9296
9294
|
function Yr(s, e, r) {
|
|
9297
9295
|
const t = xi(s, e);
|
|
9298
|
-
if (!t) return
|
|
9299
|
-
let n =
|
|
9300
|
-
return t.isDynamic ? (t.maxPriorityFeeGwei !== void 0 && (n +=
|
|
9296
|
+
if (!t) return Z((r == null ? void 0 : r.label_estimated_fee) ?? "Estimated fee", "<span>—</span>");
|
|
9297
|
+
let n = Z((r == null ? void 0 : r.label_est_tx_fee) ?? "Est. Tx Fee", `<span>${t.estTxFee}</span>`);
|
|
9298
|
+
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
9299
|
}
|
|
9302
9300
|
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
9301
|
<rect x="9" y="9" width="13" height="13" rx="2"/>
|
|
9304
9302
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
|
9305
|
-
</svg>`,
|
|
9303
|
+
</svg>`, ne = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
|
9306
9304
|
<line x1="18" y1="6" x2="6" y2="18"/>
|
|
9307
9305
|
<line x1="6" y1="6" x2="18" y2="18"/>
|
|
9308
9306
|
</svg>`, wi = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9309
9307
|
<circle cx="20" cy="20" r="20" fill="#00D5AA"/>
|
|
9310
9308
|
<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
9309
|
</svg>`, mi = '<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>', yi = '<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>', bi = '<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>', vi = {
|
|
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"/>',
|
|
9310
|
+
[He.MetaMask]: mi,
|
|
9311
|
+
[He.Binance]: yi,
|
|
9312
|
+
[He.CROSSx]: bi
|
|
9313
|
+
}, 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>`, Si = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
9316
9314
|
<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
9315
|
</svg>`, Ei = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
9318
9316
|
<circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
|
|
@@ -9345,7 +9343,7 @@ function ie(s) {
|
|
|
9345
9343
|
`--cx-on-primary:${s.onPrimary}`
|
|
9346
9344
|
].join(";");
|
|
9347
9345
|
}
|
|
9348
|
-
function
|
|
9346
|
+
function Z(s, e) {
|
|
9349
9347
|
return `
|
|
9350
9348
|
<div class="__crossx-row">
|
|
9351
9349
|
<span class="__crossx-row-label">${s}</span>
|
|
@@ -9353,64 +9351,64 @@ function j(s, e) {
|
|
|
9353
9351
|
</div>`;
|
|
9354
9352
|
}
|
|
9355
9353
|
function Ai(s, e, r, t) {
|
|
9356
|
-
const n = e, i = s.nativeSymbol ?? "ETH", o = s.nativeDecimals ?? 18, a =
|
|
9357
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9358
|
-
return _.id =
|
|
9354
|
+
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>
|
|
9355
|
+
<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");
|
|
9356
|
+
return _.id = ee, _.innerHTML = `
|
|
9359
9357
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${ie(n)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9360
9358
|
<div class="__crossx-header">
|
|
9361
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9362
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9359
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((t == null ? void 0 : t.sign_transaction_title) ?? "Signature Request")}</p>
|
|
9360
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9363
9361
|
</div>
|
|
9364
9362
|
<hr class="__crossx-divider">
|
|
9365
9363
|
<div class="__crossx-body">
|
|
9366
9364
|
<div class="__crossx-body-cols">
|
|
9367
9365
|
<div class="__crossx-col-left">
|
|
9368
9366
|
<p class="__crossx-sig-subtitle">
|
|
9369
|
-
<span class="__crossx-sig-origin">${
|
|
9367
|
+
<span class="__crossx-sig-origin">${S(a)}</span>${S((t == null ? void 0 : t.signature_requesting) ?? " is requesting a Signature")}
|
|
9370
9368
|
</p>
|
|
9371
9369
|
<div class="__crossx-addr-pill">
|
|
9372
|
-
${
|
|
9370
|
+
${Lt}
|
|
9373
9371
|
<span class="__crossx-addr-pill-text">${de(s.from)}</span>
|
|
9374
9372
|
</div>
|
|
9375
|
-
<p class="__crossx-warning">${
|
|
9373
|
+
<p class="__crossx-warning">${S((t == null ? void 0 : t.signature_warning) ?? "After you sign, changes or cancellations are not possible.")}</p>
|
|
9376
9374
|
</div>
|
|
9377
9375
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
9378
9376
|
<div class="__crossx-col-right-sign">
|
|
9379
9377
|
<div class="__crossx-rows">
|
|
9380
|
-
${
|
|
9381
|
-
${
|
|
9378
|
+
${Z((t == null ? void 0 : t.label_to) ?? "To", c)}
|
|
9379
|
+
${Z((t == null ? void 0 : t.label_network) ?? "Network", `<span>${jr(s.chainId)}</span>`)}
|
|
9382
9380
|
${p}
|
|
9383
9381
|
${l}
|
|
9384
9382
|
</div>
|
|
9385
|
-
<pre class="__crossx-raw-tx">${
|
|
9383
|
+
<pre class="__crossx-raw-tx">${S(g)}</pre>
|
|
9386
9384
|
</div>
|
|
9387
9385
|
</div>
|
|
9388
9386
|
<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">${
|
|
9387
|
+
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${S((t == null ? void 0 : t.cancel) ?? "Cancel")}</button>
|
|
9388
|
+
<button class="__crossx-confirm-btn" id="__crossx-confirm-btn">${S((t == null ? void 0 : t.signature_sign_button) ?? "Sign")}</button>
|
|
9391
9389
|
</div>
|
|
9392
9390
|
</div>
|
|
9393
9391
|
</div>
|
|
9394
9392
|
`, _;
|
|
9395
9393
|
}
|
|
9396
9394
|
function Ii(s, e, r, t) {
|
|
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 =
|
|
9395
|
+
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>
|
|
9396
|
+
<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");
|
|
9397
|
+
return g.id = ee, g.innerHTML = `
|
|
9400
9398
|
<div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ie(n)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9401
9399
|
<div class="__crossx-header">
|
|
9402
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9403
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9400
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((t == null ? void 0 : t.send_transaction_title) ?? "Approve transaction")}</p>
|
|
9401
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9404
9402
|
</div>
|
|
9405
9403
|
<hr class="__crossx-divider">
|
|
9406
9404
|
<div class="__crossx-body">
|
|
9407
9405
|
<p class="__crossx-tx-subtitle">
|
|
9408
|
-
<span class="__crossx-sig-origin">${
|
|
9406
|
+
<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
9407
|
</p>
|
|
9410
9408
|
<div class="__crossx-body-cols">
|
|
9411
9409
|
<div class="__crossx-rows">
|
|
9412
|
-
${
|
|
9413
|
-
${
|
|
9410
|
+
${Z((t == null ? void 0 : t.label_to) ?? "To", c)}
|
|
9411
|
+
${Z((t == null ? void 0 : t.label_network) ?? "Network", `<span>${jr(s.chainId)}</span>`)}
|
|
9414
9412
|
${l}
|
|
9415
9413
|
</div>
|
|
9416
9414
|
<div class="__crossx-pill">
|
|
@@ -9418,12 +9416,12 @@ function Ii(s, e, r, t) {
|
|
|
9418
9416
|
<span class="__crossx-pill-amount">${p}</span>
|
|
9419
9417
|
</div>
|
|
9420
9418
|
</div>
|
|
9421
|
-
<button class="__crossx-approve-btn" id="__crossx-confirm-btn">${
|
|
9419
|
+
<button class="__crossx-approve-btn" id="__crossx-confirm-btn">${S((t == null ? void 0 : t.send_tx_approve_button) ?? "Approve")}</button>
|
|
9422
9420
|
</div>
|
|
9423
9421
|
</div>
|
|
9424
9422
|
`, g;
|
|
9425
9423
|
}
|
|
9426
|
-
function
|
|
9424
|
+
function nt(s) {
|
|
9427
9425
|
var e;
|
|
9428
9426
|
if (s) return s;
|
|
9429
9427
|
try {
|
|
@@ -9432,17 +9430,17 @@ function st(s) {
|
|
|
9432
9430
|
return "This site";
|
|
9433
9431
|
}
|
|
9434
9432
|
}
|
|
9435
|
-
function
|
|
9433
|
+
function S(s) {
|
|
9436
9434
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
9437
9435
|
}
|
|
9438
9436
|
function Ti(s) {
|
|
9439
9437
|
return typeof s == "string" && /^0x[0-9a-fA-F]{40}$/i.test(s);
|
|
9440
9438
|
}
|
|
9441
9439
|
function ki(s) {
|
|
9442
|
-
if (typeof s == "string") return
|
|
9440
|
+
if (typeof s == "string") return S(s);
|
|
9443
9441
|
if (typeof s == "number" || typeof s == "bigint" || typeof s == "boolean") return String(s);
|
|
9444
9442
|
try {
|
|
9445
|
-
return
|
|
9443
|
+
return S(JSON.stringify(s));
|
|
9446
9444
|
} catch {
|
|
9447
9445
|
return String(s);
|
|
9448
9446
|
}
|
|
@@ -9457,30 +9455,30 @@ function Ci(s, e) {
|
|
|
9457
9455
|
return `https://explorer.crosstoken.io/${Ri(s)}/tx/${e}`;
|
|
9458
9456
|
}
|
|
9459
9457
|
function Jr(s, e) {
|
|
9460
|
-
return `<a class="__crossx-addr-text __crossx-row-link" href="${
|
|
9458
|
+
return `<a class="__crossx-addr-text __crossx-row-link" href="${S(e)}" target="_blank" rel="noopener noreferrer">${S(s)}</a>`;
|
|
9461
9459
|
}
|
|
9462
|
-
function
|
|
9460
|
+
function Qe(s) {
|
|
9463
9461
|
return Jr(de(s), Ni(s));
|
|
9464
9462
|
}
|
|
9465
9463
|
function Zr(s, e) {
|
|
9466
9464
|
return Jr(de(e), Ci(s, e));
|
|
9467
9465
|
}
|
|
9468
9466
|
function Oi(s, e, r) {
|
|
9469
|
-
const t =
|
|
9467
|
+
const t = Z(
|
|
9470
9468
|
(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">${
|
|
9469
|
+
`${Qe(s.from)}
|
|
9470
|
+
<button class="__crossx-copy-btn" data-copy="${S(s.from)}" title="Copy address">${we}</button>`
|
|
9471
|
+
), n = s.to ? Z((r == null ? void 0 : r.label_to) ?? "To", `${Qe(s.to)}
|
|
9472
|
+
<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)}
|
|
9473
|
+
<button class="__crossx-copy-btn" data-copy="${S(s.txHash)}" title="Copy hash">${we}</button>`) : "", c = s.total ? `<div class="__crossx-total-pill">
|
|
9474
|
+
<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>
|
|
9475
|
+
<span class="__crossx-total-amount">${S(s.total)}</span>
|
|
9478
9476
|
</div>` : "", l = document.createElement("div");
|
|
9479
|
-
return l.id =
|
|
9477
|
+
return l.id = ee, l.innerHTML = `
|
|
9480
9478
|
<div class="__crossx-card __crossx-card--migration" style="${ie(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9481
9479
|
<div class="__crossx-header">
|
|
9482
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9483
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9480
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((r == null ? void 0 : r.tx_success) ?? "Transaction complete")}</p>
|
|
9481
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9484
9482
|
</div>
|
|
9485
9483
|
<hr class="__crossx-divider">
|
|
9486
9484
|
<div class="__crossx-body">
|
|
@@ -9492,23 +9490,23 @@ function Oi(s, e, r) {
|
|
|
9492
9490
|
${a}
|
|
9493
9491
|
</div>
|
|
9494
9492
|
${c}
|
|
9495
|
-
<button class="__crossx-approve-btn" id="__crossx-done-btn">${
|
|
9493
|
+
<button class="__crossx-approve-btn" id="__crossx-done-btn">${S((r == null ? void 0 : r.tx_complete_done_button) ?? "All Done")}</button>
|
|
9496
9494
|
</div>
|
|
9497
9495
|
</div>
|
|
9498
9496
|
`, l;
|
|
9499
9497
|
}
|
|
9500
9498
|
function Pi(s, e, r) {
|
|
9501
9499
|
const t = document.createElement("div");
|
|
9502
|
-
return t.id =
|
|
9500
|
+
return t.id = ee, t.innerHTML = `
|
|
9503
9501
|
<div class="__crossx-card __crossx-card--migration" style="${ie(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9504
9502
|
<div class="__crossx-header">
|
|
9505
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9503
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((r == null ? void 0 : r.tx_progress_waiting_title) ?? "Waiting for confirmation")}</p>
|
|
9506
9504
|
</div>
|
|
9507
9505
|
<hr class="__crossx-divider">
|
|
9508
9506
|
<div class="__crossx-body" id="__crossx-progress-body">
|
|
9509
9507
|
<div class="__crossx-progress-center">
|
|
9510
9508
|
<div class="__crossx-spinner"></div>
|
|
9511
|
-
<p class="__crossx-progress-text">${
|
|
9509
|
+
<p class="__crossx-progress-text">${S((r == null ? void 0 : r.tx_progress_waiting_text) ?? "Waiting for transaction receipt...")}</p>
|
|
9512
9510
|
</div>
|
|
9513
9511
|
</div>
|
|
9514
9512
|
</div>
|
|
@@ -9517,21 +9515,21 @@ function Pi(s, e, r) {
|
|
|
9517
9515
|
function Li(s, e, r, t) {
|
|
9518
9516
|
const n = e.status !== "reverted" && e.status !== "timeout", i = e.status === "timeout", o = s.querySelector("#__crossx-ttl"), a = s.querySelector(".__crossx-header");
|
|
9519
9517
|
if (o) {
|
|
9520
|
-
const
|
|
9521
|
-
|
|
9518
|
+
const y = i ? Ei : n ? "" : Si, 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";
|
|
9519
|
+
y ? (o.style.display = "flex", o.style.alignItems = "center", o.style.gap = "8px", o.innerHTML = `${y}<span>${S(v)}</span>`) : o.textContent = v;
|
|
9522
9520
|
}
|
|
9523
9521
|
if (a && !s.querySelector("#__crossx-close-btn")) {
|
|
9524
|
-
const
|
|
9525
|
-
|
|
9522
|
+
const y = document.createElement("button");
|
|
9523
|
+
y.className = "__crossx-close", y.id = "__crossx-close-btn", y.setAttribute("aria-label", "Close"), y.innerHTML = ne, a.appendChild(y);
|
|
9526
9524
|
}
|
|
9527
9525
|
const c = s.querySelector("#__crossx-progress-body");
|
|
9528
9526
|
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">${
|
|
9527
|
+
const l = e.from ? Z((t == null ? void 0 : t.label_from) ?? "From", `${Qe(e.from)}
|
|
9528
|
+
<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)}
|
|
9529
|
+
<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)}
|
|
9530
|
+
<button class="__crossx-copy-btn" data-copy="${S(e.txHash)}" title="Copy hash">${we}</button>`) : "", x = e.total ? `<div class="__crossx-total-pill">
|
|
9531
|
+
<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>
|
|
9532
|
+
<span class="__crossx-total-amount">${S(e.total)}</span>
|
|
9535
9533
|
</div>` : "";
|
|
9536
9534
|
c.innerHTML = `
|
|
9537
9535
|
<div class="__crossx-rows">
|
|
@@ -9542,51 +9540,51 @@ function Li(s, e, r, t) {
|
|
|
9542
9540
|
${_}
|
|
9543
9541
|
</div>
|
|
9544
9542
|
${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
|
-
|
|
9543
|
+
<button class="__crossx-approve-btn" id="__crossx-done-btn">${S((t == null ? void 0 : t.tx_complete_done_button) ?? (n ? "All Done" : "Done"))}</button>
|
|
9544
|
+
`, c.querySelectorAll(".__crossx-copy-btn").forEach((y) => {
|
|
9545
|
+
y.addEventListener("click", (v) => {
|
|
9546
|
+
var R;
|
|
9547
|
+
v.stopPropagation();
|
|
9548
|
+
const A = y.dataset.copy;
|
|
9549
|
+
A && ((R = navigator.clipboard) == null || R.writeText(A).catch(() => {
|
|
9552
9550
|
}));
|
|
9553
9551
|
});
|
|
9554
9552
|
});
|
|
9555
9553
|
}
|
|
9556
9554
|
function Di(s, e, r) {
|
|
9557
|
-
const t = e, n =
|
|
9558
|
-
return o.id =
|
|
9555
|
+
const t = e, n = nt(s.dappName), i = S(s.message), o = document.createElement("div");
|
|
9556
|
+
return o.id = ee, o.innerHTML = `
|
|
9559
9557
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9560
9558
|
<div class="__crossx-header">
|
|
9561
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9562
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9559
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((r == null ? void 0 : r.sign_message_title) ?? "Signature Request")}</p>
|
|
9560
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9563
9561
|
</div>
|
|
9564
9562
|
<hr class="__crossx-divider">
|
|
9565
9563
|
<div class="__crossx-body">
|
|
9566
9564
|
<div class="__crossx-body-cols">
|
|
9567
9565
|
<div class="__crossx-col-left">
|
|
9568
9566
|
<p class="__crossx-sig-subtitle">
|
|
9569
|
-
<span class="__crossx-sig-origin">${
|
|
9567
|
+
<span class="__crossx-sig-origin">${S(n)}</span>${S((r == null ? void 0 : r.signature_requesting) ?? " is requesting a Signature")}
|
|
9570
9568
|
</p>
|
|
9571
9569
|
<div class="__crossx-addr-pill">
|
|
9572
|
-
${
|
|
9570
|
+
${Lt}
|
|
9573
9571
|
<span class="__crossx-addr-pill-text">${de(s.from)}</span>
|
|
9574
9572
|
</div>
|
|
9575
|
-
<p class="__crossx-warning">${
|
|
9573
|
+
<p class="__crossx-warning">${S((r == null ? void 0 : r.signature_warning) ?? "After you sign, changes or cancellations are not possible.")}</p>
|
|
9576
9574
|
</div>
|
|
9577
9575
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
9578
9576
|
<div class="__crossx-msg-raw">${i}</div>
|
|
9579
9577
|
</div>
|
|
9580
9578
|
<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">${
|
|
9579
|
+
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${S((r == null ? void 0 : r.cancel) ?? "Cancel")}</button>
|
|
9580
|
+
<button class="__crossx-confirm-btn" id="__crossx-confirm-btn">${S((r == null ? void 0 : r.confirm) ?? "Confirm")}</button>
|
|
9583
9581
|
</div>
|
|
9584
9582
|
</div>
|
|
9585
9583
|
</div>
|
|
9586
9584
|
`, o;
|
|
9587
9585
|
}
|
|
9588
9586
|
function $i(s, e, r) {
|
|
9589
|
-
const t = e, n =
|
|
9587
|
+
const t = e, n = nt(s.dappName);
|
|
9590
9588
|
let i = {};
|
|
9591
9589
|
if (typeof s.typedData == "string")
|
|
9592
9590
|
try {
|
|
@@ -9597,44 +9595,44 @@ function $i(s, e, r) {
|
|
|
9597
9595
|
const o = i.primaryType ?? "—", a = i.message ?? {};
|
|
9598
9596
|
let c = `
|
|
9599
9597
|
<div class="__crossx-td-row">
|
|
9600
|
-
<span class="__crossx-td-label">${
|
|
9601
|
-
<span class="__crossx-td-value">${
|
|
9598
|
+
<span class="__crossx-td-label">${S((r == null ? void 0 : r.label_primary_type) ?? "Primary Type")}</span>
|
|
9599
|
+
<span class="__crossx-td-value">${S(o)}</span>
|
|
9602
9600
|
</div>`;
|
|
9603
9601
|
for (const [u, p] of Object.entries(a)) {
|
|
9604
9602
|
const g = ki(p), x = Ti(p) ? `<span class="__crossx-addr-text">${de(p)}</span>
|
|
9605
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9603
|
+
<button class="__crossx-copy-btn" data-copy="${S(String(p))}" title="Copy">${we}</button>` : `<span>${g}</span>`;
|
|
9606
9604
|
c += `
|
|
9607
9605
|
<div class="__crossx-td-row">
|
|
9608
|
-
<span class="__crossx-td-label">${
|
|
9606
|
+
<span class="__crossx-td-label">${S(u)}</span>
|
|
9609
9607
|
<div class="__crossx-td-value">${x}</div>
|
|
9610
9608
|
</div>`;
|
|
9611
9609
|
}
|
|
9612
9610
|
const l = document.createElement("div");
|
|
9613
|
-
return l.id =
|
|
9611
|
+
return l.id = ee, l.innerHTML = `
|
|
9614
9612
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-typed" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9615
9613
|
<div class="__crossx-header">
|
|
9616
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9617
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9614
|
+
<p class="__crossx-title" id="__crossx-ttl">${S((r == null ? void 0 : r.sign_typed_data_title) ?? "Signature Request")}</p>
|
|
9615
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9618
9616
|
</div>
|
|
9619
9617
|
<hr class="__crossx-divider">
|
|
9620
9618
|
<div class="__crossx-body">
|
|
9621
9619
|
<div class="__crossx-body-cols">
|
|
9622
9620
|
<div class="__crossx-col-left">
|
|
9623
9621
|
<p class="__crossx-sig-subtitle">
|
|
9624
|
-
<span class="__crossx-sig-origin">${
|
|
9622
|
+
<span class="__crossx-sig-origin">${S(n)}</span>${S((r == null ? void 0 : r.signature_requesting) ?? " is requesting a Signature")}
|
|
9625
9623
|
</p>
|
|
9626
9624
|
<div class="__crossx-addr-pill">
|
|
9627
|
-
${
|
|
9625
|
+
${Lt}
|
|
9628
9626
|
<span class="__crossx-addr-pill-text">${de(s.from)}</span>
|
|
9629
9627
|
</div>
|
|
9630
|
-
<p class="__crossx-warning">${
|
|
9628
|
+
<p class="__crossx-warning">${S((r == null ? void 0 : r.signature_warning) ?? "After you sign, changes or cancellations are not possible.")}</p>
|
|
9631
9629
|
</div>
|
|
9632
9630
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
9633
9631
|
<div class="__crossx-td-rows">${c}</div>
|
|
9634
9632
|
</div>
|
|
9635
9633
|
<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">${
|
|
9634
|
+
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${S((r == null ? void 0 : r.cancel) ?? "Cancel")}</button>
|
|
9635
|
+
<button class="__crossx-confirm-btn" id="__crossx-confirm-btn">${S((r == null ? void 0 : r.confirm) ?? "Confirm")}</button>
|
|
9638
9636
|
</div>
|
|
9639
9637
|
</div>
|
|
9640
9638
|
</div>
|
|
@@ -9661,27 +9659,27 @@ function es(s, e, r) {
|
|
|
9661
9659
|
}
|
|
9662
9660
|
function Wi(s, e, r, t) {
|
|
9663
9661
|
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">${
|
|
9662
|
+
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">${Mi}</span>` : "";
|
|
9663
|
+
return `<button class="__crossx-wallet-item${l}" data-wallet-index="${a.index}" data-wallet-address="${S(a.address)}">
|
|
9664
|
+
${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
9665
|
</button>`;
|
|
9668
9666
|
}).join(""), o = document.createElement("div");
|
|
9669
|
-
return o.id =
|
|
9667
|
+
return o.id = ee, o.innerHTML = `
|
|
9670
9668
|
<div class="__crossx-card __crossx-card--migration __crossx-card--wallet-selector" style="${ie(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9671
9669
|
<div class="__crossx-header">
|
|
9672
9670
|
<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">${
|
|
9671
|
+
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:0;">${S((t == null ? void 0 : t.wallet_selector_title) ?? "Select Connected Wallet")}</p>
|
|
9672
|
+
<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
9673
|
</div>
|
|
9676
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9674
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9677
9675
|
</div>
|
|
9678
9676
|
<hr class="__crossx-divider">
|
|
9679
9677
|
<div class="__crossx-body">
|
|
9680
9678
|
<div class="__crossx-body-cols">
|
|
9681
9679
|
<div class="__crossx-col-left">
|
|
9682
9680
|
<div class="__crossx-mig-info">
|
|
9683
|
-
<p class="__crossx-mig-info-title">${
|
|
9684
|
-
<p class="__crossx-mig-info-desc">${
|
|
9681
|
+
<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>
|
|
9682
|
+
<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
9683
|
</div>
|
|
9686
9684
|
</div>
|
|
9687
9685
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
@@ -9691,7 +9689,7 @@ function Wi(s, e, r, t) {
|
|
|
9691
9689
|
</div>
|
|
9692
9690
|
<button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
|
|
9693
9691
|
<span class="__crossx-wallet-add-icon">${Bi}</span>
|
|
9694
|
-
<span class="__crossx-wallet-add-label">${
|
|
9692
|
+
<span class="__crossx-wallet-add-label">${S((t == null ? void 0 : t.wallet_selector_add_button) ?? "add a wallet")}</span>
|
|
9695
9693
|
</button>
|
|
9696
9694
|
<p class="__crossx-wallet-add-error" id="__crossx-add-wallet-error" role="alert" aria-live="polite" hidden></p>
|
|
9697
9695
|
</div>
|
|
@@ -9711,7 +9709,7 @@ const Gi = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="h
|
|
|
9711
9709
|
</svg>`;
|
|
9712
9710
|
function Ki(s) {
|
|
9713
9711
|
const e = ls(s);
|
|
9714
|
-
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${vi[s] ?? ""}</span><span class="__crossx-connect-other-wallet-name">${
|
|
9712
|
+
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${vi[s] ?? ""}</span><span class="__crossx-connect-other-wallet-name">${S(e)}</span></span>`;
|
|
9715
9713
|
}
|
|
9716
9714
|
function Vi(s) {
|
|
9717
9715
|
if (s.length === 0) return "";
|
|
@@ -9726,39 +9724,39 @@ function Vi(s) {
|
|
|
9726
9724
|
return `${r}${e(0)}, ${e(1)}, ${e(2)}, and ${t} more.`;
|
|
9727
9725
|
}
|
|
9728
9726
|
function zi(s, e = [], r) {
|
|
9729
|
-
const t = s, n =
|
|
9727
|
+
const t = s, n = S(String(e[0])), i = S((r == null ? void 0 : r.login_selector_or) ?? "or"), o = e.length > 0 ? `
|
|
9730
9728
|
<div class="__crossx-login-or-divider">
|
|
9731
9729
|
<hr><span>${i}</span><hr>
|
|
9732
9730
|
</div>
|
|
9733
9731
|
<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
9732
|
<span class="__crossx-connect-other-text">
|
|
9735
|
-
<span class="__crossx-connect-other-title" id="__crossx-connect-other-heading">${
|
|
9733
|
+
<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>
|
|
9736
9734
|
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${Vi(e)}</span>
|
|
9737
9735
|
</span>
|
|
9738
9736
|
</button>` : "", a = document.createElement("div");
|
|
9739
|
-
return a.id =
|
|
9737
|
+
return a.id = ee, a.innerHTML = `
|
|
9740
9738
|
<div class="__crossx-card __crossx-card--migration" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9741
9739
|
<div class="__crossx-header">
|
|
9742
9740
|
<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">${
|
|
9741
|
+
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:0;">${S((r == null ? void 0 : r.login_selector_title) ?? "CROSS Wallet")}</p>
|
|
9742
|
+
<p class="__crossx-subtitle">${S((r == null ? void 0 : r.login_selector_subtitle) ?? "Sign in instantly with your social account")}</p>
|
|
9745
9743
|
</div>
|
|
9746
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9744
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9747
9745
|
</div>
|
|
9748
9746
|
<hr class="__crossx-divider">
|
|
9749
9747
|
<div class="__crossx-body">
|
|
9750
9748
|
<div class="__crossx-login-btn-row">
|
|
9751
9749
|
<button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
|
|
9752
9750
|
<span class="__crossx-login-icon" style="color:var(--cx-value);">${Gi}</span>
|
|
9753
|
-
<span class="__crossx-login-btn-label">${
|
|
9751
|
+
<span class="__crossx-login-btn-label">${S((r == null ? void 0 : r.login_selector_apple) ?? "Sign in with Apple")}</span>
|
|
9754
9752
|
</button>
|
|
9755
9753
|
<button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
|
|
9756
9754
|
<span class="__crossx-login-icon">${qi}</span>
|
|
9757
|
-
<span class="__crossx-login-btn-label">${
|
|
9755
|
+
<span class="__crossx-login-btn-label">${S((r == null ? void 0 : r.login_selector_google) ?? "Sign in with Google")}</span>
|
|
9758
9756
|
</button>
|
|
9759
9757
|
</div>${o}
|
|
9760
9758
|
<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">${
|
|
9759
|
+
${((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
9760
|
</p>
|
|
9763
9761
|
</div>
|
|
9764
9762
|
</div>
|
|
@@ -9766,35 +9764,35 @@ function zi(s, e = [], r) {
|
|
|
9766
9764
|
}
|
|
9767
9765
|
function ji(s, e) {
|
|
9768
9766
|
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">${
|
|
9767
|
+
t.id = ee;
|
|
9768
|
+
const n = S(e.message).replace(/\n/g, "<br>"), i = e.email ? `<div class="__crossx-session-account-card">
|
|
9769
|
+
<p class="__crossx-session-account-label">${S(e.accountLabel)}</p>
|
|
9770
|
+
<p class="__crossx-session-account-email">${S(e.email)}</p>
|
|
9773
9771
|
</div>` : "";
|
|
9774
9772
|
return t.innerHTML = `
|
|
9775
9773
|
<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
9774
|
<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">${
|
|
9775
|
+
<p class="__crossx-title" id="__crossx-session-header-title">${S(e.title)}</p>
|
|
9776
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9779
9777
|
</div>
|
|
9780
9778
|
<hr class="__crossx-divider">
|
|
9781
9779
|
<div class="__crossx-body" style="padding:20px 24px 24px;display:flex;flex-direction:column;gap:16px;">
|
|
9782
9780
|
<div class="__crossx-session-hero">
|
|
9783
|
-
<p class="__crossx-session-hero-title">${
|
|
9781
|
+
<p class="__crossx-session-hero-title">${S(e.title)}</p>
|
|
9784
9782
|
<p class="__crossx-session-hero-message" id="__crossx-session-msg">${n}</p>
|
|
9785
9783
|
</div>
|
|
9786
9784
|
${i}
|
|
9787
9785
|
<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">${
|
|
9786
|
+
<button class="__crossx-cancel-btn" id="__crossx-session-signout">${S(e.signOutLabel)}</button>
|
|
9787
|
+
<button class="__crossx-confirm-btn" id="__crossx-session-signin">${S(e.signInAgainLabel)}</button>
|
|
9790
9788
|
</div>
|
|
9791
9789
|
</div>
|
|
9792
9790
|
</div>
|
|
9793
9791
|
`, t;
|
|
9794
9792
|
}
|
|
9795
9793
|
function Yi(s, e = !0) {
|
|
9796
|
-
const r = s, t = e ? `<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9797
|
-
return i.id =
|
|
9794
|
+
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");
|
|
9795
|
+
return i.id = ee, i.innerHTML = `
|
|
9798
9796
|
<div class="__crossx-card __crossx-card--migration" style="${ie(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9799
9797
|
<div class="__crossx-header">
|
|
9800
9798
|
<p class="__crossx-title" id="__crossx-ttl">Wallet Found on Social Account 🎉</p>
|
|
@@ -9818,11 +9816,11 @@ function Yi(s, e = !0) {
|
|
|
9818
9816
|
}
|
|
9819
9817
|
function Xi(s, e) {
|
|
9820
9818
|
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 =
|
|
9819
|
+
return p.id = ee, p.innerHTML = `
|
|
9822
9820
|
<div class="__crossx-card __crossx-card--migration" style="${ie(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9823
9821
|
<div class="__crossx-header">
|
|
9824
9822
|
<p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
|
|
9825
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9823
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9826
9824
|
</div>
|
|
9827
9825
|
<hr class="__crossx-divider">
|
|
9828
9826
|
<div class="__crossx-pin-center">
|
|
@@ -9846,11 +9844,11 @@ function Ji(s) {
|
|
|
9846
9844
|
}
|
|
9847
9845
|
function Zi(s, e, r) {
|
|
9848
9846
|
const t = s, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ? Ji(i) : null, a = document.createElement("div");
|
|
9849
|
-
return a.id =
|
|
9847
|
+
return a.id = ee, a.innerHTML = `
|
|
9850
9848
|
<div class="__crossx-card __crossx-card--migration" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9851
9849
|
<div class="__crossx-header">
|
|
9852
9850
|
<p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
|
|
9853
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9851
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9854
9852
|
</div>
|
|
9855
9853
|
<hr class="__crossx-divider">
|
|
9856
9854
|
<div class="__crossx-pin-center">
|
|
@@ -9879,14 +9877,14 @@ function Qi(s) {
|
|
|
9879
9877
|
const r = [s.check1, s.check2].map((t, n) => `
|
|
9880
9878
|
<div class="__crossx-pw-notice-item" data-check-index="${n}" role="checkbox" aria-checked="false" tabindex="0">
|
|
9881
9879
|
<div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${so}</div>
|
|
9882
|
-
<span class="__crossx-pw-notice-item-text">${
|
|
9880
|
+
<span class="__crossx-pw-notice-item-text">${S(t)}</span>
|
|
9883
9881
|
</div>
|
|
9884
9882
|
`).join("");
|
|
9885
9883
|
return `
|
|
9886
9884
|
<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">${
|
|
9885
|
+
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${S(s.title)}</p>
|
|
9886
|
+
<p class="__crossx-pw-subtitle">${S(s.headerSubtitle)}</p>
|
|
9887
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9890
9888
|
</div>
|
|
9891
9889
|
<hr class="__crossx-divider">
|
|
9892
9890
|
<div class="__crossx-pw-body">
|
|
@@ -9894,33 +9892,33 @@ function Qi(s) {
|
|
|
9894
9892
|
<div class="__crossx-pw-notice-header">
|
|
9895
9893
|
<div class="__crossx-pw-notice-title-row">
|
|
9896
9894
|
<span class="__crossx-pw-notice-icon">${no}</span>
|
|
9897
|
-
<p class="__crossx-pw-notice-title">${
|
|
9895
|
+
<p class="__crossx-pw-notice-title">${S(s.noticeTitle)}</p>
|
|
9898
9896
|
</div>
|
|
9899
|
-
<p class="__crossx-pw-notice-desc">${
|
|
9897
|
+
<p class="__crossx-pw-notice-desc">${S(s.noticeDesc)}</p>
|
|
9900
9898
|
</div>
|
|
9901
9899
|
<div class="__crossx-pw-notice-checks" id="__crossx-notice-checks">
|
|
9902
9900
|
${r}
|
|
9903
9901
|
</div>
|
|
9904
9902
|
</div>
|
|
9905
9903
|
<button class="__crossx-pw-btn --disabled" id="__crossx-pin-notice-next"
|
|
9906
|
-
data-next-label="${
|
|
9907
|
-
data-submit-label="${
|
|
9908
|
-
${
|
|
9904
|
+
data-next-label="${S(s.nextButton)}"
|
|
9905
|
+
data-submit-label="${S(s.submitButton)}">
|
|
9906
|
+
${S(s.nextButton)}
|
|
9909
9907
|
</button>
|
|
9910
9908
|
</div>
|
|
9911
9909
|
<div class="__crossx-home-indicator"></div>
|
|
9912
9910
|
`;
|
|
9913
9911
|
}
|
|
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">${
|
|
9912
|
+
function _t(s) {
|
|
9913
|
+
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
9914
|
${ts}
|
|
9917
9915
|
<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">${
|
|
9916
|
+
</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
9917
|
{ length: 6 },
|
|
9920
|
-
(
|
|
9918
|
+
(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
9919
|
).join(""), p = e ? " --locked" : "", g = Array.from(
|
|
9922
9920
|
{ length: 6 },
|
|
9923
|
-
(
|
|
9921
|
+
(y, v) => `<div class="__crossx-pin6-dot${p}" data-dot-index="${v}" aria-label="PIN digit ${v + 1}"></div>`
|
|
9924
9922
|
).join(""), _ = e ? " --disabled" : "", x = `
|
|
9925
9923
|
<div class="__crossx-pin6-numpad" id="__crossx-pin6-numpad">
|
|
9926
9924
|
<div class="__crossx-pin6-numpad-row">
|
|
@@ -9946,9 +9944,9 @@ function pt(s) {
|
|
|
9946
9944
|
</div>`;
|
|
9947
9945
|
return `
|
|
9948
9946
|
<div class="__crossx-header">
|
|
9949
|
-
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${
|
|
9947
|
+
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${S(s.title)}</p>
|
|
9950
9948
|
${t}
|
|
9951
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9949
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>
|
|
9952
9950
|
</div>
|
|
9953
9951
|
<hr class="__crossx-divider">
|
|
9954
9952
|
<div class="__crossx-pin6-body"${r}>
|
|
@@ -9969,7 +9967,7 @@ function pt(s) {
|
|
|
9969
9967
|
}
|
|
9970
9968
|
function hr(s, e) {
|
|
9971
9969
|
const r = document.createElement("div");
|
|
9972
|
-
return r.id =
|
|
9970
|
+
return r.id = ee, r.innerHTML = `
|
|
9973
9971
|
<div class="__crossx-card __crossx-card--pin6" style="${ie(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9974
9972
|
${e}
|
|
9975
9973
|
</div>
|
|
@@ -9986,179 +9984,179 @@ function to(s) {
|
|
|
9986
9984
|
const e = Math.max(0, Math.ceil(s / 1e3)), r = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
|
|
9987
9985
|
return r > 0 ? `${r}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
|
|
9988
9986
|
}
|
|
9989
|
-
function
|
|
9990
|
-
var O,
|
|
9987
|
+
function ft(s, e, r, t, n, i, o) {
|
|
9988
|
+
var O, W;
|
|
9991
9989
|
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
|
-
|
|
9990
|
+
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) => {
|
|
9991
|
+
b.dataset.digit = E, b.value = y;
|
|
9992
|
+
}, A = (b) => {
|
|
9993
|
+
delete b.dataset.digit, b.value = "";
|
|
9994
|
+
}, R = (b) => b.dataset.digit ?? "", k = () => l().map(R).join(""), L = () => Array.from(s.querySelectorAll(".__crossx-pin6-dot")), D = () => {
|
|
9995
|
+
var N;
|
|
9996
|
+
const b = l(), E = L();
|
|
9997
|
+
if (E.length && (E.forEach((I, U) => {
|
|
9998
|
+
const K = !!(b[U] && R(b[U]));
|
|
9999
|
+
I.classList.toggle("--filled", K), I.classList.toggle("--active", !1);
|
|
9998
10000
|
}), !a && !c)) {
|
|
9999
|
-
const
|
|
10000
|
-
(
|
|
10001
|
-
}
|
|
10002
|
-
},
|
|
10003
|
-
s.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((
|
|
10004
|
-
},
|
|
10005
|
-
a = b, l().forEach((
|
|
10006
|
-
|
|
10001
|
+
const I = b.findIndex((K) => !R(K));
|
|
10002
|
+
(N = E[I === -1 ? 5 : I]) == null || N.classList.add("--active");
|
|
10003
|
+
}
|
|
10004
|
+
}, z = () => {
|
|
10005
|
+
s.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((E) => E.classList.toggle("--disabled", a)), L().forEach((E) => E.classList.toggle("--locked", a)), D();
|
|
10006
|
+
}, Q = (b) => {
|
|
10007
|
+
a = b, l().forEach((E) => {
|
|
10008
|
+
E.disabled = b, E.classList.toggle("--locked", b);
|
|
10007
10009
|
});
|
|
10008
|
-
},
|
|
10010
|
+
}, q = () => s.querySelector("#__crossx-pin6-attempt"), J = () => {
|
|
10009
10011
|
const b = p();
|
|
10010
10012
|
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();
|
|
10013
|
+
}, te = () => o ?? "Your account will be locked after further failures.", G = () => s.querySelector("#__crossx-pin6-warning"), B = (b) => {
|
|
10014
|
+
var N;
|
|
10015
|
+
let E = G();
|
|
10026
10016
|
if (!E) {
|
|
10027
|
-
E = document.createElement("p"), E.className = "__crossx-pin6-
|
|
10028
|
-
const
|
|
10029
|
-
|
|
10017
|
+
E = document.createElement("p"), E.className = "__crossx-pin6-warning", E.id = "__crossx-pin6-warning";
|
|
10018
|
+
const I = p();
|
|
10019
|
+
I ? I.insertAdjacentElement("afterend", E) : (N = x()) == null || N.appendChild(E);
|
|
10030
10020
|
}
|
|
10031
|
-
E.textContent =
|
|
10021
|
+
E.textContent = b;
|
|
10032
10022
|
}, H = () => {
|
|
10033
|
-
const b =
|
|
10023
|
+
const b = G();
|
|
10024
|
+
b && (b.textContent = "");
|
|
10025
|
+
}, m = (b, E) => {
|
|
10026
|
+
var I;
|
|
10027
|
+
let N = q();
|
|
10028
|
+
if (!N) {
|
|
10029
|
+
N = document.createElement("p"), N.className = "__crossx-pin6-attempt", N.id = "__crossx-pin6-attempt";
|
|
10030
|
+
const U = G() ?? p();
|
|
10031
|
+
U ? U.insertAdjacentElement("afterend", N) : (I = x()) == null || I.appendChild(N);
|
|
10032
|
+
}
|
|
10033
|
+
N.textContent = `${b}/${E}`;
|
|
10034
|
+
}, w = () => {
|
|
10035
|
+
const b = q();
|
|
10034
10036
|
b && (b.textContent = "");
|
|
10035
|
-
},
|
|
10036
|
-
const
|
|
10037
|
-
|
|
10038
|
-
const
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
var T;
|
|
10043
|
-
(T = l()[0]) == null || T.focus(), I();
|
|
10037
|
+
}, T = (b) => {
|
|
10038
|
+
const E = p();
|
|
10039
|
+
E && (E.textContent = b);
|
|
10040
|
+
const N = u();
|
|
10041
|
+
N == null || N.classList.add("--shake"), setTimeout(() => N == null ? void 0 : N.classList.remove("--shake"), 500), l().forEach(A), setTimeout(() => {
|
|
10042
|
+
var I;
|
|
10043
|
+
(I = l()[0]) == null || I.focus(), D();
|
|
10044
10044
|
}, 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());
|
|
10045
|
+
}, C = (b) => {
|
|
10046
|
+
var K;
|
|
10047
|
+
Q(!0), l().forEach(A), z();
|
|
10048
|
+
const E = p();
|
|
10049
|
+
if (E && (E.textContent = "Too many failed attempts. Please wait."), !g()) {
|
|
10050
|
+
const j = document.createElement("p");
|
|
10051
|
+
j.className = "__crossx-pin6-lock-msg", j.id = "__crossx-pin6-lock-msg", j.innerHTML = `${ts}<span id="__crossx-pin6-lock-countdown"></span>`;
|
|
10052
|
+
const V = p();
|
|
10053
|
+
V ? V.insertAdjacentElement("afterend", j) : (K = x()) == null || K.appendChild(j);
|
|
10054
|
+
}
|
|
10055
|
+
const N = () => {
|
|
10056
|
+
var Y;
|
|
10057
|
+
const j = b - Date.now(), V = _();
|
|
10058
|
+
j <= 0 ? (clearInterval(I), Q(!1), (Y = g()) == null || Y.remove(), E && (E.textContent = ""), z(), setTimeout(() => {
|
|
10059
|
+
var Ee;
|
|
10060
|
+
return (Ee = l()[0]) == null ? void 0 : Ee.focus();
|
|
10061
|
+
}, 50)) : V && (V.textContent = ` ${to(j)}`);
|
|
10062
|
+
}, I = setInterval(N, 1e3);
|
|
10063
|
+
N();
|
|
10064
|
+
const U = new MutationObserver(() => {
|
|
10065
|
+
document.contains(s) || (clearInterval(I), U.disconnect());
|
|
10068
10066
|
});
|
|
10069
|
-
|
|
10070
|
-
},
|
|
10067
|
+
U.observe(document.body, { childList: !0, subtree: !1 });
|
|
10068
|
+
}, F = async () => {
|
|
10071
10069
|
if (a || c) return;
|
|
10072
|
-
const b =
|
|
10070
|
+
const b = k();
|
|
10073
10071
|
if (b.length === 6) {
|
|
10074
|
-
c = !0, l().forEach((
|
|
10075
|
-
|
|
10072
|
+
c = !0, l().forEach((E) => {
|
|
10073
|
+
E.disabled = !0;
|
|
10076
10074
|
});
|
|
10077
10075
|
try {
|
|
10078
10076
|
if (n) {
|
|
10079
|
-
const
|
|
10080
|
-
|
|
10077
|
+
const E = await n(b);
|
|
10078
|
+
E.ok ? e(b) : E.lockExpiresAt ? (w(), C(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
10079
|
} else
|
|
10082
10080
|
e(b);
|
|
10083
|
-
} catch (
|
|
10084
|
-
t && t(
|
|
10081
|
+
} catch (E) {
|
|
10082
|
+
t && t(E);
|
|
10085
10083
|
} finally {
|
|
10086
|
-
c = !1, a || l().forEach((
|
|
10087
|
-
|
|
10088
|
-
}),
|
|
10084
|
+
c = !1, a || l().forEach((E) => {
|
|
10085
|
+
E.disabled = !1;
|
|
10086
|
+
}), D();
|
|
10089
10087
|
}
|
|
10090
10088
|
}
|
|
10091
10089
|
};
|
|
10092
|
-
i && i > Date.now() ?
|
|
10090
|
+
i && i > Date.now() ? C(i) : setTimeout(() => {
|
|
10093
10091
|
var b;
|
|
10094
10092
|
return (b = l()[0]) == null ? void 0 : b.focus();
|
|
10095
10093
|
}, 100);
|
|
10096
|
-
const
|
|
10094
|
+
const $ = () => {
|
|
10097
10095
|
if (a || c) return;
|
|
10098
|
-
const b = l(),
|
|
10099
|
-
|
|
10096
|
+
const b = l(), E = b.find((N) => !R(N)) ?? b[b.length - 1];
|
|
10097
|
+
E == null || E.focus();
|
|
10100
10098
|
};
|
|
10101
10099
|
(O = u()) == null || O.addEventListener("click", (b) => {
|
|
10102
|
-
b.target.classList.contains("__crossx-pin6-box") ||
|
|
10103
|
-
}), (
|
|
10104
|
-
const
|
|
10105
|
-
|
|
10106
|
-
}), l().forEach((b,
|
|
10100
|
+
b.target.classList.contains("__crossx-pin6-box") || $();
|
|
10101
|
+
}), (W = x()) == null || W.addEventListener("click", (b) => {
|
|
10102
|
+
const E = b.target;
|
|
10103
|
+
E.classList.contains("__crossx-pin6-box") || E.closest("button") || $();
|
|
10104
|
+
}), l().forEach((b, E) => {
|
|
10107
10105
|
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
|
-
|
|
10106
|
+
var I;
|
|
10107
|
+
const N = b.value.replace(/\D/g, "").slice(-1);
|
|
10108
|
+
N ? v(b, N) : A(b), J(), N && E < 5 && ((I = l()[E + 1]) == null || I.focus()), D(), k().length === 6 && setTimeout(F, 80);
|
|
10109
|
+
}), b.addEventListener("keydown", (N) => {
|
|
10110
|
+
var I, U;
|
|
10111
|
+
if (N.key === "Backspace") {
|
|
10112
|
+
if (N.preventDefault(), R(b))
|
|
10113
|
+
A(b);
|
|
10114
|
+
else if (E > 0) {
|
|
10115
|
+
const K = l()[E - 1];
|
|
10116
|
+
A(K), K.focus();
|
|
10119
10117
|
}
|
|
10120
|
-
|
|
10121
|
-
} else
|
|
10122
|
-
}), b.addEventListener("paste", (
|
|
10123
|
-
var
|
|
10124
|
-
|
|
10125
|
-
const
|
|
10126
|
-
if (!
|
|
10127
|
-
const
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
}), (
|
|
10118
|
+
D();
|
|
10119
|
+
} 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();
|
|
10120
|
+
}), b.addEventListener("paste", (N) => {
|
|
10121
|
+
var K, j;
|
|
10122
|
+
N.preventDefault();
|
|
10123
|
+
const I = (((K = N.clipboardData) == null ? void 0 : K.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
|
|
10124
|
+
if (!I) return;
|
|
10125
|
+
const U = l();
|
|
10126
|
+
I.split("").forEach((V, Y) => {
|
|
10127
|
+
U[Y] && v(U[Y], V);
|
|
10128
|
+
}), (j = U[Math.min(I.length - 1, 5)]) == null || j.focus(), J(), D(), k().length === 6 && setTimeout(F, 80);
|
|
10131
10129
|
}), b.addEventListener("focus", () => b.select());
|
|
10132
10130
|
});
|
|
10133
|
-
const
|
|
10134
|
-
if (
|
|
10131
|
+
const M = s.querySelector("#__crossx-pin6-numpad");
|
|
10132
|
+
if (M) {
|
|
10135
10133
|
let b = null;
|
|
10136
|
-
const
|
|
10134
|
+
const E = () => {
|
|
10137
10135
|
b && (b.classList.remove("--pressed"), b = null);
|
|
10138
10136
|
};
|
|
10139
|
-
|
|
10140
|
-
const
|
|
10141
|
-
!
|
|
10137
|
+
M.addEventListener("pointerdown", (I) => {
|
|
10138
|
+
const U = I.target.closest(".__crossx-pin6-numpad-key");
|
|
10139
|
+
!U || a || c || (E(), b = U, U.classList.add("--pressed"), U.setPointerCapture(I.pointerId));
|
|
10142
10140
|
});
|
|
10143
|
-
const
|
|
10144
|
-
const
|
|
10145
|
-
if (!
|
|
10146
|
-
if (
|
|
10147
|
-
const
|
|
10148
|
-
|
|
10141
|
+
const N = (I) => {
|
|
10142
|
+
const U = I.dataset.key;
|
|
10143
|
+
if (!U) return;
|
|
10144
|
+
if (U === "backspace") {
|
|
10145
|
+
const Y = [...l()].reverse().find((Ee) => R(Ee));
|
|
10146
|
+
Y && (A(Y), J()), D();
|
|
10149
10147
|
return;
|
|
10150
10148
|
}
|
|
10151
|
-
if (!/^\d$/.test(
|
|
10152
|
-
const
|
|
10153
|
-
|
|
10149
|
+
if (!/^\d$/.test(U)) return;
|
|
10150
|
+
const j = l().find((V) => !R(V));
|
|
10151
|
+
j && (v(j, U), J(), D(), k().length === 6 && setTimeout(F, 80));
|
|
10154
10152
|
};
|
|
10155
|
-
|
|
10153
|
+
M.addEventListener("pointerup", (I) => {
|
|
10156
10154
|
if (!b) return;
|
|
10157
|
-
const
|
|
10158
|
-
|
|
10159
|
-
const
|
|
10160
|
-
|
|
10161
|
-
}),
|
|
10155
|
+
const U = b;
|
|
10156
|
+
E();
|
|
10157
|
+
const K = U.getBoundingClientRect();
|
|
10158
|
+
I.clientX >= K.left && I.clientX <= K.right && I.clientY >= K.top && I.clientY <= K.bottom && !a && !c && N(U);
|
|
10159
|
+
}), M.addEventListener("pointercancel", E), M.addEventListener("pointerleave", E, !0), D(), i && i > Date.now() && z();
|
|
10162
10160
|
}
|
|
10163
10161
|
}
|
|
10164
10162
|
const ro = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -10206,7 +10204,7 @@ function io(s, e, r) {
|
|
|
10206
10204
|
}), (i = t[0]) == null || i.focus();
|
|
10207
10205
|
}
|
|
10208
10206
|
class oo {
|
|
10209
|
-
constructor(e = "light", r, t =
|
|
10207
|
+
constructor(e = "light", r, t = At, n) {
|
|
10210
10208
|
this.theme = e, this.overrides = r, this.tokens = dr(e, r), this.displayDecimals = t, this.pinKeyboard = n;
|
|
10211
10209
|
}
|
|
10212
10210
|
setPinKeyboard(e) {
|
|
@@ -10248,55 +10246,55 @@ class oo {
|
|
|
10248
10246
|
*/
|
|
10249
10247
|
showWalletSelector(e, r, t) {
|
|
10250
10248
|
return new Promise((n, i) => {
|
|
10251
|
-
var
|
|
10249
|
+
var R;
|
|
10252
10250
|
ae();
|
|
10253
|
-
const o = [...e], a = Wi(o, this.tokens, t, this.messages), c =
|
|
10251
|
+
const o = [...e], a = Wi(o, this.tokens, t, this.messages), c = Oe();
|
|
10254
10252
|
ce(a);
|
|
10255
10253
|
let l = !1;
|
|
10256
10254
|
const u = () => {
|
|
10257
10255
|
l || (l = !0, a.remove(), c());
|
|
10258
10256
|
};
|
|
10259
10257
|
let p = null;
|
|
10260
|
-
const g = (
|
|
10261
|
-
u(), n(
|
|
10258
|
+
const g = (k) => {
|
|
10259
|
+
u(), n(k);
|
|
10262
10260
|
}, _ = () => {
|
|
10263
10261
|
u(), p ? i(p) : n(null);
|
|
10264
10262
|
};
|
|
10265
10263
|
(() => {
|
|
10266
|
-
a.querySelectorAll(".__crossx-wallet-item").forEach((
|
|
10267
|
-
|
|
10268
|
-
const L =
|
|
10269
|
-
g({ address: L, index:
|
|
10264
|
+
a.querySelectorAll(".__crossx-wallet-item").forEach((k) => {
|
|
10265
|
+
k.addEventListener("click", () => {
|
|
10266
|
+
const L = k.dataset.walletAddress ?? "", D = parseInt(k.dataset.walletIndex ?? "0", 10), z = o.find((Q) => Q.index === D);
|
|
10267
|
+
g({ address: L, index: D, name: z == null ? void 0 : z.name });
|
|
10270
10268
|
});
|
|
10271
10269
|
});
|
|
10272
10270
|
})();
|
|
10273
|
-
const
|
|
10274
|
-
|
|
10275
|
-
|
|
10271
|
+
const y = a.querySelector("#__crossx-add-wallet-error"), v = a.querySelector("#__crossx-add-wallet-btn");
|
|
10272
|
+
v && v.addEventListener("click", async () => {
|
|
10273
|
+
v.disabled = !0, y && (y.hidden = !0, y.textContent = "");
|
|
10276
10274
|
try {
|
|
10277
|
-
const
|
|
10278
|
-
o.push(
|
|
10275
|
+
const k = await r();
|
|
10276
|
+
o.push(k);
|
|
10279
10277
|
const L = a.querySelector("#__crossx-wallet-list");
|
|
10280
10278
|
if (L) {
|
|
10281
|
-
const
|
|
10282
|
-
|
|
10279
|
+
const D = document.createElement("button");
|
|
10280
|
+
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
10281
|
try {
|
|
10284
|
-
|
|
10282
|
+
D.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
10285
10283
|
} catch {
|
|
10286
10284
|
}
|
|
10287
10285
|
}
|
|
10288
|
-
|
|
10289
|
-
} catch (
|
|
10290
|
-
const L =
|
|
10291
|
-
|
|
10286
|
+
v.disabled = !1;
|
|
10287
|
+
} catch (k) {
|
|
10288
|
+
const L = k instanceof f && k.code === h.ADDRESS_LIMIT_EXCEEDED, D = this.resolveAddWalletErrorMessage(k);
|
|
10289
|
+
y && (y.textContent = D, y.hidden = !1), L ? (v.disabled = !0, v.setAttribute("aria-disabled", "true")) : v.disabled = !1, p = k;
|
|
10292
10290
|
}
|
|
10293
|
-
}), (
|
|
10294
|
-
|
|
10291
|
+
}), (R = a.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", _), a.addEventListener("click", (k) => {
|
|
10292
|
+
k.target === a && _();
|
|
10295
10293
|
});
|
|
10296
|
-
const
|
|
10297
|
-
|
|
10294
|
+
const A = (k) => {
|
|
10295
|
+
k.key === "Escape" && (document.removeEventListener("keydown", A), _());
|
|
10298
10296
|
};
|
|
10299
|
-
document.addEventListener("keydown",
|
|
10297
|
+
document.addEventListener("keydown", A);
|
|
10300
10298
|
});
|
|
10301
10299
|
}
|
|
10302
10300
|
/**
|
|
@@ -10309,7 +10307,7 @@ class oo {
|
|
|
10309
10307
|
resolveAddWalletErrorMessage(e) {
|
|
10310
10308
|
const r = this.messages;
|
|
10311
10309
|
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 :
|
|
10310
|
+
const n = e.details, i = typeof (n == null ? void 0 : n.limit) == "number" ? n.limit : xt;
|
|
10313
10311
|
return ((r == null ? void 0 : r.wallet_selector_add_error_limit_exceeded) ?? "Account limit reached. Maximum {limit} accounts allowed.").replace("{limit}", String(i));
|
|
10314
10312
|
}
|
|
10315
10313
|
return (r == null ? void 0 : r.wallet_selector_add_error_generic) ?? "Failed to add a new account. Please try again.";
|
|
@@ -10322,32 +10320,32 @@ class oo {
|
|
|
10322
10320
|
showLoginSelector(e) {
|
|
10323
10321
|
var t;
|
|
10324
10322
|
const r = ((t = e == null ? void 0 : e.connectOtherWallets) == null ? void 0 : t.filter(
|
|
10325
|
-
(n) => Object.values(
|
|
10323
|
+
(n) => Object.values(He).includes(n) && String(n).trim() !== ""
|
|
10326
10324
|
)) ?? [];
|
|
10327
10325
|
return new Promise((n) => {
|
|
10328
|
-
var g, _, x,
|
|
10326
|
+
var g, _, x, y;
|
|
10329
10327
|
ae();
|
|
10330
|
-
const i = zi(this.tokens, r, this.messages), o =
|
|
10328
|
+
const i = zi(this.tokens, r, this.messages), o = Oe();
|
|
10331
10329
|
ce(i);
|
|
10332
10330
|
const a = () => {
|
|
10333
10331
|
i.remove(), o();
|
|
10334
|
-
}, c = (
|
|
10335
|
-
a(), n({ type: "oauth", provider:
|
|
10336
|
-
}, l = (
|
|
10337
|
-
a(), n({ type: "external", walletId:
|
|
10332
|
+
}, c = (v) => {
|
|
10333
|
+
a(), n({ type: "oauth", provider: v });
|
|
10334
|
+
}, l = (v) => {
|
|
10335
|
+
a(), n({ type: "external", walletId: v });
|
|
10338
10336
|
}, u = () => {
|
|
10339
10337
|
a(), n(null);
|
|
10340
10338
|
};
|
|
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
|
-
|
|
10339
|
+
(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) => {
|
|
10340
|
+
const R = v.currentTarget.dataset.walletId ?? "";
|
|
10341
|
+
R && l(R);
|
|
10342
|
+
}), (y = i.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", u), i.addEventListener("click", (v) => {
|
|
10343
|
+
v.target === i && u();
|
|
10344
|
+
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((v) => {
|
|
10345
|
+
v.addEventListener("click", (A) => A.stopPropagation());
|
|
10348
10346
|
});
|
|
10349
|
-
const p = (
|
|
10350
|
-
|
|
10347
|
+
const p = (v) => {
|
|
10348
|
+
v.key === "Escape" && (document.removeEventListener("keydown", p), u());
|
|
10351
10349
|
};
|
|
10352
10350
|
document.addEventListener("keydown", p);
|
|
10353
10351
|
});
|
|
@@ -10363,7 +10361,7 @@ class oo {
|
|
|
10363
10361
|
accountLabel: (t == null ? void 0 : t.session_alert_account_label) ?? "Account",
|
|
10364
10362
|
signOutLabel: (t == null ? void 0 : t.session_alert_sign_out_button) ?? "Sign out",
|
|
10365
10363
|
signInAgainLabel: (t == null ? void 0 : t.session_alert_sign_in_again_button) ?? "Sign in again"
|
|
10366
|
-
}), i =
|
|
10364
|
+
}), i = Oe();
|
|
10367
10365
|
ce(n);
|
|
10368
10366
|
let o = !1;
|
|
10369
10367
|
const a = () => {
|
|
@@ -10432,13 +10430,13 @@ class oo {
|
|
|
10432
10430
|
}, o = {
|
|
10433
10431
|
title: (t == null ? void 0 : t.pin_setup_confirm_title) ?? "Confirm PIN",
|
|
10434
10432
|
headerSubtitle: (t == null ? void 0 : t.pin_setup_confirm_subtitle) ?? "Enter your PIN again to confirm."
|
|
10435
|
-
}, a = hr(this.tokens, Qi(n)), c =
|
|
10433
|
+
}, a = hr(this.tokens, Qi(n)), c = Oe();
|
|
10436
10434
|
ce(a);
|
|
10437
10435
|
let l = !1;
|
|
10438
10436
|
const u = () => {
|
|
10439
10437
|
l || (l = !0, a.remove(), c());
|
|
10440
|
-
}, p = (
|
|
10441
|
-
u(), r(
|
|
10438
|
+
}, p = (R) => {
|
|
10439
|
+
u(), r(R);
|
|
10442
10440
|
}, g = () => {
|
|
10443
10441
|
u(), r(null);
|
|
10444
10442
|
}, _ = a.querySelector(".__crossx-card"), x = {
|
|
@@ -10447,66 +10445,66 @@ class oo {
|
|
|
10447
10445
|
repeatingDigit: (t == null ? void 0 : t.pin_validation_repeating_digit) ?? "Cannot use the same number 3+ times in a row.",
|
|
10448
10446
|
sequential: (t == null ? void 0 : t.pin_validation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
|
|
10449
10447
|
alternatingPattern: (t == null ? void 0 : t.pin_validation_alternating_pattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
10450
|
-
},
|
|
10451
|
-
var
|
|
10452
|
-
_.innerHTML =
|
|
10448
|
+
}, y = (R) => {
|
|
10449
|
+
var k;
|
|
10450
|
+
_.innerHTML = _t({
|
|
10453
10451
|
title: o.title,
|
|
10454
10452
|
headerSubtitle: o.headerSubtitle
|
|
10455
|
-
}), this.applyPinKeyboardMode(_), (
|
|
10456
|
-
L ===
|
|
10453
|
+
}), this.applyPinKeyboardMode(_), (k = _.querySelector("#__crossx-close-btn")) == null || k.addEventListener("click", g), ft(_, (L) => {
|
|
10454
|
+
L === R ? p(R) : v(i.mismatchError);
|
|
10457
10455
|
}, g);
|
|
10458
|
-
},
|
|
10459
|
-
var
|
|
10460
|
-
_.innerHTML =
|
|
10456
|
+
}, v = (R) => {
|
|
10457
|
+
var k;
|
|
10458
|
+
_.innerHTML = _t({
|
|
10461
10459
|
title: i.title,
|
|
10462
10460
|
headerSubtitle: i.headerSubtitle,
|
|
10463
10461
|
subtitle: i.subtitle,
|
|
10464
|
-
errorMessage:
|
|
10465
|
-
}), this.applyPinKeyboardMode(_), (
|
|
10466
|
-
const
|
|
10467
|
-
|
|
10462
|
+
errorMessage: R
|
|
10463
|
+
}), this.applyPinKeyboardMode(_), (k = _.querySelector("#__crossx-close-btn")) == null || k.addEventListener("click", g), ft(_, (L) => {
|
|
10464
|
+
const D = eo(L, x);
|
|
10465
|
+
D ? v(D) : y(L);
|
|
10468
10466
|
}, g);
|
|
10469
10467
|
};
|
|
10470
10468
|
(() => {
|
|
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(
|
|
10469
|
+
var te;
|
|
10470
|
+
const R = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), k = _.querySelector("#__crossx-pin-notice-next"), L = /* @__PURE__ */ new Set();
|
|
10471
|
+
k.removeAttribute("disabled");
|
|
10472
|
+
const D = k.dataset.nextLabel ?? "Next", z = k.dataset.submitLabel ?? "I Understand", Q = () => {
|
|
10473
|
+
const G = L.size === R.length;
|
|
10474
|
+
k.classList.toggle("--disabled", !G), k.textContent = G ? z : D;
|
|
10475
|
+
}, q = (G, B) => {
|
|
10476
|
+
if (L.has(B)) return;
|
|
10477
|
+
const H = G.querySelector(`#__crossx-notice-check-${B}`);
|
|
10478
|
+
L.add(B), H.classList.add("--checked"), G.setAttribute("aria-checked", "true"), Q();
|
|
10479
|
+
}, J = (G, B) => {
|
|
10480
|
+
if (!L.has(B)) return;
|
|
10481
|
+
const H = G.querySelector(`#__crossx-notice-check-${B}`);
|
|
10482
|
+
L.delete(B), H.classList.remove("--checked"), G.setAttribute("aria-checked", "false"), Q();
|
|
10485
10483
|
};
|
|
10486
|
-
|
|
10487
|
-
const
|
|
10488
|
-
|
|
10489
|
-
L.has(
|
|
10490
|
-
}),
|
|
10491
|
-
(
|
|
10484
|
+
R.forEach((G) => {
|
|
10485
|
+
const B = parseInt(G.dataset.checkIndex ?? "0", 10);
|
|
10486
|
+
G.addEventListener("click", () => {
|
|
10487
|
+
L.has(B) ? J(G, B) : q(G, B);
|
|
10488
|
+
}), G.addEventListener("keydown", (H) => {
|
|
10489
|
+
(H.key === " " || H.key === "Enter") && (H.preventDefault(), L.has(B) ? J(G, B) : q(G, B));
|
|
10492
10490
|
});
|
|
10493
|
-
}),
|
|
10494
|
-
if (L.size ===
|
|
10495
|
-
|
|
10491
|
+
}), k.addEventListener("click", () => {
|
|
10492
|
+
if (L.size === R.length) {
|
|
10493
|
+
v(e == null ? void 0 : e.errorMessage);
|
|
10496
10494
|
return;
|
|
10497
10495
|
}
|
|
10498
|
-
const
|
|
10499
|
-
const m = parseInt(
|
|
10496
|
+
const G = R.find((H) => {
|
|
10497
|
+
const m = parseInt(H.dataset.checkIndex ?? "0", 10);
|
|
10500
10498
|
return !L.has(m);
|
|
10501
10499
|
});
|
|
10502
|
-
if (!
|
|
10503
|
-
const
|
|
10504
|
-
|
|
10505
|
-
|
|
10500
|
+
if (!G) return;
|
|
10501
|
+
const B = parseInt(G.dataset.checkIndex ?? "0", 10);
|
|
10502
|
+
G.scrollIntoView({ behavior: "smooth", block: "nearest" }), G.classList.add("--highlight"), setTimeout(() => {
|
|
10503
|
+
G.classList.remove("--highlight"), q(G, B);
|
|
10506
10504
|
}, 400);
|
|
10507
|
-
}), (
|
|
10508
|
-
})(), a.addEventListener("click", (
|
|
10509
|
-
|
|
10505
|
+
}), (te = _.querySelector("#__crossx-close-btn")) == null || te.addEventListener("click", g);
|
|
10506
|
+
})(), a.addEventListener("click", (R) => {
|
|
10507
|
+
R.target === a && g();
|
|
10510
10508
|
});
|
|
10511
10509
|
});
|
|
10512
10510
|
}
|
|
@@ -10517,11 +10515,11 @@ class oo {
|
|
|
10517
10515
|
*/
|
|
10518
10516
|
showPinInputPrompt(e) {
|
|
10519
10517
|
return new Promise((r, t) => {
|
|
10520
|
-
var
|
|
10518
|
+
var A;
|
|
10521
10519
|
ae();
|
|
10522
10520
|
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
10521
|
this.tokens,
|
|
10524
|
-
|
|
10522
|
+
_t({
|
|
10525
10523
|
title: o,
|
|
10526
10524
|
headerSubtitle: a,
|
|
10527
10525
|
errorMessage: e == null ? void 0 : e.errorMessage,
|
|
@@ -10530,20 +10528,20 @@ class oo {
|
|
|
10530
10528
|
attemptCount: e == null ? void 0 : e.attemptCount,
|
|
10531
10529
|
maxAttempts: e == null ? void 0 : e.maxAttempts
|
|
10532
10530
|
})
|
|
10533
|
-
), u =
|
|
10531
|
+
), u = Oe();
|
|
10534
10532
|
ce(l);
|
|
10535
10533
|
let p = !1;
|
|
10536
10534
|
const g = () => {
|
|
10537
10535
|
p || (p = !0, l.remove(), u());
|
|
10538
|
-
}, _ = (
|
|
10539
|
-
g(), r(
|
|
10536
|
+
}, _ = (R) => {
|
|
10537
|
+
g(), r(R);
|
|
10540
10538
|
}, x = () => {
|
|
10541
10539
|
g(), r(null);
|
|
10542
|
-
},
|
|
10543
|
-
g(), t(
|
|
10544
|
-
},
|
|
10545
|
-
this.applyPinKeyboardMode(
|
|
10546
|
-
|
|
10540
|
+
}, y = (R) => {
|
|
10541
|
+
g(), t(R);
|
|
10542
|
+
}, v = l.querySelector(".__crossx-card");
|
|
10543
|
+
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) => {
|
|
10544
|
+
R.target === l && x();
|
|
10547
10545
|
});
|
|
10548
10546
|
});
|
|
10549
10547
|
}
|
|
@@ -10656,7 +10654,7 @@ class oo {
|
|
|
10656
10654
|
ae();
|
|
10657
10655
|
let t;
|
|
10658
10656
|
e.type === "sign-message" ? t = Di(e, this.tokens, this.messages) : e.type === "sign-typed-data" ? t = $i(e, this.tokens, this.messages) : e.type === "sign" ? t = Ai(e, this.tokens, this.displayDecimals, this.messages) : t = Ii(e, this.tokens, this.displayDecimals, this.messages);
|
|
10659
|
-
const n =
|
|
10657
|
+
const n = Oe();
|
|
10660
10658
|
ce(t);
|
|
10661
10659
|
const i = () => {
|
|
10662
10660
|
t.remove(), n();
|
|
@@ -10667,10 +10665,10 @@ class oo {
|
|
|
10667
10665
|
};
|
|
10668
10666
|
(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
10667
|
g.addEventListener("click", (_) => {
|
|
10670
|
-
var
|
|
10668
|
+
var y;
|
|
10671
10669
|
_.stopPropagation();
|
|
10672
10670
|
const x = g.dataset.copy;
|
|
10673
|
-
x && ((
|
|
10671
|
+
x && ((y = navigator.clipboard) == null || y.writeText(x).catch(() => {
|
|
10674
10672
|
}));
|
|
10675
10673
|
});
|
|
10676
10674
|
}), _i(t), t.addEventListener("click", (g) => {
|
|
@@ -10888,7 +10886,7 @@ Set the projectId field in SDKConfig when calling createCROSSxSDK().
|
|
|
10888
10886
|
Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
10889
10887
|
);
|
|
10890
10888
|
s.debug;
|
|
10891
|
-
const r =
|
|
10889
|
+
const r = Le.production, t = {
|
|
10892
10890
|
...s,
|
|
10893
10891
|
oauthServiceUrl: r.oauthServiceUrl,
|
|
10894
10892
|
authApiUrl: r.authApiUrl,
|
|
@@ -10902,9 +10900,9 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10902
10900
|
"refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
|
|
10903
10901
|
"IndexedDB를 지원하는 브라우저 사용을 권장합니다."
|
|
10904
10902
|
), t.secureStorageAvailable = i;
|
|
10905
|
-
const o = i ? new Vt(s.projectId) : new js(), a = new si(), c = new ai(), l = new
|
|
10903
|
+
const o = i ? new Vt(s.projectId) : new js(), a = new si(), c = new ai(), l = new Ie(), u = new co(), p = new _r();
|
|
10906
10904
|
let g;
|
|
10907
|
-
s.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), g = new li(o, p)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), g = new
|
|
10905
|
+
s.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), g = new li(o, p)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), g = new Te(
|
|
10908
10906
|
n,
|
|
10909
10907
|
o,
|
|
10910
10908
|
c,
|
|
@@ -10913,31 +10911,31 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10913
10911
|
));
|
|
10914
10912
|
let _ = null;
|
|
10915
10913
|
const x = () => {
|
|
10916
|
-
var
|
|
10917
|
-
return ((
|
|
10914
|
+
var D;
|
|
10915
|
+
return ((D = _ == null ? void 0 : _.isAuthenticatedViaRNBridge) == null ? void 0 : D.call(_)) ?? !1;
|
|
10918
10916
|
};
|
|
10919
10917
|
g = new di(
|
|
10920
10918
|
g,
|
|
10921
10919
|
() => {
|
|
10922
|
-
var
|
|
10923
|
-
return (
|
|
10920
|
+
var D;
|
|
10921
|
+
return (D = _ == null ? void 0 : _.getRNBridge) == null ? void 0 : D.call(_);
|
|
10924
10922
|
},
|
|
10925
10923
|
x
|
|
10926
10924
|
);
|
|
10927
|
-
const
|
|
10925
|
+
const y = new We(n, c), v = new oo(
|
|
10928
10926
|
s.theme ?? "light",
|
|
10929
10927
|
s.themeTokens,
|
|
10930
10928
|
s.displayDecimals,
|
|
10931
10929
|
s.pinKeyboard
|
|
10932
|
-
),
|
|
10933
|
-
|
|
10930
|
+
), A = new ao(
|
|
10931
|
+
v,
|
|
10934
10932
|
() => {
|
|
10935
|
-
var
|
|
10936
|
-
return (
|
|
10933
|
+
var D;
|
|
10934
|
+
return (D = _ == null ? void 0 : _.getRNBridge) == null ? void 0 : D.call(_);
|
|
10937
10935
|
},
|
|
10938
10936
|
() => typeof window < "u" ? window.location.origin : "http://localhost",
|
|
10939
10937
|
x
|
|
10940
|
-
),
|
|
10938
|
+
), R = e != null && e.wrapConfirmation ? e.wrapConfirmation(A) : A, k = new wt(
|
|
10941
10939
|
t,
|
|
10942
10940
|
n,
|
|
10943
10941
|
o,
|
|
@@ -10946,13 +10944,13 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10946
10944
|
l,
|
|
10947
10945
|
g,
|
|
10948
10946
|
u,
|
|
10949
|
-
|
|
10950
|
-
|
|
10947
|
+
R,
|
|
10948
|
+
y,
|
|
10951
10949
|
p
|
|
10952
10950
|
);
|
|
10953
|
-
_ =
|
|
10954
|
-
const L =
|
|
10955
|
-
return L && typeof L.setFreshTokenCallback == "function" && L.setFreshTokenCallback(() =>
|
|
10951
|
+
_ = k;
|
|
10952
|
+
const L = k.signInUseCase;
|
|
10953
|
+
return L && typeof L.setFreshTokenCallback == "function" && L.setFreshTokenCallback(() => k.requestFreshFirebaseIdTokenFromBridge()), typeof window < "u" && (window.__crossxSDK = k), k;
|
|
10956
10954
|
}
|
|
10957
10955
|
function wo(s) {
|
|
10958
10956
|
const e = lo(s), r = uo(e), t = JSON.parse(r);
|
|
@@ -11015,11 +11013,11 @@ export {
|
|
|
11015
11013
|
cs as CONNECT_OTHER_WALLET_DISPLAY_ORDER,
|
|
11016
11014
|
f as CROSSxError,
|
|
11017
11015
|
ps as CROSSxEthereumProvider,
|
|
11018
|
-
|
|
11016
|
+
wt as CROSSxSDK,
|
|
11019
11017
|
go as ChainId,
|
|
11020
|
-
|
|
11018
|
+
He as ConnectOtherWalletItem,
|
|
11021
11019
|
h as ErrorCode,
|
|
11022
|
-
|
|
11020
|
+
xt as MNEMONIC_ADDRESS_LIMIT,
|
|
11023
11021
|
_r as PinMemoryStore,
|
|
11024
11022
|
co as TokenMemoryStore,
|
|
11025
11023
|
xo as createCROSSxSDK,
|