@nexus-cross/crossx-sdk-core 2.3.10-beta.4 → 2.3.10-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/config/environments.d.ts +14 -0
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/types/events.d.ts +12 -0
- package/dist/crossx.global +2 -2
- package/dist/index.cjs +7 -7
- package/dist/index.js +183 -164
- package/dist/sdk/CROSSxSDK.d.ts +7 -1
- package/dist/sdk/services/StateManager.d.ts +3 -1
- 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.5", 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 Se = {
|
|
38
38
|
// ─── CROSS ────────────────────────────────────────────
|
|
39
39
|
CROSS_MAINNET: {
|
|
40
40
|
caipId: "eip155:612055",
|
|
@@ -84,12 +84,12 @@ const ve = {
|
|
|
84
84
|
testnet: !0
|
|
85
85
|
}
|
|
86
86
|
}, Hs = Object.fromEntries(
|
|
87
|
-
Object.entries(
|
|
87
|
+
Object.entries(Se).map(([i, e]) => [i, e.caipId])
|
|
88
88
|
), Wt = new Map(
|
|
89
|
-
Object.values(
|
|
89
|
+
Object.values(Se).map((i) => [i.caipId, i])
|
|
90
90
|
);
|
|
91
91
|
new Map(
|
|
92
|
-
Object.values(
|
|
92
|
+
Object.values(Se).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", ve = class ve {
|
|
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;
|
|
@@ -677,20 +677,20 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
677
677
|
const { authApiUrl: _ } = this.config, { accessToken: u, refreshToken: x } = await this.exchangeFirebaseToken(e, _);
|
|
678
678
|
let g, f, m;
|
|
679
679
|
try {
|
|
680
|
-
const
|
|
681
|
-
c.log("[CROSSx] Firebase JWT 필드:", Object.keys(
|
|
682
|
-
const
|
|
683
|
-
m =
|
|
680
|
+
const S = this.crypto.decodeJWT(e);
|
|
681
|
+
c.log("[CROSSx] Firebase JWT 필드:", Object.keys(S).join(", ")), f = (o = S.firebase) == null ? void 0 : o.sign_in_provider;
|
|
682
|
+
const E = ((n = S.firebase) == null ? void 0 : n.identities) ?? {};
|
|
683
|
+
m = S.email ?? ((a = E.email) == null ? void 0 : a[0]), f === "google.com" ? g = (l = E["google.com"]) == null ? void 0 : l[0] : f === "apple.com" && (g = (p = E["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
|
-
const
|
|
689
|
-
c.log("[CROSSx] access_token 디코딩 — sub:",
|
|
690
|
-
const
|
|
691
|
-
if (s =
|
|
688
|
+
const S = this.crypto.decodeJWT(u);
|
|
689
|
+
c.log("[CROSSx] access_token 디코딩 — sub:", S.sub, "exp:", S.exp, "필드:", Object.keys(S).join(", "));
|
|
690
|
+
const E = await this.crypto.verifyJWT(u);
|
|
691
|
+
if (s = E.signatureVerified ?? !1, !E.valid)
|
|
692
692
|
throw c.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
|
|
693
|
-
const A =
|
|
693
|
+
const A = E.payload, T = A.email ?? m ?? r;
|
|
694
694
|
c.log(
|
|
695
695
|
"[CROSSx] email 소스 — CROSSx JWT:",
|
|
696
696
|
A.email ?? "(없음)",
|
|
@@ -707,10 +707,10 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
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 영속 저장을 건너뜁니다"));
|
|
709
709
|
} else {
|
|
710
|
-
const
|
|
710
|
+
const S = this.crypto.decodeJWT(e);
|
|
711
711
|
t = {
|
|
712
|
-
id:
|
|
713
|
-
email:
|
|
712
|
+
id: S.sub,
|
|
713
|
+
email: S.email ?? r,
|
|
714
714
|
signInProvider: f,
|
|
715
715
|
providerSub: g
|
|
716
716
|
}, c.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", t.id);
|
|
@@ -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 _ = ve.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
|
+
ve.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
|
|
1055
|
+
let Oe = ve;
|
|
1056
1056
|
class Vt {
|
|
1057
1057
|
constructor(e, r, t) {
|
|
1058
1058
|
this.config = e, this.storage = r, this.tokenStore = t;
|
|
@@ -1435,8 +1435,16 @@ const de = {
|
|
|
1435
1435
|
}
|
|
1436
1436
|
};
|
|
1437
1437
|
function Jt(i) {
|
|
1438
|
-
const e = i.environment;
|
|
1439
|
-
|
|
1438
|
+
const e = i.environment, r = e && e in de ? de[e] : null;
|
|
1439
|
+
if (!r)
|
|
1440
|
+
return null;
|
|
1441
|
+
const t = i.overrides;
|
|
1442
|
+
if (!t)
|
|
1443
|
+
return r;
|
|
1444
|
+
const s = { ...r };
|
|
1445
|
+
for (const [o, n] of Object.entries(t))
|
|
1446
|
+
typeof n == "string" && n.trim() !== "" && (s[o] = n);
|
|
1447
|
+
return s;
|
|
1440
1448
|
}
|
|
1441
1449
|
function We() {
|
|
1442
1450
|
try {
|
|
@@ -2098,24 +2106,25 @@ class pr {
|
|
|
2098
2106
|
(t == null ? void 0 : t.walletName) !== void 0 && (s.walletName = t.walletName), this.deps.emitAddressChanged(s), this.deps.shouldPersistWalletPreference() && this.deps.storage.set(this.deps.walletPreferenceKey, { index: r, address: e }).catch(() => {
|
|
2099
2107
|
});
|
|
2100
2108
|
}
|
|
2101
|
-
applyAuthResult(e) {
|
|
2102
|
-
var
|
|
2103
|
-
const
|
|
2109
|
+
applyAuthResult(e, r) {
|
|
2110
|
+
var s, o, n, a, l;
|
|
2111
|
+
const t = {
|
|
2104
2112
|
authenticated: e.success,
|
|
2105
|
-
userId: ((
|
|
2113
|
+
userId: ((s = e.user) == null ? void 0 : s.id) ?? null,
|
|
2106
2114
|
address: e.address ?? null,
|
|
2107
2115
|
activeWalletIndex: 0,
|
|
2108
|
-
userEmail: ((
|
|
2109
|
-
providerSub: ((
|
|
2116
|
+
userEmail: ((o = e.user) == null ? void 0 : o.email) ?? null,
|
|
2117
|
+
providerSub: ((n = e.user) == null ? void 0 : n.providerSub) ?? null,
|
|
2110
2118
|
loginType: dr(
|
|
2111
|
-
(
|
|
2119
|
+
(a = e.user) == null ? void 0 : a.signInProvider
|
|
2112
2120
|
),
|
|
2113
2121
|
tokenSignatureVerified: e.tokenSignatureVerified ?? !1
|
|
2114
2122
|
};
|
|
2115
|
-
this.deps.setState(
|
|
2123
|
+
this.deps.setState(t), this.deps.getIsRecoveringSession() || this.deps.emitAuthChanged({
|
|
2116
2124
|
isAuthenticated: e.success,
|
|
2117
2125
|
address: e.address ?? null,
|
|
2118
|
-
userId: ((
|
|
2126
|
+
userId: ((l = e.user) == null ? void 0 : l.id) ?? null,
|
|
2127
|
+
...r ? { source: r } : {}
|
|
2119
2128
|
});
|
|
2120
2129
|
}
|
|
2121
2130
|
clearAuthState() {
|
|
@@ -2395,11 +2404,16 @@ const ne = class ne extends Yt {
|
|
|
2395
2404
|
},
|
|
2396
2405
|
getIsRecoveringSession: () => this._isRecoveringSession,
|
|
2397
2406
|
emitAddressChanged: ({ address: f, index: m, walletName: y }) => {
|
|
2398
|
-
const
|
|
2399
|
-
y !== void 0 && (
|
|
2407
|
+
const S = { address: f, index: m };
|
|
2408
|
+
y !== void 0 && (S.walletName = y), this.emit("addressChanged", S);
|
|
2400
2409
|
},
|
|
2401
|
-
emitAuthChanged: ({ isAuthenticated: f, address: m, userId: y }) => {
|
|
2402
|
-
this.emit("authChanged", {
|
|
2410
|
+
emitAuthChanged: ({ isAuthenticated: f, address: m, userId: y, source: S }) => {
|
|
2411
|
+
this.emit("authChanged", {
|
|
2412
|
+
isAuthenticated: f,
|
|
2413
|
+
address: m,
|
|
2414
|
+
userId: y,
|
|
2415
|
+
...S ? { source: S } : {}
|
|
2416
|
+
});
|
|
2403
2417
|
},
|
|
2404
2418
|
shouldPersistWalletPreference: () => this._config.persistWalletPreference !== !1,
|
|
2405
2419
|
walletPreferenceKey: ne.WALLET_PREF_KEY,
|
|
@@ -2547,7 +2561,7 @@ const ne = class ne extends Yt {
|
|
|
2547
2561
|
}
|
|
2548
2562
|
async _doInitialize(e) {
|
|
2549
2563
|
var r, t;
|
|
2550
|
-
c.log("[CROSSx SDK] v2.3.10-beta.
|
|
2564
|
+
c.log("[CROSSx SDK] v2.3.10-beta.5 초기화 중..."), this.confirmation.setMessages(X(this._config.locale));
|
|
2551
2565
|
try {
|
|
2552
2566
|
const s = We();
|
|
2553
2567
|
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 +2597,7 @@ const ne = class ne extends Yt {
|
|
|
2583
2597
|
throw u;
|
|
2584
2598
|
}
|
|
2585
2599
|
}
|
|
2586
|
-
return this.initialized = !0, c.info("[CROSSx SDK] v2.3.10-beta.
|
|
2600
|
+
return this.initialized = !0, c.info("[CROSSx SDK] v2.3.10-beta.5 초기화 완료"), this.emit("initialized", { restored: !!(l != null && l.success) }), l ?? null;
|
|
2587
2601
|
} catch (s) {
|
|
2588
2602
|
throw new h(d.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", s);
|
|
2589
2603
|
}
|
|
@@ -2603,7 +2617,7 @@ const ne = class ne extends Yt {
|
|
|
2603
2617
|
c.log("[CROSSx] RN Bridge 감지 — Handshake 시도"), c.info("[CROSSx][RNBridge trace] Bootstrap config", {
|
|
2604
2618
|
appId: this._config.projectId,
|
|
2605
2619
|
appVersion: "1.0.0",
|
|
2606
|
-
sdkVersion: "2.3.10-beta.
|
|
2620
|
+
sdkVersion: "2.3.10-beta.5",
|
|
2607
2621
|
keyId: "key-id-1",
|
|
2608
2622
|
userIdHash: "user-hash-placeholder",
|
|
2609
2623
|
projectId: this._config.projectId
|
|
@@ -2611,7 +2625,7 @@ const ne = class ne extends Yt {
|
|
|
2611
2625
|
const e = new j({
|
|
2612
2626
|
appId: this._config.projectId,
|
|
2613
2627
|
appVersion: "1.0.0",
|
|
2614
|
-
sdkVersion: "2.3.10-beta.
|
|
2628
|
+
sdkVersion: "2.3.10-beta.5",
|
|
2615
2629
|
keyId: "key-id-1",
|
|
2616
2630
|
userIdHash: "user-hash-placeholder",
|
|
2617
2631
|
projectId: this._config.projectId
|
|
@@ -2814,10 +2828,9 @@ const ne = class ne extends Yt {
|
|
|
2814
2828
|
d.ALREADY_AUTHENTICATED,
|
|
2815
2829
|
"이미 로그인된 상태입니다. signOut()을 먼저 호출하세요."
|
|
2816
2830
|
);
|
|
2817
|
-
(s = (t = this.oauth).cancelPending) == null || s.call(t, "signInWithOAuthToken으로 외부 인증이 도착했습니다");
|
|
2818
2831
|
let r;
|
|
2819
2832
|
try {
|
|
2820
|
-
r = await this.signInUseCase.executeWithOAuthToken(e), r.success && (this._isAuthenticatedViaRNBridge = !1, this.applyAuthResult(r));
|
|
2833
|
+
r = await this.signInUseCase.executeWithOAuthToken(e), r.success && (this._isAuthenticatedViaRNBridge = !1, this.applyAuthResult(r, "external"), (s = (t = this.oauth).cancelPending) == null || s.call(t, "signInWithOAuthToken으로 외부 인증이 도착했습니다"));
|
|
2821
2834
|
} catch (o) {
|
|
2822
2835
|
throw o instanceof h ? o : new h(d.AUTH_FAILED, "OAuth 토큰 로그인에 실패했습니다", o);
|
|
2823
2836
|
}
|
|
@@ -3562,27 +3575,27 @@ const ne = class ne extends Yt {
|
|
|
3562
3575
|
async sendTransactionWithWaitForReceipt(e, r, t = {}) {
|
|
3563
3576
|
var m, y;
|
|
3564
3577
|
if (this._isAuthenticatedViaRNBridge) {
|
|
3565
|
-
const
|
|
3566
|
-
if (
|
|
3567
|
-
return this.bridgeSendTransactionWithWaitForReceipt(
|
|
3578
|
+
const S = j.getBridge();
|
|
3579
|
+
if (S != null && S.sendTransactionWithWaitForReceipt)
|
|
3580
|
+
return this.bridgeSendTransactionWithWaitForReceipt(S, e, r, t);
|
|
3568
3581
|
}
|
|
3569
3582
|
const { intervalMs: s, timeoutMs: o, ...n } = t, { txHash: a } = await this.sendTransaction(e, r, n), l = s ?? ((m = this._config.receiptPolling) == null ? void 0 : m.intervalMs) ?? Rt, p = o ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? je, _ = Ae(e), u = r.from ?? "";
|
|
3570
3583
|
let x, g;
|
|
3571
|
-
const f = this.waitForTxAndGetReceipt(a, e, { intervalMs: l, timeoutMs: p }).then((
|
|
3572
|
-
x =
|
|
3573
|
-
const
|
|
3584
|
+
const f = this.waitForTxAndGetReceipt(a, e, { intervalMs: l, timeoutMs: p }).then((S) => {
|
|
3585
|
+
x = S;
|
|
3586
|
+
const E = BigInt(S.gasUsed) * BigInt(S.effectiveGasPrice), A = r.value ? BigInt(r.value) : 0n, T = me(r.value, _.symbol, _.decimals, this._config.displayDecimals), k = me("0x" + E.toString(16), _.symbol, _.decimals, this._config.displayDecimals), O = me("0x" + (A + E).toString(16), _.symbol, _.decimals, this._config.displayDecimals);
|
|
3574
3587
|
return {
|
|
3575
3588
|
chainId: e,
|
|
3576
3589
|
txHash: a,
|
|
3577
|
-
from:
|
|
3578
|
-
to:
|
|
3590
|
+
from: S.from,
|
|
3591
|
+
to: S.to ?? r.to,
|
|
3579
3592
|
amount: T,
|
|
3580
3593
|
fees: k,
|
|
3581
3594
|
total: O,
|
|
3582
3595
|
nativeSymbol: _.symbol,
|
|
3583
|
-
status:
|
|
3596
|
+
status: S.status === "0x1" ? "success" : "reverted"
|
|
3584
3597
|
};
|
|
3585
|
-
}).catch((
|
|
3598
|
+
}).catch((S) => (g = S instanceof Error ? S : new Error(String(S)), {
|
|
3586
3599
|
chainId: e,
|
|
3587
3600
|
txHash: a,
|
|
3588
3601
|
from: u,
|
|
@@ -3940,9 +3953,15 @@ const ne = class ne extends Yt {
|
|
|
3940
3953
|
this.address && this.address.toLowerCase() === s.toLowerCase() || (c.log("[CROSSx] Native walletChanged 수신", { address: s, walletId: t.walletId, source: t.source, walletName: n }), this.setActiveWallet(s, 0, { walletName: n }), this._rnBridgeWalletAddress = s, this._rnBridgeWalletName = n);
|
|
3941
3954
|
}), c.log("[CROSSx] bridge.onEvent walletChanged 구독 완료");
|
|
3942
3955
|
}
|
|
3943
|
-
/**
|
|
3944
|
-
|
|
3945
|
-
|
|
3956
|
+
/**
|
|
3957
|
+
* AuthResult를 내부 상태에 반영합니다.
|
|
3958
|
+
*
|
|
3959
|
+
* @param source 외부 경로(JS injection → signInWithOAuthToken) 인증이면
|
|
3960
|
+
* `'external'`. `authChanged` 구독자가 자기 호출의 결과와 구분할 수 있게
|
|
3961
|
+
* 그대로 전달된다(AuthChangedEvent.source 주석 참고).
|
|
3962
|
+
*/
|
|
3963
|
+
applyAuthResult(e, r) {
|
|
3964
|
+
this.stateManager.applyAuthResult(e, r);
|
|
3946
3965
|
}
|
|
3947
3966
|
/** 인증 상태를 초기화합니다. */
|
|
3948
3967
|
clearAuthState() {
|
|
@@ -4355,7 +4374,7 @@ function ot(i) {
|
|
|
4355
4374
|
for (const r of i) e += r.toString(16).padStart(2, "0");
|
|
4356
4375
|
return BigInt(e);
|
|
4357
4376
|
}
|
|
4358
|
-
const
|
|
4377
|
+
const vr = 3e4, Sr = 1e3;
|
|
4359
4378
|
class Er {
|
|
4360
4379
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4361
4380
|
async request(e) {
|
|
@@ -4367,7 +4386,7 @@ class Er {
|
|
|
4367
4386
|
} catch (s) {
|
|
4368
4387
|
if (t === r) throw s;
|
|
4369
4388
|
}
|
|
4370
|
-
await new Promise((s) => setTimeout(s,
|
|
4389
|
+
await new Promise((s) => setTimeout(s, Sr * 2 ** t));
|
|
4371
4390
|
}
|
|
4372
4391
|
throw new Error("Unexpected: retry loop exited without result");
|
|
4373
4392
|
}
|
|
@@ -4375,7 +4394,7 @@ class Er {
|
|
|
4375
4394
|
async _doRequest(e) {
|
|
4376
4395
|
const r = new AbortController(), t = setTimeout(
|
|
4377
4396
|
() => r.abort(),
|
|
4378
|
-
e.timeoutMs ??
|
|
4397
|
+
e.timeoutMs ?? vr
|
|
4379
4398
|
);
|
|
4380
4399
|
try {
|
|
4381
4400
|
const s = await fetch(e.url, {
|
|
@@ -4503,24 +4522,24 @@ class ie {
|
|
|
4503
4522
|
const f = setTimeout(() => {
|
|
4504
4523
|
c.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), k(), t(new Error("Authentication timeout"));
|
|
4505
4524
|
}, 5 * 60 * 1e3), m = 10, y = 30;
|
|
4506
|
-
let
|
|
4525
|
+
let S = 0, E = null;
|
|
4507
4526
|
const A = () => {
|
|
4508
|
-
clearInterval(T), c.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + y + "초간 대기합니다"),
|
|
4527
|
+
clearInterval(T), c.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + y + "초간 대기합니다"), E = setTimeout(() => {
|
|
4509
4528
|
k(), t(new Error(
|
|
4510
4529
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
4511
4530
|
));
|
|
4512
4531
|
}, y * 1e3);
|
|
4513
4532
|
}, T = setInterval(() => {
|
|
4514
|
-
|
|
4533
|
+
S++;
|
|
4515
4534
|
try {
|
|
4516
4535
|
if (!g.closed) return;
|
|
4517
4536
|
const M = typeof document < "u" && document.hasFocus();
|
|
4518
|
-
|
|
4537
|
+
S <= m && !M ? A() : (k(), t(new Error("로그인이 취소되었습니다")));
|
|
4519
4538
|
} catch {
|
|
4520
4539
|
A();
|
|
4521
4540
|
}
|
|
4522
4541
|
}, 1e3), k = () => {
|
|
4523
|
-
this.abortPending = null, clearTimeout(f), clearInterval(T),
|
|
4542
|
+
this.abortPending = null, clearTimeout(f), clearInterval(T), E && clearTimeout(E), window.removeEventListener("message", O);
|
|
4524
4543
|
}, O = (M) => {
|
|
4525
4544
|
if (!Ar.has(M.origin)) return;
|
|
4526
4545
|
k();
|
|
@@ -4801,9 +4820,9 @@ class oe {
|
|
|
4801
4820
|
d.USER_NOT_FOUND,
|
|
4802
4821
|
oe.getGatewayErrorMessage(g.code, f)
|
|
4803
4822
|
);
|
|
4804
|
-
const y = m === d.AUTH_NOT_AUTHENTICATED ? d.SESSION_EXPIRED : m,
|
|
4823
|
+
const y = m === d.AUTH_NOT_AUTHENTICATED ? d.SESSION_EXPIRED : m, S = y === d.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : oe.getGatewayErrorMessage(g.code, f), E = g.data;
|
|
4805
4824
|
let A;
|
|
4806
|
-
throw m === d.PIN_LOCKED ? A = oe.extractLockDetails(
|
|
4825
|
+
throw m === d.PIN_LOCKED ? A = oe.extractLockDetails(E) : m === d.ADDRESS_LIMIT_EXCEEDED ? A = { limit: Ne, raw: E } : A = E ?? void 0, new h(y, S, A);
|
|
4807
4826
|
}
|
|
4808
4827
|
return c.log("[CROSSx] Wallet Gateway API 성공:", { code: g.code, url: n, method: e }), g.data ?? g;
|
|
4809
4828
|
}
|
|
@@ -5390,7 +5409,7 @@ class fe {
|
|
|
5390
5409
|
);
|
|
5391
5410
|
}
|
|
5392
5411
|
static fallbackChains() {
|
|
5393
|
-
return Object.values(
|
|
5412
|
+
return Object.values(Se).map((e) => ({
|
|
5394
5413
|
chainId: e.caipId,
|
|
5395
5414
|
rpcUrl: e.rpcUrl
|
|
5396
5415
|
}));
|
|
@@ -8638,10 +8657,10 @@ function is(i, e, r, t) {
|
|
|
8638
8657
|
<button class="__crossx-approve-btn" id="__crossx-done-btn">${w((t == null ? void 0 : t.tx_complete_done_button) ?? (s ? "All Done" : "Done"))}</button>
|
|
8639
8658
|
`, l.querySelectorAll(".__crossx-copy-btn").forEach((m) => {
|
|
8640
8659
|
m.addEventListener("click", (y) => {
|
|
8641
|
-
var
|
|
8660
|
+
var E;
|
|
8642
8661
|
y.stopPropagation();
|
|
8643
|
-
const
|
|
8644
|
-
|
|
8662
|
+
const S = m.dataset.copy;
|
|
8663
|
+
S && ((E = navigator.clipboard) == null || E.writeText(S).catch(() => {
|
|
8645
8664
|
}));
|
|
8646
8665
|
});
|
|
8647
8666
|
});
|
|
@@ -8748,7 +8767,7 @@ function ps(i, e) {
|
|
|
8748
8767
|
const r = e.replace("#", "");
|
|
8749
8768
|
return `${ds}/portrait/evm/${i}.png?size=256&bg=${r}`;
|
|
8750
8769
|
}
|
|
8751
|
-
function
|
|
8770
|
+
function vt(i, e, r) {
|
|
8752
8771
|
const t = ps(i, r), o = ls().replace(/"/g, """);
|
|
8753
8772
|
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>`;
|
|
8754
8773
|
}
|
|
@@ -8756,7 +8775,7 @@ function _s(i, e, r, t) {
|
|
|
8756
8775
|
const s = r == null ? void 0 : r.toLowerCase(), o = i.map((a) => {
|
|
8757
8776
|
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>` : "";
|
|
8758
8777
|
return `<button class="__crossx-wallet-item${p}" data-wallet-index="${a.index}" data-wallet-address="${w(a.address)}">
|
|
8759
|
-
${
|
|
8778
|
+
${vt(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>${_}
|
|
8760
8779
|
</button>`;
|
|
8761
8780
|
}).join(""), n = document.createElement("div");
|
|
8762
8781
|
return n.id = F, n.className = "__crossx-overlay--wallet-selector", n.innerHTML = `
|
|
@@ -8972,12 +8991,12 @@ function bs(i, e) {
|
|
|
8972
8991
|
</div>
|
|
8973
8992
|
`, u;
|
|
8974
8993
|
}
|
|
8975
|
-
function
|
|
8994
|
+
function vs(i) {
|
|
8976
8995
|
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");
|
|
8977
8996
|
return `${s}, ${o} ${n} ${a}:${l}`;
|
|
8978
8997
|
}
|
|
8979
|
-
function
|
|
8980
|
-
const t = i, s = e <= 0, o = s ? null : Date.now() + e * 1e3, n = o ?
|
|
8998
|
+
function Ss(i, e, r) {
|
|
8999
|
+
const t = i, s = e <= 0, o = s ? null : Date.now() + e * 1e3, n = o ? vs(o) : null, a = document.createElement("div");
|
|
8981
9000
|
return a.id = F, a.innerHTML = `
|
|
8982
9001
|
<div class="__crossx-card __crossx-card--migration" style="${H(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8983
9002
|
<div class="__crossx-header">
|
|
@@ -9048,7 +9067,7 @@ function Es(i) {
|
|
|
9048
9067
|
}
|
|
9049
9068
|
function Ce(i) {
|
|
9050
9069
|
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">
|
|
9051
|
-
${
|
|
9070
|
+
${St}
|
|
9052
9071
|
<span id="__crossx-pin6-lock-countdown"></span>
|
|
9053
9072
|
</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(
|
|
9054
9073
|
{ length: 6 },
|
|
@@ -9125,42 +9144,42 @@ function Is(i) {
|
|
|
9125
9144
|
function Pe(i, e, r, t, s, o, n) {
|
|
9126
9145
|
var ze, Ve;
|
|
9127
9146
|
let a = !!(o && o > Date.now()), l = !1;
|
|
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,
|
|
9129
|
-
b.dataset.digit =
|
|
9130
|
-
},
|
|
9147
|
+
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, v) => {
|
|
9148
|
+
b.dataset.digit = v, b.value = m;
|
|
9149
|
+
}, S = (b) => {
|
|
9131
9150
|
delete b.dataset.digit, b.value = "";
|
|
9132
|
-
},
|
|
9151
|
+
}, E = (b) => b.dataset.digit ?? "", A = () => p().map(E).join(""), T = () => Array.from(i.querySelectorAll(".__crossx-pin6-dot")), k = () => {
|
|
9133
9152
|
var I;
|
|
9134
|
-
const b = p(),
|
|
9135
|
-
if (
|
|
9136
|
-
const $ = !!(b[N] &&
|
|
9153
|
+
const b = p(), v = T();
|
|
9154
|
+
if (v.length && (v.forEach((R, N) => {
|
|
9155
|
+
const $ = !!(b[N] && E(b[N]));
|
|
9137
9156
|
R.classList.toggle("--filled", $), R.classList.toggle("--active", !1);
|
|
9138
9157
|
}), !a && !l)) {
|
|
9139
|
-
const R = b.findIndex(($) => !
|
|
9140
|
-
(I =
|
|
9158
|
+
const R = b.findIndex(($) => !E($));
|
|
9159
|
+
(I = v[R === -1 ? 5 : R]) == null || I.classList.add("--active");
|
|
9141
9160
|
}
|
|
9142
9161
|
}, O = () => {
|
|
9143
|
-
i.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((
|
|
9162
|
+
i.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((v) => v.classList.toggle("--disabled", a)), T().forEach((v) => v.classList.toggle("--locked", a)), k();
|
|
9144
9163
|
}, M = (b) => {
|
|
9145
|
-
a = b, p().forEach((
|
|
9146
|
-
|
|
9164
|
+
a = b, p().forEach((v) => {
|
|
9165
|
+
v.disabled = b, v.classList.toggle("--locked", b);
|
|
9147
9166
|
});
|
|
9148
9167
|
}, G = () => i.querySelector("#__crossx-pin6-attempt"), P = () => {
|
|
9149
9168
|
const b = u();
|
|
9150
9169
|
b && (b.textContent = "");
|
|
9151
9170
|
}, ee = () => n ?? "Your account will be locked after further failures.", C = () => i.querySelector("#__crossx-pin6-warning"), L = (b) => {
|
|
9152
9171
|
var I;
|
|
9153
|
-
let
|
|
9154
|
-
if (!
|
|
9155
|
-
|
|
9172
|
+
let v = C();
|
|
9173
|
+
if (!v) {
|
|
9174
|
+
v = document.createElement("p"), v.className = "__crossx-pin6-warning", v.id = "__crossx-pin6-warning";
|
|
9156
9175
|
const R = u();
|
|
9157
|
-
R ? R.insertAdjacentElement("afterend",
|
|
9176
|
+
R ? R.insertAdjacentElement("afterend", v) : (I = f()) == null || I.appendChild(v);
|
|
9158
9177
|
}
|
|
9159
|
-
|
|
9178
|
+
v.textContent = b;
|
|
9160
9179
|
}, U = () => {
|
|
9161
9180
|
const b = C();
|
|
9162
9181
|
b && (b.textContent = "");
|
|
9163
|
-
}, ae = (b,
|
|
9182
|
+
}, ae = (b, v) => {
|
|
9164
9183
|
var R;
|
|
9165
9184
|
let I = G();
|
|
9166
9185
|
if (!I) {
|
|
@@ -9168,32 +9187,32 @@ function Pe(i, e, r, t, s, o, n) {
|
|
|
9168
9187
|
const N = C() ?? u();
|
|
9169
9188
|
N ? N.insertAdjacentElement("afterend", I) : (R = f()) == null || R.appendChild(I);
|
|
9170
9189
|
}
|
|
9171
|
-
I.textContent = `${b}/${
|
|
9190
|
+
I.textContent = `${b}/${v}`;
|
|
9172
9191
|
}, pe = () => {
|
|
9173
9192
|
const b = G();
|
|
9174
9193
|
b && (b.textContent = "");
|
|
9175
9194
|
}, _e = (b) => {
|
|
9176
|
-
const
|
|
9177
|
-
|
|
9195
|
+
const v = u();
|
|
9196
|
+
v && (v.textContent = b);
|
|
9178
9197
|
const I = _();
|
|
9179
|
-
I == null || I.classList.add("--shake"), setTimeout(() => I == null ? void 0 : I.classList.remove("--shake"), 500), p().forEach(
|
|
9198
|
+
I == null || I.classList.add("--shake"), setTimeout(() => I == null ? void 0 : I.classList.remove("--shake"), 500), p().forEach(S), setTimeout(() => {
|
|
9180
9199
|
var R;
|
|
9181
9200
|
(R = p()[0]) == null || R.focus(), k();
|
|
9182
9201
|
}, 50);
|
|
9183
9202
|
}, he = (b) => {
|
|
9184
9203
|
var $;
|
|
9185
|
-
M(!0), p().forEach(
|
|
9186
|
-
const
|
|
9187
|
-
if (
|
|
9204
|
+
M(!0), p().forEach(S), O();
|
|
9205
|
+
const v = u();
|
|
9206
|
+
if (v && (v.textContent = "Too many failed attempts. Please wait."), !x()) {
|
|
9188
9207
|
const B = document.createElement("p");
|
|
9189
|
-
B.className = "__crossx-pin6-lock-msg", B.id = "__crossx-pin6-lock-msg", B.innerHTML = `${
|
|
9208
|
+
B.className = "__crossx-pin6-lock-msg", B.id = "__crossx-pin6-lock-msg", B.innerHTML = `${St}<span id="__crossx-pin6-lock-countdown"></span>`;
|
|
9190
9209
|
const V = u();
|
|
9191
9210
|
V ? V.insertAdjacentElement("afterend", B) : ($ = f()) == null || $.appendChild(B);
|
|
9192
9211
|
}
|
|
9193
9212
|
const I = () => {
|
|
9194
9213
|
var Q;
|
|
9195
9214
|
const B = b - Date.now(), V = g();
|
|
9196
|
-
B <= 0 ? (clearInterval(R), M(!1), (Q = x()) == null || Q.remove(),
|
|
9215
|
+
B <= 0 ? (clearInterval(R), M(!1), (Q = x()) == null || Q.remove(), v && (v.textContent = ""), O(), setTimeout(() => {
|
|
9197
9216
|
var we;
|
|
9198
9217
|
return (we = p()[0]) == null ? void 0 : we.focus();
|
|
9199
9218
|
}, 50)) : V && (V.textContent = ` ${Is(B)}`);
|
|
@@ -9207,20 +9226,20 @@ function Pe(i, e, r, t, s, o, n) {
|
|
|
9207
9226
|
if (a || l) return;
|
|
9208
9227
|
const b = A();
|
|
9209
9228
|
if (b.length === 6) {
|
|
9210
|
-
l = !0, p().forEach((
|
|
9211
|
-
|
|
9229
|
+
l = !0, p().forEach((v) => {
|
|
9230
|
+
v.disabled = !0;
|
|
9212
9231
|
});
|
|
9213
9232
|
try {
|
|
9214
9233
|
if (s) {
|
|
9215
|
-
const
|
|
9216
|
-
|
|
9234
|
+
const v = await s(b);
|
|
9235
|
+
v.ok ? e(b) : v.lockExpiresAt ? (pe(), he(v.lockExpiresAt)) : (_e(v.error ?? "Incorrect PIN. Please try again."), v.attemptCount != null && v.maxAttempts != null ? (L(ee()), ae(v.attemptCount, v.maxAttempts)) : (U(), pe()));
|
|
9217
9236
|
} else
|
|
9218
9237
|
e(b);
|
|
9219
|
-
} catch (
|
|
9220
|
-
t && t(
|
|
9238
|
+
} catch (v) {
|
|
9239
|
+
t && t(v);
|
|
9221
9240
|
} finally {
|
|
9222
|
-
l = !1, a || p().forEach((
|
|
9223
|
-
|
|
9241
|
+
l = !1, a || p().forEach((v) => {
|
|
9242
|
+
v.disabled = !1;
|
|
9224
9243
|
}), k();
|
|
9225
9244
|
}
|
|
9226
9245
|
}
|
|
@@ -9231,30 +9250,30 @@ function Pe(i, e, r, t, s, o, n) {
|
|
|
9231
9250
|
}, 100);
|
|
9232
9251
|
const Ke = () => {
|
|
9233
9252
|
if (a || l) return;
|
|
9234
|
-
const b = p(),
|
|
9235
|
-
|
|
9253
|
+
const b = p(), v = b.find((I) => !E(I)) ?? b[b.length - 1];
|
|
9254
|
+
v == null || v.focus();
|
|
9236
9255
|
};
|
|
9237
9256
|
(ze = _()) == null || ze.addEventListener("click", (b) => {
|
|
9238
9257
|
b.target.classList.contains("__crossx-pin6-box") || Ke();
|
|
9239
9258
|
}), (Ve = f()) == null || Ve.addEventListener("click", (b) => {
|
|
9240
|
-
const
|
|
9241
|
-
|
|
9242
|
-
}), p().forEach((b,
|
|
9259
|
+
const v = b.target;
|
|
9260
|
+
v.classList.contains("__crossx-pin6-box") || v.closest("button") || Ke();
|
|
9261
|
+
}), p().forEach((b, v) => {
|
|
9243
9262
|
b.addEventListener("input", () => {
|
|
9244
9263
|
var R;
|
|
9245
9264
|
const I = b.value.replace(/\D/g, "").slice(-1);
|
|
9246
|
-
I ? y(b, I) :
|
|
9265
|
+
I ? y(b, I) : S(b), P(), I && v < 5 && ((R = p()[v + 1]) == null || R.focus()), k(), A().length === 6 && setTimeout(te, 80);
|
|
9247
9266
|
}), b.addEventListener("keydown", (I) => {
|
|
9248
9267
|
var R, N;
|
|
9249
9268
|
if (I.key === "Backspace") {
|
|
9250
|
-
if (I.preventDefault(),
|
|
9251
|
-
|
|
9252
|
-
else if (
|
|
9253
|
-
const $ = p()[
|
|
9254
|
-
|
|
9269
|
+
if (I.preventDefault(), E(b))
|
|
9270
|
+
S(b);
|
|
9271
|
+
else if (v > 0) {
|
|
9272
|
+
const $ = p()[v - 1];
|
|
9273
|
+
S($), $.focus();
|
|
9255
9274
|
}
|
|
9256
9275
|
k();
|
|
9257
|
-
} else I.key === "ArrowLeft" &&
|
|
9276
|
+
} else I.key === "ArrowLeft" && v > 0 ? (I.preventDefault(), (R = p()[v - 1]) == null || R.focus()) : I.key === "ArrowRight" && v < 5 ? (I.preventDefault(), (N = p()[v + 1]) == null || N.focus()) : I.key === "Escape" && r();
|
|
9258
9277
|
}), b.addEventListener("paste", (I) => {
|
|
9259
9278
|
var $, B;
|
|
9260
9279
|
I.preventDefault();
|
|
@@ -9269,39 +9288,39 @@ function Pe(i, e, r, t, s, o, n) {
|
|
|
9269
9288
|
const ue = i.querySelector("#__crossx-pin6-numpad");
|
|
9270
9289
|
if (ue) {
|
|
9271
9290
|
let b = null;
|
|
9272
|
-
const
|
|
9291
|
+
const v = () => {
|
|
9273
9292
|
b && (b.classList.remove("--pressed"), b = null);
|
|
9274
9293
|
};
|
|
9275
9294
|
ue.addEventListener("pointerdown", (R) => {
|
|
9276
9295
|
const N = R.target.closest(".__crossx-pin6-numpad-key");
|
|
9277
|
-
!N || a || l || (
|
|
9296
|
+
!N || a || l || (v(), b = N, N.classList.add("--pressed"), N.setPointerCapture(R.pointerId));
|
|
9278
9297
|
});
|
|
9279
9298
|
const I = (R) => {
|
|
9280
9299
|
const N = R.dataset.key;
|
|
9281
9300
|
if (!N) return;
|
|
9282
9301
|
if (N === "backspace") {
|
|
9283
|
-
const Q = [...p()].reverse().find((we) =>
|
|
9284
|
-
Q && (
|
|
9302
|
+
const Q = [...p()].reverse().find((we) => E(we));
|
|
9303
|
+
Q && (S(Q), P()), k();
|
|
9285
9304
|
return;
|
|
9286
9305
|
}
|
|
9287
9306
|
if (!/^\d$/.test(N)) return;
|
|
9288
|
-
const B = p().find((V) => !
|
|
9307
|
+
const B = p().find((V) => !E(V));
|
|
9289
9308
|
B && (y(B, N), P(), k(), A().length === 6 && setTimeout(te, 80));
|
|
9290
9309
|
};
|
|
9291
9310
|
ue.addEventListener("pointerup", (R) => {
|
|
9292
9311
|
if (!b) return;
|
|
9293
9312
|
const N = b;
|
|
9294
|
-
|
|
9313
|
+
v();
|
|
9295
9314
|
const $ = N.getBoundingClientRect();
|
|
9296
9315
|
R.clientX >= $.left && R.clientX <= $.right && R.clientY >= $.top && R.clientY <= $.bottom && !a && !l && I(N);
|
|
9297
|
-
}), ue.addEventListener("pointercancel",
|
|
9316
|
+
}), ue.addEventListener("pointercancel", v), ue.addEventListener("pointerleave", v, !0), k(), o && o > Date.now() && O();
|
|
9298
9317
|
}
|
|
9299
9318
|
}
|
|
9300
9319
|
const ks = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9301
9320
|
<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"/>
|
|
9302
9321
|
<line x1="10" y1="5.5" x2="16" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9303
9322
|
<line x1="16" y1="5.5" x2="10" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9304
|
-
</svg>`,
|
|
9323
|
+
</svg>`, St = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9305
9324
|
<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"/>
|
|
9306
9325
|
</svg>`, Ts = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9307
9326
|
<path d="M1 4.5L4 7.5L10 1" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -9384,7 +9403,7 @@ class Ps {
|
|
|
9384
9403
|
*/
|
|
9385
9404
|
showWalletSelector(e, r, t) {
|
|
9386
9405
|
return new Promise((s, o) => {
|
|
9387
|
-
var
|
|
9406
|
+
var E;
|
|
9388
9407
|
K();
|
|
9389
9408
|
const n = [...e], a = _s(n, this.tokens, t, this.messages), l = se();
|
|
9390
9409
|
z(a);
|
|
@@ -9415,7 +9434,7 @@ class Ps {
|
|
|
9415
9434
|
const T = a.querySelector("#__crossx-wallet-list");
|
|
9416
9435
|
if (T) {
|
|
9417
9436
|
const k = document.createElement("button");
|
|
9418
|
-
k.className = "__crossx-wallet-item", k.dataset.walletIndex = String(A.index), k.dataset.walletAddress = A.address, k.innerHTML = `${
|
|
9437
|
+
k.className = "__crossx-wallet-item", k.dataset.walletIndex = String(A.index), k.dataset.walletAddress = A.address, k.innerHTML = `${vt(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);
|
|
9419
9438
|
try {
|
|
9420
9439
|
k.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
9421
9440
|
} catch {
|
|
@@ -9426,13 +9445,13 @@ class Ps {
|
|
|
9426
9445
|
const T = A instanceof h && A.code === d.ADDRESS_LIMIT_EXCEEDED, k = this.resolveAddWalletErrorMessage(A);
|
|
9427
9446
|
m && (m.textContent = k, m.hidden = !1), T ? (y.disabled = !0, y.setAttribute("aria-disabled", "true")) : y.disabled = !1, u = A;
|
|
9428
9447
|
}
|
|
9429
|
-
}), (
|
|
9448
|
+
}), (E = a.querySelector("#__crossx-close-btn")) == null || E.addEventListener("click", g), a.addEventListener("click", (A) => {
|
|
9430
9449
|
A.target === a && g();
|
|
9431
9450
|
});
|
|
9432
|
-
const
|
|
9433
|
-
A.key === "Escape" && (document.removeEventListener("keydown",
|
|
9451
|
+
const S = (A) => {
|
|
9452
|
+
A.key === "Escape" && (document.removeEventListener("keydown", S), g());
|
|
9434
9453
|
};
|
|
9435
|
-
document.addEventListener("keydown",
|
|
9454
|
+
document.addEventListener("keydown", S);
|
|
9436
9455
|
});
|
|
9437
9456
|
}
|
|
9438
9457
|
showWalletCreatedPrompt() {
|
|
@@ -9492,12 +9511,12 @@ class Ps {
|
|
|
9492
9511
|
a(), s(null);
|
|
9493
9512
|
};
|
|
9494
9513
|
(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) => {
|
|
9495
|
-
const
|
|
9496
|
-
|
|
9514
|
+
const E = y.currentTarget.dataset.walletId ?? "";
|
|
9515
|
+
E && p(E);
|
|
9497
9516
|
}), (m = o.querySelector("#__crossx-close-btn")) == null || m.addEventListener("click", _), o.addEventListener("click", (y) => {
|
|
9498
9517
|
y.target === o && _();
|
|
9499
9518
|
}), o.querySelectorAll(".__crossx-login-terms-link").forEach((y) => {
|
|
9500
|
-
y.addEventListener("click", (
|
|
9519
|
+
y.addEventListener("click", (S) => S.stopPropagation());
|
|
9501
9520
|
});
|
|
9502
9521
|
const u = (y) => {
|
|
9503
9522
|
y.key === "Escape" && (document.removeEventListener("keydown", u), _());
|
|
@@ -9591,8 +9610,8 @@ class Ps {
|
|
|
9591
9610
|
let p = !1;
|
|
9592
9611
|
const _ = () => {
|
|
9593
9612
|
p || (p = !0, a.remove(), l());
|
|
9594
|
-
}, u = (
|
|
9595
|
-
_(), r(
|
|
9613
|
+
}, u = (E) => {
|
|
9614
|
+
_(), r(E);
|
|
9596
9615
|
}, x = () => {
|
|
9597
9616
|
_(), r(null);
|
|
9598
9617
|
}, g = a.querySelector(".__crossx-card"), f = {
|
|
@@ -9601,22 +9620,22 @@ class Ps {
|
|
|
9601
9620
|
repeatingDigit: (t == null ? void 0 : t.pin_validation_repeating_digit) ?? "Cannot use the same number 3+ times in a row.",
|
|
9602
9621
|
sequential: (t == null ? void 0 : t.pin_validation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
|
|
9603
9622
|
alternatingPattern: (t == null ? void 0 : t.pin_validation_alternating_pattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
9604
|
-
}, m = (
|
|
9623
|
+
}, m = (E) => {
|
|
9605
9624
|
var A;
|
|
9606
9625
|
g.innerHTML = Ce({
|
|
9607
9626
|
title: n.title,
|
|
9608
9627
|
headerSubtitle: n.headerSubtitle,
|
|
9609
9628
|
subtitle: n.subtitle
|
|
9610
9629
|
}), this.applyPinKeyboardMode(g), (A = g.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x), Pe(g, (T) => {
|
|
9611
|
-
T ===
|
|
9630
|
+
T === E ? u(E) : y(o.mismatchError);
|
|
9612
9631
|
}, x);
|
|
9613
|
-
}, y = (
|
|
9632
|
+
}, y = (E) => {
|
|
9614
9633
|
var A;
|
|
9615
9634
|
g.innerHTML = Ce({
|
|
9616
9635
|
title: o.title,
|
|
9617
9636
|
headerSubtitle: o.headerSubtitle,
|
|
9618
9637
|
subtitle: o.subtitle,
|
|
9619
|
-
errorMessage:
|
|
9638
|
+
errorMessage: E
|
|
9620
9639
|
}), this.applyPinKeyboardMode(g), (A = g.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x), Pe(g, (T) => {
|
|
9621
9640
|
const k = As(T, f);
|
|
9622
9641
|
k ? y(k) : m(T);
|
|
@@ -9624,10 +9643,10 @@ class Ps {
|
|
|
9624
9643
|
};
|
|
9625
9644
|
(() => {
|
|
9626
9645
|
var ee;
|
|
9627
|
-
const
|
|
9646
|
+
const E = Array.from(g.querySelectorAll(".__crossx-pw-notice-item")), A = g.querySelector("#__crossx-pin-notice-next"), T = /* @__PURE__ */ new Set();
|
|
9628
9647
|
A.removeAttribute("disabled");
|
|
9629
9648
|
const k = A.dataset.nextLabel ?? "Next", O = A.dataset.submitLabel ?? "I Understand", M = () => {
|
|
9630
|
-
const C = T.size ===
|
|
9649
|
+
const C = T.size === E.length;
|
|
9631
9650
|
A.classList.toggle("--disabled", !C), A.textContent = O || k;
|
|
9632
9651
|
}, G = (C, L) => {
|
|
9633
9652
|
if (T.has(L)) return;
|
|
@@ -9638,7 +9657,7 @@ class Ps {
|
|
|
9638
9657
|
const U = C.querySelector(`#__crossx-notice-check-${L}`);
|
|
9639
9658
|
T.delete(L), U.classList.remove("--checked"), C.setAttribute("aria-checked", "false"), M();
|
|
9640
9659
|
};
|
|
9641
|
-
|
|
9660
|
+
E.forEach((C) => {
|
|
9642
9661
|
const L = parseInt(C.dataset.checkIndex ?? "0", 10);
|
|
9643
9662
|
C.addEventListener("click", () => {
|
|
9644
9663
|
T.has(L) ? P(C, L) : G(C, L);
|
|
@@ -9646,11 +9665,11 @@ class Ps {
|
|
|
9646
9665
|
(U.key === " " || U.key === "Enter") && (U.preventDefault(), T.has(L) ? P(C, L) : G(C, L));
|
|
9647
9666
|
});
|
|
9648
9667
|
}), A.addEventListener("click", () => {
|
|
9649
|
-
if (T.size ===
|
|
9668
|
+
if (T.size === E.length) {
|
|
9650
9669
|
y(e == null ? void 0 : e.errorMessage);
|
|
9651
9670
|
return;
|
|
9652
9671
|
}
|
|
9653
|
-
const C =
|
|
9672
|
+
const C = E.find((U) => {
|
|
9654
9673
|
const ae = parseInt(U.dataset.checkIndex ?? "0", 10);
|
|
9655
9674
|
return !T.has(ae);
|
|
9656
9675
|
});
|
|
@@ -9660,8 +9679,8 @@ class Ps {
|
|
|
9660
9679
|
C.classList.remove("--highlight"), G(C, L);
|
|
9661
9680
|
}, 400);
|
|
9662
9681
|
}), (ee = g.querySelector("#__crossx-close-btn")) == null || ee.addEventListener("click", x);
|
|
9663
|
-
})(), a.addEventListener("click", (
|
|
9664
|
-
|
|
9682
|
+
})(), a.addEventListener("click", (E) => {
|
|
9683
|
+
E.target === a && x();
|
|
9665
9684
|
});
|
|
9666
9685
|
});
|
|
9667
9686
|
}
|
|
@@ -9672,7 +9691,7 @@ class Ps {
|
|
|
9672
9691
|
*/
|
|
9673
9692
|
showPinInputPrompt(e) {
|
|
9674
9693
|
return new Promise((r, t) => {
|
|
9675
|
-
var
|
|
9694
|
+
var S;
|
|
9676
9695
|
K();
|
|
9677
9696
|
const s = this.messages, o = (e == null ? void 0 : e.verifyMode) === !0, n = o ? (s == null ? void 0 : s.verify_pin_title) ?? "Verify Your PIN" : (s == null ? void 0 : s.pin_input_title) ?? "Enter PIN", a = o ? (s == null ? void 0 : s.verify_pin_subtitle) ?? "Enter your PIN to authorize this transaction." : (s == null ? void 0 : s.pin_input_subtitle) ?? "Enter your 6-digit PIN to continue.", l = (s == null ? void 0 : s.pin_locked_failure_warning) ?? "Your account will be locked after further failures.", p = lt(
|
|
9678
9697
|
this.tokens,
|
|
@@ -9690,15 +9709,15 @@ class Ps {
|
|
|
9690
9709
|
let u = !1;
|
|
9691
9710
|
const x = () => {
|
|
9692
9711
|
u || (u = !0, p.remove(), _());
|
|
9693
|
-
}, g = (
|
|
9694
|
-
x(), r(
|
|
9712
|
+
}, g = (E) => {
|
|
9713
|
+
x(), r(E);
|
|
9695
9714
|
}, f = () => {
|
|
9696
9715
|
x(), r(null);
|
|
9697
|
-
}, m = (
|
|
9698
|
-
x(), t(
|
|
9716
|
+
}, m = (E) => {
|
|
9717
|
+
x(), t(E);
|
|
9699
9718
|
}, y = p.querySelector(".__crossx-card");
|
|
9700
|
-
this.applyPinKeyboardMode(y), (
|
|
9701
|
-
|
|
9719
|
+
this.applyPinKeyboardMode(y), (S = y.querySelector("#__crossx-close-btn")) == null || S.addEventListener("click", f), Pe(y, g, f, m, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, l), p.addEventListener("click", (E) => {
|
|
9720
|
+
E.target === p && f();
|
|
9702
9721
|
});
|
|
9703
9722
|
});
|
|
9704
9723
|
}
|
|
@@ -9735,7 +9754,7 @@ class Ps {
|
|
|
9735
9754
|
return new Promise((t) => {
|
|
9736
9755
|
var p;
|
|
9737
9756
|
K();
|
|
9738
|
-
const { overlay: s, startCountdown: o } =
|
|
9757
|
+
const { overlay: s, startCountdown: o } = Ss(this.tokens, e, r);
|
|
9739
9758
|
z(s);
|
|
9740
9759
|
const n = () => {
|
|
9741
9760
|
l(), s.remove();
|
|
@@ -10089,20 +10108,20 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10089
10108
|
m,
|
|
10090
10109
|
() => i.appName
|
|
10091
10110
|
);
|
|
10092
|
-
const y = new fe(s, l),
|
|
10111
|
+
const y = new fe(s, l), S = new Ps(
|
|
10093
10112
|
i.theme ?? "light",
|
|
10094
10113
|
i.themeTokens,
|
|
10095
10114
|
i.displayDecimals,
|
|
10096
10115
|
i.pinKeyboard
|
|
10097
|
-
),
|
|
10098
|
-
|
|
10116
|
+
), E = new Ns(
|
|
10117
|
+
S,
|
|
10099
10118
|
() => {
|
|
10100
10119
|
var O;
|
|
10101
10120
|
return (O = g == null ? void 0 : g.getRNBridge) == null ? void 0 : O.call(g);
|
|
10102
10121
|
},
|
|
10103
10122
|
() => typeof window < "u" ? window.location.origin : "http://localhost",
|
|
10104
10123
|
f
|
|
10105
|
-
), A = e != null && e.wrapConfirmation ? e.wrapConfirmation(
|
|
10124
|
+
), A = e != null && e.wrapConfirmation ? e.wrapConfirmation(E) : E, T = new Le(
|
|
10106
10125
|
t,
|
|
10107
10126
|
s,
|
|
10108
10127
|
n,
|