@nexus-cross/crossx-sdk-core 2.3.10-beta.3 → 2.3.10-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/oauth/BrowserOAuthAdapter.d.ts +10 -0
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/ports/OAuthPort.d.ts +13 -0
- package/dist/crossx.global +6 -6
- package/dist/index.cjs +6 -6
- package/dist/index.js +178 -163
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ class h extends Error {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
const Rt = 2e3, je = 6e4, Ct = 1e3, Pt = 1e4, Nt = "0x77359400", Ye = "0x3B9ACA00", Xe = 130, Fe = 6, Je = 18, Ze = 3e4, Ot = 5 * 60 * 1e3, Lt = 30 * 1e3, Ne = 100, Dt = "crossx-sdk-js/2.3.10-beta.
|
|
19
|
+
const Rt = 2e3, je = 6e4, Ct = 1e3, Pt = 1e4, Nt = "0x77359400", Ye = "0x3B9ACA00", Xe = 130, Fe = 6, Je = 18, Ze = 3e4, Ot = 5 * 60 * 1e3, Lt = 30 * 1e3, Ne = 100, Dt = "crossx-sdk-js/2.3.10-beta.4", Be = "ONEwallet";
|
|
20
20
|
var ge = /* @__PURE__ */ ((i) => (i.MetaMask = "io.metamask", i.Binance = "com.binance.wallet", i.CROSSx = "crossx", i))(ge || {});
|
|
21
21
|
const Mt = {
|
|
22
22
|
"io.metamask": "MetaMask",
|
|
@@ -34,7 +34,7 @@ function Ft(i) {
|
|
|
34
34
|
function Bt(i) {
|
|
35
35
|
return Array.isArray(i.connectOtherWallets) && i.connectOtherWallets.length > 0 ? [...i.connectOtherWallets] : i.showConnectOtherWallets === !0 ? [...$t] : [];
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const ve = {
|
|
38
38
|
// ─── CROSS ────────────────────────────────────────────
|
|
39
39
|
CROSS_MAINNET: {
|
|
40
40
|
caipId: "eip155:612055",
|
|
@@ -84,12 +84,12 @@ const Se = {
|
|
|
84
84
|
testnet: !0
|
|
85
85
|
}
|
|
86
86
|
}, Hs = Object.fromEntries(
|
|
87
|
-
Object.entries(
|
|
87
|
+
Object.entries(ve).map(([i, e]) => [i, e.caipId])
|
|
88
88
|
), Wt = new Map(
|
|
89
|
-
Object.values(
|
|
89
|
+
Object.values(ve).map((i) => [i.caipId, i])
|
|
90
90
|
);
|
|
91
91
|
new Map(
|
|
92
|
-
Object.values(
|
|
92
|
+
Object.values(ve).map((i) => [i.chainId, i])
|
|
93
93
|
);
|
|
94
94
|
const Ut = { symbol: "", decimals: 18 };
|
|
95
95
|
function Ae(i) {
|
|
@@ -469,7 +469,7 @@ function X(i = "en", e) {
|
|
|
469
469
|
function zt(i) {
|
|
470
470
|
return i === "ko" || i === "en" ? i : typeof navigator < "u" && (navigator.language ?? "").toLowerCase().startsWith("ko") ? "ko" : "en";
|
|
471
471
|
}
|
|
472
|
-
const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user_info",
|
|
472
|
+
const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user_info", Se = class Se {
|
|
473
473
|
constructor(e, r, t, s, o, n, a, l, p = () => {
|
|
474
474
|
}) {
|
|
475
475
|
this.config = e, this.storage = r, this.crypto = t, this.oauth = s, this.transport = o, this.walletProvider = n, this.tokenStore = a, this.requestFreshTokenFromBridge = l, this.getLocale = p, this._refreshPromise = null, this._migrated = !1;
|
|
@@ -679,18 +679,18 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
679
679
|
try {
|
|
680
680
|
const E = this.crypto.decodeJWT(e);
|
|
681
681
|
c.log("[CROSSx] Firebase JWT 필드:", Object.keys(E).join(", ")), f = (o = E.firebase) == null ? void 0 : o.sign_in_provider;
|
|
682
|
-
const
|
|
683
|
-
m = E.email ?? ((a =
|
|
682
|
+
const v = ((n = E.firebase) == null ? void 0 : n.identities) ?? {};
|
|
683
|
+
m = E.email ?? ((a = v.email) == null ? void 0 : a[0]), f === "google.com" ? g = (l = v["google.com"]) == null ? void 0 : l[0] : f === "apple.com" && (g = (p = v["apple.com"]) == null ? void 0 : p[0]), c.log("[CROSSx] OAuth provider sub 추출 — provider:", f, "hasProviderSub:", !!g, "email:", m ?? "(없음)");
|
|
684
684
|
} catch {
|
|
685
685
|
c.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
|
|
686
686
|
}
|
|
687
687
|
if (u) {
|
|
688
688
|
const E = this.crypto.decodeJWT(u);
|
|
689
689
|
c.log("[CROSSx] access_token 디코딩 — sub:", E.sub, "exp:", E.exp, "필드:", Object.keys(E).join(", "));
|
|
690
|
-
const
|
|
691
|
-
if (s =
|
|
690
|
+
const v = await this.crypto.verifyJWT(u);
|
|
691
|
+
if (s = v.signatureVerified ?? !1, !v.valid)
|
|
692
692
|
throw c.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
|
|
693
|
-
const A =
|
|
693
|
+
const A = v.payload, T = A.email ?? m ?? r;
|
|
694
694
|
c.log(
|
|
695
695
|
"[CROSSx] email 소스 — CROSSx JWT:",
|
|
696
696
|
A.email ?? "(없음)",
|
|
@@ -699,10 +699,10 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
699
699
|
"/ OAuth 콜백:",
|
|
700
700
|
r ?? "(없음)",
|
|
701
701
|
"→",
|
|
702
|
-
|
|
702
|
+
T ?? "(없음)"
|
|
703
703
|
), t = {
|
|
704
704
|
id: A.sub,
|
|
705
|
-
email:
|
|
705
|
+
email: T,
|
|
706
706
|
signInProvider: f,
|
|
707
707
|
providerSub: g
|
|
708
708
|
}, this.tokenStore.set(u), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, u), x && this.config.secureStorageAvailable !== !1 ? await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, x) : x && c.warn("[CROSSx] 안전한 스토리지 미사용 — refresh_token 영속 저장을 건너뜁니다"));
|
|
@@ -915,7 +915,7 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
915
915
|
c.log("[CROSSx] silentRefresh 응답 — status:", n.status);
|
|
916
916
|
const a = n.data, l = this.extractResponseErrorCode(a);
|
|
917
917
|
if (l) {
|
|
918
|
-
const _ =
|
|
918
|
+
const _ = Se.REFRESH_RELOGIN_CODES.has(l.code);
|
|
919
919
|
throw new h(
|
|
920
920
|
_ ? d.SESSION_EXPIRED : d.AUTH_FAILED,
|
|
921
921
|
`토큰 갱신 실패 (코드 ${l.code}): ${l.message}`
|
|
@@ -1051,8 +1051,8 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
1051
1051
|
return c.log("[CROSSx] loadWallet 결과 — address:", t, "needsMigration:", s), { success: !0, address: t, user: e, needsMigration: s, tokenSignatureVerified: r };
|
|
1052
1052
|
}
|
|
1053
1053
|
};
|
|
1054
|
-
|
|
1055
|
-
let Oe =
|
|
1054
|
+
Se.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
|
|
1055
|
+
let Oe = Se;
|
|
1056
1056
|
class Vt {
|
|
1057
1057
|
constructor(e, r, t) {
|
|
1058
1058
|
this.config = e, this.storage = r, this.tokenStore = t;
|
|
@@ -2547,7 +2547,7 @@ const ne = class ne extends Yt {
|
|
|
2547
2547
|
}
|
|
2548
2548
|
async _doInitialize(e) {
|
|
2549
2549
|
var r, t;
|
|
2550
|
-
c.log("[CROSSx SDK] v2.3.10-beta.
|
|
2550
|
+
c.log("[CROSSx SDK] v2.3.10-beta.4 초기화 중..."), this.confirmation.setMessages(X(this._config.locale));
|
|
2551
2551
|
try {
|
|
2552
2552
|
const s = We();
|
|
2553
2553
|
this.internalConfig.oauthServiceUrl = s.oauthServiceUrl, this.internalConfig.authApiUrl = s.authApiUrl, this.internalConfig.walletGatewayUrl = s.walletGatewayUrl, this.adapterConfig.gatewayUrl = s.walletGatewayUrl, (t = (r = this.crypto).setJWKSEndpoint) == null || t.call(r, `${s.authApiUrl}/.well-known/jwks.json`);
|
|
@@ -2583,7 +2583,7 @@ const ne = class ne extends Yt {
|
|
|
2583
2583
|
throw u;
|
|
2584
2584
|
}
|
|
2585
2585
|
}
|
|
2586
|
-
return this.initialized = !0, c.info("[CROSSx SDK] v2.3.10-beta.
|
|
2586
|
+
return this.initialized = !0, c.info("[CROSSx SDK] v2.3.10-beta.4 초기화 완료"), this.emit("initialized", { restored: !!(l != null && l.success) }), l ?? null;
|
|
2587
2587
|
} catch (s) {
|
|
2588
2588
|
throw new h(d.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", s);
|
|
2589
2589
|
}
|
|
@@ -2603,7 +2603,7 @@ const ne = class ne extends Yt {
|
|
|
2603
2603
|
c.log("[CROSSx] RN Bridge 감지 — Handshake 시도"), c.info("[CROSSx][RNBridge trace] Bootstrap config", {
|
|
2604
2604
|
appId: this._config.projectId,
|
|
2605
2605
|
appVersion: "1.0.0",
|
|
2606
|
-
sdkVersion: "2.3.10-beta.
|
|
2606
|
+
sdkVersion: "2.3.10-beta.4",
|
|
2607
2607
|
keyId: "key-id-1",
|
|
2608
2608
|
userIdHash: "user-hash-placeholder",
|
|
2609
2609
|
projectId: this._config.projectId
|
|
@@ -2611,7 +2611,7 @@ const ne = class ne extends Yt {
|
|
|
2611
2611
|
const e = new j({
|
|
2612
2612
|
appId: this._config.projectId,
|
|
2613
2613
|
appVersion: "1.0.0",
|
|
2614
|
-
sdkVersion: "2.3.10-beta.
|
|
2614
|
+
sdkVersion: "2.3.10-beta.4",
|
|
2615
2615
|
keyId: "key-id-1",
|
|
2616
2616
|
userIdHash: "user-hash-placeholder",
|
|
2617
2617
|
projectId: this._config.projectId
|
|
@@ -2808,29 +2808,31 @@ const ne = class ne extends Yt {
|
|
|
2808
2808
|
* }
|
|
2809
2809
|
*/
|
|
2810
2810
|
async signInWithOAuthToken(e) {
|
|
2811
|
+
var t, s;
|
|
2811
2812
|
if (this.ensureInitialized(), this.authenticated)
|
|
2812
2813
|
throw new h(
|
|
2813
2814
|
d.ALREADY_AUTHENTICATED,
|
|
2814
2815
|
"이미 로그인된 상태입니다. signOut()을 먼저 호출하세요."
|
|
2815
2816
|
);
|
|
2817
|
+
(s = (t = this.oauth).cancelPending) == null || s.call(t, "signInWithOAuthToken으로 외부 인증이 도착했습니다");
|
|
2816
2818
|
let r;
|
|
2817
2819
|
try {
|
|
2818
2820
|
r = await this.signInUseCase.executeWithOAuthToken(e), r.success && (this._isAuthenticatedViaRNBridge = !1, this.applyAuthResult(r));
|
|
2819
|
-
} catch (
|
|
2820
|
-
throw
|
|
2821
|
+
} catch (o) {
|
|
2822
|
+
throw o instanceof h ? o : new h(d.AUTH_FAILED, "OAuth 토큰 로그인에 실패했습니다", o);
|
|
2821
2823
|
}
|
|
2822
2824
|
if (!r.success) return { ...r, addresses: [] };
|
|
2823
2825
|
try {
|
|
2824
2826
|
if (r.needsMigration || !r.address) {
|
|
2825
|
-
const { address:
|
|
2826
|
-
return { ...r, address: (
|
|
2827
|
+
const { address: a } = await this.createWallet(), l = await this.getAddresses(), p = await this.selectWalletIfMultiple(l);
|
|
2828
|
+
return { ...r, address: (p == null ? void 0 : p.address) ?? a, needsMigration: !1, addresses: l };
|
|
2827
2829
|
}
|
|
2828
|
-
const
|
|
2829
|
-
return { ...r, address: (
|
|
2830
|
-
} catch (
|
|
2831
|
-
throw
|
|
2832
|
-
(
|
|
2833
|
-
)),
|
|
2830
|
+
const o = await this.getAddresses(), n = await this.selectWalletIfMultiple(o);
|
|
2831
|
+
return { ...r, address: (n == null ? void 0 : n.address) ?? r.address, addresses: o };
|
|
2832
|
+
} catch (o) {
|
|
2833
|
+
throw o instanceof h && o.code === d.PIN_CANCELLED && (c.log("[CROSSx] signInWithOAuthToken: 비밀번호 설정 취소 — 자동 로그아웃 진행"), await this.signOut().catch(
|
|
2834
|
+
(n) => c.warn("[CROSSx] signInWithOAuthToken: 자동 로그아웃 실패", n)
|
|
2835
|
+
)), o;
|
|
2834
2836
|
}
|
|
2835
2837
|
}
|
|
2836
2838
|
/**
|
|
@@ -3568,14 +3570,14 @@ const ne = class ne extends Yt {
|
|
|
3568
3570
|
let x, g;
|
|
3569
3571
|
const f = this.waitForTxAndGetReceipt(a, e, { intervalMs: l, timeoutMs: p }).then((E) => {
|
|
3570
3572
|
x = E;
|
|
3571
|
-
const
|
|
3573
|
+
const v = BigInt(E.gasUsed) * BigInt(E.effectiveGasPrice), A = r.value ? BigInt(r.value) : 0n, T = me(r.value, _.symbol, _.decimals, this._config.displayDecimals), k = me("0x" + v.toString(16), _.symbol, _.decimals, this._config.displayDecimals), O = me("0x" + (A + v).toString(16), _.symbol, _.decimals, this._config.displayDecimals);
|
|
3572
3574
|
return {
|
|
3573
3575
|
chainId: e,
|
|
3574
3576
|
txHash: a,
|
|
3575
3577
|
from: E.from,
|
|
3576
3578
|
to: E.to ?? r.to,
|
|
3577
|
-
amount:
|
|
3578
|
-
fees:
|
|
3579
|
+
amount: T,
|
|
3580
|
+
fees: k,
|
|
3579
3581
|
total: O,
|
|
3580
3582
|
nativeSymbol: _.symbol,
|
|
3581
3583
|
status: E.status === "0x1" ? "success" : "reverted"
|
|
@@ -4353,7 +4355,7 @@ function ot(i) {
|
|
|
4353
4355
|
for (const r of i) e += r.toString(16).padStart(2, "0");
|
|
4354
4356
|
return BigInt(e);
|
|
4355
4357
|
}
|
|
4356
|
-
const
|
|
4358
|
+
const Sr = 3e4, vr = 1e3;
|
|
4357
4359
|
class Er {
|
|
4358
4360
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4359
4361
|
async request(e) {
|
|
@@ -4365,7 +4367,7 @@ class Er {
|
|
|
4365
4367
|
} catch (s) {
|
|
4366
4368
|
if (t === r) throw s;
|
|
4367
4369
|
}
|
|
4368
|
-
await new Promise((s) => setTimeout(s,
|
|
4370
|
+
await new Promise((s) => setTimeout(s, vr * 2 ** t));
|
|
4369
4371
|
}
|
|
4370
4372
|
throw new Error("Unexpected: retry loop exited without result");
|
|
4371
4373
|
}
|
|
@@ -4373,7 +4375,7 @@ class Er {
|
|
|
4373
4375
|
async _doRequest(e) {
|
|
4374
4376
|
const r = new AbortController(), t = setTimeout(
|
|
4375
4377
|
() => r.abort(),
|
|
4376
|
-
e.timeoutMs ??
|
|
4378
|
+
e.timeoutMs ?? Sr
|
|
4377
4379
|
);
|
|
4378
4380
|
try {
|
|
4379
4381
|
const s = await fetch(e.url, {
|
|
@@ -4409,6 +4411,17 @@ const Ar = /* @__PURE__ */ new Set([
|
|
|
4409
4411
|
"https://dev-one-wallet-oauth.onechain.nexus"
|
|
4410
4412
|
]), Ir = /CROSSx\/[\d.]+/i, kr = "crossx://oauth-callback";
|
|
4411
4413
|
class ie {
|
|
4414
|
+
constructor() {
|
|
4415
|
+
this.abortPending = null;
|
|
4416
|
+
}
|
|
4417
|
+
/**
|
|
4418
|
+
* 외부 경로 인증이 들어와 대화형 OAuth 대기가 무의미해졌을 때 호출한다.
|
|
4419
|
+
* 대기 중인 openAuth를 reject시켜 상위 connect() 흐름을 즉시 종료시킨다.
|
|
4420
|
+
*/
|
|
4421
|
+
cancelPending(e = "외부 경로 인증으로 OAuth 대기를 중단했습니다") {
|
|
4422
|
+
const r = this.abortPending;
|
|
4423
|
+
r && (c.log("[CROSSx] OAuth 대기 중단 —", e), r(e));
|
|
4424
|
+
}
|
|
4412
4425
|
static generateRandom16Hex() {
|
|
4413
4426
|
const e = new Uint8Array(16);
|
|
4414
4427
|
return crypto.getRandomValues(e), Array.from(e, (r) => r.toString(16).padStart(2, "0")).join("");
|
|
@@ -4488,29 +4501,29 @@ class ie {
|
|
|
4488
4501
|
return;
|
|
4489
4502
|
}
|
|
4490
4503
|
const f = setTimeout(() => {
|
|
4491
|
-
c.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"),
|
|
4504
|
+
c.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), k(), t(new Error("Authentication timeout"));
|
|
4492
4505
|
}, 5 * 60 * 1e3), m = 10, y = 30;
|
|
4493
|
-
let E = 0,
|
|
4506
|
+
let E = 0, v = null;
|
|
4494
4507
|
const A = () => {
|
|
4495
|
-
clearInterval(
|
|
4496
|
-
|
|
4508
|
+
clearInterval(T), c.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + y + "초간 대기합니다"), v = setTimeout(() => {
|
|
4509
|
+
k(), t(new Error(
|
|
4497
4510
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
4498
4511
|
));
|
|
4499
4512
|
}, y * 1e3);
|
|
4500
|
-
},
|
|
4513
|
+
}, T = setInterval(() => {
|
|
4501
4514
|
E++;
|
|
4502
4515
|
try {
|
|
4503
4516
|
if (!g.closed) return;
|
|
4504
4517
|
const M = typeof document < "u" && document.hasFocus();
|
|
4505
|
-
E <= m && !M ? A() : (
|
|
4518
|
+
E <= m && !M ? A() : (k(), t(new Error("로그인이 취소되었습니다")));
|
|
4506
4519
|
} catch {
|
|
4507
4520
|
A();
|
|
4508
4521
|
}
|
|
4509
|
-
}, 1e3),
|
|
4510
|
-
clearTimeout(f), clearInterval(
|
|
4522
|
+
}, 1e3), k = () => {
|
|
4523
|
+
this.abortPending = null, clearTimeout(f), clearInterval(T), v && clearTimeout(v), window.removeEventListener("message", O);
|
|
4511
4524
|
}, O = (M) => {
|
|
4512
4525
|
if (!Ar.has(M.origin)) return;
|
|
4513
|
-
|
|
4526
|
+
k();
|
|
4514
4527
|
const G = typeof M.data.status == "string", P = G ? M.data.data ?? {} : M.data;
|
|
4515
4528
|
c.log("[CROSSx] OAuth postMessage 수신 —", {
|
|
4516
4529
|
format: G ? "wrapped" : "flat",
|
|
@@ -4548,7 +4561,9 @@ class ie {
|
|
|
4548
4561
|
"서버 측 nonce 검증이 필요합니다."
|
|
4549
4562
|
), r(pe)) : C ? _e(C) : t(new Error("Token not found in response"));
|
|
4550
4563
|
};
|
|
4551
|
-
|
|
4564
|
+
this.abortPending = (M) => {
|
|
4565
|
+
k(), t(new Error(M));
|
|
4566
|
+
}, window.addEventListener("message", O);
|
|
4552
4567
|
});
|
|
4553
4568
|
}
|
|
4554
4569
|
}
|
|
@@ -4786,9 +4801,9 @@ class oe {
|
|
|
4786
4801
|
d.USER_NOT_FOUND,
|
|
4787
4802
|
oe.getGatewayErrorMessage(g.code, f)
|
|
4788
4803
|
);
|
|
4789
|
-
const y = m === d.AUTH_NOT_AUTHENTICATED ? d.SESSION_EXPIRED : m, E = y === d.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : oe.getGatewayErrorMessage(g.code, f),
|
|
4804
|
+
const y = m === d.AUTH_NOT_AUTHENTICATED ? d.SESSION_EXPIRED : m, E = y === d.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : oe.getGatewayErrorMessage(g.code, f), v = g.data;
|
|
4790
4805
|
let A;
|
|
4791
|
-
throw m === d.PIN_LOCKED ? A = oe.extractLockDetails(
|
|
4806
|
+
throw m === d.PIN_LOCKED ? A = oe.extractLockDetails(v) : m === d.ADDRESS_LIMIT_EXCEEDED ? A = { limit: Ne, raw: v } : A = v ?? void 0, new h(y, E, A);
|
|
4792
4807
|
}
|
|
4793
4808
|
return c.log("[CROSSx] Wallet Gateway API 성공:", { code: g.code, url: n, method: e }), g.data ?? g;
|
|
4794
4809
|
}
|
|
@@ -5375,7 +5390,7 @@ class fe {
|
|
|
5375
5390
|
);
|
|
5376
5391
|
}
|
|
5377
5392
|
static fallbackChains() {
|
|
5378
|
-
return Object.values(
|
|
5393
|
+
return Object.values(ve).map((e) => ({
|
|
5379
5394
|
chainId: e.caipId,
|
|
5380
5395
|
rpcUrl: e.rpcUrl
|
|
5381
5396
|
}));
|
|
@@ -8623,10 +8638,10 @@ function is(i, e, r, t) {
|
|
|
8623
8638
|
<button class="__crossx-approve-btn" id="__crossx-done-btn">${w((t == null ? void 0 : t.tx_complete_done_button) ?? (s ? "All Done" : "Done"))}</button>
|
|
8624
8639
|
`, l.querySelectorAll(".__crossx-copy-btn").forEach((m) => {
|
|
8625
8640
|
m.addEventListener("click", (y) => {
|
|
8626
|
-
var
|
|
8641
|
+
var v;
|
|
8627
8642
|
y.stopPropagation();
|
|
8628
8643
|
const E = m.dataset.copy;
|
|
8629
|
-
E && ((
|
|
8644
|
+
E && ((v = navigator.clipboard) == null || v.writeText(E).catch(() => {
|
|
8630
8645
|
}));
|
|
8631
8646
|
});
|
|
8632
8647
|
});
|
|
@@ -8733,7 +8748,7 @@ function ps(i, e) {
|
|
|
8733
8748
|
const r = e.replace("#", "");
|
|
8734
8749
|
return `${ds}/portrait/evm/${i}.png?size=256&bg=${r}`;
|
|
8735
8750
|
}
|
|
8736
|
-
function
|
|
8751
|
+
function St(i, e, r) {
|
|
8737
8752
|
const t = ps(i, r), o = ls().replace(/"/g, """);
|
|
8738
8753
|
return `<span class="__crossx-wallet-avatar"><img class="__crossx-wallet-avatar-img" src="${t}" alt="" onerror="this.style.display='none';this.nextElementSibling.innerHTML='${o}';this.nextElementSibling.style.display='flex';"><span class="__crossx-wallet-avatar-fallback"></span></span>`;
|
|
8739
8754
|
}
|
|
@@ -8741,7 +8756,7 @@ function _s(i, e, r, t) {
|
|
|
8741
8756
|
const s = r == null ? void 0 : r.toLowerCase(), o = i.map((a) => {
|
|
8742
8757
|
const l = s && a.address.toLowerCase() === s, p = l ? " __crossx-wallet-item--selected" : "", _ = l ? `<span class="__crossx-wallet-selected">${w((t == null ? void 0 : t.wallet_selector_selected) ?? "Selected")}</span><span class="__crossx-wallet-check">${cs}</span>` : "";
|
|
8743
8758
|
return `<button class="__crossx-wallet-item${p}" data-wallet-index="${a.index}" data-wallet-address="${w(a.address)}">
|
|
8744
|
-
${
|
|
8759
|
+
${St(a.address, a.index, e.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${w(bt(a))}</span><span class="__crossx-wallet-addr">${ht(a.address)}</span></span>${_}
|
|
8745
8760
|
</button>`;
|
|
8746
8761
|
}).join(""), n = document.createElement("div");
|
|
8747
8762
|
return n.id = F, n.className = "__crossx-overlay--wallet-selector", n.innerHTML = `
|
|
@@ -8957,12 +8972,12 @@ function bs(i, e) {
|
|
|
8957
8972
|
</div>
|
|
8958
8973
|
`, u;
|
|
8959
8974
|
}
|
|
8960
|
-
function
|
|
8975
|
+
function Ss(i) {
|
|
8961
8976
|
const e = new Date(i), r = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], t = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], s = r[e.getDay()], o = t[e.getMonth()], n = e.getDate(), a = String(e.getHours()).padStart(2, "0"), l = String(e.getMinutes()).padStart(2, "0");
|
|
8962
8977
|
return `${s}, ${o} ${n} ${a}:${l}`;
|
|
8963
8978
|
}
|
|
8964
|
-
function
|
|
8965
|
-
const t = i, s = e <= 0, o = s ? null : Date.now() + e * 1e3, n = o ?
|
|
8979
|
+
function vs(i, e, r) {
|
|
8980
|
+
const t = i, s = e <= 0, o = s ? null : Date.now() + e * 1e3, n = o ? Ss(o) : null, a = document.createElement("div");
|
|
8966
8981
|
return a.id = F, a.innerHTML = `
|
|
8967
8982
|
<div class="__crossx-card __crossx-card--migration" style="${H(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8968
8983
|
<div class="__crossx-header">
|
|
@@ -9033,7 +9048,7 @@ function Es(i) {
|
|
|
9033
9048
|
}
|
|
9034
9049
|
function Ce(i) {
|
|
9035
9050
|
const e = !!i.lockExpiresAt && i.lockExpiresAt > Date.now(), r = i.lockExpiresAt ? ` data-lock-expires="${i.lockExpiresAt}"` : "", t = i.headerSubtitle ? `<p class="__crossx-pin6-header-sub">${w(i.headerSubtitle)}</p>` : "", s = i.subtitle ? `<p class="__crossx-pin6-subtitle">${w(i.subtitle)}</p>` : "", o = i.errorMessage ? `<p class="__crossx-pin6-error" id="__crossx-pin6-error">${w(i.errorMessage)}</p>` : '<p class="__crossx-pin6-error" id="__crossx-pin6-error"></p>', n = e ? `<p class="__crossx-pin6-lock-msg" id="__crossx-pin6-lock-msg">
|
|
9036
|
-
${
|
|
9051
|
+
${vt}
|
|
9037
9052
|
<span id="__crossx-pin6-lock-countdown"></span>
|
|
9038
9053
|
</p>` : "", a = i.warningMessage && i.attemptCount != null && i.attemptCount > 0 ? `<p class="__crossx-pin6-warning" id="__crossx-pin6-warning">${w(i.warningMessage)}</p>` : '<p class="__crossx-pin6-warning" id="__crossx-pin6-warning"></p>', l = i.attemptCount != null && i.attemptCount > 0 ? `<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt">${i.attemptCount}/${i.maxAttempts ?? "?"}</p>` : '<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt"></p>', p = e ? " --locked" : "", _ = Array.from(
|
|
9039
9054
|
{ length: 6 },
|
|
@@ -9110,42 +9125,42 @@ function Is(i) {
|
|
|
9110
9125
|
function Pe(i, e, r, t, s, o, n) {
|
|
9111
9126
|
var ze, Ve;
|
|
9112
9127
|
let a = !!(o && o > Date.now()), l = !1;
|
|
9113
|
-
const p = () => Array.from(i.querySelectorAll(".__crossx-pin6-box")), _ = () => i.querySelector("#__crossx-pin6-boxes"), u = () => i.querySelector("#__crossx-pin6-error"), x = () => i.querySelector("#__crossx-pin6-lock-msg"), g = () => i.querySelector("#__crossx-pin6-lock-countdown"), f = () => i.querySelector(".__crossx-pin6-body"), m = "●", y = (b,
|
|
9114
|
-
b.dataset.digit =
|
|
9128
|
+
const p = () => Array.from(i.querySelectorAll(".__crossx-pin6-box")), _ = () => i.querySelector("#__crossx-pin6-boxes"), u = () => i.querySelector("#__crossx-pin6-error"), x = () => i.querySelector("#__crossx-pin6-lock-msg"), g = () => i.querySelector("#__crossx-pin6-lock-countdown"), f = () => i.querySelector(".__crossx-pin6-body"), m = "●", y = (b, S) => {
|
|
9129
|
+
b.dataset.digit = S, b.value = m;
|
|
9115
9130
|
}, E = (b) => {
|
|
9116
9131
|
delete b.dataset.digit, b.value = "";
|
|
9117
|
-
},
|
|
9132
|
+
}, v = (b) => b.dataset.digit ?? "", A = () => p().map(v).join(""), T = () => Array.from(i.querySelectorAll(".__crossx-pin6-dot")), k = () => {
|
|
9118
9133
|
var I;
|
|
9119
|
-
const b = p(),
|
|
9120
|
-
if (
|
|
9121
|
-
const $ = !!(b[N] &&
|
|
9134
|
+
const b = p(), S = T();
|
|
9135
|
+
if (S.length && (S.forEach((R, N) => {
|
|
9136
|
+
const $ = !!(b[N] && v(b[N]));
|
|
9122
9137
|
R.classList.toggle("--filled", $), R.classList.toggle("--active", !1);
|
|
9123
9138
|
}), !a && !l)) {
|
|
9124
|
-
const R = b.findIndex(($) => !
|
|
9125
|
-
(I =
|
|
9139
|
+
const R = b.findIndex(($) => !v($));
|
|
9140
|
+
(I = S[R === -1 ? 5 : R]) == null || I.classList.add("--active");
|
|
9126
9141
|
}
|
|
9127
9142
|
}, O = () => {
|
|
9128
|
-
i.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((
|
|
9143
|
+
i.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((S) => S.classList.toggle("--disabled", a)), T().forEach((S) => S.classList.toggle("--locked", a)), k();
|
|
9129
9144
|
}, M = (b) => {
|
|
9130
|
-
a = b, p().forEach((
|
|
9131
|
-
|
|
9145
|
+
a = b, p().forEach((S) => {
|
|
9146
|
+
S.disabled = b, S.classList.toggle("--locked", b);
|
|
9132
9147
|
});
|
|
9133
9148
|
}, G = () => i.querySelector("#__crossx-pin6-attempt"), P = () => {
|
|
9134
9149
|
const b = u();
|
|
9135
9150
|
b && (b.textContent = "");
|
|
9136
9151
|
}, ee = () => n ?? "Your account will be locked after further failures.", C = () => i.querySelector("#__crossx-pin6-warning"), L = (b) => {
|
|
9137
9152
|
var I;
|
|
9138
|
-
let
|
|
9139
|
-
if (!
|
|
9140
|
-
|
|
9153
|
+
let S = C();
|
|
9154
|
+
if (!S) {
|
|
9155
|
+
S = document.createElement("p"), S.className = "__crossx-pin6-warning", S.id = "__crossx-pin6-warning";
|
|
9141
9156
|
const R = u();
|
|
9142
|
-
R ? R.insertAdjacentElement("afterend",
|
|
9157
|
+
R ? R.insertAdjacentElement("afterend", S) : (I = f()) == null || I.appendChild(S);
|
|
9143
9158
|
}
|
|
9144
|
-
|
|
9159
|
+
S.textContent = b;
|
|
9145
9160
|
}, U = () => {
|
|
9146
9161
|
const b = C();
|
|
9147
9162
|
b && (b.textContent = "");
|
|
9148
|
-
}, ae = (b,
|
|
9163
|
+
}, ae = (b, S) => {
|
|
9149
9164
|
var R;
|
|
9150
9165
|
let I = G();
|
|
9151
9166
|
if (!I) {
|
|
@@ -9153,32 +9168,32 @@ function Pe(i, e, r, t, s, o, n) {
|
|
|
9153
9168
|
const N = C() ?? u();
|
|
9154
9169
|
N ? N.insertAdjacentElement("afterend", I) : (R = f()) == null || R.appendChild(I);
|
|
9155
9170
|
}
|
|
9156
|
-
I.textContent = `${b}/${
|
|
9171
|
+
I.textContent = `${b}/${S}`;
|
|
9157
9172
|
}, pe = () => {
|
|
9158
9173
|
const b = G();
|
|
9159
9174
|
b && (b.textContent = "");
|
|
9160
9175
|
}, _e = (b) => {
|
|
9161
|
-
const
|
|
9162
|
-
|
|
9176
|
+
const S = u();
|
|
9177
|
+
S && (S.textContent = b);
|
|
9163
9178
|
const I = _();
|
|
9164
9179
|
I == null || I.classList.add("--shake"), setTimeout(() => I == null ? void 0 : I.classList.remove("--shake"), 500), p().forEach(E), setTimeout(() => {
|
|
9165
9180
|
var R;
|
|
9166
|
-
(R = p()[0]) == null || R.focus(),
|
|
9181
|
+
(R = p()[0]) == null || R.focus(), k();
|
|
9167
9182
|
}, 50);
|
|
9168
9183
|
}, he = (b) => {
|
|
9169
9184
|
var $;
|
|
9170
9185
|
M(!0), p().forEach(E), O();
|
|
9171
|
-
const
|
|
9172
|
-
if (
|
|
9186
|
+
const S = u();
|
|
9187
|
+
if (S && (S.textContent = "Too many failed attempts. Please wait."), !x()) {
|
|
9173
9188
|
const B = document.createElement("p");
|
|
9174
|
-
B.className = "__crossx-pin6-lock-msg", B.id = "__crossx-pin6-lock-msg", B.innerHTML = `${
|
|
9189
|
+
B.className = "__crossx-pin6-lock-msg", B.id = "__crossx-pin6-lock-msg", B.innerHTML = `${vt}<span id="__crossx-pin6-lock-countdown"></span>`;
|
|
9175
9190
|
const V = u();
|
|
9176
9191
|
V ? V.insertAdjacentElement("afterend", B) : ($ = f()) == null || $.appendChild(B);
|
|
9177
9192
|
}
|
|
9178
9193
|
const I = () => {
|
|
9179
9194
|
var Q;
|
|
9180
9195
|
const B = b - Date.now(), V = g();
|
|
9181
|
-
B <= 0 ? (clearInterval(R), M(!1), (Q = x()) == null || Q.remove(),
|
|
9196
|
+
B <= 0 ? (clearInterval(R), M(!1), (Q = x()) == null || Q.remove(), S && (S.textContent = ""), O(), setTimeout(() => {
|
|
9182
9197
|
var we;
|
|
9183
9198
|
return (we = p()[0]) == null ? void 0 : we.focus();
|
|
9184
9199
|
}, 50)) : V && (V.textContent = ` ${Is(B)}`);
|
|
@@ -9192,21 +9207,21 @@ function Pe(i, e, r, t, s, o, n) {
|
|
|
9192
9207
|
if (a || l) return;
|
|
9193
9208
|
const b = A();
|
|
9194
9209
|
if (b.length === 6) {
|
|
9195
|
-
l = !0, p().forEach((
|
|
9196
|
-
|
|
9210
|
+
l = !0, p().forEach((S) => {
|
|
9211
|
+
S.disabled = !0;
|
|
9197
9212
|
});
|
|
9198
9213
|
try {
|
|
9199
9214
|
if (s) {
|
|
9200
|
-
const
|
|
9201
|
-
|
|
9215
|
+
const S = await s(b);
|
|
9216
|
+
S.ok ? e(b) : S.lockExpiresAt ? (pe(), he(S.lockExpiresAt)) : (_e(S.error ?? "Incorrect PIN. Please try again."), S.attemptCount != null && S.maxAttempts != null ? (L(ee()), ae(S.attemptCount, S.maxAttempts)) : (U(), pe()));
|
|
9202
9217
|
} else
|
|
9203
9218
|
e(b);
|
|
9204
|
-
} catch (
|
|
9205
|
-
t && t(
|
|
9219
|
+
} catch (S) {
|
|
9220
|
+
t && t(S);
|
|
9206
9221
|
} finally {
|
|
9207
|
-
l = !1, a || p().forEach((
|
|
9208
|
-
|
|
9209
|
-
}),
|
|
9222
|
+
l = !1, a || p().forEach((S) => {
|
|
9223
|
+
S.disabled = !1;
|
|
9224
|
+
}), k();
|
|
9210
9225
|
}
|
|
9211
9226
|
}
|
|
9212
9227
|
};
|
|
@@ -9216,30 +9231,30 @@ function Pe(i, e, r, t, s, o, n) {
|
|
|
9216
9231
|
}, 100);
|
|
9217
9232
|
const Ke = () => {
|
|
9218
9233
|
if (a || l) return;
|
|
9219
|
-
const b = p(),
|
|
9220
|
-
|
|
9234
|
+
const b = p(), S = b.find((I) => !v(I)) ?? b[b.length - 1];
|
|
9235
|
+
S == null || S.focus();
|
|
9221
9236
|
};
|
|
9222
9237
|
(ze = _()) == null || ze.addEventListener("click", (b) => {
|
|
9223
9238
|
b.target.classList.contains("__crossx-pin6-box") || Ke();
|
|
9224
9239
|
}), (Ve = f()) == null || Ve.addEventListener("click", (b) => {
|
|
9225
|
-
const
|
|
9226
|
-
|
|
9227
|
-
}), p().forEach((b,
|
|
9240
|
+
const S = b.target;
|
|
9241
|
+
S.classList.contains("__crossx-pin6-box") || S.closest("button") || Ke();
|
|
9242
|
+
}), p().forEach((b, S) => {
|
|
9228
9243
|
b.addEventListener("input", () => {
|
|
9229
9244
|
var R;
|
|
9230
9245
|
const I = b.value.replace(/\D/g, "").slice(-1);
|
|
9231
|
-
I ? y(b, I) : E(b), P(), I &&
|
|
9246
|
+
I ? y(b, I) : E(b), P(), I && S < 5 && ((R = p()[S + 1]) == null || R.focus()), k(), A().length === 6 && setTimeout(te, 80);
|
|
9232
9247
|
}), b.addEventListener("keydown", (I) => {
|
|
9233
9248
|
var R, N;
|
|
9234
9249
|
if (I.key === "Backspace") {
|
|
9235
|
-
if (I.preventDefault(),
|
|
9250
|
+
if (I.preventDefault(), v(b))
|
|
9236
9251
|
E(b);
|
|
9237
|
-
else if (
|
|
9238
|
-
const $ = p()[
|
|
9252
|
+
else if (S > 0) {
|
|
9253
|
+
const $ = p()[S - 1];
|
|
9239
9254
|
E($), $.focus();
|
|
9240
9255
|
}
|
|
9241
|
-
|
|
9242
|
-
} else I.key === "ArrowLeft" &&
|
|
9256
|
+
k();
|
|
9257
|
+
} else I.key === "ArrowLeft" && S > 0 ? (I.preventDefault(), (R = p()[S - 1]) == null || R.focus()) : I.key === "ArrowRight" && S < 5 ? (I.preventDefault(), (N = p()[S + 1]) == null || N.focus()) : I.key === "Escape" && r();
|
|
9243
9258
|
}), b.addEventListener("paste", (I) => {
|
|
9244
9259
|
var $, B;
|
|
9245
9260
|
I.preventDefault();
|
|
@@ -9248,45 +9263,45 @@ function Pe(i, e, r, t, s, o, n) {
|
|
|
9248
9263
|
const N = p();
|
|
9249
9264
|
R.split("").forEach((V, Q) => {
|
|
9250
9265
|
N[Q] && y(N[Q], V);
|
|
9251
|
-
}), (B = N[Math.min(R.length - 1, 5)]) == null || B.focus(), P(),
|
|
9266
|
+
}), (B = N[Math.min(R.length - 1, 5)]) == null || B.focus(), P(), k(), A().length === 6 && setTimeout(te, 80);
|
|
9252
9267
|
}), b.addEventListener("focus", () => b.select());
|
|
9253
9268
|
});
|
|
9254
9269
|
const ue = i.querySelector("#__crossx-pin6-numpad");
|
|
9255
9270
|
if (ue) {
|
|
9256
9271
|
let b = null;
|
|
9257
|
-
const
|
|
9272
|
+
const S = () => {
|
|
9258
9273
|
b && (b.classList.remove("--pressed"), b = null);
|
|
9259
9274
|
};
|
|
9260
9275
|
ue.addEventListener("pointerdown", (R) => {
|
|
9261
9276
|
const N = R.target.closest(".__crossx-pin6-numpad-key");
|
|
9262
|
-
!N || a || l || (
|
|
9277
|
+
!N || a || l || (S(), b = N, N.classList.add("--pressed"), N.setPointerCapture(R.pointerId));
|
|
9263
9278
|
});
|
|
9264
9279
|
const I = (R) => {
|
|
9265
9280
|
const N = R.dataset.key;
|
|
9266
9281
|
if (!N) return;
|
|
9267
9282
|
if (N === "backspace") {
|
|
9268
|
-
const Q = [...p()].reverse().find((we) =>
|
|
9269
|
-
Q && (E(Q), P()),
|
|
9283
|
+
const Q = [...p()].reverse().find((we) => v(we));
|
|
9284
|
+
Q && (E(Q), P()), k();
|
|
9270
9285
|
return;
|
|
9271
9286
|
}
|
|
9272
9287
|
if (!/^\d$/.test(N)) return;
|
|
9273
|
-
const B = p().find((V) => !
|
|
9274
|
-
B && (y(B, N), P(),
|
|
9288
|
+
const B = p().find((V) => !v(V));
|
|
9289
|
+
B && (y(B, N), P(), k(), A().length === 6 && setTimeout(te, 80));
|
|
9275
9290
|
};
|
|
9276
9291
|
ue.addEventListener("pointerup", (R) => {
|
|
9277
9292
|
if (!b) return;
|
|
9278
9293
|
const N = b;
|
|
9279
|
-
|
|
9294
|
+
S();
|
|
9280
9295
|
const $ = N.getBoundingClientRect();
|
|
9281
9296
|
R.clientX >= $.left && R.clientX <= $.right && R.clientY >= $.top && R.clientY <= $.bottom && !a && !l && I(N);
|
|
9282
|
-
}), ue.addEventListener("pointercancel",
|
|
9297
|
+
}), ue.addEventListener("pointercancel", S), ue.addEventListener("pointerleave", S, !0), k(), o && o > Date.now() && O();
|
|
9283
9298
|
}
|
|
9284
9299
|
}
|
|
9285
9300
|
const ks = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9286
9301
|
<path d="M7.36 0.5H19.5C20.6046 0.5 21.5 1.39543 21.5 2.5V14.5C21.5 15.6046 20.6046 16.5 19.5 16.5H7.36C6.76 16.5 6.19 16.24 5.8 15.79L0.94 10.02C0.35 9.32 0.35 8.3 0.94 7.6L5.8 1.71C6.19 1.26 6.76 0.5 7.36 0.5Z" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
|
9287
9302
|
<line x1="10" y1="5.5" x2="16" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9288
9303
|
<line x1="16" y1="5.5" x2="10" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9289
|
-
</svg>`,
|
|
9304
|
+
</svg>`, vt = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9290
9305
|
<path d="M14.5 8.5H14V6.5C14 4.015 11.985 2 9.5 2C7.015 2 5 4.015 5 6.5V8.5H4.5C3.672 8.5 3 9.172 3 10V16.5C3 17.328 3.672 18 4.5 18H14.5C15.328 18 16 17.328 16 16.5V10C16 9.172 15.328 8.5 14.5 8.5ZM10.5 13.415V15C10.5 15.276 10.276 15.5 10 15.5H9C8.724 15.5 8.5 15.276 8.5 15V13.415C8.187 13.196 8 12.847 8 12.5C8 11.672 8.672 11 9.5 11C10.328 11 11 11.672 11 12.5C11 12.847 10.813 13.196 10.5 13.415ZM12.5 8.5H6.5V6.5C6.5 4.843 7.843 3.5 9.5 3.5C11.157 3.5 12.5 4.843 12.5 6.5V8.5Z" fill="currentColor"/>
|
|
9291
9306
|
</svg>`, Ts = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9292
9307
|
<path d="M1 4.5L4 7.5L10 1" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -9369,7 +9384,7 @@ class Ps {
|
|
|
9369
9384
|
*/
|
|
9370
9385
|
showWalletSelector(e, r, t) {
|
|
9371
9386
|
return new Promise((s, o) => {
|
|
9372
|
-
var
|
|
9387
|
+
var v;
|
|
9373
9388
|
K();
|
|
9374
9389
|
const n = [...e], a = _s(n, this.tokens, t, this.messages), l = se();
|
|
9375
9390
|
z(a);
|
|
@@ -9386,8 +9401,8 @@ class Ps {
|
|
|
9386
9401
|
(() => {
|
|
9387
9402
|
a.querySelectorAll(".__crossx-wallet-item").forEach((A) => {
|
|
9388
9403
|
A.addEventListener("click", () => {
|
|
9389
|
-
const
|
|
9390
|
-
x({ address:
|
|
9404
|
+
const T = A.dataset.walletAddress ?? "", k = parseInt(A.dataset.walletIndex ?? "0", 10), O = n.find((M) => M.index === k);
|
|
9405
|
+
x({ address: T, index: k, name: O == null ? void 0 : O.name });
|
|
9391
9406
|
});
|
|
9392
9407
|
});
|
|
9393
9408
|
})();
|
|
@@ -9397,21 +9412,21 @@ class Ps {
|
|
|
9397
9412
|
try {
|
|
9398
9413
|
const A = await r();
|
|
9399
9414
|
n.push(A);
|
|
9400
|
-
const
|
|
9401
|
-
if (
|
|
9402
|
-
const
|
|
9403
|
-
|
|
9415
|
+
const T = a.querySelector("#__crossx-wallet-list");
|
|
9416
|
+
if (T) {
|
|
9417
|
+
const k = document.createElement("button");
|
|
9418
|
+
k.className = "__crossx-wallet-item", k.dataset.walletIndex = String(A.index), k.dataset.walletAddress = A.address, k.innerHTML = `${St(A.address, A.index, this.tokens.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${w(bt(A))}</span><span class="__crossx-wallet-addr">${ht(A.address)}</span></span>`, k.addEventListener("click", () => x(A)), T.appendChild(k);
|
|
9404
9419
|
try {
|
|
9405
|
-
|
|
9420
|
+
k.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
9406
9421
|
} catch {
|
|
9407
9422
|
}
|
|
9408
9423
|
}
|
|
9409
9424
|
y.disabled = !1;
|
|
9410
9425
|
} catch (A) {
|
|
9411
|
-
const
|
|
9412
|
-
m && (m.textContent =
|
|
9426
|
+
const T = A instanceof h && A.code === d.ADDRESS_LIMIT_EXCEEDED, k = this.resolveAddWalletErrorMessage(A);
|
|
9427
|
+
m && (m.textContent = k, m.hidden = !1), T ? (y.disabled = !0, y.setAttribute("aria-disabled", "true")) : y.disabled = !1, u = A;
|
|
9413
9428
|
}
|
|
9414
|
-
}), (
|
|
9429
|
+
}), (v = a.querySelector("#__crossx-close-btn")) == null || v.addEventListener("click", g), a.addEventListener("click", (A) => {
|
|
9415
9430
|
A.target === a && g();
|
|
9416
9431
|
});
|
|
9417
9432
|
const E = (A) => {
|
|
@@ -9477,8 +9492,8 @@ class Ps {
|
|
|
9477
9492
|
a(), s(null);
|
|
9478
9493
|
};
|
|
9479
9494
|
(x = o.querySelector("#__crossx-apple-btn")) == null || x.addEventListener("click", () => l("apple")), (g = o.querySelector("#__crossx-google-btn")) == null || g.addEventListener("click", () => l("google")), (f = o.querySelector("#__crossx-connect-other-wallet-btn")) == null || f.addEventListener("click", (y) => {
|
|
9480
|
-
const
|
|
9481
|
-
|
|
9495
|
+
const v = y.currentTarget.dataset.walletId ?? "";
|
|
9496
|
+
v && p(v);
|
|
9482
9497
|
}), (m = o.querySelector("#__crossx-close-btn")) == null || m.addEventListener("click", _), o.addEventListener("click", (y) => {
|
|
9483
9498
|
y.target === o && _();
|
|
9484
9499
|
}), o.querySelectorAll(".__crossx-login-terms-link").forEach((y) => {
|
|
@@ -9576,8 +9591,8 @@ class Ps {
|
|
|
9576
9591
|
let p = !1;
|
|
9577
9592
|
const _ = () => {
|
|
9578
9593
|
p || (p = !0, a.remove(), l());
|
|
9579
|
-
}, u = (
|
|
9580
|
-
_(), r(
|
|
9594
|
+
}, u = (v) => {
|
|
9595
|
+
_(), r(v);
|
|
9581
9596
|
}, x = () => {
|
|
9582
9597
|
_(), r(null);
|
|
9583
9598
|
}, g = a.querySelector(".__crossx-card"), f = {
|
|
@@ -9586,58 +9601,58 @@ class Ps {
|
|
|
9586
9601
|
repeatingDigit: (t == null ? void 0 : t.pin_validation_repeating_digit) ?? "Cannot use the same number 3+ times in a row.",
|
|
9587
9602
|
sequential: (t == null ? void 0 : t.pin_validation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
|
|
9588
9603
|
alternatingPattern: (t == null ? void 0 : t.pin_validation_alternating_pattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
9589
|
-
}, m = (
|
|
9604
|
+
}, m = (v) => {
|
|
9590
9605
|
var A;
|
|
9591
9606
|
g.innerHTML = Ce({
|
|
9592
9607
|
title: n.title,
|
|
9593
9608
|
headerSubtitle: n.headerSubtitle,
|
|
9594
9609
|
subtitle: n.subtitle
|
|
9595
|
-
}), this.applyPinKeyboardMode(g), (A = g.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x), Pe(g, (
|
|
9596
|
-
|
|
9610
|
+
}), this.applyPinKeyboardMode(g), (A = g.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x), Pe(g, (T) => {
|
|
9611
|
+
T === v ? u(v) : y(o.mismatchError);
|
|
9597
9612
|
}, x);
|
|
9598
|
-
}, y = (
|
|
9613
|
+
}, y = (v) => {
|
|
9599
9614
|
var A;
|
|
9600
9615
|
g.innerHTML = Ce({
|
|
9601
9616
|
title: o.title,
|
|
9602
9617
|
headerSubtitle: o.headerSubtitle,
|
|
9603
9618
|
subtitle: o.subtitle,
|
|
9604
|
-
errorMessage:
|
|
9605
|
-
}), this.applyPinKeyboardMode(g), (A = g.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x), Pe(g, (
|
|
9606
|
-
const
|
|
9607
|
-
|
|
9619
|
+
errorMessage: v
|
|
9620
|
+
}), this.applyPinKeyboardMode(g), (A = g.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x), Pe(g, (T) => {
|
|
9621
|
+
const k = As(T, f);
|
|
9622
|
+
k ? y(k) : m(T);
|
|
9608
9623
|
}, x);
|
|
9609
9624
|
};
|
|
9610
9625
|
(() => {
|
|
9611
9626
|
var ee;
|
|
9612
|
-
const
|
|
9627
|
+
const v = Array.from(g.querySelectorAll(".__crossx-pw-notice-item")), A = g.querySelector("#__crossx-pin-notice-next"), T = /* @__PURE__ */ new Set();
|
|
9613
9628
|
A.removeAttribute("disabled");
|
|
9614
|
-
const
|
|
9615
|
-
const C =
|
|
9616
|
-
A.classList.toggle("--disabled", !C), A.textContent = O ||
|
|
9629
|
+
const k = A.dataset.nextLabel ?? "Next", O = A.dataset.submitLabel ?? "I Understand", M = () => {
|
|
9630
|
+
const C = T.size === v.length;
|
|
9631
|
+
A.classList.toggle("--disabled", !C), A.textContent = O || k;
|
|
9617
9632
|
}, G = (C, L) => {
|
|
9618
|
-
if (
|
|
9633
|
+
if (T.has(L)) return;
|
|
9619
9634
|
const U = C.querySelector(`#__crossx-notice-check-${L}`);
|
|
9620
|
-
|
|
9635
|
+
T.add(L), U.classList.add("--checked"), C.setAttribute("aria-checked", "true"), M();
|
|
9621
9636
|
}, P = (C, L) => {
|
|
9622
|
-
if (!
|
|
9637
|
+
if (!T.has(L)) return;
|
|
9623
9638
|
const U = C.querySelector(`#__crossx-notice-check-${L}`);
|
|
9624
|
-
|
|
9639
|
+
T.delete(L), U.classList.remove("--checked"), C.setAttribute("aria-checked", "false"), M();
|
|
9625
9640
|
};
|
|
9626
|
-
|
|
9641
|
+
v.forEach((C) => {
|
|
9627
9642
|
const L = parseInt(C.dataset.checkIndex ?? "0", 10);
|
|
9628
9643
|
C.addEventListener("click", () => {
|
|
9629
|
-
|
|
9644
|
+
T.has(L) ? P(C, L) : G(C, L);
|
|
9630
9645
|
}), C.addEventListener("keydown", (U) => {
|
|
9631
|
-
(U.key === " " || U.key === "Enter") && (U.preventDefault(),
|
|
9646
|
+
(U.key === " " || U.key === "Enter") && (U.preventDefault(), T.has(L) ? P(C, L) : G(C, L));
|
|
9632
9647
|
});
|
|
9633
9648
|
}), A.addEventListener("click", () => {
|
|
9634
|
-
if (
|
|
9649
|
+
if (T.size === v.length) {
|
|
9635
9650
|
y(e == null ? void 0 : e.errorMessage);
|
|
9636
9651
|
return;
|
|
9637
9652
|
}
|
|
9638
|
-
const C =
|
|
9653
|
+
const C = v.find((U) => {
|
|
9639
9654
|
const ae = parseInt(U.dataset.checkIndex ?? "0", 10);
|
|
9640
|
-
return !
|
|
9655
|
+
return !T.has(ae);
|
|
9641
9656
|
});
|
|
9642
9657
|
if (!C) return;
|
|
9643
9658
|
const L = parseInt(C.dataset.checkIndex ?? "0", 10);
|
|
@@ -9645,8 +9660,8 @@ class Ps {
|
|
|
9645
9660
|
C.classList.remove("--highlight"), G(C, L);
|
|
9646
9661
|
}, 400);
|
|
9647
9662
|
}), (ee = g.querySelector("#__crossx-close-btn")) == null || ee.addEventListener("click", x);
|
|
9648
|
-
})(), a.addEventListener("click", (
|
|
9649
|
-
|
|
9663
|
+
})(), a.addEventListener("click", (v) => {
|
|
9664
|
+
v.target === a && x();
|
|
9650
9665
|
});
|
|
9651
9666
|
});
|
|
9652
9667
|
}
|
|
@@ -9675,15 +9690,15 @@ class Ps {
|
|
|
9675
9690
|
let u = !1;
|
|
9676
9691
|
const x = () => {
|
|
9677
9692
|
u || (u = !0, p.remove(), _());
|
|
9678
|
-
}, g = (
|
|
9679
|
-
x(), r(
|
|
9693
|
+
}, g = (v) => {
|
|
9694
|
+
x(), r(v);
|
|
9680
9695
|
}, f = () => {
|
|
9681
9696
|
x(), r(null);
|
|
9682
|
-
}, m = (
|
|
9683
|
-
x(), t(
|
|
9697
|
+
}, m = (v) => {
|
|
9698
|
+
x(), t(v);
|
|
9684
9699
|
}, y = p.querySelector(".__crossx-card");
|
|
9685
|
-
this.applyPinKeyboardMode(y), (E = y.querySelector("#__crossx-close-btn")) == null || E.addEventListener("click", f), Pe(y, g, f, m, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, l), p.addEventListener("click", (
|
|
9686
|
-
|
|
9700
|
+
this.applyPinKeyboardMode(y), (E = y.querySelector("#__crossx-close-btn")) == null || E.addEventListener("click", f), Pe(y, g, f, m, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, l), p.addEventListener("click", (v) => {
|
|
9701
|
+
v.target === p && f();
|
|
9687
9702
|
});
|
|
9688
9703
|
});
|
|
9689
9704
|
}
|
|
@@ -9720,7 +9735,7 @@ class Ps {
|
|
|
9720
9735
|
return new Promise((t) => {
|
|
9721
9736
|
var p;
|
|
9722
9737
|
K();
|
|
9723
|
-
const { overlay: s, startCountdown: o } =
|
|
9738
|
+
const { overlay: s, startCountdown: o } = vs(this.tokens, e, r);
|
|
9724
9739
|
z(s);
|
|
9725
9740
|
const n = () => {
|
|
9726
9741
|
l(), s.remove();
|
|
@@ -10079,7 +10094,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10079
10094
|
i.themeTokens,
|
|
10080
10095
|
i.displayDecimals,
|
|
10081
10096
|
i.pinKeyboard
|
|
10082
|
-
),
|
|
10097
|
+
), v = new Ns(
|
|
10083
10098
|
E,
|
|
10084
10099
|
() => {
|
|
10085
10100
|
var O;
|
|
@@ -10087,7 +10102,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10087
10102
|
},
|
|
10088
10103
|
() => typeof window < "u" ? window.location.origin : "http://localhost",
|
|
10089
10104
|
f
|
|
10090
|
-
), A = e != null && e.wrapConfirmation ? e.wrapConfirmation(
|
|
10105
|
+
), A = e != null && e.wrapConfirmation ? e.wrapConfirmation(v) : v, T = new Le(
|
|
10091
10106
|
t,
|
|
10092
10107
|
s,
|
|
10093
10108
|
n,
|
|
@@ -10100,9 +10115,9 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10100
10115
|
y,
|
|
10101
10116
|
u
|
|
10102
10117
|
);
|
|
10103
|
-
g =
|
|
10104
|
-
const
|
|
10105
|
-
return
|
|
10118
|
+
g = T;
|
|
10119
|
+
const k = T.signInUseCase;
|
|
10120
|
+
return k && typeof k.setFreshTokenCallback == "function" && k.setFreshTokenCallback(() => T.requestFreshFirebaseIdTokenFromBridge()), typeof window < "u" && (window.__crossxSDK = T), T;
|
|
10106
10121
|
}
|
|
10107
10122
|
function Ks(i) {
|
|
10108
10123
|
const e = Ls(i), r = Ds(e), t = JSON.parse(r);
|