@nexus-cross/crossx-sdk-core 2.2.3-beta.2 → 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 -135
- package/dist/index.cjs +119 -119
- package/dist/index.js +988 -988
- 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,
|
|
@@ -9104,7 +9104,7 @@ function ae() {
|
|
|
9104
9104
|
s || (s = document.createElement("style"), s.id = lr, document.head.appendChild(s)), s.textContent = hi;
|
|
9105
9105
|
}
|
|
9106
9106
|
function pi() {
|
|
9107
|
-
const s = `#${
|
|
9107
|
+
const s = `#${ee}`, e = (t) => {
|
|
9108
9108
|
var n, i;
|
|
9109
9109
|
(i = (n = t.target) == null ? void 0 : n.closest) != null && i.call(n, s) && t.stopImmediatePropagation();
|
|
9110
9110
|
}, r = (t) => {
|
|
@@ -9173,7 +9173,7 @@ function _i(s) {
|
|
|
9173
9173
|
}, { passive: !0 });
|
|
9174
9174
|
}
|
|
9175
9175
|
const fi = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
9176
|
-
function
|
|
9176
|
+
function Oe() {
|
|
9177
9177
|
if (fi()) {
|
|
9178
9178
|
const e = window.scrollY;
|
|
9179
9179
|
return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
|
|
@@ -9193,10 +9193,10 @@ function zr(s, e = "CROSS", r = 18, t = 6) {
|
|
|
9193
9193
|
try {
|
|
9194
9194
|
const n = BigInt(s);
|
|
9195
9195
|
if (n === 0n) return null;
|
|
9196
|
-
const i =
|
|
9196
|
+
const i = Et(n, r, t);
|
|
9197
9197
|
if (i === "0") return null;
|
|
9198
|
-
const o =
|
|
9199
|
-
return
|
|
9198
|
+
const o = vt(n, r);
|
|
9199
|
+
return St(`${i} ${e}`, `${o} ${e}`);
|
|
9200
9200
|
} catch {
|
|
9201
9201
|
return null;
|
|
9202
9202
|
}
|
|
@@ -9228,20 +9228,20 @@ function jr(s) {
|
|
|
9228
9228
|
const e = parseInt(s.split(":")[1] ?? "", 10);
|
|
9229
9229
|
return !isNaN(e) && ur[e] ? ur[e] : s;
|
|
9230
9230
|
}
|
|
9231
|
-
function
|
|
9231
|
+
function vt(s, e) {
|
|
9232
9232
|
if (s === 0n) return "0";
|
|
9233
9233
|
const r = 10n ** BigInt(e), t = s / r, i = (s % r).toString().padStart(e, "0").replace(/0+$/, "");
|
|
9234
9234
|
return i ? `${t}.${i}` : `${t}`;
|
|
9235
9235
|
}
|
|
9236
|
-
function
|
|
9237
|
-
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>`;
|
|
9238
9238
|
}
|
|
9239
|
-
function
|
|
9239
|
+
function Et(s, e, r) {
|
|
9240
9240
|
if (s === 0n) return "0";
|
|
9241
9241
|
const t = 10n ** BigInt(e), n = s / t, a = (s % t).toString().padStart(e, "0").slice(0, r).replace(/0+$/, "");
|
|
9242
9242
|
return a ? `${n}.${a}` : `${n}`;
|
|
9243
9243
|
}
|
|
9244
|
-
function
|
|
9244
|
+
function pt(s) {
|
|
9245
9245
|
try {
|
|
9246
9246
|
const e = BigInt(s), r = e / 1000000000n, n = (e % 1000000000n).toString().padStart(9, "0").slice(0, 2).replace(/0+$/, "");
|
|
9247
9247
|
return n ? `${r}.${n}` : `${r}`;
|
|
@@ -9265,12 +9265,12 @@ function xi(s, e) {
|
|
|
9265
9265
|
const u = c * BigInt(n);
|
|
9266
9266
|
return {
|
|
9267
9267
|
isDynamic: !0,
|
|
9268
|
-
estTxFee:
|
|
9269
|
-
`${
|
|
9270
|
-
`${
|
|
9268
|
+
estTxFee: St(
|
|
9269
|
+
`${Et(u, a, e)} ${o}`,
|
|
9270
|
+
`${vt(u, a)} ${o}`
|
|
9271
9271
|
),
|
|
9272
|
-
maxFeeGwei:
|
|
9273
|
-
maxPriorityFeeGwei: i ?
|
|
9272
|
+
maxFeeGwei: pt(n),
|
|
9273
|
+
maxPriorityFeeGwei: i ? pt(i) : void 0,
|
|
9274
9274
|
gasLimitFormatted: l
|
|
9275
9275
|
};
|
|
9276
9276
|
}
|
|
@@ -9278,11 +9278,11 @@ function xi(s, e) {
|
|
|
9278
9278
|
const u = c * BigInt(t);
|
|
9279
9279
|
return {
|
|
9280
9280
|
isDynamic: !1,
|
|
9281
|
-
estTxFee:
|
|
9282
|
-
`${
|
|
9283
|
-
`${
|
|
9281
|
+
estTxFee: St(
|
|
9282
|
+
`${Et(u, a, e)} ${o}`,
|
|
9283
|
+
`${vt(u, a)} ${o}`
|
|
9284
9284
|
),
|
|
9285
|
-
gasPriceGwei:
|
|
9285
|
+
gasPriceGwei: pt(t),
|
|
9286
9286
|
gasLimitFormatted: l
|
|
9287
9287
|
};
|
|
9288
9288
|
}
|
|
@@ -9293,24 +9293,24 @@ function xi(s, e) {
|
|
|
9293
9293
|
}
|
|
9294
9294
|
function Yr(s, e, r) {
|
|
9295
9295
|
const t = xi(s, e);
|
|
9296
|
-
if (!t) return
|
|
9297
|
-
let n =
|
|
9298
|
-
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;
|
|
9299
9299
|
}
|
|
9300
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">
|
|
9301
9301
|
<rect x="9" y="9" width="13" height="13" rx="2"/>
|
|
9302
9302
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
|
9303
|
-
</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">
|
|
9304
9304
|
<line x1="18" y1="6" x2="6" y2="18"/>
|
|
9305
9305
|
<line x1="6" y1="6" x2="18" y2="18"/>
|
|
9306
9306
|
</svg>`, wi = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9307
9307
|
<circle cx="20" cy="20" r="20" fill="#00D5AA"/>
|
|
9308
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"/>
|
|
9309
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 = {
|
|
9310
|
-
[
|
|
9311
|
-
[
|
|
9312
|
-
[
|
|
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"/>',
|
|
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">
|
|
9314
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)"/>
|
|
9315
9315
|
</svg>`, Ei = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
9316
9316
|
<circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
|
|
@@ -9343,7 +9343,7 @@ function ie(s) {
|
|
|
9343
9343
|
`--cx-on-primary:${s.onPrimary}`
|
|
9344
9344
|
].join(";");
|
|
9345
9345
|
}
|
|
9346
|
-
function
|
|
9346
|
+
function Z(s, e) {
|
|
9347
9347
|
return `
|
|
9348
9348
|
<div class="__crossx-row">
|
|
9349
9349
|
<span class="__crossx-row-label">${s}</span>
|
|
@@ -9351,64 +9351,64 @@ function j(s, e) {
|
|
|
9351
9351
|
</div>`;
|
|
9352
9352
|
}
|
|
9353
9353
|
function Ai(s, e, r, t) {
|
|
9354
|
-
const n = e, i = s.nativeSymbol ?? "ETH", o = s.nativeDecimals ?? 18, a =
|
|
9355
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9356
|
-
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 = `
|
|
9357
9357
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${ie(n)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9358
9358
|
<div class="__crossx-header">
|
|
9359
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9360
|
-
<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>
|
|
9361
9361
|
</div>
|
|
9362
9362
|
<hr class="__crossx-divider">
|
|
9363
9363
|
<div class="__crossx-body">
|
|
9364
9364
|
<div class="__crossx-body-cols">
|
|
9365
9365
|
<div class="__crossx-col-left">
|
|
9366
9366
|
<p class="__crossx-sig-subtitle">
|
|
9367
|
-
<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")}
|
|
9368
9368
|
</p>
|
|
9369
9369
|
<div class="__crossx-addr-pill">
|
|
9370
|
-
${
|
|
9370
|
+
${Lt}
|
|
9371
9371
|
<span class="__crossx-addr-pill-text">${de(s.from)}</span>
|
|
9372
9372
|
</div>
|
|
9373
|
-
<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>
|
|
9374
9374
|
</div>
|
|
9375
9375
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
9376
9376
|
<div class="__crossx-col-right-sign">
|
|
9377
9377
|
<div class="__crossx-rows">
|
|
9378
|
-
${
|
|
9379
|
-
${
|
|
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>`)}
|
|
9380
9380
|
${p}
|
|
9381
9381
|
${l}
|
|
9382
9382
|
</div>
|
|
9383
|
-
<pre class="__crossx-raw-tx">${
|
|
9383
|
+
<pre class="__crossx-raw-tx">${S(g)}</pre>
|
|
9384
9384
|
</div>
|
|
9385
9385
|
</div>
|
|
9386
9386
|
<div class="__crossx-btn-row">
|
|
9387
|
-
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${
|
|
9388
|
-
<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>
|
|
9389
9389
|
</div>
|
|
9390
9390
|
</div>
|
|
9391
9391
|
</div>
|
|
9392
9392
|
`, _;
|
|
9393
9393
|
}
|
|
9394
9394
|
function Ii(s, e, r, t) {
|
|
9395
|
-
const n = e, i = s.nativeSymbol ?? "ETH", o = s.nativeDecimals ?? 18, a =
|
|
9396
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9397
|
-
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 = `
|
|
9398
9398
|
<div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ie(n)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9399
9399
|
<div class="__crossx-header">
|
|
9400
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9401
|
-
<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>
|
|
9402
9402
|
</div>
|
|
9403
9403
|
<hr class="__crossx-divider">
|
|
9404
9404
|
<div class="__crossx-body">
|
|
9405
9405
|
<p class="__crossx-tx-subtitle">
|
|
9406
|
-
<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.")}
|
|
9407
9407
|
</p>
|
|
9408
9408
|
<div class="__crossx-body-cols">
|
|
9409
9409
|
<div class="__crossx-rows">
|
|
9410
|
-
${
|
|
9411
|
-
${
|
|
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>`)}
|
|
9412
9412
|
${l}
|
|
9413
9413
|
</div>
|
|
9414
9414
|
<div class="__crossx-pill">
|
|
@@ -9416,12 +9416,12 @@ function Ii(s, e, r, t) {
|
|
|
9416
9416
|
<span class="__crossx-pill-amount">${p}</span>
|
|
9417
9417
|
</div>
|
|
9418
9418
|
</div>
|
|
9419
|
-
<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>
|
|
9420
9420
|
</div>
|
|
9421
9421
|
</div>
|
|
9422
9422
|
`, g;
|
|
9423
9423
|
}
|
|
9424
|
-
function
|
|
9424
|
+
function nt(s) {
|
|
9425
9425
|
var e;
|
|
9426
9426
|
if (s) return s;
|
|
9427
9427
|
try {
|
|
@@ -9430,17 +9430,17 @@ function st(s) {
|
|
|
9430
9430
|
return "This site";
|
|
9431
9431
|
}
|
|
9432
9432
|
}
|
|
9433
|
-
function
|
|
9433
|
+
function S(s) {
|
|
9434
9434
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
9435
9435
|
}
|
|
9436
9436
|
function Ti(s) {
|
|
9437
9437
|
return typeof s == "string" && /^0x[0-9a-fA-F]{40}$/i.test(s);
|
|
9438
9438
|
}
|
|
9439
9439
|
function ki(s) {
|
|
9440
|
-
if (typeof s == "string") return
|
|
9440
|
+
if (typeof s == "string") return S(s);
|
|
9441
9441
|
if (typeof s == "number" || typeof s == "bigint" || typeof s == "boolean") return String(s);
|
|
9442
9442
|
try {
|
|
9443
|
-
return
|
|
9443
|
+
return S(JSON.stringify(s));
|
|
9444
9444
|
} catch {
|
|
9445
9445
|
return String(s);
|
|
9446
9446
|
}
|
|
@@ -9455,30 +9455,30 @@ function Ci(s, e) {
|
|
|
9455
9455
|
return `https://explorer.crosstoken.io/${Ri(s)}/tx/${e}`;
|
|
9456
9456
|
}
|
|
9457
9457
|
function Jr(s, e) {
|
|
9458
|
-
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>`;
|
|
9459
9459
|
}
|
|
9460
|
-
function
|
|
9460
|
+
function Qe(s) {
|
|
9461
9461
|
return Jr(de(s), Ni(s));
|
|
9462
9462
|
}
|
|
9463
9463
|
function Zr(s, e) {
|
|
9464
9464
|
return Jr(de(e), Ci(s, e));
|
|
9465
9465
|
}
|
|
9466
9466
|
function Oi(s, e, r) {
|
|
9467
|
-
const t =
|
|
9467
|
+
const t = Z(
|
|
9468
9468
|
(r == null ? void 0 : r.label_from) ?? "From",
|
|
9469
|
-
`${
|
|
9470
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9471
|
-
), n = s.to ?
|
|
9472
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9473
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9474
|
-
<span class="__crossx-total-label">${
|
|
9475
|
-
<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>
|
|
9476
9476
|
</div>` : "", l = document.createElement("div");
|
|
9477
|
-
return l.id =
|
|
9477
|
+
return l.id = ee, l.innerHTML = `
|
|
9478
9478
|
<div class="__crossx-card __crossx-card--migration" style="${ie(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9479
9479
|
<div class="__crossx-header">
|
|
9480
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9481
|
-
<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>
|
|
9482
9482
|
</div>
|
|
9483
9483
|
<hr class="__crossx-divider">
|
|
9484
9484
|
<div class="__crossx-body">
|
|
@@ -9490,23 +9490,23 @@ function Oi(s, e, r) {
|
|
|
9490
9490
|
${a}
|
|
9491
9491
|
</div>
|
|
9492
9492
|
${c}
|
|
9493
|
-
<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>
|
|
9494
9494
|
</div>
|
|
9495
9495
|
</div>
|
|
9496
9496
|
`, l;
|
|
9497
9497
|
}
|
|
9498
9498
|
function Pi(s, e, r) {
|
|
9499
9499
|
const t = document.createElement("div");
|
|
9500
|
-
return t.id =
|
|
9500
|
+
return t.id = ee, t.innerHTML = `
|
|
9501
9501
|
<div class="__crossx-card __crossx-card--migration" style="${ie(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9502
9502
|
<div class="__crossx-header">
|
|
9503
|
-
<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>
|
|
9504
9504
|
</div>
|
|
9505
9505
|
<hr class="__crossx-divider">
|
|
9506
9506
|
<div class="__crossx-body" id="__crossx-progress-body">
|
|
9507
9507
|
<div class="__crossx-progress-center">
|
|
9508
9508
|
<div class="__crossx-spinner"></div>
|
|
9509
|
-
<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>
|
|
9510
9510
|
</div>
|
|
9511
9511
|
</div>
|
|
9512
9512
|
</div>
|
|
@@ -9515,21 +9515,21 @@ function Pi(s, e, r) {
|
|
|
9515
9515
|
function Li(s, e, r, t) {
|
|
9516
9516
|
const n = e.status !== "reverted" && e.status !== "timeout", i = e.status === "timeout", o = s.querySelector("#__crossx-ttl"), a = s.querySelector(".__crossx-header");
|
|
9517
9517
|
if (o) {
|
|
9518
|
-
const
|
|
9519
|
-
|
|
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;
|
|
9520
9520
|
}
|
|
9521
9521
|
if (a && !s.querySelector("#__crossx-close-btn")) {
|
|
9522
|
-
const
|
|
9523
|
-
|
|
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);
|
|
9524
9524
|
}
|
|
9525
9525
|
const c = s.querySelector("#__crossx-progress-body");
|
|
9526
9526
|
if (!c) return;
|
|
9527
|
-
const l = e.from ?
|
|
9528
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9529
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9530
|
-
<button class="__crossx-copy-btn" data-copy="${
|
|
9531
|
-
<span class="__crossx-total-label">${
|
|
9532
|
-
<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>
|
|
9533
9533
|
</div>` : "";
|
|
9534
9534
|
c.innerHTML = `
|
|
9535
9535
|
<div class="__crossx-rows">
|
|
@@ -9540,51 +9540,51 @@ function Li(s, e, r, t) {
|
|
|
9540
9540
|
${_}
|
|
9541
9541
|
</div>
|
|
9542
9542
|
${x}
|
|
9543
|
-
<button class="__crossx-approve-btn" id="__crossx-done-btn">${
|
|
9544
|
-
`, c.querySelectorAll(".__crossx-copy-btn").forEach((
|
|
9545
|
-
|
|
9546
|
-
var
|
|
9547
|
-
|
|
9548
|
-
const
|
|
9549
|
-
|
|
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(() => {
|
|
9550
9550
|
}));
|
|
9551
9551
|
});
|
|
9552
9552
|
});
|
|
9553
9553
|
}
|
|
9554
9554
|
function Di(s, e, r) {
|
|
9555
|
-
const t = e, n =
|
|
9556
|
-
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 = `
|
|
9557
9557
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9558
9558
|
<div class="__crossx-header">
|
|
9559
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9560
|
-
<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>
|
|
9561
9561
|
</div>
|
|
9562
9562
|
<hr class="__crossx-divider">
|
|
9563
9563
|
<div class="__crossx-body">
|
|
9564
9564
|
<div class="__crossx-body-cols">
|
|
9565
9565
|
<div class="__crossx-col-left">
|
|
9566
9566
|
<p class="__crossx-sig-subtitle">
|
|
9567
|
-
<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")}
|
|
9568
9568
|
</p>
|
|
9569
9569
|
<div class="__crossx-addr-pill">
|
|
9570
|
-
${
|
|
9570
|
+
${Lt}
|
|
9571
9571
|
<span class="__crossx-addr-pill-text">${de(s.from)}</span>
|
|
9572
9572
|
</div>
|
|
9573
|
-
<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>
|
|
9574
9574
|
</div>
|
|
9575
9575
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
9576
9576
|
<div class="__crossx-msg-raw">${i}</div>
|
|
9577
9577
|
</div>
|
|
9578
9578
|
<div class="__crossx-btn-row">
|
|
9579
|
-
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${
|
|
9580
|
-
<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>
|
|
9581
9581
|
</div>
|
|
9582
9582
|
</div>
|
|
9583
9583
|
</div>
|
|
9584
9584
|
`, o;
|
|
9585
9585
|
}
|
|
9586
9586
|
function $i(s, e, r) {
|
|
9587
|
-
const t = e, n =
|
|
9587
|
+
const t = e, n = nt(s.dappName);
|
|
9588
9588
|
let i = {};
|
|
9589
9589
|
if (typeof s.typedData == "string")
|
|
9590
9590
|
try {
|
|
@@ -9595,44 +9595,44 @@ function $i(s, e, r) {
|
|
|
9595
9595
|
const o = i.primaryType ?? "—", a = i.message ?? {};
|
|
9596
9596
|
let c = `
|
|
9597
9597
|
<div class="__crossx-td-row">
|
|
9598
|
-
<span class="__crossx-td-label">${
|
|
9599
|
-
<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>
|
|
9600
9600
|
</div>`;
|
|
9601
9601
|
for (const [u, p] of Object.entries(a)) {
|
|
9602
9602
|
const g = ki(p), x = Ti(p) ? `<span class="__crossx-addr-text">${de(p)}</span>
|
|
9603
|
-
<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>`;
|
|
9604
9604
|
c += `
|
|
9605
9605
|
<div class="__crossx-td-row">
|
|
9606
|
-
<span class="__crossx-td-label">${
|
|
9606
|
+
<span class="__crossx-td-label">${S(u)}</span>
|
|
9607
9607
|
<div class="__crossx-td-value">${x}</div>
|
|
9608
9608
|
</div>`;
|
|
9609
9609
|
}
|
|
9610
9610
|
const l = document.createElement("div");
|
|
9611
|
-
return l.id =
|
|
9611
|
+
return l.id = ee, l.innerHTML = `
|
|
9612
9612
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-typed" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9613
9613
|
<div class="__crossx-header">
|
|
9614
|
-
<p class="__crossx-title" id="__crossx-ttl">${
|
|
9615
|
-
<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>
|
|
9616
9616
|
</div>
|
|
9617
9617
|
<hr class="__crossx-divider">
|
|
9618
9618
|
<div class="__crossx-body">
|
|
9619
9619
|
<div class="__crossx-body-cols">
|
|
9620
9620
|
<div class="__crossx-col-left">
|
|
9621
9621
|
<p class="__crossx-sig-subtitle">
|
|
9622
|
-
<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")}
|
|
9623
9623
|
</p>
|
|
9624
9624
|
<div class="__crossx-addr-pill">
|
|
9625
|
-
${
|
|
9625
|
+
${Lt}
|
|
9626
9626
|
<span class="__crossx-addr-pill-text">${de(s.from)}</span>
|
|
9627
9627
|
</div>
|
|
9628
|
-
<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>
|
|
9629
9629
|
</div>
|
|
9630
9630
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
9631
9631
|
<div class="__crossx-td-rows">${c}</div>
|
|
9632
9632
|
</div>
|
|
9633
9633
|
<div class="__crossx-btn-row">
|
|
9634
|
-
<button class="__crossx-cancel-btn" id="__crossx-cancel-btn">${
|
|
9635
|
-
<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>
|
|
9636
9636
|
</div>
|
|
9637
9637
|
</div>
|
|
9638
9638
|
</div>
|
|
@@ -9659,27 +9659,27 @@ function es(s, e, r) {
|
|
|
9659
9659
|
}
|
|
9660
9660
|
function Wi(s, e, r, t) {
|
|
9661
9661
|
const n = r == null ? void 0 : r.toLowerCase(), i = s.map((a) => {
|
|
9662
|
-
const c = n && a.address.toLowerCase() === n, l = c ? " __crossx-wallet-item--selected" : "", u = c ? `<span class="__crossx-wallet-selected">${
|
|
9663
|
-
return `<button class="__crossx-wallet-item${l}" data-wallet-index="${a.index}" data-wallet-address="${
|
|
9664
|
-
${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}
|
|
9665
9665
|
</button>`;
|
|
9666
9666
|
}).join(""), o = document.createElement("div");
|
|
9667
|
-
return o.id =
|
|
9667
|
+
return o.id = ee, o.innerHTML = `
|
|
9668
9668
|
<div class="__crossx-card __crossx-card--migration __crossx-card--wallet-selector" style="${ie(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9669
9669
|
<div class="__crossx-header">
|
|
9670
9670
|
<div style="display:flex;flex-direction:column;gap:4px;padding-right:36px;">
|
|
9671
|
-
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:0;">${
|
|
9672
|
-
<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>
|
|
9673
9673
|
</div>
|
|
9674
|
-
<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>
|
|
9675
9675
|
</div>
|
|
9676
9676
|
<hr class="__crossx-divider">
|
|
9677
9677
|
<div class="__crossx-body">
|
|
9678
9678
|
<div class="__crossx-body-cols">
|
|
9679
9679
|
<div class="__crossx-col-left">
|
|
9680
9680
|
<div class="__crossx-mig-info">
|
|
9681
|
-
<p class="__crossx-mig-info-title">${
|
|
9682
|
-
<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>
|
|
9683
9683
|
</div>
|
|
9684
9684
|
</div>
|
|
9685
9685
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
@@ -9689,7 +9689,7 @@ function Wi(s, e, r, t) {
|
|
|
9689
9689
|
</div>
|
|
9690
9690
|
<button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
|
|
9691
9691
|
<span class="__crossx-wallet-add-icon">${Bi}</span>
|
|
9692
|
-
<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>
|
|
9693
9693
|
</button>
|
|
9694
9694
|
<p class="__crossx-wallet-add-error" id="__crossx-add-wallet-error" role="alert" aria-live="polite" hidden></p>
|
|
9695
9695
|
</div>
|
|
@@ -9709,7 +9709,7 @@ const Gi = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="h
|
|
|
9709
9709
|
</svg>`;
|
|
9710
9710
|
function Ki(s) {
|
|
9711
9711
|
const e = ls(s);
|
|
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">${
|
|
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>`;
|
|
9713
9713
|
}
|
|
9714
9714
|
function Vi(s) {
|
|
9715
9715
|
if (s.length === 0) return "";
|
|
@@ -9724,39 +9724,39 @@ function Vi(s) {
|
|
|
9724
9724
|
return `${r}${e(0)}, ${e(1)}, ${e(2)}, and ${t} more.`;
|
|
9725
9725
|
}
|
|
9726
9726
|
function zi(s, e = [], r) {
|
|
9727
|
-
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 ? `
|
|
9728
9728
|
<div class="__crossx-login-or-divider">
|
|
9729
9729
|
<hr><span>${i}</span><hr>
|
|
9730
9730
|
</div>
|
|
9731
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">
|
|
9732
9732
|
<span class="__crossx-connect-other-text">
|
|
9733
|
-
<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>
|
|
9734
9734
|
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${Vi(e)}</span>
|
|
9735
9735
|
</span>
|
|
9736
9736
|
</button>` : "", a = document.createElement("div");
|
|
9737
|
-
return a.id =
|
|
9737
|
+
return a.id = ee, a.innerHTML = `
|
|
9738
9738
|
<div class="__crossx-card __crossx-card--migration" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9739
9739
|
<div class="__crossx-header">
|
|
9740
9740
|
<div style="display:flex;flex-direction:column;gap:4px;padding-right:36px;">
|
|
9741
|
-
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:0;">${
|
|
9742
|
-
<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>
|
|
9743
9743
|
</div>
|
|
9744
|
-
<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>
|
|
9745
9745
|
</div>
|
|
9746
9746
|
<hr class="__crossx-divider">
|
|
9747
9747
|
<div class="__crossx-body">
|
|
9748
9748
|
<div class="__crossx-login-btn-row">
|
|
9749
9749
|
<button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
|
|
9750
9750
|
<span class="__crossx-login-icon" style="color:var(--cx-value);">${Gi}</span>
|
|
9751
|
-
<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>
|
|
9752
9752
|
</button>
|
|
9753
9753
|
<button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
|
|
9754
9754
|
<span class="__crossx-login-icon">${qi}</span>
|
|
9755
|
-
<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>
|
|
9756
9756
|
</button>
|
|
9757
9757
|
</div>${o}
|
|
9758
9758
|
<p class="__crossx-login-terms">
|
|
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">${
|
|
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>`)}
|
|
9760
9760
|
</p>
|
|
9761
9761
|
</div>
|
|
9762
9762
|
</div>
|
|
@@ -9764,35 +9764,35 @@ function zi(s, e = [], r) {
|
|
|
9764
9764
|
}
|
|
9765
9765
|
function ji(s, e) {
|
|
9766
9766
|
const r = s, t = document.createElement("div");
|
|
9767
|
-
t.id =
|
|
9768
|
-
const n =
|
|
9769
|
-
<p class="__crossx-session-account-label">${
|
|
9770
|
-
<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>
|
|
9771
9771
|
</div>` : "";
|
|
9772
9772
|
return t.innerHTML = `
|
|
9773
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">
|
|
9774
9774
|
<div class="__crossx-header">
|
|
9775
|
-
<p class="__crossx-title" id="__crossx-session-header-title">${
|
|
9776
|
-
<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>
|
|
9777
9777
|
</div>
|
|
9778
9778
|
<hr class="__crossx-divider">
|
|
9779
9779
|
<div class="__crossx-body" style="padding:20px 24px 24px;display:flex;flex-direction:column;gap:16px;">
|
|
9780
9780
|
<div class="__crossx-session-hero">
|
|
9781
|
-
<p class="__crossx-session-hero-title">${
|
|
9781
|
+
<p class="__crossx-session-hero-title">${S(e.title)}</p>
|
|
9782
9782
|
<p class="__crossx-session-hero-message" id="__crossx-session-msg">${n}</p>
|
|
9783
9783
|
</div>
|
|
9784
9784
|
${i}
|
|
9785
9785
|
<div class="__crossx-btn-row">
|
|
9786
|
-
<button class="__crossx-cancel-btn" id="__crossx-session-signout">${
|
|
9787
|
-
<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>
|
|
9788
9788
|
</div>
|
|
9789
9789
|
</div>
|
|
9790
9790
|
</div>
|
|
9791
9791
|
`, t;
|
|
9792
9792
|
}
|
|
9793
9793
|
function Yi(s, e = !0) {
|
|
9794
|
-
const r = s, t = e ? `<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9795
|
-
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 = `
|
|
9796
9796
|
<div class="__crossx-card __crossx-card--migration" style="${ie(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9797
9797
|
<div class="__crossx-header">
|
|
9798
9798
|
<p class="__crossx-title" id="__crossx-ttl">Wallet Found on Social Account 🎉</p>
|
|
@@ -9816,11 +9816,11 @@ function Yi(s, e = !0) {
|
|
|
9816
9816
|
}
|
|
9817
9817
|
function Xi(s, e) {
|
|
9818
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");
|
|
9819
|
-
return p.id =
|
|
9819
|
+
return p.id = ee, p.innerHTML = `
|
|
9820
9820
|
<div class="__crossx-card __crossx-card--migration" style="${ie(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9821
9821
|
<div class="__crossx-header">
|
|
9822
9822
|
<p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
|
|
9823
|
-
<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>
|
|
9824
9824
|
</div>
|
|
9825
9825
|
<hr class="__crossx-divider">
|
|
9826
9826
|
<div class="__crossx-pin-center">
|
|
@@ -9844,11 +9844,11 @@ function Ji(s) {
|
|
|
9844
9844
|
}
|
|
9845
9845
|
function Zi(s, e, r) {
|
|
9846
9846
|
const t = s, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ? Ji(i) : null, a = document.createElement("div");
|
|
9847
|
-
return a.id =
|
|
9847
|
+
return a.id = ee, a.innerHTML = `
|
|
9848
9848
|
<div class="__crossx-card __crossx-card--migration" style="${ie(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9849
9849
|
<div class="__crossx-header">
|
|
9850
9850
|
<p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
|
|
9851
|
-
<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>
|
|
9852
9852
|
</div>
|
|
9853
9853
|
<hr class="__crossx-divider">
|
|
9854
9854
|
<div class="__crossx-pin-center">
|
|
@@ -9877,14 +9877,14 @@ function Qi(s) {
|
|
|
9877
9877
|
const r = [s.check1, s.check2].map((t, n) => `
|
|
9878
9878
|
<div class="__crossx-pw-notice-item" data-check-index="${n}" role="checkbox" aria-checked="false" tabindex="0">
|
|
9879
9879
|
<div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${so}</div>
|
|
9880
|
-
<span class="__crossx-pw-notice-item-text">${
|
|
9880
|
+
<span class="__crossx-pw-notice-item-text">${S(t)}</span>
|
|
9881
9881
|
</div>
|
|
9882
9882
|
`).join("");
|
|
9883
9883
|
return `
|
|
9884
9884
|
<div class="__crossx-header">
|
|
9885
|
-
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${
|
|
9886
|
-
<p class="__crossx-pw-subtitle">${
|
|
9887
|
-
<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>
|
|
9888
9888
|
</div>
|
|
9889
9889
|
<hr class="__crossx-divider">
|
|
9890
9890
|
<div class="__crossx-pw-body">
|
|
@@ -9892,33 +9892,33 @@ function Qi(s) {
|
|
|
9892
9892
|
<div class="__crossx-pw-notice-header">
|
|
9893
9893
|
<div class="__crossx-pw-notice-title-row">
|
|
9894
9894
|
<span class="__crossx-pw-notice-icon">${no}</span>
|
|
9895
|
-
<p class="__crossx-pw-notice-title">${
|
|
9895
|
+
<p class="__crossx-pw-notice-title">${S(s.noticeTitle)}</p>
|
|
9896
9896
|
</div>
|
|
9897
|
-
<p class="__crossx-pw-notice-desc">${
|
|
9897
|
+
<p class="__crossx-pw-notice-desc">${S(s.noticeDesc)}</p>
|
|
9898
9898
|
</div>
|
|
9899
9899
|
<div class="__crossx-pw-notice-checks" id="__crossx-notice-checks">
|
|
9900
9900
|
${r}
|
|
9901
9901
|
</div>
|
|
9902
9902
|
</div>
|
|
9903
9903
|
<button class="__crossx-pw-btn --disabled" id="__crossx-pin-notice-next"
|
|
9904
|
-
data-next-label="${
|
|
9905
|
-
data-submit-label="${
|
|
9906
|
-
${
|
|
9904
|
+
data-next-label="${S(s.nextButton)}"
|
|
9905
|
+
data-submit-label="${S(s.submitButton)}">
|
|
9906
|
+
${S(s.nextButton)}
|
|
9907
9907
|
</button>
|
|
9908
9908
|
</div>
|
|
9909
9909
|
<div class="__crossx-home-indicator"></div>
|
|
9910
9910
|
`;
|
|
9911
9911
|
}
|
|
9912
|
-
function
|
|
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">${
|
|
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">
|
|
9914
9914
|
${ts}
|
|
9915
9915
|
<span id="__crossx-pin6-lock-countdown"></span>
|
|
9916
|
-
</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(
|
|
9917
9917
|
{ length: 6 },
|
|
9918
|
-
(
|
|
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" : ""}>`
|
|
9919
9919
|
).join(""), p = e ? " --locked" : "", g = Array.from(
|
|
9920
9920
|
{ length: 6 },
|
|
9921
|
-
(
|
|
9921
|
+
(y, v) => `<div class="__crossx-pin6-dot${p}" data-dot-index="${v}" aria-label="PIN digit ${v + 1}"></div>`
|
|
9922
9922
|
).join(""), _ = e ? " --disabled" : "", x = `
|
|
9923
9923
|
<div class="__crossx-pin6-numpad" id="__crossx-pin6-numpad">
|
|
9924
9924
|
<div class="__crossx-pin6-numpad-row">
|
|
@@ -9944,9 +9944,9 @@ function pt(s) {
|
|
|
9944
9944
|
</div>`;
|
|
9945
9945
|
return `
|
|
9946
9946
|
<div class="__crossx-header">
|
|
9947
|
-
<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>
|
|
9948
9948
|
${t}
|
|
9949
|
-
<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>
|
|
9950
9950
|
</div>
|
|
9951
9951
|
<hr class="__crossx-divider">
|
|
9952
9952
|
<div class="__crossx-pin6-body"${r}>
|
|
@@ -9967,7 +9967,7 @@ function pt(s) {
|
|
|
9967
9967
|
}
|
|
9968
9968
|
function hr(s, e) {
|
|
9969
9969
|
const r = document.createElement("div");
|
|
9970
|
-
return r.id =
|
|
9970
|
+
return r.id = ee, r.innerHTML = `
|
|
9971
9971
|
<div class="__crossx-card __crossx-card--pin6" style="${ie(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9972
9972
|
${e}
|
|
9973
9973
|
</div>
|
|
@@ -9984,179 +9984,179 @@ function to(s) {
|
|
|
9984
9984
|
const e = Math.max(0, Math.ceil(s / 1e3)), r = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
|
|
9985
9985
|
return r > 0 ? `${r}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
|
|
9986
9986
|
}
|
|
9987
|
-
function
|
|
9988
|
-
var O,
|
|
9987
|
+
function ft(s, e, r, t, n, i, o) {
|
|
9988
|
+
var O, W;
|
|
9989
9989
|
let a = !!(i && i > Date.now()), c = !1;
|
|
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"),
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
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);
|
|
9996
10000
|
}), !a && !c)) {
|
|
9997
|
-
const
|
|
9998
|
-
(
|
|
9999
|
-
}
|
|
10000
|
-
},
|
|
10001
|
-
s.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((
|
|
10002
|
-
},
|
|
10003
|
-
a = b, l().forEach((
|
|
10004
|
-
|
|
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);
|
|
10005
10009
|
});
|
|
10006
|
-
},
|
|
10010
|
+
}, q = () => s.querySelector("#__crossx-pin6-attempt"), J = () => {
|
|
10007
10011
|
const b = p();
|
|
10008
10012
|
b && (b.textContent = "");
|
|
10009
|
-
},
|
|
10010
|
-
var
|
|
10011
|
-
let
|
|
10012
|
-
if (!v) {
|
|
10013
|
-
v = document.createElement("p"), v.className = "__crossx-pin6-warning", v.id = "__crossx-pin6-warning";
|
|
10014
|
-
const T = p();
|
|
10015
|
-
T ? T.insertAdjacentElement("afterend", v) : (E = x()) == null || E.appendChild(v);
|
|
10016
|
-
}
|
|
10017
|
-
v.textContent = b;
|
|
10018
|
-
}, X = () => {
|
|
10019
|
-
const b = J();
|
|
10020
|
-
b && (b.textContent = "");
|
|
10021
|
-
}, Q = (b, v) => {
|
|
10022
|
-
var T;
|
|
10023
|
-
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();
|
|
10024
10016
|
if (!E) {
|
|
10025
|
-
E = document.createElement("p"), E.className = "__crossx-pin6-
|
|
10026
|
-
const
|
|
10027
|
-
|
|
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);
|
|
10028
10020
|
}
|
|
10029
|
-
E.textContent =
|
|
10021
|
+
E.textContent = b;
|
|
10030
10022
|
}, H = () => {
|
|
10031
|
-
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();
|
|
10032
10036
|
b && (b.textContent = "");
|
|
10033
|
-
},
|
|
10034
|
-
const
|
|
10035
|
-
|
|
10036
|
-
const
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
var T;
|
|
10041
|
-
(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();
|
|
10042
10044
|
}, 50);
|
|
10043
|
-
},
|
|
10044
|
-
var
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
const
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
const N = new MutationObserver(() => {
|
|
10065
|
-
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());
|
|
10066
10066
|
});
|
|
10067
|
-
|
|
10068
|
-
},
|
|
10067
|
+
U.observe(document.body, { childList: !0, subtree: !1 });
|
|
10068
|
+
}, F = async () => {
|
|
10069
10069
|
if (a || c) return;
|
|
10070
|
-
const b =
|
|
10070
|
+
const b = k();
|
|
10071
10071
|
if (b.length === 6) {
|
|
10072
|
-
c = !0, l().forEach((
|
|
10073
|
-
|
|
10072
|
+
c = !0, l().forEach((E) => {
|
|
10073
|
+
E.disabled = !0;
|
|
10074
10074
|
});
|
|
10075
10075
|
try {
|
|
10076
10076
|
if (n) {
|
|
10077
|
-
const
|
|
10078
|
-
|
|
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()));
|
|
10079
10079
|
} else
|
|
10080
10080
|
e(b);
|
|
10081
|
-
} catch (
|
|
10082
|
-
t && t(
|
|
10081
|
+
} catch (E) {
|
|
10082
|
+
t && t(E);
|
|
10083
10083
|
} finally {
|
|
10084
|
-
c = !1, a || l().forEach((
|
|
10085
|
-
|
|
10086
|
-
}),
|
|
10084
|
+
c = !1, a || l().forEach((E) => {
|
|
10085
|
+
E.disabled = !1;
|
|
10086
|
+
}), D();
|
|
10087
10087
|
}
|
|
10088
10088
|
}
|
|
10089
10089
|
};
|
|
10090
|
-
i && i > Date.now() ?
|
|
10090
|
+
i && i > Date.now() ? C(i) : setTimeout(() => {
|
|
10091
10091
|
var b;
|
|
10092
10092
|
return (b = l()[0]) == null ? void 0 : b.focus();
|
|
10093
10093
|
}, 100);
|
|
10094
|
-
const
|
|
10094
|
+
const $ = () => {
|
|
10095
10095
|
if (a || c) return;
|
|
10096
|
-
const b = l(),
|
|
10097
|
-
|
|
10096
|
+
const b = l(), E = b.find((N) => !R(N)) ?? b[b.length - 1];
|
|
10097
|
+
E == null || E.focus();
|
|
10098
10098
|
};
|
|
10099
10099
|
(O = u()) == null || O.addEventListener("click", (b) => {
|
|
10100
|
-
b.target.classList.contains("__crossx-pin6-box") ||
|
|
10101
|
-
}), (
|
|
10102
|
-
const
|
|
10103
|
-
|
|
10104
|
-
}), 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) => {
|
|
10105
10105
|
b.addEventListener("input", () => {
|
|
10106
|
-
var
|
|
10107
|
-
const
|
|
10108
|
-
b
|
|
10109
|
-
}), b.addEventListener("keydown", (
|
|
10110
|
-
var
|
|
10111
|
-
if (
|
|
10112
|
-
if (
|
|
10113
|
-
b
|
|
10114
|
-
else if (
|
|
10115
|
-
const
|
|
10116
|
-
|
|
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();
|
|
10117
10117
|
}
|
|
10118
|
-
|
|
10119
|
-
} else
|
|
10120
|
-
}), b.addEventListener("paste", (
|
|
10121
|
-
var
|
|
10122
|
-
|
|
10123
|
-
const
|
|
10124
|
-
if (!
|
|
10125
|
-
const
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
}), (
|
|
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);
|
|
10129
10129
|
}), b.addEventListener("focus", () => b.select());
|
|
10130
10130
|
});
|
|
10131
|
-
const
|
|
10132
|
-
if (
|
|
10131
|
+
const M = s.querySelector("#__crossx-pin6-numpad");
|
|
10132
|
+
if (M) {
|
|
10133
10133
|
let b = null;
|
|
10134
|
-
const
|
|
10134
|
+
const E = () => {
|
|
10135
10135
|
b && (b.classList.remove("--pressed"), b = null);
|
|
10136
10136
|
};
|
|
10137
|
-
|
|
10138
|
-
const
|
|
10139
|
-
!
|
|
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));
|
|
10140
10140
|
});
|
|
10141
|
-
const
|
|
10142
|
-
const
|
|
10143
|
-
if (!
|
|
10144
|
-
if (
|
|
10145
|
-
const
|
|
10146
|
-
|
|
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();
|
|
10147
10147
|
return;
|
|
10148
10148
|
}
|
|
10149
|
-
if (!/^\d$/.test(
|
|
10150
|
-
const
|
|
10151
|
-
|
|
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));
|
|
10152
10152
|
};
|
|
10153
|
-
|
|
10153
|
+
M.addEventListener("pointerup", (I) => {
|
|
10154
10154
|
if (!b) return;
|
|
10155
|
-
const
|
|
10156
|
-
|
|
10157
|
-
const
|
|
10158
|
-
|
|
10159
|
-
}),
|
|
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();
|
|
10160
10160
|
}
|
|
10161
10161
|
}
|
|
10162
10162
|
const ro = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -10204,7 +10204,7 @@ function io(s, e, r) {
|
|
|
10204
10204
|
}), (i = t[0]) == null || i.focus();
|
|
10205
10205
|
}
|
|
10206
10206
|
class oo {
|
|
10207
|
-
constructor(e = "light", r, t =
|
|
10207
|
+
constructor(e = "light", r, t = At, n) {
|
|
10208
10208
|
this.theme = e, this.overrides = r, this.tokens = dr(e, r), this.displayDecimals = t, this.pinKeyboard = n;
|
|
10209
10209
|
}
|
|
10210
10210
|
setPinKeyboard(e) {
|
|
@@ -10246,55 +10246,55 @@ class oo {
|
|
|
10246
10246
|
*/
|
|
10247
10247
|
showWalletSelector(e, r, t) {
|
|
10248
10248
|
return new Promise((n, i) => {
|
|
10249
|
-
var
|
|
10249
|
+
var R;
|
|
10250
10250
|
ae();
|
|
10251
|
-
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();
|
|
10252
10252
|
ce(a);
|
|
10253
10253
|
let l = !1;
|
|
10254
10254
|
const u = () => {
|
|
10255
10255
|
l || (l = !0, a.remove(), c());
|
|
10256
10256
|
};
|
|
10257
10257
|
let p = null;
|
|
10258
|
-
const g = (
|
|
10259
|
-
u(), n(
|
|
10258
|
+
const g = (k) => {
|
|
10259
|
+
u(), n(k);
|
|
10260
10260
|
}, _ = () => {
|
|
10261
10261
|
u(), p ? i(p) : n(null);
|
|
10262
10262
|
};
|
|
10263
10263
|
(() => {
|
|
10264
|
-
a.querySelectorAll(".__crossx-wallet-item").forEach((
|
|
10265
|
-
|
|
10266
|
-
const L =
|
|
10267
|
-
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 });
|
|
10268
10268
|
});
|
|
10269
10269
|
});
|
|
10270
10270
|
})();
|
|
10271
|
-
const
|
|
10272
|
-
|
|
10273
|
-
|
|
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 = "");
|
|
10274
10274
|
try {
|
|
10275
|
-
const
|
|
10276
|
-
o.push(
|
|
10275
|
+
const k = await r();
|
|
10276
|
+
o.push(k);
|
|
10277
10277
|
const L = a.querySelector("#__crossx-wallet-list");
|
|
10278
10278
|
if (L) {
|
|
10279
|
-
const
|
|
10280
|
-
|
|
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);
|
|
10281
10281
|
try {
|
|
10282
|
-
|
|
10282
|
+
D.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
10283
10283
|
} catch {
|
|
10284
10284
|
}
|
|
10285
10285
|
}
|
|
10286
|
-
|
|
10287
|
-
} catch (
|
|
10288
|
-
const L =
|
|
10289
|
-
|
|
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;
|
|
10290
10290
|
}
|
|
10291
|
-
}), (
|
|
10292
|
-
|
|
10291
|
+
}), (R = a.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", _), a.addEventListener("click", (k) => {
|
|
10292
|
+
k.target === a && _();
|
|
10293
10293
|
});
|
|
10294
|
-
const
|
|
10295
|
-
|
|
10294
|
+
const A = (k) => {
|
|
10295
|
+
k.key === "Escape" && (document.removeEventListener("keydown", A), _());
|
|
10296
10296
|
};
|
|
10297
|
-
document.addEventListener("keydown",
|
|
10297
|
+
document.addEventListener("keydown", A);
|
|
10298
10298
|
});
|
|
10299
10299
|
}
|
|
10300
10300
|
/**
|
|
@@ -10307,7 +10307,7 @@ class oo {
|
|
|
10307
10307
|
resolveAddWalletErrorMessage(e) {
|
|
10308
10308
|
const r = this.messages;
|
|
10309
10309
|
if (e instanceof f && e.code === h.ADDRESS_LIMIT_EXCEEDED) {
|
|
10310
|
-
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;
|
|
10311
10311
|
return ((r == null ? void 0 : r.wallet_selector_add_error_limit_exceeded) ?? "Account limit reached. Maximum {limit} accounts allowed.").replace("{limit}", String(i));
|
|
10312
10312
|
}
|
|
10313
10313
|
return (r == null ? void 0 : r.wallet_selector_add_error_generic) ?? "Failed to add a new account. Please try again.";
|
|
@@ -10320,32 +10320,32 @@ class oo {
|
|
|
10320
10320
|
showLoginSelector(e) {
|
|
10321
10321
|
var t;
|
|
10322
10322
|
const r = ((t = e == null ? void 0 : e.connectOtherWallets) == null ? void 0 : t.filter(
|
|
10323
|
-
(n) => Object.values(
|
|
10323
|
+
(n) => Object.values(He).includes(n) && String(n).trim() !== ""
|
|
10324
10324
|
)) ?? [];
|
|
10325
10325
|
return new Promise((n) => {
|
|
10326
|
-
var g, _, x,
|
|
10326
|
+
var g, _, x, y;
|
|
10327
10327
|
ae();
|
|
10328
|
-
const i = zi(this.tokens, r, this.messages), o =
|
|
10328
|
+
const i = zi(this.tokens, r, this.messages), o = Oe();
|
|
10329
10329
|
ce(i);
|
|
10330
10330
|
const a = () => {
|
|
10331
10331
|
i.remove(), o();
|
|
10332
|
-
}, c = (
|
|
10333
|
-
a(), n({ type: "oauth", provider:
|
|
10334
|
-
}, l = (
|
|
10335
|
-
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 });
|
|
10336
10336
|
}, u = () => {
|
|
10337
10337
|
a(), n(null);
|
|
10338
10338
|
};
|
|
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", (
|
|
10340
|
-
const
|
|
10341
|
-
|
|
10342
|
-
}), (
|
|
10343
|
-
|
|
10344
|
-
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((
|
|
10345
|
-
|
|
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());
|
|
10346
10346
|
});
|
|
10347
|
-
const p = (
|
|
10348
|
-
|
|
10347
|
+
const p = (v) => {
|
|
10348
|
+
v.key === "Escape" && (document.removeEventListener("keydown", p), u());
|
|
10349
10349
|
};
|
|
10350
10350
|
document.addEventListener("keydown", p);
|
|
10351
10351
|
});
|
|
@@ -10361,7 +10361,7 @@ class oo {
|
|
|
10361
10361
|
accountLabel: (t == null ? void 0 : t.session_alert_account_label) ?? "Account",
|
|
10362
10362
|
signOutLabel: (t == null ? void 0 : t.session_alert_sign_out_button) ?? "Sign out",
|
|
10363
10363
|
signInAgainLabel: (t == null ? void 0 : t.session_alert_sign_in_again_button) ?? "Sign in again"
|
|
10364
|
-
}), i =
|
|
10364
|
+
}), i = Oe();
|
|
10365
10365
|
ce(n);
|
|
10366
10366
|
let o = !1;
|
|
10367
10367
|
const a = () => {
|
|
@@ -10430,13 +10430,13 @@ class oo {
|
|
|
10430
10430
|
}, o = {
|
|
10431
10431
|
title: (t == null ? void 0 : t.pin_setup_confirm_title) ?? "Confirm PIN",
|
|
10432
10432
|
headerSubtitle: (t == null ? void 0 : t.pin_setup_confirm_subtitle) ?? "Enter your PIN again to confirm."
|
|
10433
|
-
}, a = hr(this.tokens, Qi(n)), c =
|
|
10433
|
+
}, a = hr(this.tokens, Qi(n)), c = Oe();
|
|
10434
10434
|
ce(a);
|
|
10435
10435
|
let l = !1;
|
|
10436
10436
|
const u = () => {
|
|
10437
10437
|
l || (l = !0, a.remove(), c());
|
|
10438
|
-
}, p = (
|
|
10439
|
-
u(), r(
|
|
10438
|
+
}, p = (R) => {
|
|
10439
|
+
u(), r(R);
|
|
10440
10440
|
}, g = () => {
|
|
10441
10441
|
u(), r(null);
|
|
10442
10442
|
}, _ = a.querySelector(".__crossx-card"), x = {
|
|
@@ -10445,66 +10445,66 @@ class oo {
|
|
|
10445
10445
|
repeatingDigit: (t == null ? void 0 : t.pin_validation_repeating_digit) ?? "Cannot use the same number 3+ times in a row.",
|
|
10446
10446
|
sequential: (t == null ? void 0 : t.pin_validation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
|
|
10447
10447
|
alternatingPattern: (t == null ? void 0 : t.pin_validation_alternating_pattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
10448
|
-
},
|
|
10449
|
-
var
|
|
10450
|
-
_.innerHTML =
|
|
10448
|
+
}, y = (R) => {
|
|
10449
|
+
var k;
|
|
10450
|
+
_.innerHTML = _t({
|
|
10451
10451
|
title: o.title,
|
|
10452
10452
|
headerSubtitle: o.headerSubtitle
|
|
10453
|
-
}), this.applyPinKeyboardMode(_), (
|
|
10454
|
-
L ===
|
|
10453
|
+
}), this.applyPinKeyboardMode(_), (k = _.querySelector("#__crossx-close-btn")) == null || k.addEventListener("click", g), ft(_, (L) => {
|
|
10454
|
+
L === R ? p(R) : v(i.mismatchError);
|
|
10455
10455
|
}, g);
|
|
10456
|
-
},
|
|
10457
|
-
var
|
|
10458
|
-
_.innerHTML =
|
|
10456
|
+
}, v = (R) => {
|
|
10457
|
+
var k;
|
|
10458
|
+
_.innerHTML = _t({
|
|
10459
10459
|
title: i.title,
|
|
10460
10460
|
headerSubtitle: i.headerSubtitle,
|
|
10461
10461
|
subtitle: i.subtitle,
|
|
10462
|
-
errorMessage:
|
|
10463
|
-
}), this.applyPinKeyboardMode(_), (
|
|
10464
|
-
const
|
|
10465
|
-
|
|
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);
|
|
10466
10466
|
}, g);
|
|
10467
10467
|
};
|
|
10468
10468
|
(() => {
|
|
10469
|
-
var
|
|
10470
|
-
const
|
|
10471
|
-
|
|
10472
|
-
const
|
|
10473
|
-
const
|
|
10474
|
-
|
|
10475
|
-
},
|
|
10476
|
-
if (L.has(
|
|
10477
|
-
const
|
|
10478
|
-
L.add(
|
|
10479
|
-
},
|
|
10480
|
-
if (!L.has(
|
|
10481
|
-
const
|
|
10482
|
-
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();
|
|
10483
10483
|
};
|
|
10484
|
-
|
|
10485
|
-
const
|
|
10486
|
-
|
|
10487
|
-
L.has(
|
|
10488
|
-
}),
|
|
10489
|
-
(
|
|
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));
|
|
10490
10490
|
});
|
|
10491
|
-
}),
|
|
10492
|
-
if (L.size ===
|
|
10493
|
-
|
|
10491
|
+
}), k.addEventListener("click", () => {
|
|
10492
|
+
if (L.size === R.length) {
|
|
10493
|
+
v(e == null ? void 0 : e.errorMessage);
|
|
10494
10494
|
return;
|
|
10495
10495
|
}
|
|
10496
|
-
const
|
|
10497
|
-
const m = parseInt(
|
|
10496
|
+
const G = R.find((H) => {
|
|
10497
|
+
const m = parseInt(H.dataset.checkIndex ?? "0", 10);
|
|
10498
10498
|
return !L.has(m);
|
|
10499
10499
|
});
|
|
10500
|
-
if (!
|
|
10501
|
-
const
|
|
10502
|
-
|
|
10503
|
-
|
|
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);
|
|
10504
10504
|
}, 400);
|
|
10505
|
-
}), (
|
|
10506
|
-
})(), a.addEventListener("click", (
|
|
10507
|
-
|
|
10505
|
+
}), (te = _.querySelector("#__crossx-close-btn")) == null || te.addEventListener("click", g);
|
|
10506
|
+
})(), a.addEventListener("click", (R) => {
|
|
10507
|
+
R.target === a && g();
|
|
10508
10508
|
});
|
|
10509
10509
|
});
|
|
10510
10510
|
}
|
|
@@ -10515,11 +10515,11 @@ class oo {
|
|
|
10515
10515
|
*/
|
|
10516
10516
|
showPinInputPrompt(e) {
|
|
10517
10517
|
return new Promise((r, t) => {
|
|
10518
|
-
var
|
|
10518
|
+
var A;
|
|
10519
10519
|
ae();
|
|
10520
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(
|
|
10521
10521
|
this.tokens,
|
|
10522
|
-
|
|
10522
|
+
_t({
|
|
10523
10523
|
title: o,
|
|
10524
10524
|
headerSubtitle: a,
|
|
10525
10525
|
errorMessage: e == null ? void 0 : e.errorMessage,
|
|
@@ -10528,20 +10528,20 @@ class oo {
|
|
|
10528
10528
|
attemptCount: e == null ? void 0 : e.attemptCount,
|
|
10529
10529
|
maxAttempts: e == null ? void 0 : e.maxAttempts
|
|
10530
10530
|
})
|
|
10531
|
-
), u =
|
|
10531
|
+
), u = Oe();
|
|
10532
10532
|
ce(l);
|
|
10533
10533
|
let p = !1;
|
|
10534
10534
|
const g = () => {
|
|
10535
10535
|
p || (p = !0, l.remove(), u());
|
|
10536
|
-
}, _ = (
|
|
10537
|
-
g(), r(
|
|
10536
|
+
}, _ = (R) => {
|
|
10537
|
+
g(), r(R);
|
|
10538
10538
|
}, x = () => {
|
|
10539
10539
|
g(), r(null);
|
|
10540
|
-
},
|
|
10541
|
-
g(), t(
|
|
10542
|
-
},
|
|
10543
|
-
this.applyPinKeyboardMode(
|
|
10544
|
-
|
|
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();
|
|
10545
10545
|
});
|
|
10546
10546
|
});
|
|
10547
10547
|
}
|
|
@@ -10654,7 +10654,7 @@ class oo {
|
|
|
10654
10654
|
ae();
|
|
10655
10655
|
let t;
|
|
10656
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);
|
|
10657
|
-
const n =
|
|
10657
|
+
const n = Oe();
|
|
10658
10658
|
ce(t);
|
|
10659
10659
|
const i = () => {
|
|
10660
10660
|
t.remove(), n();
|
|
@@ -10665,10 +10665,10 @@ class oo {
|
|
|
10665
10665
|
};
|
|
10666
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) => {
|
|
10667
10667
|
g.addEventListener("click", (_) => {
|
|
10668
|
-
var
|
|
10668
|
+
var y;
|
|
10669
10669
|
_.stopPropagation();
|
|
10670
10670
|
const x = g.dataset.copy;
|
|
10671
|
-
x && ((
|
|
10671
|
+
x && ((y = navigator.clipboard) == null || y.writeText(x).catch(() => {
|
|
10672
10672
|
}));
|
|
10673
10673
|
});
|
|
10674
10674
|
}), _i(t), t.addEventListener("click", (g) => {
|
|
@@ -10886,7 +10886,7 @@ Set the projectId field in SDKConfig when calling createCROSSxSDK().
|
|
|
10886
10886
|
Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
10887
10887
|
);
|
|
10888
10888
|
s.debug;
|
|
10889
|
-
const r =
|
|
10889
|
+
const r = Le.production, t = {
|
|
10890
10890
|
...s,
|
|
10891
10891
|
oauthServiceUrl: r.oauthServiceUrl,
|
|
10892
10892
|
authApiUrl: r.authApiUrl,
|
|
@@ -10900,9 +10900,9 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10900
10900
|
"refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
|
|
10901
10901
|
"IndexedDB를 지원하는 브라우저 사용을 권장합니다."
|
|
10902
10902
|
), t.secureStorageAvailable = i;
|
|
10903
|
-
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();
|
|
10904
10904
|
let g;
|
|
10905
|
-
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(
|
|
10906
10906
|
n,
|
|
10907
10907
|
o,
|
|
10908
10908
|
c,
|
|
@@ -10911,31 +10911,31 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10911
10911
|
));
|
|
10912
10912
|
let _ = null;
|
|
10913
10913
|
const x = () => {
|
|
10914
|
-
var
|
|
10915
|
-
return ((
|
|
10914
|
+
var D;
|
|
10915
|
+
return ((D = _ == null ? void 0 : _.isAuthenticatedViaRNBridge) == null ? void 0 : D.call(_)) ?? !1;
|
|
10916
10916
|
};
|
|
10917
10917
|
g = new di(
|
|
10918
10918
|
g,
|
|
10919
10919
|
() => {
|
|
10920
|
-
var
|
|
10921
|
-
return (
|
|
10920
|
+
var D;
|
|
10921
|
+
return (D = _ == null ? void 0 : _.getRNBridge) == null ? void 0 : D.call(_);
|
|
10922
10922
|
},
|
|
10923
10923
|
x
|
|
10924
10924
|
);
|
|
10925
|
-
const
|
|
10925
|
+
const y = new We(n, c), v = new oo(
|
|
10926
10926
|
s.theme ?? "light",
|
|
10927
10927
|
s.themeTokens,
|
|
10928
10928
|
s.displayDecimals,
|
|
10929
10929
|
s.pinKeyboard
|
|
10930
|
-
),
|
|
10931
|
-
|
|
10930
|
+
), A = new ao(
|
|
10931
|
+
v,
|
|
10932
10932
|
() => {
|
|
10933
|
-
var
|
|
10934
|
-
return (
|
|
10933
|
+
var D;
|
|
10934
|
+
return (D = _ == null ? void 0 : _.getRNBridge) == null ? void 0 : D.call(_);
|
|
10935
10935
|
},
|
|
10936
10936
|
() => typeof window < "u" ? window.location.origin : "http://localhost",
|
|
10937
10937
|
x
|
|
10938
|
-
),
|
|
10938
|
+
), R = e != null && e.wrapConfirmation ? e.wrapConfirmation(A) : A, k = new wt(
|
|
10939
10939
|
t,
|
|
10940
10940
|
n,
|
|
10941
10941
|
o,
|
|
@@ -10944,13 +10944,13 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10944
10944
|
l,
|
|
10945
10945
|
g,
|
|
10946
10946
|
u,
|
|
10947
|
-
|
|
10948
|
-
|
|
10947
|
+
R,
|
|
10948
|
+
y,
|
|
10949
10949
|
p
|
|
10950
10950
|
);
|
|
10951
|
-
_ =
|
|
10952
|
-
const L =
|
|
10953
|
-
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;
|
|
10954
10954
|
}
|
|
10955
10955
|
function wo(s) {
|
|
10956
10956
|
const e = lo(s), r = uo(e), t = JSON.parse(r);
|
|
@@ -11013,11 +11013,11 @@ export {
|
|
|
11013
11013
|
cs as CONNECT_OTHER_WALLET_DISPLAY_ORDER,
|
|
11014
11014
|
f as CROSSxError,
|
|
11015
11015
|
ps as CROSSxEthereumProvider,
|
|
11016
|
-
|
|
11016
|
+
wt as CROSSxSDK,
|
|
11017
11017
|
go as ChainId,
|
|
11018
|
-
|
|
11018
|
+
He as ConnectOtherWalletItem,
|
|
11019
11019
|
h as ErrorCode,
|
|
11020
|
-
|
|
11020
|
+
xt as MNEMONIC_ADDRESS_LIMIT,
|
|
11021
11021
|
_r as PinMemoryStore,
|
|
11022
11022
|
co as TokenMemoryStore,
|
|
11023
11023
|
xo as createCROSSxSDK,
|