@nexus-cross/crossx-sdk-core 2.3.10-beta.5 → 2.3.10-beta.7
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 +13 -0
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/ports/OAuthPort.d.ts +9 -0
- package/dist/core/types/internal.d.ts +2 -0
- package/dist/core/utils/walletBrowser.d.ts +61 -0
- package/dist/crossx.global +92 -92
- package/dist/index.cjs +79 -79
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1035 -938
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createRemoteJWKSet as
|
|
2
|
-
import { secp256k1 as
|
|
3
|
-
import { keccak_256 as
|
|
4
|
-
import { bytesToHex as
|
|
1
|
+
import { createRemoteJWKSet as Tt, jwtVerify as Rt, decodeJwt as Ct } from "jose";
|
|
2
|
+
import { secp256k1 as Pt } from "@noble/curves/secp256k1.js";
|
|
3
|
+
import { keccak_256 as Xe } from "@noble/hashes/sha3.js";
|
|
4
|
+
import { bytesToHex as Nt } from "@noble/hashes/utils.js";
|
|
5
5
|
var d = /* @__PURE__ */ ((i) => (i.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", i.AUTH_FAILED = "AUTH_FAILED", i.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", i.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", i.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", i.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", i.SESSION_EXPIRED = "SESSION_EXPIRED", i.OAUTH_POPUP_BLOCKED = "OAUTH_POPUP_BLOCKED", i.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", i.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", i.WALLET_ALREADY_EXISTS = "WALLET_ALREADY_EXISTS", i.ADDRESS_LIMIT_EXCEEDED = "ADDRESS_LIMIT_EXCEEDED", i.SIGN_FAILED = "SIGN_FAILED", i.SIGN_REJECTED = "SIGN_REJECTED", i.TX_FAILED = "TX_FAILED", i.TX_REJECTED = "TX_REJECTED", i.BROADCAST_FAILED = "BROADCAST_FAILED", i.USER_REJECTED = "USER_REJECTED", i.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", i.NETWORK_ERROR = "NETWORK_ERROR", i.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", i.INVALID_CHAIN = "INVALID_CHAIN", i.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", i.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", i.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", i.SIGNATURE_FAILED = "SIGNATURE_FAILED", i.TRANSACTION_FAILED = "TRANSACTION_FAILED", i.PREPARE_FAILED = "PREPARE_FAILED", i.PREPARE_EXPIRED = "PREPARE_EXPIRED", i.PREPARE_MISMATCH = "PREPARE_MISMATCH", i.MIGRATION_FAILED = "MIGRATION_FAILED", i.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", i.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", i.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", i.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", i.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", i.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", i.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", i.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", i.INVALID_APP_TYPE = "INVALID_APP_TYPE", i.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", i.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", i.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", i.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", i.PIN_NOT_SET = "PIN_NOT_SET", i.PIN_WRONG = "PIN_WRONG", i.PIN_INVALID = "PIN_INVALID", i.PIN_REPEATED_PATTERN = "PIN_REPEATED_PATTERN", i.PIN_CANCELLED = "PIN_CANCELLED", i.EXTERNAL_WALLET_REQUESTED = "EXTERNAL_WALLET_REQUESTED", i.PIN_LOCKED = "PIN_LOCKED", i.HMAC_REQUIRED = "HMAC_REQUIRED", i.HMAC_VERIFICATION_FAILED = "HMAC_VERIFICATION_FAILED", i.WITHDRAW_FAILED = "WITHDRAW_FAILED", i.USER_NOT_FOUND = "USER_NOT_FOUND", i.RN_BRIDGE_NOT_AVAILABLE = "RN_BRIDGE_NOT_AVAILABLE", i.RN_BRIDGE_HANDSHAKE_FAILED = "RN_BRIDGE_HANDSHAKE_FAILED", i.RN_NATIVE_SESSION_EXPIRED = "RN_NATIVE_SESSION_EXPIRED", i.INVALID_CONFIG = "INVALID_CONFIG", i.UNKNOWN_ERROR = "UNKNOWN_ERROR", i))(d || {});
|
|
6
|
-
class
|
|
6
|
+
class _ extends Error {
|
|
7
7
|
constructor(e, r, t) {
|
|
8
|
-
super(r), this.code = e, this.details = t, this.name = "CROSSxError", Object.setPrototypeOf(this,
|
|
8
|
+
super(r), this.code = e, this.details = t, this.name = "CROSSxError", Object.setPrototypeOf(this, _.prototype);
|
|
9
9
|
}
|
|
10
10
|
toJSON() {
|
|
11
11
|
return {
|
|
@@ -16,25 +16,25 @@ class h extends Error {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const Ot = 2e3, Je = 6e4, Lt = 1e3, Dt = 1e4, Mt = "0x77359400", Ze = "0x3B9ACA00", Qe = 130, We = 6, et = 18, tt = 3e4, $t = 5 * 60 * 1e3, Ft = 30 * 1e3, De = 100, Bt = "crossx-sdk-js/2.3.10-beta.7", He = "ONEwallet";
|
|
20
20
|
var ge = /* @__PURE__ */ ((i) => (i.MetaMask = "io.metamask", i.Binance = "com.binance.wallet", i.CROSSx = "crossx", i))(ge || {});
|
|
21
|
-
const
|
|
21
|
+
const Ut = {
|
|
22
22
|
"io.metamask": "MetaMask",
|
|
23
23
|
"com.binance.wallet": "Binance Wallet",
|
|
24
|
-
crossx:
|
|
25
|
-
},
|
|
24
|
+
crossx: He
|
|
25
|
+
}, Wt = [
|
|
26
26
|
"crossx",
|
|
27
27
|
"io.metamask",
|
|
28
28
|
"com.binance.wallet"
|
|
29
29
|
/* Binance */
|
|
30
30
|
];
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function Ht(i) {
|
|
32
|
+
return Ut[i] ?? i;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return Array.isArray(i.connectOtherWallets) && i.connectOtherWallets.length > 0 ? [...i.connectOtherWallets] : i.showConnectOtherWallets === !0 ? [
|
|
34
|
+
function Gt(i) {
|
|
35
|
+
return Array.isArray(i.connectOtherWallets) && i.connectOtherWallets.length > 0 ? [...i.connectOtherWallets] : i.showConnectOtherWallets === !0 ? [...Wt] : [];
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const Ae = {
|
|
38
38
|
// ─── CROSS ────────────────────────────────────────────
|
|
39
39
|
CROSS_MAINNET: {
|
|
40
40
|
caipId: "eip155:612055",
|
|
@@ -83,20 +83,20 @@ const Se = {
|
|
|
83
83
|
rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
|
|
84
84
|
testnet: !0
|
|
85
85
|
}
|
|
86
|
-
},
|
|
87
|
-
Object.entries(
|
|
88
|
-
),
|
|
89
|
-
Object.values(
|
|
86
|
+
}, Zs = Object.fromEntries(
|
|
87
|
+
Object.entries(Ae).map(([i, e]) => [i, e.caipId])
|
|
88
|
+
), Kt = new Map(
|
|
89
|
+
Object.values(Ae).map((i) => [i.caipId, i])
|
|
90
90
|
);
|
|
91
91
|
new Map(
|
|
92
|
-
Object.values(
|
|
92
|
+
Object.values(Ae).map((i) => [i.chainId, i])
|
|
93
93
|
);
|
|
94
|
-
const
|
|
95
|
-
function
|
|
94
|
+
const Vt = { symbol: "", decimals: 18 };
|
|
95
|
+
function ke(i) {
|
|
96
96
|
var e;
|
|
97
|
-
return ((e =
|
|
97
|
+
return ((e = Kt.get(i)) == null ? void 0 : e.nativeCurrency) ?? Vt;
|
|
98
98
|
}
|
|
99
|
-
class
|
|
99
|
+
class zt {
|
|
100
100
|
constructor(e, r) {
|
|
101
101
|
this.sdk = e, this.chainId = r, this._listeners = /* @__PURE__ */ new Map();
|
|
102
102
|
}
|
|
@@ -125,7 +125,7 @@ class Ht {
|
|
|
125
125
|
}
|
|
126
126
|
case "personal_sign":
|
|
127
127
|
case "eth_sign":
|
|
128
|
-
throw new
|
|
128
|
+
throw new _(
|
|
129
129
|
d.NOT_IMPLEMENTED,
|
|
130
130
|
`${e}은(는) 아직 지원되지 않습니다. sdk.signMessage()를 직접 사용하세요.`
|
|
131
131
|
);
|
|
@@ -133,7 +133,7 @@ class Ht {
|
|
|
133
133
|
case "eth_signTypedData_v1":
|
|
134
134
|
case "eth_signTypedData_v3":
|
|
135
135
|
case "eth_signTypedData_v4":
|
|
136
|
-
throw new
|
|
136
|
+
throw new _(
|
|
137
137
|
d.NOT_IMPLEMENTED,
|
|
138
138
|
`${e}은(는) 아직 지원되지 않습니다. sdk.signTypedData() 또는 sdk.signTypedDataOffchain()을 직접 사용하세요.`
|
|
139
139
|
);
|
|
@@ -185,38 +185,38 @@ class Ht {
|
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
let
|
|
189
|
-
function
|
|
190
|
-
|
|
188
|
+
let Z = null;
|
|
189
|
+
function rt(i) {
|
|
190
|
+
Z = i;
|
|
191
191
|
}
|
|
192
192
|
const c = {
|
|
193
193
|
/** 빌드 모드와 무관하게 항상 출력되는 정보성 로그 (SDK 수명주기 등) */
|
|
194
194
|
info(...i) {
|
|
195
|
-
if (
|
|
196
|
-
|
|
195
|
+
if (Z) {
|
|
196
|
+
Z.log(...i);
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
console.log(...i);
|
|
200
200
|
},
|
|
201
201
|
log(...i) {
|
|
202
|
-
if (
|
|
203
|
-
|
|
202
|
+
if (Z) {
|
|
203
|
+
Z.log(...i);
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
206
|
},
|
|
207
207
|
warn(...i) {
|
|
208
|
-
if (
|
|
209
|
-
|
|
208
|
+
if (Z) {
|
|
209
|
+
Z.warn(...i);
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
212
|
},
|
|
213
213
|
error(...i) {
|
|
214
|
-
if (
|
|
215
|
-
|
|
214
|
+
if (Z) {
|
|
215
|
+
Z.error(...i);
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
},
|
|
219
|
+
}, qt = {
|
|
220
220
|
// ── 공통 버튼 ────────────────────────────────────────────────
|
|
221
221
|
confirm: "확인",
|
|
222
222
|
cancel: "취소",
|
|
@@ -338,7 +338,7 @@ const c = {
|
|
|
338
338
|
session_alert_apple_account: "Apple 계정",
|
|
339
339
|
session_alert_sign_out_button: "로그아웃",
|
|
340
340
|
session_alert_sign_in_again_button: "다시 로그인"
|
|
341
|
-
},
|
|
341
|
+
}, ut = {
|
|
342
342
|
// ── Common buttons ───────────────────────────────────────────
|
|
343
343
|
confirm: "Confirm",
|
|
344
344
|
cancel: "Cancel",
|
|
@@ -383,7 +383,7 @@ const c = {
|
|
|
383
383
|
label_including_fees: "(including fees)",
|
|
384
384
|
label_primary_type: "Primary Type",
|
|
385
385
|
// ── Login selector modal ─────────────────────────────────────
|
|
386
|
-
login_selector_title:
|
|
386
|
+
login_selector_title: He,
|
|
387
387
|
login_selector_subtitle: "Sign in instantly with your social account",
|
|
388
388
|
login_selector_google: "Sign in with Google",
|
|
389
389
|
login_selector_apple: "Sign in with Apple",
|
|
@@ -459,22 +459,22 @@ For security, you must continue with the same account.`,
|
|
|
459
459
|
session_alert_apple_account: "Apple account",
|
|
460
460
|
session_alert_sign_out_button: "Sign out",
|
|
461
461
|
session_alert_sign_in_again_button: "Sign in again"
|
|
462
|
-
},
|
|
463
|
-
ko:
|
|
464
|
-
en:
|
|
462
|
+
}, jt = {
|
|
463
|
+
ko: qt,
|
|
464
|
+
en: ut
|
|
465
465
|
};
|
|
466
|
-
function
|
|
467
|
-
return
|
|
466
|
+
function Q(i = "en", e) {
|
|
467
|
+
return jt[i] ?? ut;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Yt(i) {
|
|
470
470
|
return i === "ko" || i === "en" ? i : typeof navigator < "u" && (navigator.language ?? "").toLowerCase().startsWith("ko") ? "ko" : "en";
|
|
471
471
|
}
|
|
472
|
-
const
|
|
472
|
+
const st = "crossx_access_token", it = "crossx_refresh_token", ot = "crossx_user_info", Ee = class Ee {
|
|
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;
|
|
476
|
-
const
|
|
477
|
-
this.STORAGE_KEY_ACCESS_TOKEN = `crossx_${
|
|
476
|
+
const h = e.projectId;
|
|
477
|
+
this.STORAGE_KEY_ACCESS_TOKEN = `crossx_${h}_access_token`, this.STORAGE_KEY_REFRESH_TOKEN = `crossx_${h}_refresh_token`, this.STORAGE_KEY_USER = `crossx_${h}_user_info`, this.STORAGE_KEY_RN_BRIDGE_SESSION = `crossx_${h}_rn_bridge_session`;
|
|
478
478
|
}
|
|
479
479
|
get useCookieAuth() {
|
|
480
480
|
return this.config.authMode === "cookie";
|
|
@@ -557,7 +557,7 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
557
557
|
checkResponseError(e, r) {
|
|
558
558
|
const t = this.extractResponseErrorCode(e);
|
|
559
559
|
if (t)
|
|
560
|
-
throw new
|
|
560
|
+
throw new _(
|
|
561
561
|
d.AUTH_FAILED,
|
|
562
562
|
`${r} 실패 (코드 ${t.code}): ${t.message}`
|
|
563
563
|
);
|
|
@@ -568,20 +568,24 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
568
568
|
const s = e == null ? void 0 : e.provider;
|
|
569
569
|
let o = "/login";
|
|
570
570
|
s === "google" ? o = "/google" : s === "apple" && (o = "/apple");
|
|
571
|
-
const { oauthServiceUrl: n } = this.config,
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
571
|
+
const { oauthServiceUrl: n, legacyOauthServiceUrl: a } = this.config, l = Yt(this.getLocale()), p = (g) => {
|
|
572
|
+
const f = `${g}${o}`, m = f.includes("?") ? "&" : "?";
|
|
573
|
+
return `${f}${m}locale=${l}`;
|
|
574
|
+
}, h = p(n), u = a ? p(a) : void 0;
|
|
575
|
+
c.log(`[CROSSx] OAuth 팝업 열기 (${s || "일반"} 로그인)`), c.log(`[CROSSx] Auth URL: ${h}`);
|
|
576
|
+
const x = await this.oauth.openAuth({
|
|
577
|
+
authUrl: h,
|
|
578
|
+
...u ? { legacyAuthUrl: u } : {},
|
|
575
579
|
expectedOrigin: new URL(n).origin
|
|
576
580
|
});
|
|
577
|
-
r =
|
|
581
|
+
r = x.token, t = x.email, c.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", r.length, ")"), t && c.log("[CROSSx] OAuth 콜백 email:", t);
|
|
578
582
|
} catch (s) {
|
|
579
583
|
c.error("[CROSSx] SignIn 에러 (OAuth 단계):", s);
|
|
580
584
|
const o = s instanceof Error ? s.message : "Sign in failed";
|
|
581
|
-
throw /팝업|popup/i.test(o) ? new
|
|
585
|
+
throw /팝업|popup/i.test(o) ? new _(
|
|
582
586
|
d.OAUTH_POPUP_BLOCKED,
|
|
583
587
|
o
|
|
584
|
-
) : new
|
|
588
|
+
) : new _(d.AUTH_FAILED, o);
|
|
585
589
|
}
|
|
586
590
|
return this.processFirebaseToken(r, t);
|
|
587
591
|
}
|
|
@@ -629,21 +633,21 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
629
633
|
);
|
|
630
634
|
let l, p;
|
|
631
635
|
try {
|
|
632
|
-
const
|
|
633
|
-
p = e.provider ?? ((t =
|
|
634
|
-
const u = ((s =
|
|
635
|
-
l =
|
|
636
|
+
const h = this.crypto.decodeJWT(e.idToken);
|
|
637
|
+
p = e.provider ?? ((t = h.firebase) == null ? void 0 : t.sign_in_provider);
|
|
638
|
+
const u = ((s = h.firebase) == null ? void 0 : s.identities) ?? {};
|
|
639
|
+
l = h.email ?? ((o = u.email) == null ? void 0 : o[0]), c.log("[CROSSx] RN Bridge Firebase token 정보 — provider:", p, "email:", l ?? "(없음)");
|
|
636
640
|
} catch {
|
|
637
641
|
c.warn("[CROSSx] RN Bridge Firebase token에서 정보 추출 실패");
|
|
638
642
|
}
|
|
639
643
|
if (a) {
|
|
640
|
-
const
|
|
641
|
-
if (!
|
|
642
|
-
throw new
|
|
644
|
+
const h = await this.crypto.verifyJWT(a);
|
|
645
|
+
if (!h.valid)
|
|
646
|
+
throw new _(
|
|
643
647
|
d.AUTH_FAILED,
|
|
644
648
|
"Access token 검증 실패"
|
|
645
649
|
);
|
|
646
|
-
const u =
|
|
650
|
+
const u = h.payload;
|
|
647
651
|
r = {
|
|
648
652
|
id: u.sub,
|
|
649
653
|
email: u.email ?? l,
|
|
@@ -651,7 +655,7 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
651
655
|
providerSub: e.providerSub
|
|
652
656
|
}, this.tokenStore.set(a), await this.storage.set(this.STORAGE_KEY_RN_BRIDGE_SESSION, !0), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, a), c.log("[CROSSx] RN Bridge — access_token 저장 (refresh_token 제외)")), c.log("[CROSSx] 사용자 정보 — id:", r.id, "email:", r.email ?? "(없음)"), await this.storage.set(this.STORAGE_KEY_USER, r);
|
|
653
657
|
} else
|
|
654
|
-
throw new
|
|
658
|
+
throw new _(
|
|
655
659
|
d.AUTH_FAILED,
|
|
656
660
|
"Access token 교환 실패"
|
|
657
661
|
);
|
|
@@ -674,7 +678,7 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
674
678
|
var o, n, a, l, p;
|
|
675
679
|
let t, s = !1;
|
|
676
680
|
try {
|
|
677
|
-
const { authApiUrl:
|
|
681
|
+
const { authApiUrl: h } = this.config, { accessToken: u, refreshToken: x } = await this.exchangeFirebaseToken(e, h);
|
|
678
682
|
let g, f, m;
|
|
679
683
|
try {
|
|
680
684
|
const S = this.crypto.decodeJWT(e);
|
|
@@ -718,10 +722,10 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
718
722
|
c.log("[CROSSx] 사용자 정보 — id:", t.id, "email:", t.email ?? "(없음)");
|
|
719
723
|
const y = this.useCookieAuth ? { id: t.id, email: t.email, signInProvider: t.signInProvider, providerSub: t.providerSub } : t;
|
|
720
724
|
await this.storage.set(this.STORAGE_KEY_USER, y), await this.clearStoredRNBridgeSession(), c.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
|
|
721
|
-
} catch (
|
|
722
|
-
return c.error("[CROSSx] SignIn 에러 (토큰 교환 단계):",
|
|
725
|
+
} catch (h) {
|
|
726
|
+
return c.error("[CROSSx] SignIn 에러 (토큰 교환 단계):", h), {
|
|
723
727
|
success: !1,
|
|
724
|
-
error:
|
|
728
|
+
error: h instanceof Error ? h.message : "Sign in failed"
|
|
725
729
|
};
|
|
726
730
|
}
|
|
727
731
|
return c.log("[CROSSx][Migration Phase 1] 로그인 완료, 지갑 로드 시작 — userId:", t.id), this.loadWallet(t, s);
|
|
@@ -747,7 +751,7 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
747
751
|
} catch (a) {
|
|
748
752
|
c.error("[CROSSx] RN Bridge 토큰 교환 fetch 실패 — url:", t, "error:", a);
|
|
749
753
|
const l = a instanceof Error ? a.message : String(a);
|
|
750
|
-
throw new
|
|
754
|
+
throw new _(
|
|
751
755
|
d.AUTH_FAILED,
|
|
752
756
|
`RN Bridge 토큰 교환 네트워크 실패: ${l}`,
|
|
753
757
|
a
|
|
@@ -758,7 +762,7 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
758
762
|
this.checkResponseError(o, "RN Bridge token exchange");
|
|
759
763
|
const n = this.extractAccessToken(o);
|
|
760
764
|
if (!n)
|
|
761
|
-
throw new
|
|
765
|
+
throw new _(
|
|
762
766
|
d.AUTH_FAILED,
|
|
763
767
|
"RN Bridge 토큰 교환 응답에서 access_token을 찾을 수 없습니다"
|
|
764
768
|
);
|
|
@@ -786,7 +790,7 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
786
790
|
if (t && !a)
|
|
787
791
|
return c.log("[CROSSx] Cookie 모드 — 로그인 성공 (JWT는 HttpOnly 쿠키)"), {};
|
|
788
792
|
if (!a)
|
|
789
|
-
throw new
|
|
793
|
+
throw new _(
|
|
790
794
|
d.AUTH_FAILED,
|
|
791
795
|
"토큰 교환 응답에서 access_token을 찾을 수 없습니다"
|
|
792
796
|
);
|
|
@@ -890,7 +894,7 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
890
894
|
return c.warn("[CROSSx] restoreSession — 지갑 로드 실패 (세션은 유지):", t), { success: !0, user: r, tokenSignatureVerified: !1 };
|
|
891
895
|
}
|
|
892
896
|
} catch (e) {
|
|
893
|
-
const r = e instanceof
|
|
897
|
+
const r = e instanceof _ && e.code === d.SESSION_EXPIRED;
|
|
894
898
|
return c.log("[CROSSx] restoreSession —", r ? "세션 만료 (재로그인 필요)" : "세션 복원 실패:", e), this.tokenStore.clear(), r && (this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN), await this.storage.remove(this.STORAGE_KEY_USER)), null;
|
|
895
899
|
}
|
|
896
900
|
}
|
|
@@ -902,8 +906,8 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
902
906
|
async _doSilentRefresh(e) {
|
|
903
907
|
const { authApiUrl: r } = this.config, t = this.useCookieAuth, s = `${r}/cross-auth/social/refresh/simple`, o = {};
|
|
904
908
|
if (!t) {
|
|
905
|
-
const
|
|
906
|
-
|
|
909
|
+
const h = this.tokenStore.get() ?? "";
|
|
910
|
+
h && (o.access_token = h), e && (o.refresh_token = e);
|
|
907
911
|
}
|
|
908
912
|
const n = await this.transport.request({
|
|
909
913
|
url: s,
|
|
@@ -915,9 +919,9 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
915
919
|
c.log("[CROSSx] silentRefresh 응답 — status:", n.status);
|
|
916
920
|
const a = n.data, l = this.extractResponseErrorCode(a);
|
|
917
921
|
if (l) {
|
|
918
|
-
const
|
|
919
|
-
throw new
|
|
920
|
-
|
|
922
|
+
const h = Ee.REFRESH_RELOGIN_CODES.has(l.code);
|
|
923
|
+
throw new _(
|
|
924
|
+
h ? d.SESSION_EXPIRED : d.AUTH_FAILED,
|
|
921
925
|
`토큰 갱신 실패 (코드 ${l.code}): ${l.message}`
|
|
922
926
|
);
|
|
923
927
|
}
|
|
@@ -927,11 +931,11 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
927
931
|
return;
|
|
928
932
|
}
|
|
929
933
|
if (!p)
|
|
930
|
-
throw new
|
|
934
|
+
throw new _(d.AUTH_FAILED, "토큰 자동 갱신 실패: 응답에 토큰이 없습니다");
|
|
931
935
|
if (this.tokenStore.set(p), !t) {
|
|
932
936
|
await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, p);
|
|
933
|
-
const
|
|
934
|
-
|
|
937
|
+
const h = this.extractRefreshToken(a);
|
|
938
|
+
h && this.config.secureStorageAvailable !== !1 && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, h);
|
|
935
939
|
}
|
|
936
940
|
return c.log("[CROSSx] silentRefresh 성공"), p;
|
|
937
941
|
}
|
|
@@ -954,7 +958,7 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
954
958
|
);
|
|
955
959
|
return s ? (this.tokenStore.set(s), await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, s), await this.storage.set(this.STORAGE_KEY_RN_BRIDGE_SESSION, !0), c.log("[CROSSx] RN Bridge access token 갱신 성공"), !0) : !1;
|
|
956
960
|
} catch (t) {
|
|
957
|
-
throw t instanceof
|
|
961
|
+
throw t instanceof _ && t.code === d.RN_NATIVE_SESSION_EXPIRED && (c.warn("[CROSSx] RN Native session expired — 재로그인 필요"), this.tokenStore.clear(), await this.storage.remove(this.STORAGE_KEY_USER)), t;
|
|
958
962
|
}
|
|
959
963
|
}
|
|
960
964
|
if (this.useCookieAuth)
|
|
@@ -962,7 +966,7 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
962
966
|
const e = await this.storage.get(this.STORAGE_KEY_REFRESH_TOKEN);
|
|
963
967
|
return e ? !!await this.silentRefresh(e) : (c.warn("[CROSSx] refreshAccessToken: refresh_token 없음 — 갱신 불가"), !1);
|
|
964
968
|
} catch (e) {
|
|
965
|
-
return e instanceof
|
|
969
|
+
return e instanceof _ && e.code === d.SESSION_EXPIRED ? (c.warn("[CROSSx] refreshAccessToken: 세션 만료 — 재로그인 필요"), this.tokenStore.clear(), this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN)) : c.warn("[CROSSx] refreshAccessToken 실패:", e), !1;
|
|
966
970
|
}
|
|
967
971
|
}
|
|
968
972
|
/**
|
|
@@ -1010,13 +1014,13 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
1010
1014
|
if (!this._migrated) {
|
|
1011
1015
|
this._migrated = !0;
|
|
1012
1016
|
try {
|
|
1013
|
-
const e = await this.storage.get(
|
|
1017
|
+
const e = await this.storage.get(ot);
|
|
1014
1018
|
if (!e || await this.storage.get(this.STORAGE_KEY_USER)) return;
|
|
1015
1019
|
await this.storage.set(this.STORAGE_KEY_USER, e);
|
|
1016
|
-
const t = await this.storage.get(
|
|
1020
|
+
const t = await this.storage.get(st);
|
|
1017
1021
|
t && await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, t);
|
|
1018
|
-
const s = await this.storage.get(
|
|
1019
|
-
s && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, s), await this.storage.remove(
|
|
1022
|
+
const s = await this.storage.get(it);
|
|
1023
|
+
s && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, s), await this.storage.remove(ot), await this.storage.remove(st), await this.storage.remove(it), c.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
|
|
1020
1024
|
} catch (e) {
|
|
1021
1025
|
c.warn("[CROSSx] 스토리지 키 마이그레이션 실패:", e);
|
|
1022
1026
|
}
|
|
@@ -1040,10 +1044,10 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
1040
1044
|
} else
|
|
1041
1045
|
c.log("[CROSSx] getOrCreateWallet 직접 호출 (폴백)"), t = (await this.walletProvider.getOrCreateWallet(e.id)).address, c.log("[CROSSx] 지갑 로드 완료 — address:", t);
|
|
1042
1046
|
} catch (o) {
|
|
1043
|
-
if (o instanceof
|
|
1047
|
+
if (o instanceof _ && o.code === d.MIGRATION_BACKUP_EXISTS)
|
|
1044
1048
|
c.log("[CROSSx] MIGRATION_BACKUP_EXISTS 감지 → needsMigration = true"), s = !0;
|
|
1045
1049
|
else {
|
|
1046
|
-
if (o instanceof
|
|
1050
|
+
if (o instanceof _ && (o.code === d.PROJECT_NOT_REGISTERED || o.code === d.PROJECT_ID_MISSING || o.code === d.ORIGIN_NOT_ALLOWED))
|
|
1047
1051
|
throw c.error("[CROSSx] 프로젝트 설정 에러:", o.message), o;
|
|
1048
1052
|
c.warn("[CROSSx] 지갑 상태 확인 실패 (로그인은 유지):", o);
|
|
1049
1053
|
}
|
|
@@ -1051,9 +1055,9 @@ const et = "crossx_access_token", tt = "crossx_refresh_token", rt = "crossx_user
|
|
|
1051
1055
|
return c.log("[CROSSx] loadWallet 결과 — address:", t, "needsMigration:", s), { success: !0, address: t, user: e, needsMigration: s, tokenSignatureVerified: r };
|
|
1052
1056
|
}
|
|
1053
1057
|
};
|
|
1054
|
-
|
|
1055
|
-
let
|
|
1056
|
-
class
|
|
1058
|
+
Ee.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
|
|
1059
|
+
let Me = Ee;
|
|
1060
|
+
class Xt {
|
|
1057
1061
|
constructor(e, r, t) {
|
|
1058
1062
|
this.config = e, this.storage = r, this.tokenStore = t;
|
|
1059
1063
|
const s = e.projectId;
|
|
@@ -1063,13 +1067,13 @@ class Vt {
|
|
|
1063
1067
|
this.tokenStore.clear(), this.config.authMode !== "cookie" && (await this.storage.remove(this.STORAGE_KEY_ACCESS_TOKEN), await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN)), await this.storage.remove(this.STORAGE_KEY_USER), await this.storage.clear();
|
|
1064
1068
|
}
|
|
1065
1069
|
}
|
|
1066
|
-
class
|
|
1070
|
+
class Jt {
|
|
1067
1071
|
constructor(e, r) {
|
|
1068
1072
|
this.storage = e, this.walletProvider = r;
|
|
1069
1073
|
}
|
|
1070
1074
|
async execute(e, r) {
|
|
1071
1075
|
if (!this.walletProvider.migrateWallet)
|
|
1072
|
-
throw new
|
|
1076
|
+
throw new _(
|
|
1073
1077
|
d.NOT_IMPLEMENTED,
|
|
1074
1078
|
"현재 환경에서는 마이그레이션이 지원되지 않습니다"
|
|
1075
1079
|
);
|
|
@@ -1080,7 +1084,7 @@ class qt {
|
|
|
1080
1084
|
};
|
|
1081
1085
|
}
|
|
1082
1086
|
}
|
|
1083
|
-
class
|
|
1087
|
+
class xt {
|
|
1084
1088
|
constructor() {
|
|
1085
1089
|
this.encryptedBytes = null, this.xorKey = null;
|
|
1086
1090
|
}
|
|
@@ -1121,7 +1125,7 @@ class pt {
|
|
|
1121
1125
|
return this.encryptedBytes !== null;
|
|
1122
1126
|
}
|
|
1123
1127
|
}
|
|
1124
|
-
class
|
|
1128
|
+
class Zt {
|
|
1125
1129
|
constructor(e, r) {
|
|
1126
1130
|
this.chainRegistry = e, this.transport = r, this._nextId = 1;
|
|
1127
1131
|
}
|
|
@@ -1146,14 +1150,14 @@ class jt {
|
|
|
1146
1150
|
body: o
|
|
1147
1151
|
})).data;
|
|
1148
1152
|
if (a != null && a.error)
|
|
1149
|
-
throw new
|
|
1153
|
+
throw new _(
|
|
1150
1154
|
d.UNKNOWN_ERROR,
|
|
1151
1155
|
`RPC 오류 [${e}] (${t}): ${a.error.message} (코드: ${a.error.code})`
|
|
1152
1156
|
);
|
|
1153
1157
|
return a == null ? void 0 : a.result;
|
|
1154
1158
|
}
|
|
1155
1159
|
}
|
|
1156
|
-
class
|
|
1160
|
+
class Qt {
|
|
1157
1161
|
constructor() {
|
|
1158
1162
|
this.listeners = /* @__PURE__ */ new Map();
|
|
1159
1163
|
}
|
|
@@ -1176,7 +1180,7 @@ class Yt {
|
|
|
1176
1180
|
this.listeners.clear();
|
|
1177
1181
|
}
|
|
1178
1182
|
}
|
|
1179
|
-
function
|
|
1183
|
+
function er() {
|
|
1180
1184
|
var e;
|
|
1181
1185
|
if (typeof globalThis < "u" && ((e = globalThis.crypto) != null && e.getRandomValues)) {
|
|
1182
1186
|
const r = new Uint8Array(16);
|
|
@@ -1222,7 +1226,7 @@ class j {
|
|
|
1222
1226
|
*/
|
|
1223
1227
|
async initialize() {
|
|
1224
1228
|
if (await j.waitForBridgeReady(5e3) || c.warn("[RNBridge] Bridge did not become ready in time"), this.bridge = j.getBridge(), !this.bridge)
|
|
1225
|
-
throw new
|
|
1229
|
+
throw new _(
|
|
1226
1230
|
d.AUTH_NOT_INITIALIZED,
|
|
1227
1231
|
"RN Bridge not available in this environment"
|
|
1228
1232
|
);
|
|
@@ -1230,7 +1234,7 @@ class j {
|
|
|
1230
1234
|
throw c.error("[RNBridge] Bridge.handshake is not a function", {
|
|
1231
1235
|
handshake: typeof this.bridge.handshake,
|
|
1232
1236
|
bridge: Object.keys(this.bridge)
|
|
1233
|
-
}), new
|
|
1237
|
+
}), new _(
|
|
1234
1238
|
d.AUTH_NOT_INITIALIZED,
|
|
1235
1239
|
"RN Bridge handshake method not available"
|
|
1236
1240
|
);
|
|
@@ -1245,8 +1249,8 @@ class j {
|
|
|
1245
1249
|
*/
|
|
1246
1250
|
async handshake() {
|
|
1247
1251
|
if (!this.bridge)
|
|
1248
|
-
throw new
|
|
1249
|
-
const e =
|
|
1252
|
+
throw new _(d.AUTH_NOT_INITIALIZED, "Bridge not initialized");
|
|
1253
|
+
const e = er(), r = Date.now(), t = {
|
|
1250
1254
|
version: 1,
|
|
1251
1255
|
appId: this.config.appId,
|
|
1252
1256
|
appVersion: this.config.appVersion,
|
|
@@ -1261,7 +1265,7 @@ class j {
|
|
|
1261
1265
|
try {
|
|
1262
1266
|
const s = await this.bridge.handshake(t);
|
|
1263
1267
|
if (!s.activated)
|
|
1264
|
-
throw new
|
|
1268
|
+
throw new _(
|
|
1265
1269
|
d.AUTH_FAILED,
|
|
1266
1270
|
"Bridge handshake rejected by native"
|
|
1267
1271
|
);
|
|
@@ -1278,7 +1282,7 @@ class j {
|
|
|
1278
1282
|
walletProvider: a
|
|
1279
1283
|
};
|
|
1280
1284
|
} catch (s) {
|
|
1281
|
-
throw c.error("[RNBridge] Handshake failed", s), new
|
|
1285
|
+
throw c.error("[RNBridge] Handshake failed", s), new _(
|
|
1282
1286
|
d.AUTH_FAILED,
|
|
1283
1287
|
"Bridge handshake failed",
|
|
1284
1288
|
s
|
|
@@ -1290,25 +1294,25 @@ class j {
|
|
|
1290
1294
|
*/
|
|
1291
1295
|
async requestFirebaseIdToken() {
|
|
1292
1296
|
if (!this.bridge)
|
|
1293
|
-
throw new
|
|
1297
|
+
throw new _(d.AUTH_NOT_INITIALIZED, "Bridge not initialized");
|
|
1294
1298
|
this.assertActive();
|
|
1295
1299
|
try {
|
|
1296
1300
|
const e = await this.bridge.requestFirebaseIdToken(), r = (e.expiresAt - Date.now()) / 1e3;
|
|
1297
1301
|
if (r < 60)
|
|
1298
|
-
throw new
|
|
1302
|
+
throw new _(
|
|
1299
1303
|
d.AUTH_TOKEN_EXPIRED,
|
|
1300
1304
|
"Firebase ID token TTL too short",
|
|
1301
1305
|
{ ttlSeconds: r }
|
|
1302
1306
|
);
|
|
1303
1307
|
return this.touchActivity(), e;
|
|
1304
1308
|
} catch (e) {
|
|
1305
|
-
if (e instanceof
|
|
1309
|
+
if (e instanceof _) throw e;
|
|
1306
1310
|
const r = e instanceof Error ? e.message : String(e);
|
|
1307
|
-
throw r.includes("USER_REJECTED") || r.toLowerCase().includes("rejected") ? new
|
|
1311
|
+
throw r.includes("USER_REJECTED") || r.toLowerCase().includes("rejected") ? new _(
|
|
1308
1312
|
d.USER_REJECTED,
|
|
1309
1313
|
"Firebase ID token request rejected by user",
|
|
1310
1314
|
e
|
|
1311
|
-
) : (c.error("[RNBridge] Firebase token request failed", e), new
|
|
1315
|
+
) : (c.error("[RNBridge] Firebase token request failed", e), new _(
|
|
1312
1316
|
d.AUTH_FAILED,
|
|
1313
1317
|
"Firebase token request failed",
|
|
1314
1318
|
e
|
|
@@ -1320,18 +1324,18 @@ class j {
|
|
|
1320
1324
|
*/
|
|
1321
1325
|
async requestFreshFirebaseIdToken() {
|
|
1322
1326
|
if (!this.bridge)
|
|
1323
|
-
throw new
|
|
1327
|
+
throw new _(d.AUTH_NOT_INITIALIZED, "Bridge not initialized");
|
|
1324
1328
|
this.assertActive();
|
|
1325
1329
|
try {
|
|
1326
1330
|
const e = await this.bridge.requestFreshFirebaseIdToken();
|
|
1327
1331
|
if ((e.expiresAt - Date.now()) / 1e3 < 60)
|
|
1328
|
-
throw new
|
|
1332
|
+
throw new _(
|
|
1329
1333
|
d.AUTH_TOKEN_EXPIRED,
|
|
1330
1334
|
"Firebase ID token TTL too short"
|
|
1331
1335
|
);
|
|
1332
1336
|
return this.touchActivity(), e;
|
|
1333
1337
|
} catch (e) {
|
|
1334
|
-
throw e instanceof
|
|
1338
|
+
throw e instanceof _ ? e : (c.error("[RNBridge] Fresh Firebase token request failed", e), new _(
|
|
1335
1339
|
d.SESSION_EXPIRED,
|
|
1336
1340
|
"Native session expired. Please sign in again in the app.",
|
|
1337
1341
|
e
|
|
@@ -1347,27 +1351,27 @@ class j {
|
|
|
1347
1351
|
async requestFirebaseIdTokenForSessionRestore() {
|
|
1348
1352
|
var e;
|
|
1349
1353
|
if (!this.bridge)
|
|
1350
|
-
throw new
|
|
1354
|
+
throw new _(d.AUTH_NOT_INITIALIZED, "Bridge not initialized");
|
|
1351
1355
|
if (!((e = this.context) != null && e.isActivated))
|
|
1352
|
-
throw new
|
|
1356
|
+
throw new _(
|
|
1353
1357
|
d.AUTH_NOT_INITIALIZED,
|
|
1354
1358
|
"Bridge not activated"
|
|
1355
1359
|
);
|
|
1356
1360
|
if (!this.bridge.requestFirebaseIdTokenForSessionRestore)
|
|
1357
|
-
throw new
|
|
1361
|
+
throw new _(
|
|
1358
1362
|
d.RN_NATIVE_SESSION_EXPIRED,
|
|
1359
1363
|
"Native session restore bridge method is not available"
|
|
1360
1364
|
);
|
|
1361
1365
|
try {
|
|
1362
1366
|
const r = await this.bridge.requestFirebaseIdTokenForSessionRestore();
|
|
1363
1367
|
if ((r.expiresAt - Date.now()) / 1e3 < 60)
|
|
1364
|
-
throw new
|
|
1368
|
+
throw new _(
|
|
1365
1369
|
d.AUTH_TOKEN_EXPIRED,
|
|
1366
1370
|
"Firebase ID token TTL too short"
|
|
1367
1371
|
);
|
|
1368
1372
|
return r;
|
|
1369
1373
|
} catch (r) {
|
|
1370
|
-
throw r instanceof
|
|
1374
|
+
throw r instanceof _ ? r : (c.warn("[RNBridge] Session restore Firebase token request failed", r), new _(
|
|
1371
1375
|
d.RN_NATIVE_SESSION_EXPIRED,
|
|
1372
1376
|
"Native bridge session restore failed. Please sign in again.",
|
|
1373
1377
|
r
|
|
@@ -1404,15 +1408,16 @@ class j {
|
|
|
1404
1408
|
*/
|
|
1405
1409
|
assertActive() {
|
|
1406
1410
|
if (!this.isActive())
|
|
1407
|
-
throw this.context = null, new
|
|
1411
|
+
throw this.context = null, new _(
|
|
1408
1412
|
d.SESSION_EXPIRED,
|
|
1409
1413
|
"RN Bridge session expired. Please sign in again in the app."
|
|
1410
1414
|
);
|
|
1411
1415
|
}
|
|
1412
1416
|
}
|
|
1413
|
-
const
|
|
1417
|
+
const pe = {
|
|
1414
1418
|
production: {
|
|
1415
1419
|
oauthServiceUrl: "https://one-wallet-oauth.onechain.nexus",
|
|
1420
|
+
legacyOauthServiceUrl: "https://cross-wallet-oauth.crosstoken.io",
|
|
1416
1421
|
authApiUrl: "https://cross-auth.crosstoken.io",
|
|
1417
1422
|
walletGatewayUrl: "https://embedded-wallet-gateway.crosstoken.io/api/v1",
|
|
1418
1423
|
portraitBaseUrl: "https://portrait.crosstoken.io",
|
|
@@ -1421,6 +1426,7 @@ const de = {
|
|
|
1421
1426
|
staging: {
|
|
1422
1427
|
// TEST(one-wallet-rebrand): onechain 호스트 검증용 임시 변경 (원복 예정)
|
|
1423
1428
|
oauthServiceUrl: "https://stg-one-wallet-oauth.onechain.nexus",
|
|
1429
|
+
legacyOauthServiceUrl: "https://stg-cross-wallet-oauth.crosstoken.io",
|
|
1424
1430
|
authApiUrl: "https://stg-cross-auth.crosstoken.io",
|
|
1425
1431
|
walletGatewayUrl: "https://stg-embedded-wallet-gateway.crosstoken.io/api/v1",
|
|
1426
1432
|
portraitBaseUrl: "https://dev-portrait.crosstoken.io",
|
|
@@ -1428,14 +1434,15 @@ const de = {
|
|
|
1428
1434
|
},
|
|
1429
1435
|
development: {
|
|
1430
1436
|
oauthServiceUrl: "https://dev-one-wallet-oauth.onechain.nexus",
|
|
1437
|
+
legacyOauthServiceUrl: "https://dev-cross-wallet-oauth.crosstoken.io",
|
|
1431
1438
|
authApiUrl: "https://dev-cross-auth.crosstoken.io",
|
|
1432
1439
|
walletGatewayUrl: "https://dev-embedded-wallet-gateway.crosstoken.io/api/v1",
|
|
1433
1440
|
portraitBaseUrl: "https://dev-portrait.crosstoken.io",
|
|
1434
1441
|
contentsBaseUrl: "https://stg-contents.crosstoken.io/frontend/common/app-launcher"
|
|
1435
1442
|
}
|
|
1436
1443
|
};
|
|
1437
|
-
function
|
|
1438
|
-
const e = i.environment, r = e && e in
|
|
1444
|
+
function tr(i) {
|
|
1445
|
+
const e = i.environment, r = e && e in pe ? pe[e] : null;
|
|
1439
1446
|
if (!r)
|
|
1440
1447
|
return null;
|
|
1441
1448
|
const t = i.overrides;
|
|
@@ -1446,80 +1453,80 @@ function Jt(i) {
|
|
|
1446
1453
|
typeof n == "string" && n.trim() !== "" && (s[o] = n);
|
|
1447
1454
|
return s;
|
|
1448
1455
|
}
|
|
1449
|
-
function
|
|
1456
|
+
function Ge() {
|
|
1450
1457
|
try {
|
|
1451
1458
|
if (typeof __CROSSX_CONFIG__ < "u") {
|
|
1452
|
-
const i = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e =
|
|
1459
|
+
const i = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = tr(i);
|
|
1453
1460
|
if (e) return e;
|
|
1454
1461
|
}
|
|
1455
1462
|
} catch {
|
|
1456
1463
|
}
|
|
1457
1464
|
try {
|
|
1458
1465
|
const i = process.env.NEXT_PUBLIC_CROSSX_ENVIRONMENT;
|
|
1459
|
-
if (i && i in
|
|
1460
|
-
return
|
|
1466
|
+
if (i && i in pe)
|
|
1467
|
+
return pe[i];
|
|
1461
1468
|
} catch {
|
|
1462
1469
|
}
|
|
1463
|
-
return
|
|
1470
|
+
return pe.production;
|
|
1464
1471
|
}
|
|
1465
|
-
function
|
|
1472
|
+
function gt(i) {
|
|
1466
1473
|
let e = i.length;
|
|
1467
1474
|
for (; e > 0 && i.charCodeAt(e - 1) === 48; ) e--;
|
|
1468
1475
|
return i.slice(0, e);
|
|
1469
1476
|
}
|
|
1470
|
-
function
|
|
1477
|
+
function rr(i, e = We) {
|
|
1471
1478
|
if (!i || i === "0x0" || i === "0x") return "0";
|
|
1472
1479
|
try {
|
|
1473
1480
|
const r = BigInt(i);
|
|
1474
1481
|
if (r === 0n) return "0";
|
|
1475
|
-
const t = 10n ** BigInt(
|
|
1482
|
+
const t = 10n ** BigInt(et), s = r / t, n = (r % t).toString().padStart(et, "0"), a = gt(n).slice(0, e);
|
|
1476
1483
|
return a ? `${s}.${a}` : `${s}`;
|
|
1477
1484
|
} catch {
|
|
1478
1485
|
return "?";
|
|
1479
1486
|
}
|
|
1480
1487
|
}
|
|
1481
|
-
function
|
|
1488
|
+
function ye(i, e, r, t = We) {
|
|
1482
1489
|
if (!(!i || i === "0x" || i === "0x0"))
|
|
1483
1490
|
try {
|
|
1484
1491
|
const s = BigInt(i);
|
|
1485
1492
|
if (s === 0n) return;
|
|
1486
|
-
const o = 10n ** BigInt(r), n = s / o, l = (s % o).toString().padStart(r, "0"), p =
|
|
1493
|
+
const o = 10n ** BigInt(r), n = s / o, l = (s % o).toString().padStart(r, "0"), p = gt(l.slice(0, t));
|
|
1487
1494
|
return `${p ? `${n}.${p}` : `${n}`} ${e}`;
|
|
1488
1495
|
} catch {
|
|
1489
1496
|
return;
|
|
1490
1497
|
}
|
|
1491
1498
|
}
|
|
1492
|
-
function
|
|
1499
|
+
function sr(i) {
|
|
1493
1500
|
const e = i.startsWith("0x") ? i.slice(2) : i;
|
|
1494
1501
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
1495
|
-
throw new
|
|
1502
|
+
throw new _(
|
|
1496
1503
|
d.SIGNATURE_FAILED,
|
|
1497
1504
|
"유효하지 않은 서명: 올바른 hex 문자열이 아닙니다"
|
|
1498
1505
|
);
|
|
1499
|
-
if (e.length !==
|
|
1500
|
-
throw new
|
|
1506
|
+
if (e.length !== Qe)
|
|
1507
|
+
throw new _(
|
|
1501
1508
|
d.SIGNATURE_FAILED,
|
|
1502
|
-
`서명 길이가 유효하지 않습니다: ${
|
|
1509
|
+
`서명 길이가 유효하지 않습니다: ${Qe} hex 문자(65 바이트) 예상, 현재 ${e.length}`
|
|
1503
1510
|
);
|
|
1504
1511
|
}
|
|
1505
|
-
function
|
|
1512
|
+
function ir(i) {
|
|
1506
1513
|
const e = i.startsWith("0x") ? i.slice(2) : i;
|
|
1507
1514
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
1508
|
-
throw new
|
|
1515
|
+
throw new _(
|
|
1509
1516
|
d.SIGNATURE_FAILED,
|
|
1510
1517
|
"유효하지 않은 서명된 트랜잭션: 올바른 hex 문자열이 아닙니다"
|
|
1511
1518
|
);
|
|
1512
1519
|
if (e.length < 2)
|
|
1513
|
-
throw new
|
|
1520
|
+
throw new _(
|
|
1514
1521
|
d.SIGNATURE_FAILED,
|
|
1515
1522
|
"유효하지 않은 서명된 트랜잭션: 너무 짧습니다"
|
|
1516
1523
|
);
|
|
1517
1524
|
}
|
|
1518
|
-
function
|
|
1519
|
-
const r =
|
|
1525
|
+
function or(i, e) {
|
|
1526
|
+
const r = nr(e);
|
|
1520
1527
|
if (i === "0") {
|
|
1521
1528
|
if (r !== void 0 && r !== 0)
|
|
1522
|
-
throw new
|
|
1529
|
+
throw new _(
|
|
1523
1530
|
d.TYPED_DATA_CHAIN_ID_MISMATCH,
|
|
1524
1531
|
`오프체인 서명(chainId=0)에서는 typedData.domain.chainId가 없거나 0이어야 합니다. 현재 값: ${r}`
|
|
1525
1532
|
);
|
|
@@ -1529,18 +1536,18 @@ function tr(i, e) {
|
|
|
1529
1536
|
if (t) {
|
|
1530
1537
|
const s = Number(t[1]);
|
|
1531
1538
|
if (r === void 0)
|
|
1532
|
-
throw new
|
|
1539
|
+
throw new _(
|
|
1533
1540
|
d.TYPED_DATA_CHAIN_ID_MISMATCH,
|
|
1534
1541
|
`온체인 서명(${i})에서는 typedData.domain.chainId가 반드시 있어야 합니다`
|
|
1535
1542
|
);
|
|
1536
1543
|
if (r !== s)
|
|
1537
|
-
throw new
|
|
1544
|
+
throw new _(
|
|
1538
1545
|
d.TYPED_DATA_CHAIN_ID_MISMATCH,
|
|
1539
1546
|
`typedData.domain.chainId (${r})가 chainId (${i}, 예상값: ${s})와 일치하지 않습니다`
|
|
1540
1547
|
);
|
|
1541
1548
|
}
|
|
1542
1549
|
}
|
|
1543
|
-
function
|
|
1550
|
+
function nr(i) {
|
|
1544
1551
|
if (i == null || typeof i != "object") return;
|
|
1545
1552
|
const e = i.domain;
|
|
1546
1553
|
if (e == null || typeof e != "object") return;
|
|
@@ -1549,7 +1556,7 @@ function rr(i) {
|
|
|
1549
1556
|
const t = Number(r);
|
|
1550
1557
|
return Number.isFinite(t) ? t : void 0;
|
|
1551
1558
|
}
|
|
1552
|
-
class
|
|
1559
|
+
class de {
|
|
1553
1560
|
constructor(e) {
|
|
1554
1561
|
this.deps = e, this.verifyPinMutex = null;
|
|
1555
1562
|
}
|
|
@@ -1557,7 +1564,7 @@ class le {
|
|
|
1557
1564
|
if (this.deps.pinStore.has()) return;
|
|
1558
1565
|
const e = await this.deps.confirmation.showPinSetupPrompt();
|
|
1559
1566
|
if (!e)
|
|
1560
|
-
throw new
|
|
1567
|
+
throw new _(
|
|
1561
1568
|
d.PIN_CANCELLED,
|
|
1562
1569
|
"사용자가 PIN 설정을 취소했습니다"
|
|
1563
1570
|
);
|
|
@@ -1569,7 +1576,7 @@ class le {
|
|
|
1569
1576
|
e && this.deps.pinStore.clear();
|
|
1570
1577
|
const r = await this.deps.confirmation.showPinInputPrompt({ errorMessage: e });
|
|
1571
1578
|
if (!r)
|
|
1572
|
-
throw new
|
|
1579
|
+
throw new _(
|
|
1573
1580
|
d.PIN_CANCELLED,
|
|
1574
1581
|
"사용자가 PIN 입력을 취소했습니다"
|
|
1575
1582
|
);
|
|
@@ -1587,10 +1594,10 @@ class le {
|
|
|
1587
1594
|
return;
|
|
1588
1595
|
}
|
|
1589
1596
|
let o, n;
|
|
1590
|
-
this.verifyPinMutex = new Promise((
|
|
1591
|
-
o =
|
|
1597
|
+
this.verifyPinMutex = new Promise((h, u) => {
|
|
1598
|
+
o = h, n = u;
|
|
1592
1599
|
});
|
|
1593
|
-
const a =
|
|
1600
|
+
const a = Q(this.deps.getLocale() ?? "en");
|
|
1594
1601
|
try {
|
|
1595
1602
|
if (typeof this.deps.walletProvider.verifyPin != "function") {
|
|
1596
1603
|
const u = await this.deps.confirmation.showPinInputPrompt({
|
|
@@ -1601,14 +1608,14 @@ class le {
|
|
|
1601
1608
|
maxAttempts: s
|
|
1602
1609
|
});
|
|
1603
1610
|
if (!u)
|
|
1604
|
-
throw new
|
|
1611
|
+
throw new _(
|
|
1605
1612
|
d.PIN_CANCELLED,
|
|
1606
1613
|
"사용자가 PIN 입력을 취소했습니다"
|
|
1607
1614
|
);
|
|
1608
1615
|
this.deps.pinStore.set(u), c.log("[CROSSx] PIN 캐시 완료 (verifyPin 미지원, 로컬 전용)"), o();
|
|
1609
1616
|
return;
|
|
1610
1617
|
}
|
|
1611
|
-
const
|
|
1618
|
+
const h = await this.deps.confirmation.showPinInputPrompt({
|
|
1612
1619
|
verifyMode: !0,
|
|
1613
1620
|
errorMessage: e,
|
|
1614
1621
|
lockExpiresAt: r,
|
|
@@ -1619,47 +1626,47 @@ class le {
|
|
|
1619
1626
|
try {
|
|
1620
1627
|
return await this.deps.walletProvider.verifyPin(u) ? (c.log("[CROSSx] PIN 서버 검증 완료 (verify-password)"), { ok: !0 }) : (this.deps.pinStore.clear(), { ok: !1, error: a.pin_input_error });
|
|
1621
1628
|
} catch (x) {
|
|
1622
|
-
if (this.deps.pinStore.clear(), x instanceof
|
|
1629
|
+
if (this.deps.pinStore.clear(), x instanceof _) {
|
|
1623
1630
|
if (x.code === d.PIN_WRONG)
|
|
1624
1631
|
return { ok: !1, error: a.pin_input_error };
|
|
1625
1632
|
if (x.code === d.PIN_INVALID)
|
|
1626
1633
|
return { ok: !1, error: x.message };
|
|
1627
1634
|
if (x.code === d.PIN_LOCKED)
|
|
1628
|
-
return
|
|
1635
|
+
return de.buildPinLockedResult(x, a);
|
|
1629
1636
|
}
|
|
1630
1637
|
throw x;
|
|
1631
1638
|
}
|
|
1632
1639
|
}
|
|
1633
1640
|
});
|
|
1634
|
-
if (!
|
|
1635
|
-
throw new
|
|
1641
|
+
if (!h)
|
|
1642
|
+
throw new _(
|
|
1636
1643
|
d.PIN_CANCELLED,
|
|
1637
1644
|
"사용자가 PIN 입력을 취소했습니다"
|
|
1638
1645
|
);
|
|
1639
|
-
this.deps.pinStore.set(
|
|
1640
|
-
} catch (
|
|
1641
|
-
if (
|
|
1642
|
-
const u =
|
|
1646
|
+
this.deps.pinStore.set(h), c.log("[CROSSx] PIN 갱신 완료 (verify 모달 닫힘)"), o();
|
|
1647
|
+
} catch (h) {
|
|
1648
|
+
if (h instanceof _ && (h.code === d.AUTH_NOT_AUTHENTICATED || h.code === d.AUTH_TOKEN_EXPIRED || h.code === d.SESSION_EXPIRED) && h.code !== d.SESSION_EXPIRED) {
|
|
1649
|
+
const u = Q(this.deps.getLocale() ?? "en"), x = this.deps.getUserEmail();
|
|
1643
1650
|
if (await this.deps.confirmation.showSessionAlert({
|
|
1644
1651
|
title: u.session_alert_title,
|
|
1645
1652
|
message: u.alert_session_expired,
|
|
1646
1653
|
email: x ? this.deps.maskEmail(x, u.session_alert_apple_account) : void 0
|
|
1647
1654
|
}) === "signin-again" && (await this.deps.signInAgain()).success)
|
|
1648
|
-
throw n(
|
|
1655
|
+
throw n(h), h;
|
|
1649
1656
|
}
|
|
1650
|
-
throw n(
|
|
1657
|
+
throw n(h), h;
|
|
1651
1658
|
} finally {
|
|
1652
1659
|
this.verifyPinMutex = null;
|
|
1653
1660
|
}
|
|
1654
1661
|
}
|
|
1655
1662
|
async withPinRetry(e) {
|
|
1656
|
-
const r =
|
|
1663
|
+
const r = Q(this.deps.getLocale() ?? "en");
|
|
1657
1664
|
let t = null;
|
|
1658
1665
|
try {
|
|
1659
1666
|
return await e();
|
|
1660
1667
|
} catch (s) {
|
|
1661
|
-
if (s instanceof
|
|
1662
|
-
if (t =
|
|
1668
|
+
if (s instanceof _) {
|
|
1669
|
+
if (t = de.parsePinError(s, r), !t) throw s;
|
|
1663
1670
|
} else
|
|
1664
1671
|
throw s;
|
|
1665
1672
|
}
|
|
@@ -1673,7 +1680,7 @@ class le {
|
|
|
1673
1680
|
try {
|
|
1674
1681
|
return await e();
|
|
1675
1682
|
} catch (s) {
|
|
1676
|
-
if (s instanceof
|
|
1683
|
+
if (s instanceof _ && (t = de.parsePinError(s, r), t))
|
|
1677
1684
|
continue;
|
|
1678
1685
|
throw s;
|
|
1679
1686
|
}
|
|
@@ -1698,13 +1705,13 @@ class le {
|
|
|
1698
1705
|
return null;
|
|
1699
1706
|
}
|
|
1700
1707
|
static buildPinLockedResult(e, r) {
|
|
1701
|
-
const t =
|
|
1708
|
+
const t = de.parsePinError(e, r);
|
|
1702
1709
|
if (!t) return { ok: !1, error: e.message };
|
|
1703
1710
|
const { errorMessage: s, ...o } = t;
|
|
1704
1711
|
return { ok: !1, error: s, ...o };
|
|
1705
1712
|
}
|
|
1706
1713
|
}
|
|
1707
|
-
class
|
|
1714
|
+
class ar {
|
|
1708
1715
|
constructor(e) {
|
|
1709
1716
|
this.deps = e;
|
|
1710
1717
|
}
|
|
@@ -1715,7 +1722,7 @@ class sr {
|
|
|
1715
1722
|
if (!await this.deps.confirmation.requestConfirmation(
|
|
1716
1723
|
e.confirmation
|
|
1717
1724
|
))
|
|
1718
|
-
throw new
|
|
1725
|
+
throw new _(d.USER_REJECTED, e.rejectedMessage);
|
|
1719
1726
|
return this.deps.pinOrchestrator.withPinRetry(async () => {
|
|
1720
1727
|
let o;
|
|
1721
1728
|
return this.deps.walletProvider.prepare && (o = (await this.deps.walletProvider.prepare(
|
|
@@ -1725,10 +1732,10 @@ class sr {
|
|
|
1725
1732
|
});
|
|
1726
1733
|
}
|
|
1727
1734
|
}
|
|
1728
|
-
function
|
|
1735
|
+
function cr(i) {
|
|
1729
1736
|
return i === "google" || i === "apple";
|
|
1730
1737
|
}
|
|
1731
|
-
class
|
|
1738
|
+
class lr {
|
|
1732
1739
|
constructor(e) {
|
|
1733
1740
|
this.deps = e;
|
|
1734
1741
|
}
|
|
@@ -1739,7 +1746,7 @@ class or {
|
|
|
1739
1746
|
this.deps.setRecoveringSession(!0);
|
|
1740
1747
|
try {
|
|
1741
1748
|
this.deps.setAuthenticated(!1), this.deps.clearTokenStore();
|
|
1742
|
-
const s =
|
|
1749
|
+
const s = cr(e.loginType) ? { provider: e.loginType } : void 0;
|
|
1743
1750
|
let o;
|
|
1744
1751
|
try {
|
|
1745
1752
|
o = await this.deps.executeSignIn(s);
|
|
@@ -1754,7 +1761,7 @@ class or {
|
|
|
1754
1761
|
"[CROSSx] signInAgain: providerSub/userId 불일치 — 잘못된 계정으로 로그인됨"
|
|
1755
1762
|
), await this.deps.executeSignOut().catch(() => {
|
|
1756
1763
|
});
|
|
1757
|
-
const p =
|
|
1764
|
+
const p = Q(this.deps.getLocale() ?? "en");
|
|
1758
1765
|
return await this.deps.showSessionAlert({
|
|
1759
1766
|
title: p.session_alert_title,
|
|
1760
1767
|
message: p.alert_different_account,
|
|
@@ -1779,8 +1786,8 @@ class or {
|
|
|
1779
1786
|
try {
|
|
1780
1787
|
return await e();
|
|
1781
1788
|
} catch (r) {
|
|
1782
|
-
const t =
|
|
1783
|
-
if (r instanceof
|
|
1789
|
+
const t = Q(this.deps.getLocale() ?? "en"), { userEmail: s } = this.deps.getSessionSnapshot(), o = s ? this.deps.maskEmail(s, t.session_alert_apple_account) : void 0;
|
|
1790
|
+
if (r instanceof _ && r.code === d.WITHDRAW_FAILED) {
|
|
1784
1791
|
if (c.warn("[CROSSx] WITHDRAW_FAILED — 로컬 인증 초기화"), await this.deps.showSessionAlert({
|
|
1785
1792
|
title: t.session_alert_title,
|
|
1786
1793
|
message: t.alert_account_withdrawn,
|
|
@@ -1789,7 +1796,7 @@ class or {
|
|
|
1789
1796
|
return e();
|
|
1790
1797
|
throw this.deps.clearAuthState(), r;
|
|
1791
1798
|
}
|
|
1792
|
-
if (r instanceof
|
|
1799
|
+
if (r instanceof _ && r.code === d.WALLET_NOT_FOUND) {
|
|
1793
1800
|
if (c.warn("[CROSSx] WALLET_NOT_FOUND — 로컬 인증 초기화"), await this.deps.showSessionAlert({
|
|
1794
1801
|
title: t.session_alert_title,
|
|
1795
1802
|
message: t.alert_wallet_not_found,
|
|
@@ -1798,20 +1805,20 @@ class or {
|
|
|
1798
1805
|
return e();
|
|
1799
1806
|
throw this.deps.clearAuthState(), r;
|
|
1800
1807
|
}
|
|
1801
|
-
if (!(r instanceof
|
|
1808
|
+
if (!(r instanceof _) || r.code !== d.SESSION_EXPIRED)
|
|
1802
1809
|
throw r;
|
|
1803
1810
|
if (c.warn("[CROSSx] SESSION_EXPIRED 감지 — 자동 재인증 시도"), await this.deps.showSessionAlert({
|
|
1804
1811
|
title: t.session_alert_title,
|
|
1805
1812
|
message: t.alert_session_expired,
|
|
1806
1813
|
email: o
|
|
1807
1814
|
}) === "signout")
|
|
1808
|
-
throw this.deps.clearAuthState(), new
|
|
1815
|
+
throw this.deps.clearAuthState(), new _(
|
|
1809
1816
|
d.SESSION_EXPIRED,
|
|
1810
1817
|
"세션이 만료되었습니다. 다시 로그인해 주세요."
|
|
1811
1818
|
);
|
|
1812
1819
|
const a = await this.signInAgain();
|
|
1813
1820
|
if (!a.success)
|
|
1814
|
-
throw new
|
|
1821
|
+
throw new _(
|
|
1815
1822
|
d.SESSION_EXPIRED,
|
|
1816
1823
|
a.error ?? "세션이 만료되었습니다. 다시 로그인해 주세요."
|
|
1817
1824
|
);
|
|
@@ -1819,7 +1826,7 @@ class or {
|
|
|
1819
1826
|
}
|
|
1820
1827
|
}
|
|
1821
1828
|
}
|
|
1822
|
-
class
|
|
1829
|
+
class dr {
|
|
1823
1830
|
constructor(e) {
|
|
1824
1831
|
this.deps = e;
|
|
1825
1832
|
}
|
|
@@ -1853,11 +1860,11 @@ class nr {
|
|
|
1853
1860
|
"[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):",
|
|
1854
1861
|
l.address
|
|
1855
1862
|
);
|
|
1856
|
-
const
|
|
1863
|
+
const h = !!r && !!t && l.address.toLowerCase() === r.toLowerCase();
|
|
1857
1864
|
this.deps.setActiveWallet(
|
|
1858
1865
|
l.address,
|
|
1859
1866
|
l.index,
|
|
1860
|
-
|
|
1867
|
+
h ? { walletName: t } : void 0
|
|
1861
1868
|
);
|
|
1862
1869
|
return;
|
|
1863
1870
|
}
|
|
@@ -1866,7 +1873,7 @@ class nr {
|
|
|
1866
1873
|
c.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", a.address), this.deps.setActiveWallet(a.address, 0);
|
|
1867
1874
|
}
|
|
1868
1875
|
}
|
|
1869
|
-
class
|
|
1876
|
+
class pr {
|
|
1870
1877
|
constructor(e) {
|
|
1871
1878
|
this.deps = e;
|
|
1872
1879
|
}
|
|
@@ -1886,12 +1893,12 @@ class ar {
|
|
|
1886
1893
|
`[CROSSx][Migration Phase 4] PIN 입력 팝업 표시 (시도 #${o}/${n})`,
|
|
1887
1894
|
s ? `— 이전 메시지: ${s}` : ""
|
|
1888
1895
|
);
|
|
1889
|
-
const
|
|
1896
|
+
const h = await this.deps.confirmation.showRecoveryPinInputPrompt({
|
|
1890
1897
|
errorMessage: s,
|
|
1891
1898
|
attemptCount: o > 1 ? o - 1 : void 0,
|
|
1892
1899
|
maxAttempts: n
|
|
1893
1900
|
});
|
|
1894
|
-
if (
|
|
1901
|
+
if (h === null)
|
|
1895
1902
|
return c.log("[CROSSx][Migration Phase 4] 사용자가 PIN 입력을 취소함 → 종료"), null;
|
|
1896
1903
|
c.log(
|
|
1897
1904
|
"[CROSSx][Migration Phase 4] PIN 입력 완료 — verify-recovery-pin API 호출"
|
|
@@ -1899,17 +1906,17 @@ class ar {
|
|
|
1899
1906
|
try {
|
|
1900
1907
|
const u = await ((p = (l = this.deps.walletProvider).verifyRecoveryPin) == null ? void 0 : p.call(
|
|
1901
1908
|
l,
|
|
1902
|
-
|
|
1909
|
+
h,
|
|
1903
1910
|
e
|
|
1904
1911
|
));
|
|
1905
1912
|
if (!u) {
|
|
1906
1913
|
c.log(
|
|
1907
1914
|
"[CROSSx][Migration Phase 4] verifyRecoveryPin 미지원 — PIN 검증 생략"
|
|
1908
|
-
), a =
|
|
1915
|
+
), a = h;
|
|
1909
1916
|
break;
|
|
1910
1917
|
}
|
|
1911
1918
|
if (u.valid) {
|
|
1912
|
-
c.log("[CROSSx][Migration Phase 4] PIN 검증 성공"), a =
|
|
1919
|
+
c.log("[CROSSx][Migration Phase 4] PIN 검증 성공"), a = h;
|
|
1913
1920
|
break;
|
|
1914
1921
|
}
|
|
1915
1922
|
const x = u.pinStatus;
|
|
@@ -1929,12 +1936,12 @@ class ar {
|
|
|
1929
1936
|
`[CROSSx][Migration Phase 4] PIN 불일치 (시도 ${o}/${n})`
|
|
1930
1937
|
), s = "Incorrect PIN.";
|
|
1931
1938
|
} catch (u) {
|
|
1932
|
-
if (!(u instanceof
|
|
1939
|
+
if (!(u instanceof _)) throw u;
|
|
1933
1940
|
if (u.code === d.SESSION_EXPIRED) {
|
|
1934
1941
|
c.warn(
|
|
1935
1942
|
"[CROSSx][Migration Phase 4] 세션 만료 — 재로그인 후 PIN 입력 재시도"
|
|
1936
1943
|
);
|
|
1937
|
-
const x =
|
|
1944
|
+
const x = Q(this.deps.getLocale() ?? "en"), g = this.deps.getUserEmail();
|
|
1938
1945
|
if (await this.deps.confirmation.showSessionAlert({
|
|
1939
1946
|
title: x.session_alert_title,
|
|
1940
1947
|
message: x.alert_session_expired,
|
|
@@ -1978,21 +1985,21 @@ class ar {
|
|
|
1978
1985
|
);
|
|
1979
1986
|
try {
|
|
1980
1987
|
await this.deps.pinOrchestrator.ensurePinSetup();
|
|
1981
|
-
const
|
|
1988
|
+
const h = await this.deps.executeMigrate(a, e);
|
|
1982
1989
|
return c.log(
|
|
1983
1990
|
"[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:",
|
|
1984
|
-
|
|
1985
|
-
),
|
|
1986
|
-
} catch (
|
|
1987
|
-
if (
|
|
1991
|
+
h.address
|
|
1992
|
+
), h;
|
|
1993
|
+
} catch (h) {
|
|
1994
|
+
if (h instanceof _ && h.code === d.MIGRATION_FAILED)
|
|
1988
1995
|
return c.warn(
|
|
1989
1996
|
"[CROSSx][Migration Phase 5] migrate PIN 불일치 (경합) — 처음부터 재시도"
|
|
1990
1997
|
), this.handleMigrationFlow(e);
|
|
1991
|
-
if (
|
|
1998
|
+
if (h instanceof _ && h.code === d.SESSION_EXPIRED) {
|
|
1992
1999
|
c.warn(
|
|
1993
2000
|
"[CROSSx][Migration Phase 5] 세션 만료 — 재로그인 후 마이그레이션 재시도"
|
|
1994
2001
|
);
|
|
1995
|
-
const u =
|
|
2002
|
+
const u = Q(this.deps.getLocale() ?? "en"), x = this.deps.getUserEmail();
|
|
1996
2003
|
if (await this.deps.confirmation.showSessionAlert({
|
|
1997
2004
|
title: u.session_alert_title,
|
|
1998
2005
|
message: u.alert_session_expired,
|
|
@@ -2017,13 +2024,13 @@ class ar {
|
|
|
2017
2024
|
), m;
|
|
2018
2025
|
}
|
|
2019
2026
|
}
|
|
2020
|
-
throw this.deps.clearAuthState(),
|
|
2027
|
+
throw this.deps.clearAuthState(), h;
|
|
2021
2028
|
}
|
|
2022
|
-
throw c.error("[CROSSx][Migration Phase 5] 마이그레이션 실패 (복구 불가):",
|
|
2029
|
+
throw c.error("[CROSSx][Migration Phase 5] 마이그레이션 실패 (복구 불가):", h), h;
|
|
2023
2030
|
}
|
|
2024
2031
|
}
|
|
2025
2032
|
}
|
|
2026
|
-
class
|
|
2033
|
+
class hr {
|
|
2027
2034
|
constructor(e) {
|
|
2028
2035
|
this.deps = e;
|
|
2029
2036
|
}
|
|
@@ -2038,7 +2045,7 @@ class cr {
|
|
|
2038
2045
|
), o && c.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), n && c.log(
|
|
2039
2046
|
"[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별"
|
|
2040
2047
|
);
|
|
2041
|
-
const [
|
|
2048
|
+
const [h, u, x] = await Promise.all([
|
|
2042
2049
|
p ? this.deps.jsonRpcCall(
|
|
2043
2050
|
"eth_getTransactionCount",
|
|
2044
2051
|
[p, "pending"],
|
|
@@ -2047,10 +2054,10 @@ class cr {
|
|
|
2047
2054
|
o ? this.deps.estimateGas(e, r) : null,
|
|
2048
2055
|
n ? this.deps.getBaseFeePerGas(r) : null
|
|
2049
2056
|
]);
|
|
2050
|
-
if (p && (l.nonce = parseInt(
|
|
2057
|
+
if (p && (l.nonce = parseInt(h ?? "0x0", 16), c.log("[CROSSx] nonce 결과:", l.nonce)), o && (l.gasLimit = u, c.log("[CROSSx] estimateGas 결과:", l.gasLimit)), n) {
|
|
2051
2058
|
const g = x;
|
|
2052
2059
|
if (g) {
|
|
2053
|
-
const f =
|
|
2060
|
+
const f = Ze;
|
|
2054
2061
|
l.maxFeePerGas = `0x${(BigInt(g) + BigInt(f)).toString(16)}`, l.maxPriorityFeePerGas = f, c.log(
|
|
2055
2062
|
"[CROSSx] Dynamic 체인 감지 — baseFee:",
|
|
2056
2063
|
g,
|
|
@@ -2059,12 +2066,12 @@ class cr {
|
|
|
2059
2066
|
"maxPriorityFeePerGas: 1 Gwei"
|
|
2060
2067
|
);
|
|
2061
2068
|
} else
|
|
2062
|
-
l.gasPrice =
|
|
2069
|
+
l.gasPrice = Mt, c.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
|
|
2063
2070
|
}
|
|
2064
|
-
return !n && a && (l.maxPriorityFeePerGas =
|
|
2071
|
+
return !n && a && (l.maxPriorityFeePerGas = Ze, c.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), l;
|
|
2065
2072
|
}
|
|
2066
2073
|
}
|
|
2067
|
-
class
|
|
2074
|
+
class _r {
|
|
2068
2075
|
constructor(e) {
|
|
2069
2076
|
this.crypto = e;
|
|
2070
2077
|
}
|
|
@@ -2079,21 +2086,21 @@ class lr {
|
|
|
2079
2086
|
throw c.error("[CROSSx] 서명 검증 실패: 서명자 주소 불일치", {
|
|
2080
2087
|
expected: t,
|
|
2081
2088
|
recovered: s
|
|
2082
|
-
}), new
|
|
2089
|
+
}), new _(
|
|
2083
2090
|
d.SIGNATURE_SIGNER_MISMATCH,
|
|
2084
2091
|
`서명자 주소가 일치하지 않습니다: 예상 ${t}, 복원된 주소 ${s}`
|
|
2085
2092
|
);
|
|
2086
2093
|
c.log("[CROSSx] 서명 ecrecover 검증 성공");
|
|
2087
2094
|
} catch (s) {
|
|
2088
|
-
if (s instanceof
|
|
2095
|
+
if (s instanceof _) throw s;
|
|
2089
2096
|
c.warn("[CROSSx] ecrecover 검증 중 예외 (무시):", s);
|
|
2090
2097
|
}
|
|
2091
2098
|
}
|
|
2092
2099
|
}
|
|
2093
|
-
function
|
|
2100
|
+
function ur(i) {
|
|
2094
2101
|
return i ? i.includes("google") ? "google" : i.includes("apple") ? "apple" : i : null;
|
|
2095
2102
|
}
|
|
2096
|
-
class
|
|
2103
|
+
class xr {
|
|
2097
2104
|
constructor(e) {
|
|
2098
2105
|
this.deps = e;
|
|
2099
2106
|
}
|
|
@@ -2115,7 +2122,7 @@ class pr {
|
|
|
2115
2122
|
activeWalletIndex: 0,
|
|
2116
2123
|
userEmail: ((o = e.user) == null ? void 0 : o.email) ?? null,
|
|
2117
2124
|
providerSub: ((n = e.user) == null ? void 0 : n.providerSub) ?? null,
|
|
2118
|
-
loginType:
|
|
2125
|
+
loginType: ur(
|
|
2119
2126
|
(a = e.user) == null ? void 0 : a.signInProvider
|
|
2120
2127
|
),
|
|
2121
2128
|
tokenSignatureVerified: e.tokenSignatureVerified ?? !1
|
|
@@ -2145,7 +2152,7 @@ class pr {
|
|
|
2145
2152
|
});
|
|
2146
2153
|
}
|
|
2147
2154
|
}
|
|
2148
|
-
class
|
|
2155
|
+
class gr {
|
|
2149
2156
|
constructor(e) {
|
|
2150
2157
|
this.deps = e;
|
|
2151
2158
|
}
|
|
@@ -2153,7 +2160,7 @@ class _r {
|
|
|
2153
2160
|
const r = this.deps.getActiveWalletIndex(), t = this.deps.getActiveAddress();
|
|
2154
2161
|
if (e === void 0 || e === r) {
|
|
2155
2162
|
if (!t)
|
|
2156
|
-
throw new
|
|
2163
|
+
throw new _(
|
|
2157
2164
|
d.AUTH_NOT_AUTHENTICATED,
|
|
2158
2165
|
"활성 지갑 주소를 찾을 수 없습니다"
|
|
2159
2166
|
);
|
|
@@ -2164,26 +2171,26 @@ class _r {
|
|
|
2164
2171
|
)).address, index: e };
|
|
2165
2172
|
}
|
|
2166
2173
|
}
|
|
2167
|
-
class
|
|
2174
|
+
class fr {
|
|
2168
2175
|
constructor(e) {
|
|
2169
2176
|
this.deps = e;
|
|
2170
2177
|
}
|
|
2171
2178
|
ensureInitialized() {
|
|
2172
2179
|
if (!this.deps.isInitialized())
|
|
2173
|
-
throw new
|
|
2180
|
+
throw new _(
|
|
2174
2181
|
d.AUTH_NOT_INITIALIZED,
|
|
2175
2182
|
"SDK가 초기화되지 않았습니다. initialize()를 먼저 호출하세요."
|
|
2176
2183
|
);
|
|
2177
2184
|
}
|
|
2178
2185
|
ensureAuthenticated() {
|
|
2179
2186
|
if (this.ensureInitialized(), !this.deps.isAuthenticated())
|
|
2180
|
-
throw new
|
|
2187
|
+
throw new _(
|
|
2181
2188
|
d.AUTH_NOT_AUTHENTICATED,
|
|
2182
2189
|
"인증되지 않은 상태입니다. signIn()를 먼저 호출하세요."
|
|
2183
2190
|
);
|
|
2184
2191
|
}
|
|
2185
2192
|
}
|
|
2186
|
-
class
|
|
2193
|
+
class wr {
|
|
2187
2194
|
constructor(e) {
|
|
2188
2195
|
this.deps = e;
|
|
2189
2196
|
}
|
|
@@ -2191,7 +2198,7 @@ class ur {
|
|
|
2191
2198
|
var s, o;
|
|
2192
2199
|
const e = this.deps.getUserId();
|
|
2193
2200
|
if (!e)
|
|
2194
|
-
throw new
|
|
2201
|
+
throw new _(
|
|
2195
2202
|
d.AUTH_NOT_AUTHENTICATED,
|
|
2196
2203
|
"사용자 ID를 찾을 수 없습니다"
|
|
2197
2204
|
);
|
|
@@ -2206,7 +2213,7 @@ class ur {
|
|
|
2206
2213
|
const a = await this.deps.migrationOrchestrator.handleMigrationFlow(n);
|
|
2207
2214
|
if (a)
|
|
2208
2215
|
return this.deps.setActiveWallet(a.address, 0), { address: a.address };
|
|
2209
|
-
throw new
|
|
2216
|
+
throw new _(
|
|
2210
2217
|
d.MIGRATION_FAILED,
|
|
2211
2218
|
"사용자가 마이그레이션을 건너뛰었습니다"
|
|
2212
2219
|
);
|
|
@@ -2224,7 +2231,7 @@ class ur {
|
|
|
2224
2231
|
);
|
|
2225
2232
|
return this.deps.setActiveWallet(r.address, 0), c.log("[CROSSx] 지갑 준비 완료:", r.address), { address: r.address, migrated: !1 };
|
|
2226
2233
|
} catch (r) {
|
|
2227
|
-
if (r instanceof
|
|
2234
|
+
if (r instanceof _ && r.code === d.MIGRATION_BACKUP_EXISTS) {
|
|
2228
2235
|
const t = this.deps.getProviderSub() ?? e;
|
|
2229
2236
|
c.log(
|
|
2230
2237
|
"[CROSSx] MIGRATION_BACKUP_EXISTS (폴백) → 마이그레이션 UI 시작"
|
|
@@ -2234,7 +2241,7 @@ class ur {
|
|
|
2234
2241
|
);
|
|
2235
2242
|
if (s)
|
|
2236
2243
|
return this.deps.setActiveWallet(s.address, 0), { address: s.address, migrated: !0 };
|
|
2237
|
-
throw new
|
|
2244
|
+
throw new _(
|
|
2238
2245
|
d.MIGRATION_FAILED,
|
|
2239
2246
|
"사용자가 마이그레이션을 건너뛰었습니다"
|
|
2240
2247
|
);
|
|
@@ -2243,11 +2250,11 @@ class ur {
|
|
|
2243
2250
|
}
|
|
2244
2251
|
}
|
|
2245
2252
|
}
|
|
2246
|
-
function
|
|
2253
|
+
function nt(i, e) {
|
|
2247
2254
|
const r = i.replace(/\/$/, ""), t = e.startsWith("/") ? e : `/${e}`;
|
|
2248
2255
|
return `${r}/cross-auth${t}`;
|
|
2249
2256
|
}
|
|
2250
|
-
class
|
|
2257
|
+
class mr {
|
|
2251
2258
|
constructor(e) {
|
|
2252
2259
|
this.deps = e;
|
|
2253
2260
|
}
|
|
@@ -2263,27 +2270,27 @@ class xr {
|
|
|
2263
2270
|
*/
|
|
2264
2271
|
async registerTokenHistory(e, r, t) {
|
|
2265
2272
|
if (!(e != null && e.trim()))
|
|
2266
|
-
throw new
|
|
2273
|
+
throw new _(
|
|
2267
2274
|
d.TX_INVALID_PARAMS,
|
|
2268
2275
|
"invalid param chain_id"
|
|
2269
2276
|
);
|
|
2270
2277
|
if (!(r != null && r.trim()))
|
|
2271
|
-
throw new
|
|
2278
|
+
throw new _(
|
|
2272
2279
|
d.TX_INVALID_PARAMS,
|
|
2273
2280
|
"invalid param tx_hash"
|
|
2274
2281
|
);
|
|
2275
2282
|
const s = r.startsWith("0x") ? r : `0x${r}`;
|
|
2276
2283
|
if (!/^0x[0-9a-fA-F]{64}$/.test(s))
|
|
2277
|
-
throw new
|
|
2284
|
+
throw new _(
|
|
2278
2285
|
d.TX_INVALID_PARAMS,
|
|
2279
2286
|
"invalid param tx_hash"
|
|
2280
2287
|
);
|
|
2281
2288
|
if (!(t != null && t.trim()) || t.length > 64)
|
|
2282
|
-
throw new
|
|
2289
|
+
throw new _(
|
|
2283
2290
|
d.TX_INVALID_PARAMS,
|
|
2284
2291
|
"invalid param body"
|
|
2285
2292
|
);
|
|
2286
|
-
const o = this.deps.getApiBaseUrl(), n =
|
|
2293
|
+
const o = this.deps.getApiBaseUrl(), n = nt(o, `/v2/token-historical/${e}/${s}`), a = { clientVersion: t };
|
|
2287
2294
|
try {
|
|
2288
2295
|
c.log("[TokenHistory] Registering tx:", e, s);
|
|
2289
2296
|
const l = await this.deps.transport.request({
|
|
@@ -2296,7 +2303,7 @@ class xr {
|
|
|
2296
2303
|
});
|
|
2297
2304
|
l.status !== 200 && this.handleError(l.status, "register"), c.log("[TokenHistory] Successfully registered:", e, s);
|
|
2298
2305
|
} catch (l) {
|
|
2299
|
-
throw l instanceof
|
|
2306
|
+
throw l instanceof _ ? l : new _(
|
|
2300
2307
|
d.UNKNOWN_ERROR,
|
|
2301
2308
|
`Failed to register token history: ${l instanceof Error ? l.message : String(l)}`
|
|
2302
2309
|
);
|
|
@@ -2313,7 +2320,7 @@ class xr {
|
|
|
2313
2320
|
*/
|
|
2314
2321
|
async getTokenHistory(e) {
|
|
2315
2322
|
var s;
|
|
2316
|
-
const r = this.deps.getApiBaseUrl(), t = new URL(
|
|
2323
|
+
const r = this.deps.getApiBaseUrl(), t = new URL(nt(r, "/v2/token-historical"));
|
|
2317
2324
|
(e == null ? void 0 : e.lastTimestamp) !== void 0 && t.searchParams.append("last_timestamp", e.lastTimestamp.toString()), (e == null ? void 0 : e.lastTxIndex) !== void 0 && t.searchParams.append("last_tx_index", e.lastTxIndex.toString());
|
|
2318
2325
|
try {
|
|
2319
2326
|
c.log("[TokenHistory] Fetching token history");
|
|
@@ -2324,7 +2331,7 @@ class xr {
|
|
|
2324
2331
|
// 404에 대한 재시도는 클라이언트가 처리
|
|
2325
2332
|
});
|
|
2326
2333
|
if (o.status === 404)
|
|
2327
|
-
throw new
|
|
2334
|
+
throw new _(
|
|
2328
2335
|
d.UNKNOWN_ERROR,
|
|
2329
2336
|
"Transaction not found (404) — please retry"
|
|
2330
2337
|
);
|
|
@@ -2334,7 +2341,7 @@ class xr {
|
|
|
2334
2341
|
"items"
|
|
2335
2342
|
), o.data.rows || [];
|
|
2336
2343
|
} catch (o) {
|
|
2337
|
-
throw o instanceof
|
|
2344
|
+
throw o instanceof _ ? o : new _(
|
|
2338
2345
|
d.UNKNOWN_ERROR,
|
|
2339
2346
|
`Failed to fetch token history: ${o instanceof Error ? o.message : String(o)}`
|
|
2340
2347
|
);
|
|
@@ -2358,10 +2365,10 @@ class xr {
|
|
|
2358
2365
|
await this.registerTokenHistory(e, r, t);
|
|
2359
2366
|
return;
|
|
2360
2367
|
} catch (l) {
|
|
2361
|
-
if (l instanceof
|
|
2368
|
+
if (l instanceof _ && l.message.includes("404") && a < o - 1) {
|
|
2362
2369
|
c.log(
|
|
2363
2370
|
`[TokenHistory] Retry ${a + 1}/${o} (404 - tx not yet indexed)`
|
|
2364
|
-
), await new Promise((
|
|
2371
|
+
), await new Promise((h) => setTimeout(h, n));
|
|
2365
2372
|
continue;
|
|
2366
2373
|
}
|
|
2367
2374
|
throw l;
|
|
@@ -2385,20 +2392,20 @@ class xr {
|
|
|
2385
2392
|
code: d.UNKNOWN_ERROR,
|
|
2386
2393
|
message: `HTTP ${e}`
|
|
2387
2394
|
};
|
|
2388
|
-
throw new
|
|
2395
|
+
throw new _(s.code, s.message);
|
|
2389
2396
|
}
|
|
2390
2397
|
}
|
|
2391
|
-
function
|
|
2398
|
+
function Te(i, e = "Apple account") {
|
|
2392
2399
|
if (i.endsWith("@privaterelay.appleid.com")) return e;
|
|
2393
2400
|
const r = i.indexOf("@");
|
|
2394
2401
|
if (r < 0) return "*".repeat(i.length || 3);
|
|
2395
2402
|
const t = i.substring(0, r), s = i.substring(r);
|
|
2396
2403
|
return t.length <= 1 ? `${t}${"*".repeat(Math.max(t.length, 1))}${s}` : `${t[0]}${"*".repeat(t.length - 1)}${s}`;
|
|
2397
2404
|
}
|
|
2398
|
-
const
|
|
2399
|
-
constructor(e, r, t, s, o, n, a, l, p,
|
|
2405
|
+
const ce = class ce extends Qt {
|
|
2406
|
+
constructor(e, r, t, s, o, n, a, l, p, h, u) {
|
|
2400
2407
|
var x, g;
|
|
2401
|
-
super(), this.storage = t, this.crypto = s, this.transport = o, this.oauth = n, this.walletProvider = a, this.tokenStore = l, 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._bridgeSessionRestorePromise = null, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = r, e.logger &&
|
|
2408
|
+
super(), this.storage = t, this.crypto = s, this.transport = o, this.oauth = n, this.walletProvider = a, this.tokenStore = l, 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._bridgeSessionRestorePromise = null, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = r, e.logger && rt(e.logger), this.confirmation = p, this.pinStore = u ?? new xt(), this.stateManager = new xr({
|
|
2402
2409
|
setState: (f) => {
|
|
2403
2410
|
f.authenticated !== void 0 && (this.authenticated = f.authenticated), f.userId !== void 0 && (this.userId = f.userId), f.address !== void 0 && (this.address = f.address), f.activeWalletIndex !== void 0 && (this.activeWalletIndex = f.activeWalletIndex), f.userEmail !== void 0 && (this.userEmail = f.userEmail), f.providerSub !== void 0 && (this.providerSub = f.providerSub), f.loginType !== void 0 && (this.loginType = f.loginType), f.tokenSignatureVerified !== void 0 && (this.tokenSignatureVerified = f.tokenSignatureVerified);
|
|
2404
2411
|
},
|
|
@@ -2416,62 +2423,62 @@ const ne = class ne extends Yt {
|
|
|
2416
2423
|
});
|
|
2417
2424
|
},
|
|
2418
2425
|
shouldPersistWalletPreference: () => this._config.persistWalletPreference !== !1,
|
|
2419
|
-
walletPreferenceKey:
|
|
2426
|
+
walletPreferenceKey: ce.WALLET_PREF_KEY,
|
|
2420
2427
|
storage: this.storage,
|
|
2421
2428
|
pinStore: this.pinStore
|
|
2422
|
-
}), this.pinOrchestrator = new
|
|
2429
|
+
}), this.pinOrchestrator = new de({
|
|
2423
2430
|
confirmation: this.confirmation,
|
|
2424
2431
|
walletProvider: this.walletProvider,
|
|
2425
2432
|
pinStore: this.pinStore,
|
|
2426
2433
|
getLocale: () => this._config.locale,
|
|
2427
2434
|
getUserEmail: () => this.userEmail,
|
|
2428
|
-
maskEmail:
|
|
2435
|
+
maskEmail: Te,
|
|
2429
2436
|
signInAgain: () => this.signInAgain(),
|
|
2430
2437
|
// §12 native sign delegation: bridge 자동 로그인 세션이면 JS PIN 단계를 스킵한다.
|
|
2431
2438
|
// dApp 이 sdk.pinOrchestrator.ensureVerifiedPin() 을 직접 호출해도 (SigningOrchestrator 우회)
|
|
2432
2439
|
// WebView 안에서 embedded PIN 프롬프트가 뜨지 않도록 게이팅. SigningOrchestrator 와 동일 신호.
|
|
2433
2440
|
isRNBridgeMode: () => this._isAuthenticatedViaRNBridge
|
|
2434
|
-
}), this.signingOrchestrator = new
|
|
2441
|
+
}), this.signingOrchestrator = new ar({
|
|
2435
2442
|
confirmation: this.confirmation,
|
|
2436
2443
|
walletProvider: this.walletProvider,
|
|
2437
2444
|
pinOrchestrator: this.pinOrchestrator,
|
|
2438
2445
|
// §12 native sign delegation: 이 SDK 세션이 RN bridge 자동 로그인으로 인증된 경우만 활성.
|
|
2439
2446
|
// 자동 로그인 거부 / OAuth 로 별도 로그인한 세션에서는 native SDK 가 미인증이라 우회한다.
|
|
2440
2447
|
isRNBridgeMode: () => this._isAuthenticatedViaRNBridge
|
|
2441
|
-
}), this.walletLifecycleService = new
|
|
2448
|
+
}), this.walletLifecycleService = new dr({
|
|
2442
2449
|
walletProvider: this.walletProvider,
|
|
2443
2450
|
pinOrchestrator: this.pinOrchestrator,
|
|
2444
2451
|
getUserId: () => this.userId,
|
|
2445
2452
|
setActiveWallet: (f, m, y) => this.setActiveWallet(f, m, y)
|
|
2446
|
-
}), this.migrationOrchestrator = new
|
|
2453
|
+
}), this.migrationOrchestrator = new pr({
|
|
2447
2454
|
confirmation: this.confirmation,
|
|
2448
2455
|
walletProvider: this.walletProvider,
|
|
2449
2456
|
pinOrchestrator: this.pinOrchestrator,
|
|
2450
2457
|
executeMigrate: (f, m) => this.migrateWalletUseCase.execute(f, m),
|
|
2451
2458
|
getLocale: () => this._config.locale,
|
|
2452
2459
|
getUserEmail: () => this.userEmail,
|
|
2453
|
-
maskEmail:
|
|
2460
|
+
maskEmail: Te,
|
|
2454
2461
|
signInAgain: () => this.signInAgain(),
|
|
2455
2462
|
clearAuthState: () => this.clearAuthState(),
|
|
2456
2463
|
getAllowSkip: () => {
|
|
2457
2464
|
var f;
|
|
2458
2465
|
return ((f = this._config.migration) == null ? void 0 : f.allowSkip) ?? !0;
|
|
2459
2466
|
}
|
|
2460
|
-
}), this.transactionLifecycleService = new
|
|
2467
|
+
}), this.transactionLifecycleService = new hr({
|
|
2461
2468
|
getActiveAddress: () => this.address,
|
|
2462
2469
|
estimateGas: (f, m) => this.estimateGas(f, m),
|
|
2463
2470
|
getBaseFeePerGas: (f) => this.getBaseFeePerGas(f),
|
|
2464
2471
|
jsonRpcCall: (f, m, y) => this.jsonRpc.call(f, m, y)
|
|
2465
|
-
}), this.signatureVerifier = new
|
|
2472
|
+
}), this.signatureVerifier = new _r(this.crypto), this.addressResolverService = new gr({
|
|
2466
2473
|
walletProvider: this.walletProvider,
|
|
2467
2474
|
pinOrchestrator: this.pinOrchestrator,
|
|
2468
2475
|
getActiveAddress: () => this.address,
|
|
2469
2476
|
getActiveWalletIndex: () => this.activeWalletIndex,
|
|
2470
2477
|
getUserId: () => this.userId
|
|
2471
|
-
}), this.authGuardService = new
|
|
2478
|
+
}), this.authGuardService = new fr({
|
|
2472
2479
|
isInitialized: () => this.initialized,
|
|
2473
2480
|
isAuthenticated: () => this.authenticated
|
|
2474
|
-
}), this.walletCreationService = new
|
|
2481
|
+
}), this.walletCreationService = new wr({
|
|
2475
2482
|
walletProvider: this.walletProvider,
|
|
2476
2483
|
pinOrchestrator: this.pinOrchestrator,
|
|
2477
2484
|
migrationOrchestrator: this.migrationOrchestrator,
|
|
@@ -2483,10 +2490,10 @@ const ne = class ne extends Yt {
|
|
|
2483
2490
|
var f, m;
|
|
2484
2491
|
return ((m = (f = this.confirmation).showWalletCreatedPrompt) == null ? void 0 : m.call(f)) ?? Promise.resolve();
|
|
2485
2492
|
}
|
|
2486
|
-
}), this.tokenHistoryService = new
|
|
2493
|
+
}), this.tokenHistoryService = new mr({
|
|
2487
2494
|
transport: o,
|
|
2488
2495
|
getApiBaseUrl: () => this.internalConfig.authApiUrl
|
|
2489
|
-
}), this.sessionOrchestrator = new
|
|
2496
|
+
}), this.sessionOrchestrator = new lr({
|
|
2490
2497
|
ensureInitialized: () => this.ensureInitialized(),
|
|
2491
2498
|
getSessionSnapshot: () => ({
|
|
2492
2499
|
providerSub: this.providerSub,
|
|
@@ -2508,8 +2515,8 @@ const ne = class ne extends Yt {
|
|
|
2508
2515
|
applyAuthResult: (f) => this.applyAuthResult(f),
|
|
2509
2516
|
loadWalletAfterAuth: () => this.walletLifecycleService.loadWalletAfterAuth(),
|
|
2510
2517
|
getLocale: () => this._config.locale,
|
|
2511
|
-
maskEmail:
|
|
2512
|
-
}), this.chainRegistry =
|
|
2518
|
+
maskEmail: Te
|
|
2519
|
+
}), this.chainRegistry = h, this.jsonRpc = new Zt(h, o), this.signInUseCase = new Me(
|
|
2513
2520
|
this.internalConfig,
|
|
2514
2521
|
t,
|
|
2515
2522
|
s,
|
|
@@ -2519,7 +2526,7 @@ const ne = class ne extends Yt {
|
|
|
2519
2526
|
l,
|
|
2520
2527
|
void 0,
|
|
2521
2528
|
() => this._config.locale
|
|
2522
|
-
), this.signOutUseCase = new
|
|
2529
|
+
), this.signOutUseCase = new Xt(this.internalConfig, t, l), this.migrateWalletUseCase = new Jt(t, a), (x = a.setOnUnauthorized) == null || x.call(a, () => this.forceLogout()), (g = a.setTokenRefresher) == null || g.call(
|
|
2523
2530
|
a,
|
|
2524
2531
|
() => this.signInUseCase.refreshAccessToken()
|
|
2525
2532
|
), e.autoDetectTheme && this._setupAutoDetectTheme();
|
|
@@ -2561,33 +2568,33 @@ const ne = class ne extends Yt {
|
|
|
2561
2568
|
}
|
|
2562
2569
|
async _doInitialize(e) {
|
|
2563
2570
|
var r, t;
|
|
2564
|
-
c.log("[CROSSx SDK] v2.3.10-beta.
|
|
2571
|
+
c.log("[CROSSx SDK] v2.3.10-beta.7 초기화 중..."), this.confirmation.setMessages(Q(this._config.locale));
|
|
2565
2572
|
try {
|
|
2566
|
-
const s =
|
|
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`);
|
|
2573
|
+
const s = Ge();
|
|
2574
|
+
this.internalConfig.oauthServiceUrl = s.oauthServiceUrl, this.internalConfig.legacyOauthServiceUrl = s.legacyOauthServiceUrl, 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`);
|
|
2568
2575
|
const o = this._config.persistWalletPreference !== !1 ? await this.storage.get(
|
|
2569
|
-
|
|
2576
|
+
ce.WALLET_PREF_KEY
|
|
2570
2577
|
).catch(() => null) : null, n = (e == null ? void 0 : e.preferredWalletIndex) ?? (o == null ? void 0 : o.index);
|
|
2571
2578
|
let a = (e == null ? void 0 : e.preferredWalletAddress) ?? (o == null ? void 0 : o.address), l = await this.tryRNBridgeBootstrap();
|
|
2572
2579
|
if (this._rnBridgeWalletAddress && ((a == null ? void 0 : a.toLowerCase()) !== this._rnBridgeWalletAddress.toLowerCase() && c.log("[CROSSx] RN Bridge active wallet으로 preferredWalletAddress 갱신:", this._rnBridgeWalletAddress), a = this._rnBridgeWalletAddress), l || (l = await this.signInUseCase.restoreSession()), l != null && l.success) {
|
|
2573
2580
|
this.applyAuthResult(l);
|
|
2574
|
-
const p = this.address && (!a || this.address.toLowerCase() === a.toLowerCase()),
|
|
2581
|
+
const p = this.address && (!a || this.address.toLowerCase() === a.toLowerCase()), h = this._rnBridgeWalletName && a && this._rnBridgeWalletAddress && a.toLowerCase() === this._rnBridgeWalletAddress.toLowerCase() ? this._rnBridgeWalletName : void 0;
|
|
2575
2582
|
if (p)
|
|
2576
2583
|
this.address && this.setActiveWallet(
|
|
2577
2584
|
this.address,
|
|
2578
2585
|
n ?? this.activeWalletIndex,
|
|
2579
|
-
|
|
2586
|
+
h ? { walletName: h } : void 0
|
|
2580
2587
|
);
|
|
2581
2588
|
else try {
|
|
2582
2589
|
await this.loadWalletAfterAuth(
|
|
2583
2590
|
n,
|
|
2584
2591
|
a,
|
|
2585
|
-
|
|
2592
|
+
h
|
|
2586
2593
|
);
|
|
2587
2594
|
} catch (u) {
|
|
2588
|
-
if (u instanceof
|
|
2595
|
+
if (u instanceof _ && u.code === d.PIN_CANCELLED)
|
|
2589
2596
|
c.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
|
|
2590
|
-
else if (u instanceof
|
|
2597
|
+
else if (u instanceof _ && (u.code === d.SESSION_EXPIRED || u.code === d.AUTH_NOT_AUTHENTICATED || u.code === d.USER_NOT_FOUND))
|
|
2591
2598
|
c.warn(
|
|
2592
2599
|
"[CROSSx] initialize: 복원된 세션이 유효하지 않음 — 세션 정리 후 비로그인으로 계속",
|
|
2593
2600
|
u.code
|
|
@@ -2597,9 +2604,9 @@ const ne = class ne extends Yt {
|
|
|
2597
2604
|
throw u;
|
|
2598
2605
|
}
|
|
2599
2606
|
}
|
|
2600
|
-
return this.initialized = !0, c.info("[CROSSx SDK] v2.3.10-beta.
|
|
2607
|
+
return this.initialized = !0, c.info("[CROSSx SDK] v2.3.10-beta.7 초기화 완료"), this.emit("initialized", { restored: !!(l != null && l.success) }), l ?? null;
|
|
2601
2608
|
} catch (s) {
|
|
2602
|
-
throw new
|
|
2609
|
+
throw new _(d.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", s);
|
|
2603
2610
|
}
|
|
2604
2611
|
}
|
|
2605
2612
|
/**
|
|
@@ -2617,7 +2624,7 @@ const ne = class ne extends Yt {
|
|
|
2617
2624
|
c.log("[CROSSx] RN Bridge 감지 — Handshake 시도"), c.info("[CROSSx][RNBridge trace] Bootstrap config", {
|
|
2618
2625
|
appId: this._config.projectId,
|
|
2619
2626
|
appVersion: "1.0.0",
|
|
2620
|
-
sdkVersion: "2.3.10-beta.
|
|
2627
|
+
sdkVersion: "2.3.10-beta.7",
|
|
2621
2628
|
keyId: "key-id-1",
|
|
2622
2629
|
userIdHash: "user-hash-placeholder",
|
|
2623
2630
|
projectId: this._config.projectId
|
|
@@ -2625,7 +2632,7 @@ const ne = class ne extends Yt {
|
|
|
2625
2632
|
const e = new j({
|
|
2626
2633
|
appId: this._config.projectId,
|
|
2627
2634
|
appVersion: "1.0.0",
|
|
2628
|
-
sdkVersion: "2.3.10-beta.
|
|
2635
|
+
sdkVersion: "2.3.10-beta.7",
|
|
2629
2636
|
keyId: "key-id-1",
|
|
2630
2637
|
userIdHash: "user-hash-placeholder",
|
|
2631
2638
|
projectId: this._config.projectId
|
|
@@ -2674,7 +2681,7 @@ const ne = class ne extends Yt {
|
|
|
2674
2681
|
this._rnBridgeWalletName
|
|
2675
2682
|
), c.log("[CROSSx] Bridge 로그인 성공", { userId: (e = t.user) == null ? void 0 : e.id }), t) : null;
|
|
2676
2683
|
} catch (r) {
|
|
2677
|
-
return r instanceof
|
|
2684
|
+
return r instanceof _ && r.code === d.USER_REJECTED ? (c.log("[CROSSx] Bridge 로그인 거부 — OAuth fallback 진행 (bridge 유지)"), null) : (c.warn("[CROSSx] Bridge 로그인 타임아웃/실패", r), !1);
|
|
2678
2685
|
}
|
|
2679
2686
|
}
|
|
2680
2687
|
/**
|
|
@@ -2705,14 +2712,14 @@ const ne = class ne extends Yt {
|
|
|
2705
2712
|
*/
|
|
2706
2713
|
async requestFreshFirebaseIdTokenFromBridge() {
|
|
2707
2714
|
if (!this._rnBridgeService)
|
|
2708
|
-
throw new
|
|
2715
|
+
throw new _(
|
|
2709
2716
|
d.RN_BRIDGE_NOT_AVAILABLE,
|
|
2710
2717
|
"RN Bridge not available"
|
|
2711
2718
|
);
|
|
2712
2719
|
try {
|
|
2713
2720
|
return await this._rnBridgeService.requestFirebaseIdTokenForSessionRestore();
|
|
2714
2721
|
} catch (e) {
|
|
2715
|
-
throw c.error("[CROSSx] Bridge session restore token request failed:", e), new
|
|
2722
|
+
throw c.error("[CROSSx] Bridge session restore token request failed:", e), new _(
|
|
2716
2723
|
d.RN_NATIVE_SESSION_EXPIRED,
|
|
2717
2724
|
"Native session expired. Please sign in again in the app.",
|
|
2718
2725
|
e
|
|
@@ -2728,7 +2735,7 @@ const ne = class ne extends Yt {
|
|
|
2728
2735
|
}
|
|
2729
2736
|
async signIn(e) {
|
|
2730
2737
|
if (this.ensureInitialized(), this.authenticated)
|
|
2731
|
-
throw new
|
|
2738
|
+
throw new _(
|
|
2732
2739
|
d.ALREADY_AUTHENTICATED,
|
|
2733
2740
|
"이미 로그인된 상태입니다. signOut()을 먼저 호출하세요."
|
|
2734
2741
|
);
|
|
@@ -2744,12 +2751,12 @@ const ne = class ne extends Yt {
|
|
|
2744
2751
|
let t = e;
|
|
2745
2752
|
if (!(e != null && e.provider)) {
|
|
2746
2753
|
const s = await this.confirmation.showLoginSelector({
|
|
2747
|
-
connectOtherWallets:
|
|
2754
|
+
connectOtherWallets: Gt(this._config)
|
|
2748
2755
|
});
|
|
2749
2756
|
if (s === null)
|
|
2750
2757
|
return { success: !1, error: "User cancelled login" };
|
|
2751
2758
|
if (s.type === "external")
|
|
2752
|
-
throw this.emit("connectExternalWallet", { walletId: s.walletId }), new
|
|
2759
|
+
throw this.emit("connectExternalWallet", { walletId: s.walletId }), new _(
|
|
2753
2760
|
d.EXTERNAL_WALLET_REQUESTED,
|
|
2754
2761
|
"User requested external wallet connection"
|
|
2755
2762
|
);
|
|
@@ -2759,7 +2766,7 @@ const ne = class ne extends Yt {
|
|
|
2759
2766
|
const s = await this.signInUseCase.execute(t);
|
|
2760
2767
|
return s.success && (this._isAuthenticatedViaRNBridge = !1, this.applyAuthResult(s)), s;
|
|
2761
2768
|
} catch (s) {
|
|
2762
|
-
throw s instanceof
|
|
2769
|
+
throw s instanceof _ ? s : new _(d.AUTH_FAILED, "로그인에 실패했습니다", s);
|
|
2763
2770
|
}
|
|
2764
2771
|
}
|
|
2765
2772
|
/**
|
|
@@ -2790,7 +2797,7 @@ const ne = class ne extends Yt {
|
|
|
2790
2797
|
const o = await this.getAddresses(), n = await this.selectWalletIfMultiple(o, r);
|
|
2791
2798
|
return { ...s, address: (n == null ? void 0 : n.address) ?? s.address, addresses: o };
|
|
2792
2799
|
} catch (o) {
|
|
2793
|
-
throw o instanceof
|
|
2800
|
+
throw o instanceof _ && o.code === d.PIN_CANCELLED && (c.log("[CROSSx] signInWithCreate: 비밀번호 설정 취소 — 자동 로그아웃 진행"), await this.signOut().catch(
|
|
2794
2801
|
(n) => c.warn("[CROSSx] signInWithCreate: 자동 로그아웃 실패", n)
|
|
2795
2802
|
)), o;
|
|
2796
2803
|
}
|
|
@@ -2824,7 +2831,7 @@ const ne = class ne extends Yt {
|
|
|
2824
2831
|
async signInWithOAuthToken(e) {
|
|
2825
2832
|
var t, s;
|
|
2826
2833
|
if (this.ensureInitialized(), this.authenticated)
|
|
2827
|
-
throw new
|
|
2834
|
+
throw new _(
|
|
2828
2835
|
d.ALREADY_AUTHENTICATED,
|
|
2829
2836
|
"이미 로그인된 상태입니다. signOut()을 먼저 호출하세요."
|
|
2830
2837
|
);
|
|
@@ -2832,7 +2839,7 @@ const ne = class ne extends Yt {
|
|
|
2832
2839
|
try {
|
|
2833
2840
|
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으로 외부 인증이 도착했습니다"));
|
|
2834
2841
|
} catch (o) {
|
|
2835
|
-
throw o instanceof
|
|
2842
|
+
throw o instanceof _ ? o : new _(d.AUTH_FAILED, "OAuth 토큰 로그인에 실패했습니다", o);
|
|
2836
2843
|
}
|
|
2837
2844
|
if (!r.success) return { ...r, addresses: [] };
|
|
2838
2845
|
try {
|
|
@@ -2843,7 +2850,7 @@ const ne = class ne extends Yt {
|
|
|
2843
2850
|
const o = await this.getAddresses(), n = await this.selectWalletIfMultiple(o);
|
|
2844
2851
|
return { ...r, address: (n == null ? void 0 : n.address) ?? r.address, addresses: o };
|
|
2845
2852
|
} catch (o) {
|
|
2846
|
-
throw o instanceof
|
|
2853
|
+
throw o instanceof _ && o.code === d.PIN_CANCELLED && (c.log("[CROSSx] signInWithOAuthToken: 비밀번호 설정 취소 — 자동 로그아웃 진행"), await this.signOut().catch(
|
|
2847
2854
|
(n) => c.warn("[CROSSx] signInWithOAuthToken: 자동 로그아웃 실패", n)
|
|
2848
2855
|
)), o;
|
|
2849
2856
|
}
|
|
@@ -2865,7 +2872,7 @@ const ne = class ne extends Yt {
|
|
|
2865
2872
|
*/
|
|
2866
2873
|
async signInWithJWT(e, r) {
|
|
2867
2874
|
if (this.ensureInitialized(), this.authenticated)
|
|
2868
|
-
throw new
|
|
2875
|
+
throw new _(
|
|
2869
2876
|
d.ALREADY_AUTHENTICATED,
|
|
2870
2877
|
"이미 로그인된 상태입니다. signOut()을 먼저 호출하세요."
|
|
2871
2878
|
);
|
|
@@ -2873,7 +2880,7 @@ const ne = class ne extends Yt {
|
|
|
2873
2880
|
const t = await this.signInUseCase.executeWithJWT(e, r);
|
|
2874
2881
|
return t.success && (this._isAuthenticatedViaRNBridge = !1, this.applyAuthResult(t)), t;
|
|
2875
2882
|
} catch (t) {
|
|
2876
|
-
throw t instanceof
|
|
2883
|
+
throw t instanceof _ ? t : new _(d.AUTH_FAILED, "JWT 로그인에 실패했습니다", t);
|
|
2877
2884
|
}
|
|
2878
2885
|
}
|
|
2879
2886
|
async signOut() {
|
|
@@ -2888,7 +2895,7 @@ const ne = class ne extends Yt {
|
|
|
2888
2895
|
c.warn("[CROSSx] RN Bridge signOut 통보 실패 (로그아웃 자체는 정상)", r);
|
|
2889
2896
|
}
|
|
2890
2897
|
} catch (e) {
|
|
2891
|
-
throw new
|
|
2898
|
+
throw new _(d.UNKNOWN_ERROR, "로그아웃에 실패했습니다", e);
|
|
2892
2899
|
}
|
|
2893
2900
|
}
|
|
2894
2901
|
isAuthenticated() {
|
|
@@ -2971,7 +2978,7 @@ const ne = class ne extends Yt {
|
|
|
2971
2978
|
this._rnBridgeWalletName
|
|
2972
2979
|
);
|
|
2973
2980
|
} catch (t) {
|
|
2974
|
-
t instanceof
|
|
2981
|
+
t instanceof _ && t.code === d.PIN_CANCELLED || c.warn("[CROSSx] ensureLoggedIn: bridge loadWalletAfterAuth 실패:", t);
|
|
2975
2982
|
}
|
|
2976
2983
|
return !0;
|
|
2977
2984
|
}
|
|
@@ -2981,7 +2988,7 @@ const ne = class ne extends Yt {
|
|
|
2981
2988
|
try {
|
|
2982
2989
|
await this.loadWalletAfterAuth();
|
|
2983
2990
|
} catch (t) {
|
|
2984
|
-
t instanceof
|
|
2991
|
+
t instanceof _ && t.code === d.PIN_CANCELLED || c.warn("[CROSSx] ensureLoggedIn: loadWalletAfterAuth 실패:", t);
|
|
2985
2992
|
}
|
|
2986
2993
|
return !0;
|
|
2987
2994
|
}
|
|
@@ -3028,12 +3035,12 @@ const ne = class ne extends Yt {
|
|
|
3028
3035
|
*/
|
|
3029
3036
|
async migrateWallet(e) {
|
|
3030
3037
|
if (this.ensureAuthenticated(), !this.userId)
|
|
3031
|
-
throw new
|
|
3038
|
+
throw new _(d.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
3032
3039
|
try {
|
|
3033
3040
|
const r = await this.migrateWalletUseCase.execute(e, this.userId);
|
|
3034
3041
|
return this.setActiveWallet(r.address, 0), c.log("[CROSSx] migrateWallet 완료 — address:", r.address), r;
|
|
3035
3042
|
} catch (r) {
|
|
3036
|
-
throw r instanceof
|
|
3043
|
+
throw r instanceof _ ? r : new _(
|
|
3037
3044
|
d.MIGRATION_FAILED,
|
|
3038
3045
|
"지갑 마이그레이션에 실패했습니다",
|
|
3039
3046
|
r
|
|
@@ -3055,7 +3062,7 @@ const ne = class ne extends Yt {
|
|
|
3055
3062
|
async getAddress(e) {
|
|
3056
3063
|
if (e !== void 0) {
|
|
3057
3064
|
if (this.ensureAuthenticated(), !this.userId)
|
|
3058
|
-
throw new
|
|
3065
|
+
throw new _(d.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
3059
3066
|
return { address: (await this.walletProvider.getAddress(this.userId, e)).address, index: e };
|
|
3060
3067
|
}
|
|
3061
3068
|
return !this.authenticated || !this.address ? null : { address: this.address, index: this.activeWalletIndex };
|
|
@@ -3097,7 +3104,7 @@ const ne = class ne extends Yt {
|
|
|
3097
3104
|
*/
|
|
3098
3105
|
async selectWallet(e) {
|
|
3099
3106
|
if (this.ensureAuthenticated(), !this.userId)
|
|
3100
|
-
throw new
|
|
3107
|
+
throw new _(d.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
3101
3108
|
let r = await this.withSessionRecovery(
|
|
3102
3109
|
() => this.walletProvider.getAddresses(this.userId)
|
|
3103
3110
|
);
|
|
@@ -3156,7 +3163,7 @@ const ne = class ne extends Yt {
|
|
|
3156
3163
|
try {
|
|
3157
3164
|
return await this.chainRegistry.getChains();
|
|
3158
3165
|
} catch (e) {
|
|
3159
|
-
throw e instanceof
|
|
3166
|
+
throw e instanceof _ ? e : new _(d.UNKNOWN_ERROR, "체인 목록 조회에 실패했습니다", e);
|
|
3160
3167
|
}
|
|
3161
3168
|
}
|
|
3162
3169
|
/**
|
|
@@ -3175,7 +3182,7 @@ const ne = class ne extends Yt {
|
|
|
3175
3182
|
try {
|
|
3176
3183
|
return await this.chainRegistry.getChain(e);
|
|
3177
3184
|
} catch (r) {
|
|
3178
|
-
throw r instanceof
|
|
3185
|
+
throw r instanceof _ ? r : new _(d.CHAIN_NOT_SUPPORTED, `체인 조회에 실패했습니다: ${e}`, r);
|
|
3179
3186
|
}
|
|
3180
3187
|
}
|
|
3181
3188
|
// ============================================================================
|
|
@@ -3220,7 +3227,7 @@ const ne = class ne extends Yt {
|
|
|
3220
3227
|
* sdk.applyLocale('ko');
|
|
3221
3228
|
*/
|
|
3222
3229
|
applyLocale(e = this._config.locale ?? "en") {
|
|
3223
|
-
this._config = Object.freeze({ ...this._config, locale: e }), this.confirmation.setMessages(
|
|
3230
|
+
this._config = Object.freeze({ ...this._config, locale: e }), this.confirmation.setMessages(Q(e));
|
|
3224
3231
|
}
|
|
3225
3232
|
/**
|
|
3226
3233
|
* PIN 입력 모달의 키보드 방식을 런타임에 변경합니다.
|
|
@@ -3275,7 +3282,7 @@ const ne = class ne extends Yt {
|
|
|
3275
3282
|
return { chainId: e, signature: n.signature, message: r, address: this.address ?? "" };
|
|
3276
3283
|
}
|
|
3277
3284
|
if (this.ensureAuthenticated(), !this.userId)
|
|
3278
|
-
throw new
|
|
3285
|
+
throw new _(d.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
3279
3286
|
const o = await this.resolveAddress(t == null ? void 0 : t.index);
|
|
3280
3287
|
try {
|
|
3281
3288
|
const n = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
|
|
@@ -3310,7 +3317,7 @@ const ne = class ne extends Yt {
|
|
|
3310
3317
|
address: o.address
|
|
3311
3318
|
};
|
|
3312
3319
|
} catch (n) {
|
|
3313
|
-
throw n instanceof
|
|
3320
|
+
throw n instanceof _ ? n : new _(d.SIGNATURE_FAILED, `메시지 서명에 실패했습니다 (${e})`, n);
|
|
3314
3321
|
}
|
|
3315
3322
|
}
|
|
3316
3323
|
/**
|
|
@@ -3339,10 +3346,10 @@ const ne = class ne extends Yt {
|
|
|
3339
3346
|
}
|
|
3340
3347
|
async _signTypedData(e, r, t) {
|
|
3341
3348
|
if (this.ensureAuthenticated(), !this.userId)
|
|
3342
|
-
throw new
|
|
3349
|
+
throw new _(d.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
3343
3350
|
if (!this.walletProvider.signTypedData)
|
|
3344
|
-
throw new
|
|
3345
|
-
|
|
3351
|
+
throw new _(d.NOT_IMPLEMENTED, "signTypedData가 구현되어 있지 않습니다");
|
|
3352
|
+
or(e, r);
|
|
3346
3353
|
const s = await this.resolveAddress(t == null ? void 0 : t.index);
|
|
3347
3354
|
try {
|
|
3348
3355
|
const o = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
|
|
@@ -3366,13 +3373,13 @@ const ne = class ne extends Yt {
|
|
|
3366
3373
|
s.address
|
|
3367
3374
|
)
|
|
3368
3375
|
});
|
|
3369
|
-
return
|
|
3376
|
+
return sr(o.signature), {
|
|
3370
3377
|
chainId: e,
|
|
3371
3378
|
signature: o.signature,
|
|
3372
3379
|
address: s.address
|
|
3373
3380
|
};
|
|
3374
3381
|
} catch (o) {
|
|
3375
|
-
throw o instanceof
|
|
3382
|
+
throw o instanceof _ ? o : new _(d.SIGNATURE_FAILED, `타입 데이터 서명에 실패했습니다 (${e})`, o);
|
|
3376
3383
|
}
|
|
3377
3384
|
}
|
|
3378
3385
|
/**
|
|
@@ -3395,7 +3402,7 @@ const ne = class ne extends Yt {
|
|
|
3395
3402
|
* });
|
|
3396
3403
|
*/
|
|
3397
3404
|
async signTypedDataOffchain(e, r) {
|
|
3398
|
-
return this.signTypedData(
|
|
3405
|
+
return this.signTypedData(ce.OFFCHAIN_CHAIN_ID, e, r);
|
|
3399
3406
|
}
|
|
3400
3407
|
// ============================================================================
|
|
3401
3408
|
// 트랜잭션
|
|
@@ -3411,10 +3418,10 @@ const ne = class ne extends Yt {
|
|
|
3411
3418
|
}
|
|
3412
3419
|
async _signTransaction(e, r, t) {
|
|
3413
3420
|
if (this.ensureAuthenticated(), !this.userId)
|
|
3414
|
-
throw new
|
|
3421
|
+
throw new _(d.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
3415
3422
|
const s = await this.transactionLifecycleService.withResolvedGasAndFee(r, e);
|
|
3416
3423
|
s.from || (s.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
|
|
3417
|
-
const o =
|
|
3424
|
+
const o = ke(e);
|
|
3418
3425
|
try {
|
|
3419
3426
|
const n = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
|
|
3420
3427
|
confirmation: {
|
|
@@ -3444,15 +3451,15 @@ const ne = class ne extends Yt {
|
|
|
3444
3451
|
a
|
|
3445
3452
|
)
|
|
3446
3453
|
});
|
|
3447
|
-
return
|
|
3454
|
+
return ir(n.signature), {
|
|
3448
3455
|
chainId: e,
|
|
3449
3456
|
signedTx: n.signature,
|
|
3450
3457
|
txHash: n.txHash ?? ""
|
|
3451
3458
|
};
|
|
3452
3459
|
} catch (n) {
|
|
3453
|
-
if (n instanceof
|
|
3460
|
+
if (n instanceof _) throw n;
|
|
3454
3461
|
const a = n instanceof Error ? n.message : String(n);
|
|
3455
|
-
throw new
|
|
3462
|
+
throw new _(
|
|
3456
3463
|
d.SIGNATURE_FAILED,
|
|
3457
3464
|
`트랜잭션 서명에 실패했습니다 (${e}): ${a}`,
|
|
3458
3465
|
n
|
|
@@ -3470,10 +3477,10 @@ const ne = class ne extends Yt {
|
|
|
3470
3477
|
}
|
|
3471
3478
|
async _sendTransaction(e, r, t) {
|
|
3472
3479
|
if (this.ensureAuthenticated(), !this.userId)
|
|
3473
|
-
throw new
|
|
3480
|
+
throw new _(d.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
3474
3481
|
const s = await this.transactionLifecycleService.withResolvedGasAndFee(r, e);
|
|
3475
3482
|
s.from || (s.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
|
|
3476
|
-
const o =
|
|
3483
|
+
const o = ke(e);
|
|
3477
3484
|
try {
|
|
3478
3485
|
const n = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
|
|
3479
3486
|
confirmation: {
|
|
@@ -3495,31 +3502,31 @@ const ne = class ne extends Yt {
|
|
|
3495
3502
|
rejectedMessage: "User rejected the transaction request",
|
|
3496
3503
|
prepareAction: "send",
|
|
3497
3504
|
prepareContext: { tx: s },
|
|
3498
|
-
execute: async (
|
|
3505
|
+
execute: async (h) => {
|
|
3499
3506
|
if (this.walletProvider.sendTransaction)
|
|
3500
3507
|
return (await this.walletProvider.sendTransaction(
|
|
3501
3508
|
this.userId,
|
|
3502
3509
|
e,
|
|
3503
3510
|
s,
|
|
3504
|
-
|
|
3511
|
+
h
|
|
3505
3512
|
)).txHash;
|
|
3506
3513
|
const u = await this.walletProvider.signTransaction(
|
|
3507
3514
|
this.userId,
|
|
3508
3515
|
e,
|
|
3509
3516
|
s,
|
|
3510
3517
|
t == null ? void 0 : t.index,
|
|
3511
|
-
|
|
3518
|
+
h
|
|
3512
3519
|
);
|
|
3513
3520
|
return u.txHash ?? u.signature;
|
|
3514
3521
|
}
|
|
3515
3522
|
}), a = (r.data ?? "").toLowerCase().replace(/^0x/, ""), l = a === "" || a === "00000000", p = a.startsWith("a9059cbb");
|
|
3516
|
-
return (l || p) && this.tokenHistoryService.registerHistoryFireAndForget(e, n,
|
|
3517
|
-
(
|
|
3523
|
+
return (l || p) && this.tokenHistoryService.registerHistoryFireAndForget(e, n, Bt).catch(
|
|
3524
|
+
(h) => c.log("[TokenHistory] register failed (non-critical):", h)
|
|
3518
3525
|
), { chainId: e, txHash: n, status: "pending" };
|
|
3519
3526
|
} catch (n) {
|
|
3520
|
-
if (n instanceof
|
|
3527
|
+
if (n instanceof _) throw n;
|
|
3521
3528
|
const a = n instanceof Error ? n.message : String(n);
|
|
3522
|
-
throw new
|
|
3529
|
+
throw new _(
|
|
3523
3530
|
d.TRANSACTION_FAILED,
|
|
3524
3531
|
`트랜잭션 전송에 실패했습니다 (${e}): ${a}`,
|
|
3525
3532
|
n
|
|
@@ -3545,14 +3552,14 @@ const ne = class ne extends Yt {
|
|
|
3545
3552
|
* @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
|
|
3546
3553
|
*/
|
|
3547
3554
|
async waitForTxAndGetReceipt(e, r, t = {}) {
|
|
3548
|
-
const s = t.intervalMs ??
|
|
3555
|
+
const s = t.intervalMs ?? Lt, o = Dt, n = t.timeoutMs ?? Je, a = Date.now() + n;
|
|
3549
3556
|
let l = s;
|
|
3550
3557
|
for (; Date.now() < a; ) {
|
|
3551
3558
|
const p = await this.getTransactionReceipt(e, r);
|
|
3552
3559
|
if (p) return p;
|
|
3553
|
-
await new Promise((
|
|
3560
|
+
await new Promise((h) => setTimeout(h, l)), l = Math.min(l * 2, o);
|
|
3554
3561
|
}
|
|
3555
|
-
throw new
|
|
3562
|
+
throw new _(
|
|
3556
3563
|
d.UNKNOWN_ERROR,
|
|
3557
3564
|
`트랜잭션 영수증 조회 시간이 초과되었습니다 (${e})`
|
|
3558
3565
|
);
|
|
@@ -3579,20 +3586,20 @@ const ne = class ne extends Yt {
|
|
|
3579
3586
|
if (S != null && S.sendTransactionWithWaitForReceipt)
|
|
3580
3587
|
return this.bridgeSendTransactionWithWaitForReceipt(S, e, r, t);
|
|
3581
3588
|
}
|
|
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) ??
|
|
3589
|
+
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) ?? Ot, p = o ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? Je, h = ke(e), u = r.from ?? "";
|
|
3583
3590
|
let x, g;
|
|
3584
3591
|
const f = this.waitForTxAndGetReceipt(a, e, { intervalMs: l, timeoutMs: p }).then((S) => {
|
|
3585
3592
|
x = S;
|
|
3586
|
-
const E = BigInt(S.gasUsed) * BigInt(S.effectiveGasPrice), A = r.value ? BigInt(r.value) : 0n, T =
|
|
3593
|
+
const E = BigInt(S.gasUsed) * BigInt(S.effectiveGasPrice), A = r.value ? BigInt(r.value) : 0n, T = ye(r.value, h.symbol, h.decimals, this._config.displayDecimals), R = ye("0x" + E.toString(16), h.symbol, h.decimals, this._config.displayDecimals), N = ye("0x" + (A + E).toString(16), h.symbol, h.decimals, this._config.displayDecimals);
|
|
3587
3594
|
return {
|
|
3588
3595
|
chainId: e,
|
|
3589
3596
|
txHash: a,
|
|
3590
3597
|
from: S.from,
|
|
3591
3598
|
to: S.to ?? r.to,
|
|
3592
3599
|
amount: T,
|
|
3593
|
-
fees:
|
|
3594
|
-
total:
|
|
3595
|
-
nativeSymbol:
|
|
3600
|
+
fees: R,
|
|
3601
|
+
total: N,
|
|
3602
|
+
nativeSymbol: h.symbol,
|
|
3596
3603
|
status: S.status === "0x1" ? "success" : "reverted"
|
|
3597
3604
|
};
|
|
3598
3605
|
}).catch((S) => (g = S instanceof Error ? S : new Error(String(S)), {
|
|
@@ -3600,8 +3607,8 @@ const ne = class ne extends Yt {
|
|
|
3600
3607
|
txHash: a,
|
|
3601
3608
|
from: u,
|
|
3602
3609
|
to: r.to,
|
|
3603
|
-
amount:
|
|
3604
|
-
nativeSymbol:
|
|
3610
|
+
amount: ye(r.value, h.symbol, h.decimals, this._config.displayDecimals),
|
|
3611
|
+
nativeSymbol: h.symbol,
|
|
3605
3612
|
status: "timeout"
|
|
3606
3613
|
}));
|
|
3607
3614
|
if (await this.confirmation.showTransactionProgress(
|
|
@@ -3712,12 +3719,12 @@ const ne = class ne extends Yt {
|
|
|
3712
3719
|
this.ensureAuthenticated();
|
|
3713
3720
|
const t = this.walletProvider;
|
|
3714
3721
|
if (typeof t.changePin != "function")
|
|
3715
|
-
throw new
|
|
3722
|
+
throw new _(d.NOT_IMPLEMENTED, "changePin이 구현되어 있지 않습니다");
|
|
3716
3723
|
this.pinStore.set(e);
|
|
3717
3724
|
try {
|
|
3718
3725
|
await t.changePin(e, r), this.pinStore.set(r), c.log("[CROSSx] PIN 변경 완료");
|
|
3719
3726
|
} catch (s) {
|
|
3720
|
-
throw s instanceof
|
|
3727
|
+
throw s instanceof _ ? s : new _(d.UNKNOWN_ERROR, "PIN 변경에 실패했습니다", s);
|
|
3721
3728
|
}
|
|
3722
3729
|
}
|
|
3723
3730
|
// ============================================================================
|
|
@@ -3738,7 +3745,7 @@ const ne = class ne extends Yt {
|
|
|
3738
3745
|
return await this.walletRpc("eth_gasPrice", [], e);
|
|
3739
3746
|
} catch (r) {
|
|
3740
3747
|
const t = r instanceof Error ? r.message : String(r);
|
|
3741
|
-
throw new
|
|
3748
|
+
throw new _(d.GAS_ESTIMATION_FAILED, `가스 가격 조회에 실패했습니다 (${e}): ${t}`, r);
|
|
3742
3749
|
}
|
|
3743
3750
|
}
|
|
3744
3751
|
/**
|
|
@@ -3759,7 +3766,7 @@ const ne = class ne extends Yt {
|
|
|
3759
3766
|
return await this.walletRpc("eth_estimateGas", [t], r);
|
|
3760
3767
|
} catch (s) {
|
|
3761
3768
|
const o = s instanceof Error ? s.message : String(s);
|
|
3762
|
-
throw new
|
|
3769
|
+
throw new _(d.GAS_ESTIMATION_FAILED, `가스 추정에 실패했습니다 (${r}): ${o}`, s);
|
|
3763
3770
|
}
|
|
3764
3771
|
}
|
|
3765
3772
|
/**
|
|
@@ -3780,7 +3787,7 @@ const ne = class ne extends Yt {
|
|
|
3780
3787
|
return (r == null ? void 0 : r.baseFeePerGas) ?? null;
|
|
3781
3788
|
} catch (r) {
|
|
3782
3789
|
const t = r instanceof Error ? r.message : String(r);
|
|
3783
|
-
throw new
|
|
3790
|
+
throw new _(d.GAS_ESTIMATION_FAILED, `baseFeePerGas 조회에 실패했습니다 (${e}): ${t}`, r);
|
|
3784
3791
|
}
|
|
3785
3792
|
}
|
|
3786
3793
|
/**
|
|
@@ -3799,7 +3806,7 @@ const ne = class ne extends Yt {
|
|
|
3799
3806
|
return await this.walletRpc("eth_maxPriorityFeePerGas", [], e);
|
|
3800
3807
|
} catch (r) {
|
|
3801
3808
|
const t = r instanceof Error ? r.message : String(r);
|
|
3802
|
-
throw new
|
|
3809
|
+
throw new _(d.GAS_ESTIMATION_FAILED, `maxPriorityFeePerGas 조회에 실패했습니다 (${e}): ${t}`, r);
|
|
3803
3810
|
}
|
|
3804
3811
|
}
|
|
3805
3812
|
// ============================================================================
|
|
@@ -3817,9 +3824,9 @@ const ne = class ne extends Yt {
|
|
|
3817
3824
|
const t = await this.jsonRpc.call("eth_getTransactionCount", [r, "pending"], e);
|
|
3818
3825
|
return parseInt(t ?? "0x0", 16);
|
|
3819
3826
|
} catch (t) {
|
|
3820
|
-
if (t instanceof
|
|
3827
|
+
if (t instanceof _) throw t;
|
|
3821
3828
|
const s = t instanceof Error ? t.message : String(t);
|
|
3822
|
-
throw new
|
|
3829
|
+
throw new _(d.UNKNOWN_ERROR, `Nonce 조회에 실패했습니다: ${s}`, t);
|
|
3823
3830
|
}
|
|
3824
3831
|
}
|
|
3825
3832
|
/**
|
|
@@ -3834,11 +3841,11 @@ const ne = class ne extends Yt {
|
|
|
3834
3841
|
return { wei: "0x0", formatted: "0", chainId: e };
|
|
3835
3842
|
try {
|
|
3836
3843
|
const s = await this.jsonRpc.call("eth_getBalance", [r, "latest"], e) ?? "0x0";
|
|
3837
|
-
return { wei: s, formatted:
|
|
3844
|
+
return { wei: s, formatted: rr(s, this._config.displayDecimals), chainId: e };
|
|
3838
3845
|
} catch (t) {
|
|
3839
|
-
if (t instanceof
|
|
3846
|
+
if (t instanceof _) throw t;
|
|
3840
3847
|
const s = t instanceof Error ? t.message : String(t);
|
|
3841
|
-
throw new
|
|
3848
|
+
throw new _(d.UNKNOWN_ERROR, `잔액 조회에 실패했습니다 (${e}): ${s}`, t);
|
|
3842
3849
|
}
|
|
3843
3850
|
}
|
|
3844
3851
|
// ============================================================================
|
|
@@ -3862,7 +3869,7 @@ const ne = class ne extends Yt {
|
|
|
3862
3869
|
getProvider(e) {
|
|
3863
3870
|
this.ensureAuthenticated();
|
|
3864
3871
|
let r = this._providers.get(e);
|
|
3865
|
-
return r || (r = new
|
|
3872
|
+
return r || (r = new zt(this, e), this._providers.set(e, r)), r;
|
|
3866
3873
|
}
|
|
3867
3874
|
/**
|
|
3868
3875
|
* EIP-1193 `accountsChanged` 이벤트를 모든 활성 provider 인스턴스에 dispatch 한다.
|
|
@@ -3893,9 +3900,9 @@ const ne = class ne extends Yt {
|
|
|
3893
3900
|
try {
|
|
3894
3901
|
return await this.jsonRpc.call(e, r, t);
|
|
3895
3902
|
} catch (s) {
|
|
3896
|
-
if (s instanceof
|
|
3903
|
+
if (s instanceof _) throw s;
|
|
3897
3904
|
const o = s instanceof Error ? s.message : String(s);
|
|
3898
|
-
throw new
|
|
3905
|
+
throw new _(d.UNKNOWN_ERROR, `walletRpc 호출에 실패했습니다 [${e}] (${t}): ${o}`, s);
|
|
3899
3906
|
}
|
|
3900
3907
|
}
|
|
3901
3908
|
// ============================================================================
|
|
@@ -4083,7 +4090,7 @@ const ne = class ne extends Yt {
|
|
|
4083
4090
|
*/
|
|
4084
4091
|
dispose() {
|
|
4085
4092
|
var e;
|
|
4086
|
-
(e = this._themeMediaCleanup) == null || e.call(this), this._themeMediaCleanup = null, this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(),
|
|
4093
|
+
(e = this._themeMediaCleanup) == null || e.call(this), this._themeMediaCleanup = null, this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), rt(null);
|
|
4087
4094
|
}
|
|
4088
4095
|
/**
|
|
4089
4096
|
* @internal internal 패키지 전용 — 공개 문서에 기재하지 않음
|
|
@@ -4103,9 +4110,9 @@ const ne = class ne extends Yt {
|
|
|
4103
4110
|
};
|
|
4104
4111
|
}
|
|
4105
4112
|
};
|
|
4106
|
-
|
|
4107
|
-
let
|
|
4108
|
-
class
|
|
4113
|
+
ce.WALLET_PREF_KEY = "wallet_preference", ce.OFFCHAIN_CHAIN_ID = "0";
|
|
4114
|
+
let $e = ce;
|
|
4115
|
+
class yr {
|
|
4109
4116
|
constructor() {
|
|
4110
4117
|
this.prefix = "crossx_";
|
|
4111
4118
|
}
|
|
@@ -4142,8 +4149,8 @@ class gr {
|
|
|
4142
4149
|
}
|
|
4143
4150
|
}
|
|
4144
4151
|
}
|
|
4145
|
-
const
|
|
4146
|
-
class
|
|
4152
|
+
const Re = "crossx-sdk", br = 1, q = "data", ie = "keys", be = "aes-primary", vr = 12;
|
|
4153
|
+
class at {
|
|
4147
4154
|
constructor(e) {
|
|
4148
4155
|
this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
|
|
4149
4156
|
}
|
|
@@ -4152,10 +4159,10 @@ class it {
|
|
|
4152
4159
|
}
|
|
4153
4160
|
openDB(e = this.dbName) {
|
|
4154
4161
|
return new Promise((r, t) => {
|
|
4155
|
-
const s = indexedDB.open(e,
|
|
4162
|
+
const s = indexedDB.open(e, br);
|
|
4156
4163
|
s.onupgradeneeded = () => {
|
|
4157
4164
|
const o = s.result;
|
|
4158
|
-
o.objectStoreNames.contains(q) || o.createObjectStore(q), o.objectStoreNames.contains(
|
|
4165
|
+
o.objectStoreNames.contains(q) || o.createObjectStore(q), o.objectStoreNames.contains(ie) || o.createObjectStore(ie);
|
|
4159
4166
|
}, s.onsuccess = () => r(s.result), s.onerror = () => t(s.error);
|
|
4160
4167
|
});
|
|
4161
4168
|
}
|
|
@@ -4185,7 +4192,7 @@ class it {
|
|
|
4185
4192
|
}
|
|
4186
4193
|
async init() {
|
|
4187
4194
|
this.db = await this.openDB();
|
|
4188
|
-
const e = await this.idbGet(
|
|
4195
|
+
const e = await this.idbGet(ie, be);
|
|
4189
4196
|
if (e) {
|
|
4190
4197
|
this.cryptoKey = e;
|
|
4191
4198
|
return;
|
|
@@ -4199,38 +4206,38 @@ class it {
|
|
|
4199
4206
|
{ name: "AES-GCM", length: 256 },
|
|
4200
4207
|
!1,
|
|
4201
4208
|
["encrypt", "decrypt"]
|
|
4202
|
-
), await this.idbPut(
|
|
4209
|
+
), await this.idbPut(ie, be, this.cryptoKey);
|
|
4203
4210
|
}
|
|
4204
4211
|
/**
|
|
4205
4212
|
* 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
|
|
4206
4213
|
* 마이그레이션 성공 시 레거시 DB 삭제.
|
|
4207
4214
|
*/
|
|
4208
4215
|
async migrateFromLegacyDB() {
|
|
4209
|
-
if (this.dbName ===
|
|
4216
|
+
if (this.dbName === Re) return null;
|
|
4210
4217
|
try {
|
|
4211
|
-
const e = await this.openDB(
|
|
4212
|
-
t.onsuccess = () => p(t.result), t.onerror = () =>
|
|
4218
|
+
const e = await this.openDB(Re), r = e.transaction([ie, q], "readonly"), t = r.objectStore(ie).get(be), s = await new Promise((p, h) => {
|
|
4219
|
+
t.onsuccess = () => p(t.result), t.onerror = () => h(t.error);
|
|
4213
4220
|
});
|
|
4214
4221
|
if (!s)
|
|
4215
4222
|
return e.close(), null;
|
|
4216
4223
|
const o = r.objectStore(q).getAll(), n = r.objectStore(q).getAllKeys(), [a, l] = await Promise.all([
|
|
4217
|
-
new Promise((p,
|
|
4218
|
-
o.onsuccess = () => p(o.result), o.onerror = () =>
|
|
4224
|
+
new Promise((p, h) => {
|
|
4225
|
+
o.onsuccess = () => p(o.result), o.onerror = () => h(o.error);
|
|
4219
4226
|
}),
|
|
4220
|
-
new Promise((p,
|
|
4221
|
-
n.onsuccess = () => p(n.result), n.onerror = () =>
|
|
4227
|
+
new Promise((p, h) => {
|
|
4228
|
+
n.onsuccess = () => p(n.result), n.onerror = () => h(n.error);
|
|
4222
4229
|
})
|
|
4223
4230
|
]);
|
|
4224
|
-
e.close(), await this.idbPut(
|
|
4231
|
+
e.close(), await this.idbPut(ie, be, s);
|
|
4225
4232
|
for (let p = 0; p < l.length; p++)
|
|
4226
4233
|
await this.idbPut(q, String(l[p]), a[p]);
|
|
4227
|
-
return indexedDB.deleteDatabase(
|
|
4234
|
+
return indexedDB.deleteDatabase(Re), c.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), s;
|
|
4228
4235
|
} catch (e) {
|
|
4229
4236
|
return c.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
|
|
4230
4237
|
}
|
|
4231
4238
|
}
|
|
4232
4239
|
async encrypt(e) {
|
|
4233
|
-
const r = new Uint8Array(
|
|
4240
|
+
const r = new Uint8Array(vr);
|
|
4234
4241
|
crypto.getRandomValues(r);
|
|
4235
4242
|
const t = new TextEncoder().encode(e), s = await crypto.subtle.encrypt(
|
|
4236
4243
|
{ name: "AES-GCM", iv: r },
|
|
@@ -4288,14 +4295,14 @@ class it {
|
|
|
4288
4295
|
return typeof indexedDB < "u" && typeof crypto < "u" && typeof crypto.subtle < "u";
|
|
4289
4296
|
}
|
|
4290
4297
|
}
|
|
4291
|
-
const
|
|
4292
|
-
class
|
|
4298
|
+
const Sr = 60;
|
|
4299
|
+
class Er {
|
|
4293
4300
|
constructor() {
|
|
4294
4301
|
this.jwks = null;
|
|
4295
4302
|
}
|
|
4296
4303
|
setJWKSEndpoint(e) {
|
|
4297
4304
|
try {
|
|
4298
|
-
this.jwks =
|
|
4305
|
+
this.jwks = Tt(new URL(e)), c.log("[CROSSx] JWKS 엔드포인트 설정:", e);
|
|
4299
4306
|
} catch (r) {
|
|
4300
4307
|
c.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", r);
|
|
4301
4308
|
}
|
|
@@ -4309,7 +4316,7 @@ class yr {
|
|
|
4309
4316
|
iat: t.iat
|
|
4310
4317
|
});
|
|
4311
4318
|
const s = Math.floor(Date.now() / 1e3);
|
|
4312
|
-
if (t.exp && t.exp +
|
|
4319
|
+
if (t.exp && t.exp + Sr < s)
|
|
4313
4320
|
return c.warn("[CROSSx] 토큰 만료:", {
|
|
4314
4321
|
exp: t.exp,
|
|
4315
4322
|
now: s,
|
|
@@ -4319,7 +4326,7 @@ class yr {
|
|
|
4319
4326
|
return c.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: t, valid: !1, signatureVerified: !1 };
|
|
4320
4327
|
if (this.jwks)
|
|
4321
4328
|
try {
|
|
4322
|
-
const { payload: o } = await
|
|
4329
|
+
const { payload: o } = await Rt(e, this.jwks, {
|
|
4323
4330
|
algorithms: ["RS256", "ES256"]
|
|
4324
4331
|
});
|
|
4325
4332
|
return c.log("[CROSSx] JWT 서명 검증 성공"), {
|
|
@@ -4338,7 +4345,7 @@ class yr {
|
|
|
4338
4345
|
}
|
|
4339
4346
|
}
|
|
4340
4347
|
decodeJWT(e) {
|
|
4341
|
-
return
|
|
4348
|
+
return Ct(e);
|
|
4342
4349
|
}
|
|
4343
4350
|
/**
|
|
4344
4351
|
* EIP-191 personal_sign 서명에서 서명자 Ethereum 주소를 복원합니다.
|
|
@@ -4353,29 +4360,29 @@ class yr {
|
|
|
4353
4360
|
${t.length}`
|
|
4354
4361
|
), o = new Uint8Array(s.length + t.length);
|
|
4355
4362
|
o.set(s, 0), o.set(t, s.length);
|
|
4356
|
-
const n =
|
|
4363
|
+
const n = Xe(o), a = r.startsWith("0x") ? r.slice(2) : r;
|
|
4357
4364
|
if (a.length !== 130)
|
|
4358
4365
|
throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${a.length}`);
|
|
4359
|
-
const l =
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
).addRecoveryBit(x).recoverPublicKey(n).toBytes(!1).slice(1), y =
|
|
4363
|
-
return "0x" +
|
|
4366
|
+
const l = Ar(a), p = l.slice(0, 32), h = l.slice(32, 64), u = l[64], x = u >= 27 ? u - 27 : u, m = new Pt.Signature(
|
|
4367
|
+
ct(p),
|
|
4368
|
+
ct(h)
|
|
4369
|
+
).addRecoveryBit(x).recoverPublicKey(n).toBytes(!1).slice(1), y = Xe(m);
|
|
4370
|
+
return "0x" + Nt(y.slice(12));
|
|
4364
4371
|
}
|
|
4365
4372
|
}
|
|
4366
|
-
function
|
|
4373
|
+
function Ar(i) {
|
|
4367
4374
|
const e = new Uint8Array(i.length / 2);
|
|
4368
4375
|
for (let r = 0; r < e.length; r++)
|
|
4369
4376
|
e[r] = parseInt(i.substring(r * 2, r * 2 + 2), 16);
|
|
4370
4377
|
return e;
|
|
4371
4378
|
}
|
|
4372
|
-
function
|
|
4379
|
+
function ct(i) {
|
|
4373
4380
|
let e = "0x";
|
|
4374
4381
|
for (const r of i) e += r.toString(16).padStart(2, "0");
|
|
4375
4382
|
return BigInt(e);
|
|
4376
4383
|
}
|
|
4377
|
-
const
|
|
4378
|
-
class
|
|
4384
|
+
const Ir = 3e4, kr = 1e3;
|
|
4385
|
+
class Tr {
|
|
4379
4386
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4380
4387
|
async request(e) {
|
|
4381
4388
|
const r = e.retries ?? 0;
|
|
@@ -4386,7 +4393,7 @@ class Er {
|
|
|
4386
4393
|
} catch (s) {
|
|
4387
4394
|
if (t === r) throw s;
|
|
4388
4395
|
}
|
|
4389
|
-
await new Promise((s) => setTimeout(s,
|
|
4396
|
+
await new Promise((s) => setTimeout(s, kr * 2 ** t));
|
|
4390
4397
|
}
|
|
4391
4398
|
throw new Error("Unexpected: retry loop exited without result");
|
|
4392
4399
|
}
|
|
@@ -4394,7 +4401,7 @@ class Er {
|
|
|
4394
4401
|
async _doRequest(e) {
|
|
4395
4402
|
const r = new AbortController(), t = setTimeout(
|
|
4396
4403
|
() => r.abort(),
|
|
4397
|
-
e.timeoutMs ??
|
|
4404
|
+
e.timeoutMs ?? Ir
|
|
4398
4405
|
);
|
|
4399
4406
|
try {
|
|
4400
4407
|
const s = await fetch(e.url, {
|
|
@@ -4421,15 +4428,90 @@ class Er {
|
|
|
4421
4428
|
}
|
|
4422
4429
|
}
|
|
4423
4430
|
}
|
|
4424
|
-
const
|
|
4431
|
+
const Rr = [
|
|
4432
|
+
/CROSSx\/([\d.]+)/i,
|
|
4433
|
+
/ONE\s?wallet[^\s/]*\/([\d.]+)/i
|
|
4434
|
+
];
|
|
4435
|
+
function Ke() {
|
|
4436
|
+
return typeof window > "u" ? void 0 : window;
|
|
4437
|
+
}
|
|
4438
|
+
function Cr() {
|
|
4439
|
+
const i = Ke();
|
|
4440
|
+
return i == null ? void 0 : i.__crossx;
|
|
4441
|
+
}
|
|
4442
|
+
function Pr(i) {
|
|
4443
|
+
return i === "ios" || i === "android" ? i : null;
|
|
4444
|
+
}
|
|
4445
|
+
function Ce() {
|
|
4446
|
+
const i = typeof navigator > "u" ? "" : navigator.userAgent;
|
|
4447
|
+
return /Android/i.test(i) ? "android" : /iPhone|iPad|iPod|Macintosh/i.test(i) ? "ios" : null;
|
|
4448
|
+
}
|
|
4449
|
+
function Nr(i, e) {
|
|
4450
|
+
const r = (n) => n.split(/[^\d]+/).filter((a) => a !== "").map((a) => Number.parseInt(a, 10)), t = r(i), s = r(e), o = Math.max(t.length, s.length);
|
|
4451
|
+
for (let n = 0; n < o; n += 1) {
|
|
4452
|
+
const a = (t[n] ?? 0) - (s[n] ?? 0);
|
|
4453
|
+
if (a !== 0) return a;
|
|
4454
|
+
}
|
|
4455
|
+
return 0;
|
|
4456
|
+
}
|
|
4457
|
+
function Or() {
|
|
4458
|
+
const i = Ke();
|
|
4459
|
+
if (!i) return !1;
|
|
4460
|
+
const e = i.__crossxRNBridge;
|
|
4461
|
+
return e != null && e.isInstalled ? !0 : i.__CROSSX_BRIDGE_INITIALIZED__ === !0 || i.__CROSSX_RN_BRIDGE_READY__ === !0;
|
|
4462
|
+
}
|
|
4463
|
+
function lt() {
|
|
4464
|
+
const i = typeof navigator > "u" ? "" : navigator.userAgent;
|
|
4465
|
+
for (const e of Rr) {
|
|
4466
|
+
const r = e.exec(i);
|
|
4467
|
+
if (r) return r[1] ?? null;
|
|
4468
|
+
}
|
|
4469
|
+
}
|
|
4470
|
+
function ve() {
|
|
4471
|
+
const i = Cr();
|
|
4472
|
+
if (i != null && i.browser)
|
|
4473
|
+
return {
|
|
4474
|
+
version: i.version ?? null,
|
|
4475
|
+
platform: Pr(i.platform) ?? Ce(),
|
|
4476
|
+
detectedBy: "marker"
|
|
4477
|
+
};
|
|
4478
|
+
if (Or())
|
|
4479
|
+
return {
|
|
4480
|
+
version: lt() ?? null,
|
|
4481
|
+
platform: Ce(),
|
|
4482
|
+
detectedBy: "bridge"
|
|
4483
|
+
};
|
|
4484
|
+
const e = lt();
|
|
4485
|
+
return e !== void 0 ? { version: e, platform: Ce(), detectedBy: "user-agent" } : null;
|
|
4486
|
+
}
|
|
4487
|
+
function Qs() {
|
|
4488
|
+
return ve() !== null;
|
|
4489
|
+
}
|
|
4490
|
+
function ei(i = 3e3) {
|
|
4491
|
+
const e = ve();
|
|
4492
|
+
return e ? Promise.resolve(e) : Ke() ? new Promise((r) => {
|
|
4493
|
+
const t = Date.now(), s = setInterval(() => {
|
|
4494
|
+
const o = ve();
|
|
4495
|
+
if (o) {
|
|
4496
|
+
clearInterval(s), r(o);
|
|
4497
|
+
return;
|
|
4498
|
+
}
|
|
4499
|
+
Date.now() - t >= i && (clearInterval(s), r(null));
|
|
4500
|
+
}, 50);
|
|
4501
|
+
}) : Promise.resolve(null);
|
|
4502
|
+
}
|
|
4503
|
+
const Lr = /* @__PURE__ */ new Set([
|
|
4425
4504
|
"https://cross-wallet-oauth.crosstoken.io",
|
|
4426
4505
|
"https://stg-cross-wallet-oauth.crosstoken.io",
|
|
4427
4506
|
"https://dev-cross-wallet-oauth.crosstoken.io",
|
|
4428
4507
|
"https://one-wallet-oauth.onechain.nexus",
|
|
4429
4508
|
"https://stg-one-wallet-oauth.onechain.nexus",
|
|
4430
4509
|
"https://dev-one-wallet-oauth.onechain.nexus"
|
|
4431
|
-
]),
|
|
4432
|
-
|
|
4510
|
+
]), Dr = "crossx://oauth-callback", Mr = "2.3.2";
|
|
4511
|
+
function $r(i) {
|
|
4512
|
+
return i.platform !== "ios" ? !1 : i.version ? Nr(i.version, Mr) <= 0 : !0;
|
|
4513
|
+
}
|
|
4514
|
+
class ne {
|
|
4433
4515
|
constructor() {
|
|
4434
4516
|
this.abortPending = null;
|
|
4435
4517
|
}
|
|
@@ -4464,7 +4546,7 @@ class ie {
|
|
|
4464
4546
|
* - Google 및 기타: originalNonce === jwt.nonce
|
|
4465
4547
|
*/
|
|
4466
4548
|
static async verifyIdTokenNonce(e, r) {
|
|
4467
|
-
const t =
|
|
4549
|
+
const t = ne.parseJwtPayload(e), s = t.nonce, o = typeof t.iss == "string" ? t.iss : "(unknown)";
|
|
4468
4550
|
if (c.log("[CROSSx] nonce 검증 시작 —", {
|
|
4469
4551
|
iss: o,
|
|
4470
4552
|
nonceClaimType: typeof s,
|
|
@@ -4486,7 +4568,7 @@ class ie {
|
|
|
4486
4568
|
return;
|
|
4487
4569
|
}
|
|
4488
4570
|
if (o.includes("appleid.apple.com")) {
|
|
4489
|
-
const n = await
|
|
4571
|
+
const n = await ne.sha256Hex(r);
|
|
4490
4572
|
if (c.log("[CROSSx] Apple nonce 검증 —", {
|
|
4491
4573
|
expectedHashLength: n.length,
|
|
4492
4574
|
receivedHashLength: s.length,
|
|
@@ -4503,91 +4585,102 @@ class ie {
|
|
|
4503
4585
|
}
|
|
4504
4586
|
openAuth(e) {
|
|
4505
4587
|
return new Promise((r, t) => {
|
|
4506
|
-
const s = Math.max(e.width ?? 500, 500), o = Math.max(e.height ?? 700, 700), n = window.screenX + (window.outerWidth - s) / 2, a = window.screenY + (window.outerHeight - o) / 2, l =
|
|
4507
|
-
let
|
|
4508
|
-
|
|
4588
|
+
const s = Math.max(e.width ?? 500, 500), o = Math.max(e.height ?? 700, 700), n = window.screenX + (window.outerWidth - s) / 2, a = window.screenY + (window.outerHeight - o) / 2, l = ne.generateRandom16Hex(), p = ne.generateRandom16Hex(), h = ve();
|
|
4589
|
+
let u = e.authUrl;
|
|
4590
|
+
h && e.legacyAuthUrl && $r(h) && (u = e.legacyAuthUrl, c.info("[CROSSx] 구버전 iOS 지갑 감지 — 이관 전 OAuth 호스트 사용", {
|
|
4591
|
+
appVersion: h.version ?? "(unknown)",
|
|
4592
|
+
detectedBy: h.detectedBy,
|
|
4593
|
+
authUrlBase: e.legacyAuthUrl
|
|
4594
|
+
}));
|
|
4595
|
+
const x = u.includes("?") ? "&" : "?", g = encodeURIComponent(window.location.origin);
|
|
4596
|
+
let f = `${u}${x}state=${l}&nonce=${p}&origin=${g}`;
|
|
4597
|
+
h && !f.includes("redirectUrl=") && (f += `&redirectUrl=${encodeURIComponent(Dr)}`, c.info("[CROSSx] 지갑 인앱 브라우저 감지 — redirectUrl 콜백 자동 부착", {
|
|
4598
|
+
detectedBy: h.detectedBy,
|
|
4599
|
+
appVersion: h.version ?? "(unknown)",
|
|
4600
|
+
platform: h.platform ?? "(unknown)"
|
|
4601
|
+
})), c.log("[CROSSx] OAuth 팝업 열기 — state, nonce 생성 완료:", {
|
|
4509
4602
|
stateLength: l.length,
|
|
4510
4603
|
nonceLength: p.length,
|
|
4511
|
-
authUrlBase:
|
|
4604
|
+
authUrlBase: u
|
|
4512
4605
|
});
|
|
4513
|
-
const
|
|
4514
|
-
|
|
4606
|
+
const m = window.open(
|
|
4607
|
+
f,
|
|
4515
4608
|
"CROSSx OAuth",
|
|
4516
4609
|
`width=${s},height=${o},left=${n},top=${a}`
|
|
4517
4610
|
);
|
|
4518
|
-
if (!
|
|
4611
|
+
if (!m) {
|
|
4519
4612
|
t(new Error("팝업 창을 열 수 없습니다. 팝업 차단을 해제해 주세요."));
|
|
4520
4613
|
return;
|
|
4521
4614
|
}
|
|
4522
|
-
const
|
|
4523
|
-
c.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"),
|
|
4524
|
-
}, 5 * 60 * 1e3),
|
|
4525
|
-
let
|
|
4526
|
-
const
|
|
4527
|
-
clearInterval(
|
|
4528
|
-
|
|
4615
|
+
const y = setTimeout(() => {
|
|
4616
|
+
c.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), W(), t(new Error("Authentication timeout"));
|
|
4617
|
+
}, 5 * 60 * 1e3), S = 10, E = 30;
|
|
4618
|
+
let A = 0, T = null;
|
|
4619
|
+
const R = () => {
|
|
4620
|
+
clearInterval(N), c.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + E + "초간 대기합니다"), T = setTimeout(() => {
|
|
4621
|
+
W(), t(new Error(
|
|
4529
4622
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
4530
4623
|
));
|
|
4531
|
-
},
|
|
4532
|
-
},
|
|
4533
|
-
|
|
4624
|
+
}, E * 1e3);
|
|
4625
|
+
}, N = setInterval(() => {
|
|
4626
|
+
A++;
|
|
4534
4627
|
try {
|
|
4535
|
-
if (!
|
|
4536
|
-
const
|
|
4537
|
-
|
|
4628
|
+
if (!m.closed) return;
|
|
4629
|
+
const D = typeof document < "u" && document.hasFocus();
|
|
4630
|
+
A <= S && !D ? R() : (W(), t(new Error("로그인이 취소되었습니다")));
|
|
4538
4631
|
} catch {
|
|
4539
|
-
|
|
4632
|
+
R();
|
|
4540
4633
|
}
|
|
4541
|
-
}, 1e3),
|
|
4542
|
-
this.abortPending = null, clearTimeout(
|
|
4543
|
-
},
|
|
4544
|
-
if (!
|
|
4545
|
-
|
|
4546
|
-
const
|
|
4634
|
+
}, 1e3), W = () => {
|
|
4635
|
+
this.abortPending = null, clearTimeout(y), clearInterval(N), T && clearTimeout(T), window.removeEventListener("message", Y);
|
|
4636
|
+
}, Y = (D) => {
|
|
4637
|
+
if (!Lr.has(D.origin)) return;
|
|
4638
|
+
W();
|
|
4639
|
+
const V = typeof D.data.status == "string", I = V ? D.data.data ?? {} : D.data;
|
|
4547
4640
|
c.log("[CROSSx] OAuth postMessage 수신 —", {
|
|
4548
|
-
format:
|
|
4549
|
-
status:
|
|
4641
|
+
format: V ? "wrapped" : "flat",
|
|
4642
|
+
status: V ? D.data.status : "(flat)"
|
|
4550
4643
|
});
|
|
4551
|
-
const
|
|
4552
|
-
if (!
|
|
4644
|
+
const O = (I == null ? void 0 : I.state) ?? D.data.state;
|
|
4645
|
+
if (!O || O !== l) {
|
|
4553
4646
|
t(new Error("OAuth state mismatch — possible CSRF attack"));
|
|
4554
4647
|
return;
|
|
4555
4648
|
}
|
|
4556
|
-
if (
|
|
4557
|
-
c.error("[CROSSx] OAuth 실패:",
|
|
4649
|
+
if (V && D.data.status !== "success") {
|
|
4650
|
+
c.error("[CROSSx] OAuth 실패:", I == null ? void 0 : I.error), t(new Error((I == null ? void 0 : I.error) || "Authentication failed"));
|
|
4558
4651
|
return;
|
|
4559
4652
|
}
|
|
4560
|
-
if (!
|
|
4561
|
-
c.error("[CROSSx] OAuth 실패:",
|
|
4653
|
+
if (!V && (I != null && I.error)) {
|
|
4654
|
+
c.error("[CROSSx] OAuth 실패:", I.error), t(new Error(I.error || "Authentication failed"));
|
|
4562
4655
|
return;
|
|
4563
4656
|
}
|
|
4564
|
-
const
|
|
4657
|
+
const M = I == null ? void 0 : I.idToken, X = I == null ? void 0 : I.accessToken, he = X ?? M, we = (I == null ? void 0 : I.email) || void 0;
|
|
4565
4658
|
if (c.log("[CROSSx] OAuth 토큰 수신:", {
|
|
4566
|
-
hasAccessToken: !!
|
|
4567
|
-
hasIdToken: !!
|
|
4568
|
-
hasEmail: !!
|
|
4569
|
-
}), !
|
|
4570
|
-
c.error("[CROSSx] 토큰을 찾을 수 없음:",
|
|
4659
|
+
hasAccessToken: !!X,
|
|
4660
|
+
hasIdToken: !!M,
|
|
4661
|
+
hasEmail: !!we
|
|
4662
|
+
}), !he) {
|
|
4663
|
+
c.error("[CROSSx] 토큰을 찾을 수 없음:", D.data), t(new Error("Token not found in response"));
|
|
4571
4664
|
return;
|
|
4572
4665
|
}
|
|
4573
|
-
const
|
|
4574
|
-
|
|
4575
|
-
c.error("[CROSSx] nonce 검증 실패:",
|
|
4666
|
+
const _e = { token: he, email: we }, se = (ue) => {
|
|
4667
|
+
ne.verifyIdTokenNonce(ue, p).then(() => r(_e)).catch((J) => {
|
|
4668
|
+
c.error("[CROSSx] nonce 검증 실패:", J), t(J instanceof Error ? J : new Error("nonce verification failed"));
|
|
4576
4669
|
});
|
|
4577
4670
|
};
|
|
4578
|
-
|
|
4671
|
+
X ? X.split(".").length === 3 ? se(X) : M ? se(M) : (c.warn(
|
|
4579
4672
|
"[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
|
|
4580
4673
|
"서버 측 nonce 검증이 필요합니다."
|
|
4581
|
-
), r(
|
|
4674
|
+
), r(_e)) : M ? se(M) : t(new Error("Token not found in response"));
|
|
4582
4675
|
};
|
|
4583
|
-
this.abortPending = (
|
|
4584
|
-
|
|
4585
|
-
}, window.addEventListener("message",
|
|
4676
|
+
this.abortPending = (D) => {
|
|
4677
|
+
W(), t(new Error(D));
|
|
4678
|
+
}, window.addEventListener("message", Y);
|
|
4586
4679
|
});
|
|
4587
4680
|
}
|
|
4588
4681
|
}
|
|
4589
|
-
const xe = "crossx_wallet_data",
|
|
4590
|
-
class
|
|
4682
|
+
const xe = "crossx_wallet_data", le = "crossx_mock_pin_hash";
|
|
4683
|
+
class Fr {
|
|
4591
4684
|
constructor(e, r) {
|
|
4592
4685
|
this.storage = e, this.pinStore = r ?? null;
|
|
4593
4686
|
}
|
|
@@ -4616,9 +4709,9 @@ class Tr {
|
|
|
4616
4709
|
};
|
|
4617
4710
|
await this.storage.set(xe, s);
|
|
4618
4711
|
const o = (r = this.pinStore) == null ? void 0 : r.get();
|
|
4619
|
-
return o && (await this.storage.set(
|
|
4712
|
+
return o && (await this.storage.set(le, o), c.log("[Mock] 지갑 생성 — PIN 저장됨")), s;
|
|
4620
4713
|
} catch (t) {
|
|
4621
|
-
throw new
|
|
4714
|
+
throw new _(d.WALLET_CREATION_FAILED, "지갑 생성에 실패했습니다", t);
|
|
4622
4715
|
}
|
|
4623
4716
|
}
|
|
4624
4717
|
/** GET /mnemonic/addresses 모킹 — PIN 불필요, 캐시된 주소 반환 */
|
|
@@ -4658,8 +4751,8 @@ class Tr {
|
|
|
4658
4751
|
var t;
|
|
4659
4752
|
if (c.log("[Mock] verifyPin"), this.pinScenario === "wrong")
|
|
4660
4753
|
return !1;
|
|
4661
|
-
const r = await this.storage.get(
|
|
4662
|
-
return r && r !== e ? !1 : (r || await this.storage.set(
|
|
4754
|
+
const r = await this.storage.get(le);
|
|
4755
|
+
return r && r !== e ? !1 : (r || await this.storage.set(le, e), (t = this.pinStore) == null || t.set(e), c.log("[Mock] verifyPin → 성공"), !0);
|
|
4663
4756
|
}
|
|
4664
4757
|
/**
|
|
4665
4758
|
* POST /mnemonic/change-password 모킹
|
|
@@ -4668,16 +4761,16 @@ class Tr {
|
|
|
4668
4761
|
async changePin(e, r) {
|
|
4669
4762
|
var o;
|
|
4670
4763
|
if (c.log("[Mock] changePin"), this.pinScenario === "wrong")
|
|
4671
|
-
throw new
|
|
4672
|
-
const t = (o = this.pinStore) == null ? void 0 : o.get(), s = await this.storage.get(
|
|
4764
|
+
throw new _(d.PIN_WRONG, "Incorrect PIN.");
|
|
4765
|
+
const t = (o = this.pinStore) == null ? void 0 : o.get(), s = await this.storage.get(le);
|
|
4673
4766
|
if (s && t && s !== t)
|
|
4674
|
-
throw new
|
|
4675
|
-
await this.storage.set(
|
|
4767
|
+
throw new _(d.PIN_WRONG, "Incorrect PIN.");
|
|
4768
|
+
await this.storage.set(le, r), c.log("[Mock] changePin 완료");
|
|
4676
4769
|
}
|
|
4677
4770
|
async migrateWallet(e, r) {
|
|
4678
4771
|
var o;
|
|
4679
4772
|
if (c.log(`[Mock] migrateWallet pin=${e} sub=${r}`), this.migrateScenario === "wrong_pin")
|
|
4680
|
-
throw new
|
|
4773
|
+
throw new _(d.MIGRATION_FAILED, "Incorrect PIN.", {
|
|
4681
4774
|
permanent: !1,
|
|
4682
4775
|
lockExpiresAt: 0,
|
|
4683
4776
|
remainingAttempts: 4,
|
|
@@ -4691,7 +4784,7 @@ class Tr {
|
|
|
4691
4784
|
maxAttempts: 5,
|
|
4692
4785
|
...this.migrateScenario.locked
|
|
4693
4786
|
};
|
|
4694
|
-
throw new
|
|
4787
|
+
throw new _(
|
|
4695
4788
|
d.MIGRATION_PIN_LOCKED,
|
|
4696
4789
|
"Too many incorrect PIN attempts. Your account has been temporarily locked.",
|
|
4697
4790
|
a
|
|
@@ -4705,7 +4798,7 @@ class Tr {
|
|
|
4705
4798
|
};
|
|
4706
4799
|
await this.storage.set(xe, t);
|
|
4707
4800
|
const s = (o = this.pinStore) == null ? void 0 : o.get();
|
|
4708
|
-
return s && (await this.storage.set(
|
|
4801
|
+
return s && (await this.storage.set(le, s), c.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
|
|
4709
4802
|
}
|
|
4710
4803
|
/**
|
|
4711
4804
|
* POST /mnemonic/share-c 모킹
|
|
@@ -4732,7 +4825,7 @@ class Tr {
|
|
|
4732
4825
|
).join("");
|
|
4733
4826
|
}
|
|
4734
4827
|
}
|
|
4735
|
-
class
|
|
4828
|
+
class ae {
|
|
4736
4829
|
constructor(e, r, t, s, o) {
|
|
4737
4830
|
this._refreshPromise = null, this._walletStatusCache = null, this.adapterConfig = e, this.projectId = e.projectId, this.storage = r, this.transport = t, this.tokenStore = s, this.pinStore = o ?? null;
|
|
4738
4831
|
}
|
|
@@ -4759,23 +4852,23 @@ class oe {
|
|
|
4759
4852
|
*/
|
|
4760
4853
|
async ensureValidToken() {
|
|
4761
4854
|
const e = this.tokenStore.get();
|
|
4762
|
-
if (e && !this.tokenStore.isExpiringSoon(
|
|
4855
|
+
if (e && !this.tokenStore.isExpiringSoon(tt))
|
|
4763
4856
|
return e;
|
|
4764
|
-
const r = !e || this.tokenStore.isExpiringSoon(
|
|
4857
|
+
const r = !e || this.tokenStore.isExpiringSoon(tt);
|
|
4765
4858
|
if (this._onTokenRefresh) {
|
|
4766
4859
|
if (await this.deduplicatedRefresh()) {
|
|
4767
4860
|
const s = this.tokenStore.get();
|
|
4768
4861
|
if (s) return s;
|
|
4769
4862
|
}
|
|
4770
4863
|
if (r)
|
|
4771
|
-
throw new
|
|
4864
|
+
throw new _(
|
|
4772
4865
|
d.SESSION_EXPIRED,
|
|
4773
4866
|
"인증 세션이 만료되었습니다. 다시 로그인해 주세요."
|
|
4774
4867
|
);
|
|
4775
4868
|
}
|
|
4776
4869
|
if (e)
|
|
4777
4870
|
return c.warn("[CROSSx] 토큰 갱신 실패 — 기존 토큰으로 요청 시도"), e;
|
|
4778
|
-
throw new
|
|
4871
|
+
throw new _(
|
|
4779
4872
|
d.SESSION_EXPIRED,
|
|
4780
4873
|
"인증 세션이 만료되었습니다. 다시 로그인해 주세요."
|
|
4781
4874
|
);
|
|
@@ -4787,7 +4880,7 @@ class oe {
|
|
|
4787
4880
|
}), this._refreshPromise);
|
|
4788
4881
|
}
|
|
4789
4882
|
async request(e, r, t, s = !1) {
|
|
4790
|
-
var l, p,
|
|
4883
|
+
var l, p, h, u;
|
|
4791
4884
|
const o = await this.ensureValidToken(), n = `${this.baseUrl}${r}`, a = {
|
|
4792
4885
|
Authorization: `Bearer ${o}`,
|
|
4793
4886
|
"Content-Type": "application/json",
|
|
@@ -4809,36 +4902,36 @@ class oe {
|
|
|
4809
4902
|
url: n,
|
|
4810
4903
|
method: e
|
|
4811
4904
|
});
|
|
4812
|
-
const m =
|
|
4905
|
+
const m = ae.mapGatewayError(g.code, g.data);
|
|
4813
4906
|
if (m === d.AUTH_NOT_AUTHENTICATED && !s && this._onTokenRefresh) {
|
|
4814
4907
|
if (c.warn("[CROSSx] Gateway -10002 감지 — 토큰 갱신 후 재시도"), await this.deduplicatedRefresh())
|
|
4815
4908
|
return this.request(e, r, t, !0);
|
|
4816
|
-
throw new
|
|
4909
|
+
throw new _(d.SESSION_EXPIRED, "인증 세션이 만료되었습니다. 다시 로그인해 주세요.");
|
|
4817
4910
|
}
|
|
4818
4911
|
if (m === d.USER_NOT_FOUND)
|
|
4819
|
-
throw c.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (l = this._onUnauthorized) == null || l.call(this), new
|
|
4912
|
+
throw c.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (l = this._onUnauthorized) == null || l.call(this), new _(
|
|
4820
4913
|
d.USER_NOT_FOUND,
|
|
4821
|
-
|
|
4914
|
+
ae.getGatewayErrorMessage(g.code, f)
|
|
4822
4915
|
);
|
|
4823
|
-
const y = m === d.AUTH_NOT_AUTHENTICATED ? d.SESSION_EXPIRED : m, S = y === d.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." :
|
|
4916
|
+
const y = m === d.AUTH_NOT_AUTHENTICATED ? d.SESSION_EXPIRED : m, S = y === d.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : ae.getGatewayErrorMessage(g.code, f), E = g.data;
|
|
4824
4917
|
let A;
|
|
4825
|
-
throw m === d.PIN_LOCKED ? A =
|
|
4918
|
+
throw m === d.PIN_LOCKED ? A = ae.extractLockDetails(E) : m === d.ADDRESS_LIMIT_EXCEEDED ? A = { limit: De, raw: E } : A = E ?? void 0, new _(y, S, A);
|
|
4826
4919
|
}
|
|
4827
4920
|
return c.log("[CROSSx] Wallet Gateway API 성공:", { code: g.code, url: n, method: e }), g.data ?? g;
|
|
4828
4921
|
}
|
|
4829
4922
|
return g;
|
|
4830
4923
|
} catch (x) {
|
|
4831
|
-
if (x instanceof
|
|
4924
|
+
if (x instanceof _) throw x;
|
|
4832
4925
|
const g = ((p = x.response) == null ? void 0 : p.status) ?? x.status;
|
|
4833
4926
|
if ((g === 401 || g === 403) && !s && this._onTokenRefresh) {
|
|
4834
4927
|
if (c.warn(`[CROSSx] HTTP ${g} 감지 — 토큰 갱신 후 재시도`), await this.deduplicatedRefresh())
|
|
4835
4928
|
return this.request(e, r, t, !0);
|
|
4836
|
-
throw new
|
|
4929
|
+
throw new _(
|
|
4837
4930
|
d.SESSION_EXPIRED,
|
|
4838
4931
|
"인증 세션이 만료되었습니다. 다시 로그인해 주세요."
|
|
4839
4932
|
);
|
|
4840
4933
|
}
|
|
4841
|
-
if ((
|
|
4934
|
+
if ((h = x.response) != null && h.data) {
|
|
4842
4935
|
const f = x.response.data, m = f.message || f.data || "API 요청에 실패했습니다", y = f.code || "UNKNOWN";
|
|
4843
4936
|
throw c.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
|
|
4844
4937
|
code: y,
|
|
@@ -4846,7 +4939,7 @@ class oe {
|
|
|
4846
4939
|
url: n,
|
|
4847
4940
|
method: e,
|
|
4848
4941
|
status: (u = x.response) == null ? void 0 : u.status
|
|
4849
|
-
}), new
|
|
4942
|
+
}), new _(
|
|
4850
4943
|
d.UNKNOWN_ERROR,
|
|
4851
4944
|
`Wallet Gateway 오류 (${y}): ${m}`
|
|
4852
4945
|
);
|
|
@@ -4873,7 +4966,7 @@ class oe {
|
|
|
4873
4966
|
async getOrCreateWallet(e) {
|
|
4874
4967
|
let r;
|
|
4875
4968
|
if (this._walletStatusCache !== null ? (r = this._walletStatusCache, this._walletStatusCache = null, c.log("[CROSSx] getOrCreateWallet — 캐시된 상태 사용:", r)) : (c.log("[CROSSx] GET /mnemonic/check — 지갑 상태 확인"), r = await this.checkWallet(), this._walletStatusCache = null), r === "migration_required")
|
|
4876
|
-
throw c.log("[CROSSx] migration_required → MIGRATION_BACKUP_EXISTS throw"), new
|
|
4969
|
+
throw c.log("[CROSSx] migration_required → MIGRATION_BACKUP_EXISTS throw"), new _(
|
|
4877
4970
|
d.MIGRATION_BACKUP_EXISTS,
|
|
4878
4971
|
"CROSSx 백업이 존재합니다. 마이그레이션을 진행해 주세요."
|
|
4879
4972
|
);
|
|
@@ -4916,15 +5009,15 @@ class oe {
|
|
|
4916
5009
|
switch (e) {
|
|
4917
5010
|
case "sign":
|
|
4918
5011
|
case "send":
|
|
4919
|
-
if (!r.tx) throw new
|
|
5012
|
+
if (!r.tx) throw new _(d.TX_INVALID_PARAMS, "prepare: tx가 필요합니다");
|
|
4920
5013
|
t = { unsignedTx: this.buildUnsignedTx(r.tx) };
|
|
4921
5014
|
break;
|
|
4922
5015
|
case "sign-message":
|
|
4923
|
-
if (!r.message) throw new
|
|
5016
|
+
if (!r.message) throw new _(d.TX_INVALID_PARAMS, "prepare: message가 필요합니다");
|
|
4924
5017
|
t = { message: r.message }, r.from && (t.from = r.from);
|
|
4925
5018
|
break;
|
|
4926
5019
|
case "sign-typed-data":
|
|
4927
|
-
if (!r.typedData) throw new
|
|
5020
|
+
if (!r.typedData) throw new _(d.TX_INVALID_PARAMS, "prepare: typedData가 필요합니다");
|
|
4928
5021
|
t = { typedData: r.typedData }, r.from && (t.from = r.from);
|
|
4929
5022
|
break;
|
|
4930
5023
|
}
|
|
@@ -5013,7 +5106,7 @@ class oe {
|
|
|
5013
5106
|
if (!t.valid && t.passwordStatus) {
|
|
5014
5107
|
const s = t.passwordStatus;
|
|
5015
5108
|
if (s.permanent)
|
|
5016
|
-
throw new
|
|
5109
|
+
throw new _(d.PIN_LOCKED, "Incorrect PIN.", {
|
|
5017
5110
|
permanent: !0,
|
|
5018
5111
|
lockExpiresAt: s.lockExpiresAt,
|
|
5019
5112
|
remainingAttempts: 0,
|
|
@@ -5021,7 +5114,7 @@ class oe {
|
|
|
5021
5114
|
});
|
|
5022
5115
|
if (s.remainingAttempts === 0 && s.lockExpiresAt) {
|
|
5023
5116
|
const o = s.lockExpiresAt > 1e10 ? s.lockExpiresAt : s.lockExpiresAt * 1e3;
|
|
5024
|
-
throw new
|
|
5117
|
+
throw new _(d.PIN_LOCKED, "Too many failed PIN attempts.", {
|
|
5025
5118
|
permanent: !1,
|
|
5026
5119
|
lockExpiresAt: o,
|
|
5027
5120
|
remainingAttempts: 0,
|
|
@@ -5029,7 +5122,7 @@ class oe {
|
|
|
5029
5122
|
});
|
|
5030
5123
|
}
|
|
5031
5124
|
if (s.remainingAttempts != null && s.remainingAttempts > 0)
|
|
5032
|
-
throw new
|
|
5125
|
+
throw new _(d.PIN_LOCKED, "Incorrect PIN.", {
|
|
5033
5126
|
permanent: !1,
|
|
5034
5127
|
lockExpiresAt: 0,
|
|
5035
5128
|
remainingAttempts: s.remainingAttempts,
|
|
@@ -5066,7 +5159,7 @@ class oe {
|
|
|
5066
5159
|
requirePin() {
|
|
5067
5160
|
const e = this.getPin();
|
|
5068
5161
|
if (!e)
|
|
5069
|
-
throw new
|
|
5162
|
+
throw new _(
|
|
5070
5163
|
d.PIN_NOT_SET,
|
|
5071
5164
|
"PIN이 설정되지 않았습니다. PIN을 입력해 주세요."
|
|
5072
5165
|
);
|
|
@@ -5139,7 +5232,7 @@ class oe {
|
|
|
5139
5232
|
case -10025:
|
|
5140
5233
|
return d.INVALID_APP_TYPE;
|
|
5141
5234
|
case -10028:
|
|
5142
|
-
return
|
|
5235
|
+
return ae.hasLockInfo(r) ? d.PIN_LOCKED : d.PIN_WRONG;
|
|
5143
5236
|
case -10029:
|
|
5144
5237
|
return d.PIN_INVALID;
|
|
5145
5238
|
case -10031:
|
|
@@ -5210,7 +5303,7 @@ class oe {
|
|
|
5210
5303
|
case -10033:
|
|
5211
5304
|
return "User not found. You have been signed out.";
|
|
5212
5305
|
case -10036:
|
|
5213
|
-
return `Account limit reached. Maximum ${
|
|
5306
|
+
return `Account limit reached. Maximum ${De} accounts allowed.`;
|
|
5214
5307
|
case -10040:
|
|
5215
5308
|
return "HMAC signature header is required.";
|
|
5216
5309
|
case -10041:
|
|
@@ -5220,7 +5313,7 @@ class oe {
|
|
|
5220
5313
|
}
|
|
5221
5314
|
}
|
|
5222
5315
|
}
|
|
5223
|
-
class
|
|
5316
|
+
class Br {
|
|
5224
5317
|
constructor(e, r, t, s = () => {
|
|
5225
5318
|
}, o = () => {
|
|
5226
5319
|
}) {
|
|
@@ -5371,7 +5464,7 @@ class fe {
|
|
|
5371
5464
|
}
|
|
5372
5465
|
isCacheValid() {
|
|
5373
5466
|
if (this.loadedAt === 0) return !1;
|
|
5374
|
-
const e = this.usingFallback ?
|
|
5467
|
+
const e = this.usingFallback ? Ft : $t;
|
|
5375
5468
|
return e === 0 ? !0 : Date.now() - this.loadedAt < e;
|
|
5376
5469
|
}
|
|
5377
5470
|
populateCache(e, r) {
|
|
@@ -5392,7 +5485,7 @@ class fe {
|
|
|
5392
5485
|
handleEnvelopeError(e) {
|
|
5393
5486
|
if (e.code < 0) {
|
|
5394
5487
|
const r = typeof e.data == "string" ? e.data : e.message ?? "체인 레지스트리 요청에 실패했습니다";
|
|
5395
|
-
throw new
|
|
5488
|
+
throw new _(
|
|
5396
5489
|
fe.mapErrorCode(e.code),
|
|
5397
5490
|
r
|
|
5398
5491
|
);
|
|
@@ -5403,13 +5496,13 @@ class fe {
|
|
|
5403
5496
|
(t) => t.chainId === e
|
|
5404
5497
|
);
|
|
5405
5498
|
if (r) return r;
|
|
5406
|
-
throw new
|
|
5499
|
+
throw new _(
|
|
5407
5500
|
d.CHAIN_NOT_SUPPORTED,
|
|
5408
5501
|
`지원하지 않는 체인: ${e}`
|
|
5409
5502
|
);
|
|
5410
5503
|
}
|
|
5411
5504
|
static fallbackChains() {
|
|
5412
|
-
return Object.values(
|
|
5505
|
+
return Object.values(Ae).map((e) => ({
|
|
5413
5506
|
chainId: e.caipId,
|
|
5414
5507
|
rpcUrl: e.rpcUrl
|
|
5415
5508
|
}));
|
|
@@ -5433,7 +5526,7 @@ class fe {
|
|
|
5433
5526
|
}
|
|
5434
5527
|
}
|
|
5435
5528
|
}
|
|
5436
|
-
const
|
|
5529
|
+
const dt = "__crossx-confirm-style", F = "__crossx-confirm-overlay", Ur = {
|
|
5437
5530
|
light: {
|
|
5438
5531
|
bg: "#FFFFFF",
|
|
5439
5532
|
border: "rgba(0,0,0,0.07)",
|
|
@@ -5501,8 +5594,8 @@ const nt = "__crossx-confirm-style", F = "__crossx-confirm-overlay", Cr = {
|
|
|
5501
5594
|
onPrimary: "#000000"
|
|
5502
5595
|
}
|
|
5503
5596
|
};
|
|
5504
|
-
function
|
|
5505
|
-
const r =
|
|
5597
|
+
function pt(i, e) {
|
|
5598
|
+
const r = Ur[i], t = e == null ? void 0 : e[i];
|
|
5506
5599
|
return t ? {
|
|
5507
5600
|
...r,
|
|
5508
5601
|
// ── Brand
|
|
@@ -5536,7 +5629,7 @@ function at(i, e) {
|
|
|
5536
5629
|
...t.error !== void 0 && { errorColor: t.error }
|
|
5537
5630
|
} : r;
|
|
5538
5631
|
}
|
|
5539
|
-
const
|
|
5632
|
+
const Wr = `
|
|
5540
5633
|
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400&family=Sora:wght@400;600&display=swap');
|
|
5541
5634
|
|
|
5542
5635
|
#${F} {
|
|
@@ -8137,11 +8230,11 @@ button.__crossx-connect-other-block:active {
|
|
|
8137
8230
|
display: block;
|
|
8138
8231
|
}
|
|
8139
8232
|
`;
|
|
8140
|
-
function
|
|
8141
|
-
let i = document.getElementById(
|
|
8142
|
-
i || (i = document.createElement("style"), i.id =
|
|
8233
|
+
function G() {
|
|
8234
|
+
let i = document.getElementById(dt);
|
|
8235
|
+
i || (i = document.createElement("style"), i.id = dt, document.head.appendChild(i)), i.textContent = Wr;
|
|
8143
8236
|
}
|
|
8144
|
-
function
|
|
8237
|
+
function Hr() {
|
|
8145
8238
|
const i = `#${F}`, e = (t) => {
|
|
8146
8239
|
var s, o;
|
|
8147
8240
|
(o = (s = t.target) == null ? void 0 : s.closest) != null && o.call(s, i) && t.stopImmediatePropagation();
|
|
@@ -8153,7 +8246,7 @@ function Nr() {
|
|
|
8153
8246
|
document.removeEventListener("focusin", e, !0), document.removeEventListener("focusout", r, !0);
|
|
8154
8247
|
};
|
|
8155
8248
|
}
|
|
8156
|
-
function
|
|
8249
|
+
function K(i) {
|
|
8157
8250
|
const e = i.querySelector(".__crossx-card");
|
|
8158
8251
|
if (e) {
|
|
8159
8252
|
const a = (e.getAttribute("style") ?? "").match(/--cx-bg:\s*([^;]+)/);
|
|
@@ -8181,12 +8274,12 @@ function z(i) {
|
|
|
8181
8274
|
}
|
|
8182
8275
|
n.preventDefault();
|
|
8183
8276
|
}, { passive: !1 });
|
|
8184
|
-
const t =
|
|
8277
|
+
const t = Hr(), s = Gr(i), o = i.remove.bind(i);
|
|
8185
8278
|
i.remove = () => {
|
|
8186
8279
|
s(), t(), o();
|
|
8187
8280
|
}, document.body.appendChild(i);
|
|
8188
8281
|
}
|
|
8189
|
-
function
|
|
8282
|
+
function Gr(i) {
|
|
8190
8283
|
if (typeof window > "u") return () => {
|
|
8191
8284
|
};
|
|
8192
8285
|
const e = window.visualViewport;
|
|
@@ -8201,7 +8294,7 @@ function Or(i) {
|
|
|
8201
8294
|
e.removeEventListener("resize", t), e.removeEventListener("scroll", t), i.style.removeProperty("--cx-keyboard-inset");
|
|
8202
8295
|
};
|
|
8203
8296
|
}
|
|
8204
|
-
function
|
|
8297
|
+
function Kr(i) {
|
|
8205
8298
|
const e = Array.from(i.querySelectorAll(".__crossx-amount-tip"));
|
|
8206
8299
|
if (!e.length) return;
|
|
8207
8300
|
const r = document.createElement("div");
|
|
@@ -8211,8 +8304,8 @@ function Lr(i) {
|
|
|
8211
8304
|
const a = n.dataset.full;
|
|
8212
8305
|
if (!a) return;
|
|
8213
8306
|
r.textContent = a, r.classList.add("--visible");
|
|
8214
|
-
const l = n.getBoundingClientRect(), p = r.offsetWidth,
|
|
8215
|
-
let u = l.right - p, x = l.top -
|
|
8307
|
+
const l = n.getBoundingClientRect(), p = r.offsetWidth, h = r.offsetHeight;
|
|
8308
|
+
let u = l.right - p, x = l.top - h - 6;
|
|
8216
8309
|
u < 8 && (u = 8), x < 8 && (x = l.bottom + 6), r.style.left = `${u}px`, r.style.top = `${x}px`, t = n;
|
|
8217
8310
|
}, o = () => {
|
|
8218
8311
|
r.classList.remove("--visible"), t = null;
|
|
@@ -8225,9 +8318,9 @@ function Lr(i) {
|
|
|
8225
8318
|
n.target.closest(".__crossx-amount-tip") || o();
|
|
8226
8319
|
}, { passive: !0 });
|
|
8227
8320
|
}
|
|
8228
|
-
const
|
|
8229
|
-
function
|
|
8230
|
-
if (
|
|
8321
|
+
const Vr = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
8322
|
+
function oe() {
|
|
8323
|
+
if (Vr()) {
|
|
8231
8324
|
const e = window.scrollY;
|
|
8232
8325
|
return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
|
|
8233
8326
|
document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.body.style.right = "", window.scrollTo(0, e);
|
|
@@ -8238,26 +8331,26 @@ function se() {
|
|
|
8238
8331
|
document.body.style.overflow = i;
|
|
8239
8332
|
};
|
|
8240
8333
|
}
|
|
8241
|
-
function
|
|
8334
|
+
function te(i) {
|
|
8242
8335
|
return i ? i.length <= 13 ? i : `${i.slice(0, 6)}…${i.slice(-4)}` : "—";
|
|
8243
8336
|
}
|
|
8244
|
-
function
|
|
8337
|
+
function ft(i) {
|
|
8245
8338
|
return i ? i.length <= 13 ? i : `${i.slice(0, 6)}...${i.slice(-4)}` : "—";
|
|
8246
8339
|
}
|
|
8247
|
-
function
|
|
8340
|
+
function wt(i, e = "ONE", r = 18, t = 6) {
|
|
8248
8341
|
if (!i || i === "0x" || i === "0x0") return null;
|
|
8249
8342
|
try {
|
|
8250
8343
|
const s = BigInt(i);
|
|
8251
8344
|
if (s === 0n) return null;
|
|
8252
|
-
const o =
|
|
8345
|
+
const o = Ue(s, r, t);
|
|
8253
8346
|
if (o === "0") return null;
|
|
8254
|
-
const n =
|
|
8255
|
-
return
|
|
8347
|
+
const n = Fe(s, r);
|
|
8348
|
+
return Be(`${o} ${e}`, `${n} ${e}`);
|
|
8256
8349
|
} catch {
|
|
8257
8350
|
return null;
|
|
8258
8351
|
}
|
|
8259
8352
|
}
|
|
8260
|
-
const
|
|
8353
|
+
const ht = {
|
|
8261
8354
|
1: "Ethereum Mainnet",
|
|
8262
8355
|
5: "Goerli Testnet",
|
|
8263
8356
|
11155111: "Ethereum Sepolia",
|
|
@@ -8279,60 +8372,60 @@ const ct = {
|
|
|
8279
8372
|
202601: "Ronin Saigon",
|
|
8280
8373
|
612044: "ONEchain Testnet",
|
|
8281
8374
|
612055: "CROSS Mainnet"
|
|
8282
|
-
},
|
|
8283
|
-
let
|
|
8284
|
-
function
|
|
8285
|
-
if (
|
|
8286
|
-
const i =
|
|
8375
|
+
}, Ve = /* @__PURE__ */ new Map();
|
|
8376
|
+
let Pe = !1;
|
|
8377
|
+
function zr() {
|
|
8378
|
+
if (Pe || (Pe = !0, typeof fetch > "u")) return;
|
|
8379
|
+
const i = Ge().contentsBaseUrl;
|
|
8287
8380
|
i && fetch(`${i}/chains.json`, { cache: "no-store" }).then((e) => e.ok ? e.json() : null).then((e) => {
|
|
8288
8381
|
const r = e == null ? void 0 : e.chains;
|
|
8289
8382
|
if (r)
|
|
8290
8383
|
for (const [t, s] of Object.entries(r)) {
|
|
8291
8384
|
const o = Number(t);
|
|
8292
|
-
!Number.isNaN(o) && s &&
|
|
8385
|
+
!Number.isNaN(o) && s && Ve.set(o, s);
|
|
8293
8386
|
}
|
|
8294
8387
|
}).catch(() => {
|
|
8295
|
-
|
|
8388
|
+
Pe = !1;
|
|
8296
8389
|
});
|
|
8297
8390
|
}
|
|
8298
|
-
function
|
|
8391
|
+
function mt(i) {
|
|
8299
8392
|
return parseInt(i.split(":")[1] ?? "", 10);
|
|
8300
8393
|
}
|
|
8301
|
-
function
|
|
8394
|
+
function yt(i) {
|
|
8302
8395
|
var r;
|
|
8303
|
-
const e =
|
|
8396
|
+
const e = mt(i);
|
|
8304
8397
|
if (!isNaN(e)) {
|
|
8305
|
-
const t = (r =
|
|
8398
|
+
const t = (r = Ve.get(e)) == null ? void 0 : r.name;
|
|
8306
8399
|
if (t) return t;
|
|
8307
|
-
if (
|
|
8400
|
+
if (ht[e]) return ht[e];
|
|
8308
8401
|
}
|
|
8309
8402
|
return i;
|
|
8310
8403
|
}
|
|
8311
|
-
function
|
|
8404
|
+
function ze(i, e) {
|
|
8312
8405
|
var r;
|
|
8313
8406
|
if (i) {
|
|
8314
|
-
const t =
|
|
8407
|
+
const t = mt(i);
|
|
8315
8408
|
if (!isNaN(t)) {
|
|
8316
|
-
const s = (r =
|
|
8409
|
+
const s = (r = Ve.get(t)) == null ? void 0 : r.nativeSymbol;
|
|
8317
8410
|
if (s) return s;
|
|
8318
8411
|
}
|
|
8319
8412
|
}
|
|
8320
8413
|
return e;
|
|
8321
8414
|
}
|
|
8322
|
-
function
|
|
8415
|
+
function Fe(i, e) {
|
|
8323
8416
|
if (i === 0n) return "0";
|
|
8324
8417
|
const r = 10n ** BigInt(e), t = i / r, o = (i % r).toString().padStart(e, "0").replace(/0+$/, "");
|
|
8325
8418
|
return o ? `${t}.${o}` : `${t}`;
|
|
8326
8419
|
}
|
|
8327
|
-
function
|
|
8420
|
+
function Be(i, e) {
|
|
8328
8421
|
return i === e ? w(i) : `<span class="__crossx-amount-tip" data-full="${w(e)}">${w(i)}</span>`;
|
|
8329
8422
|
}
|
|
8330
|
-
function
|
|
8423
|
+
function Ue(i, e, r) {
|
|
8331
8424
|
if (i === 0n) return "0";
|
|
8332
8425
|
const t = 10n ** BigInt(e), s = i / t, a = (i % t).toString().padStart(e, "0").slice(0, r).replace(/0+$/, "");
|
|
8333
8426
|
return a ? `${s}.${a}` : `${s}`;
|
|
8334
8427
|
}
|
|
8335
|
-
function
|
|
8428
|
+
function Ne(i) {
|
|
8336
8429
|
try {
|
|
8337
8430
|
const e = BigInt(i), r = e / 1000000000n, s = (e % 1000000000n).toString().padStart(9, "0").slice(0, 2).replace(/0+$/, "");
|
|
8338
8431
|
return s ? `${r}.${s}` : `${r}`;
|
|
@@ -8340,40 +8433,40 @@ function Re(i) {
|
|
|
8340
8433
|
return i;
|
|
8341
8434
|
}
|
|
8342
8435
|
}
|
|
8343
|
-
function
|
|
8436
|
+
function qr(i) {
|
|
8344
8437
|
try {
|
|
8345
8438
|
return BigInt(i).toLocaleString();
|
|
8346
8439
|
} catch {
|
|
8347
8440
|
return i;
|
|
8348
8441
|
}
|
|
8349
8442
|
}
|
|
8350
|
-
function
|
|
8351
|
-
const { gasLimit: r, gasPrice: t, maxFeePerGas: s, maxPriorityFeePerGas: o, nativeDecimals: n = 18 } = i, a =
|
|
8443
|
+
function jr(i, e) {
|
|
8444
|
+
const { gasLimit: r, gasPrice: t, maxFeePerGas: s, maxPriorityFeePerGas: o, nativeDecimals: n = 18 } = i, a = ze(i.chainId, i.nativeSymbol ?? "ETH");
|
|
8352
8445
|
if (!r) return null;
|
|
8353
8446
|
try {
|
|
8354
|
-
const l = BigInt(r), p =
|
|
8447
|
+
const l = BigInt(r), p = qr(r);
|
|
8355
8448
|
if (s) {
|
|
8356
|
-
const
|
|
8449
|
+
const h = l * BigInt(s);
|
|
8357
8450
|
return {
|
|
8358
8451
|
isDynamic: !0,
|
|
8359
|
-
estTxFee:
|
|
8360
|
-
`${
|
|
8361
|
-
`${
|
|
8452
|
+
estTxFee: Be(
|
|
8453
|
+
`${Ue(h, n, e)} ${a}`,
|
|
8454
|
+
`${Fe(h, n)} ${a}`
|
|
8362
8455
|
),
|
|
8363
|
-
maxFeeGwei:
|
|
8364
|
-
maxPriorityFeeGwei: o ?
|
|
8456
|
+
maxFeeGwei: Ne(s),
|
|
8457
|
+
maxPriorityFeeGwei: o ? Ne(o) : void 0,
|
|
8365
8458
|
gasLimitFormatted: p
|
|
8366
8459
|
};
|
|
8367
8460
|
}
|
|
8368
8461
|
if (t) {
|
|
8369
|
-
const
|
|
8462
|
+
const h = l * BigInt(t);
|
|
8370
8463
|
return {
|
|
8371
8464
|
isDynamic: !1,
|
|
8372
|
-
estTxFee:
|
|
8373
|
-
`${
|
|
8374
|
-
`${
|
|
8465
|
+
estTxFee: Be(
|
|
8466
|
+
`${Ue(h, n, e)} ${a}`,
|
|
8467
|
+
`${Fe(h, n)} ${a}`
|
|
8375
8468
|
),
|
|
8376
|
-
gasPriceGwei:
|
|
8469
|
+
gasPriceGwei: Ne(t),
|
|
8377
8470
|
gasLimitFormatted: p
|
|
8378
8471
|
};
|
|
8379
8472
|
}
|
|
@@ -8382,28 +8475,28 @@ function Fr(i, e) {
|
|
|
8382
8475
|
return null;
|
|
8383
8476
|
}
|
|
8384
8477
|
}
|
|
8385
|
-
function
|
|
8386
|
-
const t =
|
|
8387
|
-
if (!t) return
|
|
8388
|
-
let s =
|
|
8389
|
-
return t.isDynamic ? (t.maxPriorityFeeGwei !== void 0 && (s +=
|
|
8478
|
+
function bt(i, e, r) {
|
|
8479
|
+
const t = jr(i, e);
|
|
8480
|
+
if (!t) return L((r == null ? void 0 : r.label_estimated_fee) ?? "Estimated fee", "<span>—</span>");
|
|
8481
|
+
let s = L((r == null ? void 0 : r.label_est_tx_fee) ?? "Est. Tx Fee", `<span>${t.estTxFee}</span>`);
|
|
8482
|
+
return t.isDynamic ? (t.maxPriorityFeeGwei !== void 0 && (s += L((r == null ? void 0 : r.label_max_priority_fee) ?? "Max Priority Fee", `<span>${t.maxPriorityFeeGwei} Gwei</span>`)), t.maxFeeGwei !== void 0 && (s += L((r == null ? void 0 : r.label_max_gas_fee) ?? "Max Gas Fee", `<span>${t.maxFeeGwei} Gwei</span>`))) : t.gasPriceGwei !== void 0 && (s += L((r == null ? void 0 : r.label_gas_price) ?? "Gas Price", `<span>${t.gasPriceGwei} Gwei</span>`)), t.gasLimitFormatted && (s += L((r == null ? void 0 : r.label_gas_limit) ?? "Gas Limit", `<span>${t.gasLimitFormatted}</span>`)), s;
|
|
8390
8483
|
}
|
|
8391
|
-
const
|
|
8484
|
+
const ee = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
8392
8485
|
<rect x="9" y="9" width="13" height="13" rx="2"/>
|
|
8393
8486
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
|
8394
|
-
</svg>`,
|
|
8487
|
+
</svg>`, U = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
|
8395
8488
|
<line x1="18" y1="6" x2="6" y2="18"/>
|
|
8396
8489
|
<line x1="6" y1="6" x2="18" y2="18"/>
|
|
8397
|
-
</svg>`,
|
|
8490
|
+
</svg>`, Yr = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8398
8491
|
<circle cx="20" cy="20" r="20" fill="#00D5AA"/>
|
|
8399
8492
|
<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"/>
|
|
8400
|
-
</svg>`,
|
|
8401
|
-
[ge.MetaMask]:
|
|
8402
|
-
[ge.Binance]:
|
|
8403
|
-
[ge.CROSSx]:
|
|
8404
|
-
},
|
|
8493
|
+
</svg>`, Xr = '<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>', Jr = '<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>', Zr = '<svg width="16" height="16" viewBox="0 0 229 229" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><g clip-path="url(#clip0_74746_12130)"><rect width="228.273" height="228.273" rx="87" fill="white"/><path d="M228.307 -0.0644531H0.0332031V228.209H228.307V-0.0644531Z" fill="#CE3E35"/><path d="M33.9219 43.7533C33.9219 31.934 43.5033 22.3527 55.3225 22.3527H173.019C184.838 22.3527 194.419 31.9341 194.419 43.7533V123.107H33.9219V43.7533Z" fill="white"/><g filter="url(#filter0_d_74746_12130)"><path d="M228.241 228.21H0.0332031V56.5961C0.0332031 48.7166 6.4208 42.329 14.3003 42.329H77.9502C84.6851 42.329 90.1926 47.3831 94.2527 52.7566C98.8699 58.8676 106.06 62.7958 114.137 62.7958C122.214 62.7958 129.404 58.8676 134.021 52.7566C138.081 47.3831 143.589 42.329 150.324 42.329H213.974C221.854 42.329 228.241 48.7166 228.241 56.5961V228.21Z" fill="url(#paint0_linear_74746_12130)"/></g><path d="M79.7598 228.096H228.24V64.7367L79.7598 159.851V228.096Z" fill="url(#paint1_linear_74746_12130)"/><path d="M79.7694 228.209H0.0332031V75.9257L79.7694 160.218V228.209Z" fill="url(#paint2_linear_74746_12130)"/><g filter="url(#filter1_d_74746_12130)"><path d="M113.105 89.2908L81.3322 107.655C75.7279 110.878 73.7862 118.118 77.0076 123.724C80.229 129.331 87.4661 131.273 93.0704 128.051L119.945 112.511L107.147 126.241V180.098C107.147 186.588 112.443 191.885 118.93 191.885C125.417 191.885 130.712 186.588 130.712 180.098V99.4884C130.712 97.237 130.006 95.0297 129.124 93.5729C125.814 88.0106 118.665 86.024 113.061 89.2466L113.105 89.2908Z" fill="white"/></g></g><defs><filter id="filter0_d_74746_12130" x="-7.10034" y="33.4121" width="242.474" height="200.148" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="-1.78339"/><feGaussianBlur stdDeviation="3.56677"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0.892803 0 0 0 0 0.220099 0 0 0 0 0.293135 0 0 0 0.5 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_74746_12130"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_74746_12130" result="shape"/></filter><filter id="filter1_d_74746_12130" x="67.9009" y="80.1489" width="75.3839" height="124.308" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dx="2.51084" dy="2.51084"/><feGaussianBlur stdDeviation="5.03056"/><feColorMatrix type="matrix" values="0 0 0 0 0.831373 0 0 0 0 0.113725 0 0 0 0 0.356863 0 0 0 0.3 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_74746_12130"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_74746_12130" result="shape"/></filter><linearGradient id="paint0_linear_74746_12130" x1="-26.3993" y1="19.4879" x2="193.409" y2="286.17" gradientUnits="userSpaceOnUse"><stop stop-color="#F3752D"/><stop offset="1" stop-color="#EC1272"/></linearGradient><linearGradient id="paint1_linear_74746_12130" x1="56.978" y1="73.7355" x2="168.096" y2="169.248" gradientUnits="userSpaceOnUse"><stop stop-color="white" stop-opacity="0.5"/><stop offset="1" stop-color="white" stop-opacity="0"/></linearGradient><linearGradient id="paint2_linear_74746_12130" x1="142.362" y1="29.5078" x2="37.3384" y2="166.255" gradientUnits="userSpaceOnUse"><stop stop-color="white" stop-opacity="0.5"/><stop offset="1" stop-color="white" stop-opacity="0"/></linearGradient><clipPath id="clip0_74746_12130"><rect width="228.273" height="228.273" rx="87" fill="white"/></clipPath></defs></svg>', Qr = {
|
|
8494
|
+
[ge.MetaMask]: Xr,
|
|
8495
|
+
[ge.Binance]: Jr,
|
|
8496
|
+
[ge.CROSSx]: Zr
|
|
8497
|
+
}, vt = '<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"/>', qe = `<svg width="20" height="20" viewBox="0 0 32 32" fill="currentColor" xmlns="http://www.w3.org/2000/svg">${vt}</svg>`, es = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
8405
8498
|
<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)"/>
|
|
8406
|
-
</svg>`,
|
|
8499
|
+
</svg>`, ts = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
8407
8500
|
<circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
|
|
8408
8501
|
<circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
|
|
8409
8502
|
<path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
|
|
@@ -8441,24 +8534,24 @@ function H(i) {
|
|
|
8441
8534
|
`--cx-on-primary:${i.onPrimary}`
|
|
8442
8535
|
].join(";");
|
|
8443
8536
|
}
|
|
8444
|
-
function
|
|
8537
|
+
function rs(i, e) {
|
|
8445
8538
|
i.style.setProperty("--cx-bg", e.bg), i.style.setProperty("--cx-border", e.border), i.style.setProperty("--cx-border-medium", e.borderMedium), i.style.setProperty("--cx-title", e.titleColor), i.style.setProperty("--cx-subtitle", e.subtitleColor), i.style.setProperty("--cx-label", e.labelColor), i.style.setProperty("--cx-value", e.valueColor), i.style.setProperty("--cx-pill-bg", e.pillBg), i.style.setProperty("--cx-pill-from", e.pillFromColor), i.style.setProperty("--cx-pill-amt", e.pillAmtColor), i.style.setProperty("--cx-divider", e.divider), i.style.setProperty("--cx-close", e.closeColor), i.style.setProperty("--cx-close-hover", e.closeHoverBg), i.style.setProperty("--cx-copy", e.copyColor), i.style.setProperty("--cx-input-bg", e.inputBg), i.style.setProperty("--cx-input-border", e.inputBorder), i.style.setProperty("--cx-hint", e.hintColor), i.style.setProperty("--cx-surface-subtle", e.surfaceSubtle), i.style.setProperty("--cx-surface-high", e.surfaceHigh), i.style.setProperty("--cx-primary", e.primary), i.style.setProperty("--cx-primary-glow", e.primaryGlow), i.style.setProperty("--cx-primary-gradient", e.primaryGradient), i.style.setProperty("--cx-secondary", e.secondary), i.style.setProperty("--cx-error", e.errorColor), i.style.setProperty("--cx-notice-bg", e.noticeBg), i.style.setProperty("--cx-notice-border", e.noticeBorder), i.style.setProperty("--cx-notice-title", e.noticeTitleColor), i.style.setProperty("--cx-on-primary", e.onPrimary);
|
|
8446
8539
|
}
|
|
8447
|
-
function
|
|
8540
|
+
function L(i, e) {
|
|
8448
8541
|
return `
|
|
8449
8542
|
<div class="__crossx-row">
|
|
8450
8543
|
<span class="__crossx-row-label">${i}</span>
|
|
8451
8544
|
<div class="__crossx-row-value">${e}</div>
|
|
8452
8545
|
</div>`;
|
|
8453
8546
|
}
|
|
8454
|
-
function
|
|
8455
|
-
const s = e, o =
|
|
8456
|
-
<button class="__crossx-copy-btn" data-copy="${w(i.to)}" title="Copy address">${
|
|
8547
|
+
function ss(i, e, r, t) {
|
|
8548
|
+
const s = e, o = ze(i.chainId, i.nativeSymbol ?? "ETH"), n = i.nativeDecimals ?? 18, a = Ie(i.dappName), l = i.to ? `<span class="__crossx-addr-text">${te(i.to)}</span>
|
|
8549
|
+
<button class="__crossx-copy-btn" data-copy="${w(i.to)}" title="Copy address">${ee}</button>` : "<span>—</span>", p = bt(i, r, t), h = wt(i.value, o, n, r), u = h ? L((t == null ? void 0 : t.label_value) ?? "Value", `<span>${h}</span>`) : "", x = i.data ?? "0x", g = document.createElement("div");
|
|
8457
8550
|
return g.id = F, g.innerHTML = `
|
|
8458
8551
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${H(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8459
8552
|
<div class="__crossx-header">
|
|
8460
8553
|
<p class="__crossx-title" id="__crossx-ttl">${w((t == null ? void 0 : t.sign_transaction_title) ?? "Signature Request")}</p>
|
|
8461
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
8554
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
8462
8555
|
</div>
|
|
8463
8556
|
<hr class="__crossx-divider">
|
|
8464
8557
|
<div class="__crossx-body">
|
|
@@ -8468,16 +8561,16 @@ function qr(i, e, r, t) {
|
|
|
8468
8561
|
<span class="__crossx-sig-origin">${w(a)}</span>${w((t == null ? void 0 : t.signature_requesting) ?? " is requesting a Signature")}
|
|
8469
8562
|
</p>
|
|
8470
8563
|
<div class="__crossx-addr-pill">
|
|
8471
|
-
${
|
|
8472
|
-
<span class="__crossx-addr-pill-text">${
|
|
8564
|
+
${qe}
|
|
8565
|
+
<span class="__crossx-addr-pill-text">${te(i.from)}</span>
|
|
8473
8566
|
</div>
|
|
8474
8567
|
<p class="__crossx-warning">${w((t == null ? void 0 : t.signature_warning) ?? "After you sign, changes or cancellations are not possible.")}</p>
|
|
8475
8568
|
</div>
|
|
8476
8569
|
<hr class="__crossx-divider __crossx-divider--cols">
|
|
8477
8570
|
<div class="__crossx-col-right-sign">
|
|
8478
8571
|
<div class="__crossx-rows">
|
|
8479
|
-
${
|
|
8480
|
-
${
|
|
8572
|
+
${L((t == null ? void 0 : t.label_to) ?? "To", l)}
|
|
8573
|
+
${L((t == null ? void 0 : t.label_network) ?? "Network", `<span>${yt(i.chainId)}</span>`)}
|
|
8481
8574
|
${u}
|
|
8482
8575
|
${p}
|
|
8483
8576
|
</div>
|
|
@@ -8492,7 +8585,7 @@ function qr(i, e, r, t) {
|
|
|
8492
8585
|
</div>
|
|
8493
8586
|
`, g;
|
|
8494
8587
|
}
|
|
8495
|
-
const
|
|
8588
|
+
const is = /* @__PURE__ */ new Set([
|
|
8496
8589
|
"0x095ea7b3",
|
|
8497
8590
|
// approve(address,uint256) — ERC20 / ERC721
|
|
8498
8591
|
"0xa22cb465",
|
|
@@ -8502,17 +8595,17 @@ const jr = /* @__PURE__ */ new Set([
|
|
|
8502
8595
|
"0x8fcbaf0c"
|
|
8503
8596
|
// permit(address,address,uint256,uint256,bool,uint8,bytes32,bytes32) — DAI 스타일
|
|
8504
8597
|
]);
|
|
8505
|
-
function
|
|
8506
|
-
return i ?
|
|
8598
|
+
function os(i) {
|
|
8599
|
+
return i ? is.has(i.slice(0, 10).toLowerCase()) : !1;
|
|
8507
8600
|
}
|
|
8508
|
-
function
|
|
8509
|
-
const s = e, o =
|
|
8510
|
-
<button class="__crossx-copy-btn" data-copy="${w(i.to)}" title="Copy address">${
|
|
8601
|
+
function ns(i, e, r, t) {
|
|
8602
|
+
const s = e, o = ze(i.chainId, i.nativeSymbol ?? "ETH"), n = i.nativeDecimals ?? 18, a = Ie(i.dappName), l = i.to ? `<span class="__crossx-addr-text">${te(i.to)}</span>
|
|
8603
|
+
<button class="__crossx-copy-btn" data-copy="${w(i.to)}" title="Copy address">${ee}</button>` : "<span>—</span>", p = bt(i, r, t), u = wt(i.value, o, n, r) ?? "—", x = os(i.data) ? (t == null ? void 0 : t.send_tx_approve_button) ?? "Approve" : (t == null ? void 0 : t.send_tx_confirm_button) ?? "Confirm", g = document.createElement("div");
|
|
8511
8604
|
return g.id = F, g.innerHTML = `
|
|
8512
8605
|
<div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${H(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8513
8606
|
<div class="__crossx-header">
|
|
8514
8607
|
<p class="__crossx-title" id="__crossx-ttl">${w((t == null ? void 0 : t.send_transaction_title) ?? "Approve transaction")}</p>
|
|
8515
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
8608
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
8516
8609
|
</div>
|
|
8517
8610
|
<hr class="__crossx-divider">
|
|
8518
8611
|
<div class="__crossx-body">
|
|
@@ -8521,12 +8614,12 @@ function Xr(i, e, r, t) {
|
|
|
8521
8614
|
</p>
|
|
8522
8615
|
<div class="__crossx-body-cols">
|
|
8523
8616
|
<div class="__crossx-rows">
|
|
8524
|
-
${
|
|
8525
|
-
${
|
|
8617
|
+
${L((t == null ? void 0 : t.label_to) ?? "To", l)}
|
|
8618
|
+
${L((t == null ? void 0 : t.label_network) ?? "Network", `<span>${yt(i.chainId)}</span>`)}
|
|
8526
8619
|
${p}
|
|
8527
8620
|
</div>
|
|
8528
8621
|
<div class="__crossx-pill">
|
|
8529
|
-
<span class="__crossx-pill-from">${
|
|
8622
|
+
<span class="__crossx-pill-from">${te(i.from)}</span>
|
|
8530
8623
|
<span class="__crossx-pill-amount">${u}</span>
|
|
8531
8624
|
</div>
|
|
8532
8625
|
</div>
|
|
@@ -8535,7 +8628,7 @@ function Xr(i, e, r, t) {
|
|
|
8535
8628
|
</div>
|
|
8536
8629
|
`, g;
|
|
8537
8630
|
}
|
|
8538
|
-
function
|
|
8631
|
+
function Ie(i) {
|
|
8539
8632
|
var e;
|
|
8540
8633
|
if (i) return i;
|
|
8541
8634
|
try {
|
|
@@ -8547,10 +8640,10 @@ function Ee(i) {
|
|
|
8547
8640
|
function w(i) {
|
|
8548
8641
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
8549
8642
|
}
|
|
8550
|
-
function
|
|
8643
|
+
function as(i) {
|
|
8551
8644
|
return typeof i == "string" && /^0x[0-9a-fA-F]{40}$/i.test(i);
|
|
8552
8645
|
}
|
|
8553
|
-
function
|
|
8646
|
+
function cs(i) {
|
|
8554
8647
|
if (typeof i == "string") return w(i);
|
|
8555
8648
|
if (typeof i == "number" || typeof i == "bigint" || typeof i == "boolean") return String(i);
|
|
8556
8649
|
try {
|
|
@@ -8559,32 +8652,32 @@ function Zr(i) {
|
|
|
8559
8652
|
return String(i);
|
|
8560
8653
|
}
|
|
8561
8654
|
}
|
|
8562
|
-
function
|
|
8655
|
+
function ls(i) {
|
|
8563
8656
|
return i.includes(":") ? i.split(":")[1] ?? i : i;
|
|
8564
8657
|
}
|
|
8565
|
-
function
|
|
8658
|
+
function ds(i) {
|
|
8566
8659
|
return `https://www.crossscan.io/address/${i}?tab=txs`;
|
|
8567
8660
|
}
|
|
8568
|
-
function
|
|
8569
|
-
return `https://explorer.crosstoken.io/${
|
|
8661
|
+
function ps(i, e) {
|
|
8662
|
+
return `https://explorer.crosstoken.io/${ls(i)}/tx/${e}`;
|
|
8570
8663
|
}
|
|
8571
|
-
function
|
|
8664
|
+
function St(i, e) {
|
|
8572
8665
|
return `<a class="__crossx-addr-text __crossx-row-link" href="${w(e)}" target="_blank" rel="noopener noreferrer">${w(i)}</a>`;
|
|
8573
8666
|
}
|
|
8574
|
-
function
|
|
8575
|
-
return
|
|
8667
|
+
function Se(i) {
|
|
8668
|
+
return St(te(i), ds(i));
|
|
8576
8669
|
}
|
|
8577
|
-
function
|
|
8578
|
-
return
|
|
8670
|
+
function Et(i, e) {
|
|
8671
|
+
return St(te(e), ps(i, e));
|
|
8579
8672
|
}
|
|
8580
|
-
function
|
|
8581
|
-
const t =
|
|
8673
|
+
function hs(i, e, r) {
|
|
8674
|
+
const t = L(
|
|
8582
8675
|
(r == null ? void 0 : r.label_from) ?? "From",
|
|
8583
|
-
`${
|
|
8584
|
-
<button class="__crossx-copy-btn" data-copy="${w(i.from)}" title="Copy address">${
|
|
8585
|
-
), s = i.to ?
|
|
8586
|
-
<button class="__crossx-copy-btn" data-copy="${w(i.to)}" title="Copy address">${
|
|
8587
|
-
<button class="__crossx-copy-btn" data-copy="${w(i.txHash)}" title="Copy hash">${
|
|
8676
|
+
`${Se(i.from)}
|
|
8677
|
+
<button class="__crossx-copy-btn" data-copy="${w(i.from)}" title="Copy address">${ee}</button>`
|
|
8678
|
+
), s = i.to ? L((r == null ? void 0 : r.label_to) ?? "To", `${Se(i.to)}
|
|
8679
|
+
<button class="__crossx-copy-btn" data-copy="${w(i.to)}" title="Copy address">${ee}</button>`) : "", o = i.amount ? L((r == null ? void 0 : r.label_transfer) ?? "Transfer", `<span>${w(i.amount)}</span>`) : "", n = i.fees ? L((r == null ? void 0 : r.label_tx_fee) ?? "Tx Fee", `<span>${w(i.fees)}</span>`) : "", a = i.txHash ? L((r == null ? void 0 : r.label_tx_hash) ?? "Tx Hash", `${Et(i.chainId, i.txHash)}
|
|
8680
|
+
<button class="__crossx-copy-btn" data-copy="${w(i.txHash)}" title="Copy hash">${ee}</button>`) : "", l = i.total ? `<div class="__crossx-total-pill">
|
|
8588
8681
|
<span class="__crossx-total-label">${w((r == null ? void 0 : r.label_total) ?? "Total")}<br>${w((r == null ? void 0 : r.label_including_fees) ?? "(including fees)")}</span>
|
|
8589
8682
|
<span class="__crossx-total-amount">${w(i.total)}</span>
|
|
8590
8683
|
</div>` : "", p = document.createElement("div");
|
|
@@ -8592,7 +8685,7 @@ function rs(i, e, r) {
|
|
|
8592
8685
|
<div class="__crossx-card __crossx-card--migration" style="${H(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8593
8686
|
<div class="__crossx-header">
|
|
8594
8687
|
<p class="__crossx-title" id="__crossx-ttl">${w((r == null ? void 0 : r.tx_success) ?? "Transaction complete")}</p>
|
|
8595
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
8688
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
8596
8689
|
</div>
|
|
8597
8690
|
<hr class="__crossx-divider">
|
|
8598
8691
|
<div class="__crossx-body">
|
|
@@ -8609,7 +8702,7 @@ function rs(i, e, r) {
|
|
|
8609
8702
|
</div>
|
|
8610
8703
|
`, p;
|
|
8611
8704
|
}
|
|
8612
|
-
function
|
|
8705
|
+
function _s(i, e, r) {
|
|
8613
8706
|
const t = document.createElement("div");
|
|
8614
8707
|
return t.id = F, t.innerHTML = `
|
|
8615
8708
|
<div class="__crossx-card __crossx-card--migration" style="${H(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8626,29 +8719,29 @@ function ss(i, e, r) {
|
|
|
8626
8719
|
</div>
|
|
8627
8720
|
`, t;
|
|
8628
8721
|
}
|
|
8629
|
-
function
|
|
8722
|
+
function us(i, e, r, t) {
|
|
8630
8723
|
const s = e.status !== "reverted" && e.status !== "timeout", o = e.status === "timeout", n = i.querySelector("#__crossx-ttl"), a = i.querySelector(".__crossx-header");
|
|
8631
8724
|
if (n) {
|
|
8632
|
-
const m = o ?
|
|
8725
|
+
const m = o ? ts : s ? "" : es, y = o ? (t == null ? void 0 : t.tx_timeout) ?? "Transaction timeout" : s ? (t == null ? void 0 : t.tx_success) ?? "Transaction complete" : (t == null ? void 0 : t.tx_failed) ?? "Transaction failed";
|
|
8633
8726
|
m ? (n.style.display = "flex", n.style.alignItems = "center", n.style.gap = "8px", n.innerHTML = `${m}<span>${w(y)}</span>`) : n.textContent = y;
|
|
8634
8727
|
}
|
|
8635
8728
|
if (a && !i.querySelector("#__crossx-close-btn")) {
|
|
8636
8729
|
const m = document.createElement("button");
|
|
8637
|
-
m.className = "__crossx-close", m.id = "__crossx-close-btn", m.setAttribute("aria-label", "Close"), m.innerHTML =
|
|
8730
|
+
m.className = "__crossx-close", m.id = "__crossx-close-btn", m.setAttribute("aria-label", "Close"), m.innerHTML = U, a.appendChild(m);
|
|
8638
8731
|
}
|
|
8639
8732
|
const l = i.querySelector("#__crossx-progress-body");
|
|
8640
8733
|
if (!l) return;
|
|
8641
|
-
const p = e.from ?
|
|
8642
|
-
<button class="__crossx-copy-btn" data-copy="${w(e.from)}" title="Copy address">${
|
|
8643
|
-
<button class="__crossx-copy-btn" data-copy="${w(e.to)}" title="Copy address">${
|
|
8644
|
-
<button class="__crossx-copy-btn" data-copy="${w(e.txHash)}" title="Copy hash">${
|
|
8734
|
+
const p = e.from ? L((t == null ? void 0 : t.label_from) ?? "From", `${Se(e.from)}
|
|
8735
|
+
<button class="__crossx-copy-btn" data-copy="${w(e.from)}" title="Copy address">${ee}</button>`) : "", h = e.to ? L((t == null ? void 0 : t.label_to) ?? "To", `${Se(e.to)}
|
|
8736
|
+
<button class="__crossx-copy-btn" data-copy="${w(e.to)}" title="Copy address">${ee}</button>`) : "", u = e.amount ? L((t == null ? void 0 : t.label_transfer) ?? "Transfer", `<span>${w(e.amount)}</span>`) : "", x = e.fees ? L((t == null ? void 0 : t.label_tx_fee) ?? "Tx Fee", `<span>${w(e.fees)}</span>`) : "", g = e.txHash ? L((t == null ? void 0 : t.label_tx_hash) ?? "Tx Hash", `${Et(e.chainId, e.txHash)}
|
|
8737
|
+
<button class="__crossx-copy-btn" data-copy="${w(e.txHash)}" title="Copy hash">${ee}</button>`) : "", f = e.total ? `<div class="__crossx-total-pill">
|
|
8645
8738
|
<span class="__crossx-total-label">${w((t == null ? void 0 : t.label_total) ?? "Total")}<br>${w((t == null ? void 0 : t.label_including_fees) ?? "(including fees)")}</span>
|
|
8646
8739
|
<span class="__crossx-total-amount">${w(e.total)}</span>
|
|
8647
8740
|
</div>` : "";
|
|
8648
8741
|
l.innerHTML = `
|
|
8649
8742
|
<div class="__crossx-rows">
|
|
8650
8743
|
${p}
|
|
8651
|
-
${
|
|
8744
|
+
${h}
|
|
8652
8745
|
${u}
|
|
8653
8746
|
${x}
|
|
8654
8747
|
${g}
|
|
@@ -8665,13 +8758,13 @@ function is(i, e, r, t) {
|
|
|
8665
8758
|
});
|
|
8666
8759
|
});
|
|
8667
8760
|
}
|
|
8668
|
-
function
|
|
8669
|
-
const t = e, s =
|
|
8761
|
+
function xs(i, e, r) {
|
|
8762
|
+
const t = e, s = Ie(i.dappName), o = w(i.message), n = document.createElement("div");
|
|
8670
8763
|
return n.id = F, n.innerHTML = `
|
|
8671
8764
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${H(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8672
8765
|
<div class="__crossx-header">
|
|
8673
8766
|
<p class="__crossx-title" id="__crossx-ttl">${w((r == null ? void 0 : r.sign_message_title) ?? "Signature Request")}</p>
|
|
8674
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
8767
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
8675
8768
|
</div>
|
|
8676
8769
|
<hr class="__crossx-divider">
|
|
8677
8770
|
<div class="__crossx-body">
|
|
@@ -8681,8 +8774,8 @@ function os(i, e, r) {
|
|
|
8681
8774
|
<span class="__crossx-sig-origin">${w(s)}</span>${w((r == null ? void 0 : r.signature_requesting) ?? " is requesting a Signature")}
|
|
8682
8775
|
</p>
|
|
8683
8776
|
<div class="__crossx-addr-pill">
|
|
8684
|
-
${
|
|
8685
|
-
<span class="__crossx-addr-pill-text">${
|
|
8777
|
+
${qe}
|
|
8778
|
+
<span class="__crossx-addr-pill-text">${te(i.from)}</span>
|
|
8686
8779
|
</div>
|
|
8687
8780
|
<p class="__crossx-warning">${w((r == null ? void 0 : r.signature_warning) ?? "After you sign, changes or cancellations are not possible.")}</p>
|
|
8688
8781
|
</div>
|
|
@@ -8697,8 +8790,8 @@ function os(i, e, r) {
|
|
|
8697
8790
|
</div>
|
|
8698
8791
|
`, n;
|
|
8699
8792
|
}
|
|
8700
|
-
function
|
|
8701
|
-
const t = e, s =
|
|
8793
|
+
function gs(i, e, r) {
|
|
8794
|
+
const t = e, s = Ie(i.dappName);
|
|
8702
8795
|
let o = {};
|
|
8703
8796
|
if (typeof i.typedData == "string")
|
|
8704
8797
|
try {
|
|
@@ -8712,12 +8805,12 @@ function ns(i, e, r) {
|
|
|
8712
8805
|
<span class="__crossx-td-label">${w((r == null ? void 0 : r.label_primary_type) ?? "Primary Type")}</span>
|
|
8713
8806
|
<span class="__crossx-td-value">${w(n)}</span>
|
|
8714
8807
|
</div>`;
|
|
8715
|
-
for (const [
|
|
8716
|
-
const x =
|
|
8717
|
-
<button class="__crossx-copy-btn" data-copy="${w(String(u))}" title="Copy">${
|
|
8808
|
+
for (const [h, u] of Object.entries(a)) {
|
|
8809
|
+
const x = cs(u), f = as(u) ? `<span class="__crossx-addr-text">${te(u)}</span>
|
|
8810
|
+
<button class="__crossx-copy-btn" data-copy="${w(String(u))}" title="Copy">${ee}</button>` : `<span>${x}</span>`;
|
|
8718
8811
|
l += `
|
|
8719
8812
|
<div class="__crossx-td-row">
|
|
8720
|
-
<span class="__crossx-td-label">${w(
|
|
8813
|
+
<span class="__crossx-td-label">${w(h)}</span>
|
|
8721
8814
|
<div class="__crossx-td-value">${f}</div>
|
|
8722
8815
|
</div>`;
|
|
8723
8816
|
}
|
|
@@ -8726,7 +8819,7 @@ function ns(i, e, r) {
|
|
|
8726
8819
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-typed" style="${H(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8727
8820
|
<div class="__crossx-header">
|
|
8728
8821
|
<p class="__crossx-title" id="__crossx-ttl">${w((r == null ? void 0 : r.sign_typed_data_title) ?? "Signature Request")}</p>
|
|
8729
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
8822
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
8730
8823
|
</div>
|
|
8731
8824
|
<hr class="__crossx-divider">
|
|
8732
8825
|
<div class="__crossx-body">
|
|
@@ -8736,8 +8829,8 @@ function ns(i, e, r) {
|
|
|
8736
8829
|
<span class="__crossx-sig-origin">${w(s)}</span>${w((r == null ? void 0 : r.signature_requesting) ?? " is requesting a Signature")}
|
|
8737
8830
|
</p>
|
|
8738
8831
|
<div class="__crossx-addr-pill">
|
|
8739
|
-
${
|
|
8740
|
-
<span class="__crossx-addr-pill-text">${
|
|
8832
|
+
${qe}
|
|
8833
|
+
<span class="__crossx-addr-pill-text">${te(i.from)}</span>
|
|
8741
8834
|
</div>
|
|
8742
8835
|
<p class="__crossx-warning">${w((r == null ? void 0 : r.signature_warning) ?? "After you sign, changes or cancellations are not possible.")}</p>
|
|
8743
8836
|
</div>
|
|
@@ -8752,30 +8845,30 @@ function ns(i, e, r) {
|
|
|
8752
8845
|
</div>
|
|
8753
8846
|
`, p;
|
|
8754
8847
|
}
|
|
8755
|
-
const
|
|
8848
|
+
const fs = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
|
8756
8849
|
<line x1="12" y1="5" x2="12" y2="19"/>
|
|
8757
8850
|
<line x1="5" y1="12" x2="19" y2="12"/>
|
|
8758
|
-
</svg>`,
|
|
8759
|
-
function
|
|
8851
|
+
</svg>`, ws = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="var(--cx-primary, #00ceb2)"/><path d="M7.5 12.5L10.5 15.5L16.5 8.5" stroke="var(--cx-on-primary, #000)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
8852
|
+
function At(i) {
|
|
8760
8853
|
return i.name || `Account ${i.index + 1}`;
|
|
8761
8854
|
}
|
|
8762
|
-
function
|
|
8763
|
-
return `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="#121212" fill-opacity="0.1"/><g fill="#121212" fill-opacity="0.5">${
|
|
8855
|
+
function ms() {
|
|
8856
|
+
return `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="#121212" fill-opacity="0.1"/><g fill="#121212" fill-opacity="0.5">${vt}</g></svg>`;
|
|
8764
8857
|
}
|
|
8765
|
-
const
|
|
8766
|
-
function
|
|
8858
|
+
const ys = Ge().portraitBaseUrl;
|
|
8859
|
+
function bs(i, e) {
|
|
8767
8860
|
const r = e.replace("#", "");
|
|
8768
|
-
return `${
|
|
8861
|
+
return `${ys}/portrait/evm/${i}.png?size=256&bg=${r}`;
|
|
8769
8862
|
}
|
|
8770
|
-
function
|
|
8771
|
-
const t =
|
|
8863
|
+
function It(i, e, r) {
|
|
8864
|
+
const t = bs(i, r), o = ms().replace(/"/g, """);
|
|
8772
8865
|
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>`;
|
|
8773
8866
|
}
|
|
8774
|
-
function
|
|
8867
|
+
function vs(i, e, r, t) {
|
|
8775
8868
|
const s = r == null ? void 0 : r.toLowerCase(), o = i.map((a) => {
|
|
8776
|
-
const l = s && a.address.toLowerCase() === s, p = l ? " __crossx-wallet-item--selected" : "",
|
|
8869
|
+
const l = s && a.address.toLowerCase() === s, p = l ? " __crossx-wallet-item--selected" : "", h = l ? `<span class="__crossx-wallet-selected">${w((t == null ? void 0 : t.wallet_selector_selected) ?? "Selected")}</span><span class="__crossx-wallet-check">${ws}</span>` : "";
|
|
8777
8870
|
return `<button class="__crossx-wallet-item${p}" data-wallet-index="${a.index}" data-wallet-address="${w(a.address)}">
|
|
8778
|
-
${
|
|
8871
|
+
${It(a.address, a.index, e.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${w(At(a))}</span><span class="__crossx-wallet-addr">${ft(a.address)}</span></span>${h}
|
|
8779
8872
|
</button>`;
|
|
8780
8873
|
}).join(""), n = document.createElement("div");
|
|
8781
8874
|
return n.id = F, n.className = "__crossx-overlay--wallet-selector", n.innerHTML = `
|
|
@@ -8786,7 +8879,7 @@ function _s(i, e, r, t) {
|
|
|
8786
8879
|
<p class="__crossx-title" id="__crossx-ttl">${w((t == null ? void 0 : t.wallet_selector_title) ?? "Select Connected Wallet")}</p>
|
|
8787
8880
|
<p class="__crossx-subtitle--body">${w((t == null ? void 0 : t.wallet_selector_description) ?? "Please select the wallet you previously used for this game to continue.")}</p>
|
|
8788
8881
|
</div>
|
|
8789
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
8882
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
8790
8883
|
</div>
|
|
8791
8884
|
<hr class="__crossx-divider">
|
|
8792
8885
|
<div class="__crossx-body __crossx-wallet-selector-body">
|
|
@@ -8795,7 +8888,7 @@ function _s(i, e, r, t) {
|
|
|
8795
8888
|
${o}
|
|
8796
8889
|
</div>
|
|
8797
8890
|
<button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
|
|
8798
|
-
<span class="__crossx-wallet-add-icon">${
|
|
8891
|
+
<span class="__crossx-wallet-add-icon">${fs}</span>
|
|
8799
8892
|
<span class="__crossx-wallet-add-label">${w((t == null ? void 0 : t.wallet_selector_add_button) ?? "Add Wallet")}</span>
|
|
8800
8893
|
</button>
|
|
8801
8894
|
<p class="__crossx-wallet-add-error" id="__crossx-add-wallet-error" role="alert" aria-live="polite" hidden></p>
|
|
@@ -8810,11 +8903,11 @@ function _s(i, e, r, t) {
|
|
|
8810
8903
|
</div>
|
|
8811
8904
|
`, n;
|
|
8812
8905
|
}
|
|
8813
|
-
function
|
|
8906
|
+
function Ss(i, e) {
|
|
8814
8907
|
const r = document.createElement("div");
|
|
8815
8908
|
r.id = F;
|
|
8816
8909
|
const t = document.createElement("div");
|
|
8817
|
-
t.className = "__crossx-card __crossx-card--wallet-created",
|
|
8910
|
+
t.className = "__crossx-card __crossx-card--wallet-created", rs(t, i), t.role = "dialog", t.ariaModal = "true", t.setAttribute("aria-labelledby", "__crossx-ttl");
|
|
8818
8911
|
const s = document.createElement("div");
|
|
8819
8912
|
s.className = "__crossx-header";
|
|
8820
8913
|
const o = document.createElement("span");
|
|
@@ -8822,13 +8915,13 @@ function hs(i, e) {
|
|
|
8822
8915
|
const n = document.createElement("p");
|
|
8823
8916
|
n.className = "__crossx-title", n.id = "__crossx-ttl", n.style.paddingRight = "48px", n.textContent = (e == null ? void 0 : e.wallet_created_title) ?? "Wallet Created!";
|
|
8824
8917
|
const a = document.createElement("button");
|
|
8825
|
-
a.className = "__crossx-close", a.id = "__crossx-close-btn", a.type = "button", a.ariaLabel = "Close", a.innerHTML =
|
|
8918
|
+
a.className = "__crossx-close", a.id = "__crossx-close-btn", a.type = "button", a.ariaLabel = "Close", a.innerHTML = U, s.append(o, n, a);
|
|
8826
8919
|
const l = document.createElement("hr");
|
|
8827
8920
|
l.className = "__crossx-divider";
|
|
8828
8921
|
const p = document.createElement("div");
|
|
8829
8922
|
p.className = "__crossx-wallet-created-body";
|
|
8830
|
-
const
|
|
8831
|
-
|
|
8923
|
+
const h = document.createElement("div");
|
|
8924
|
+
h.className = "__crossx-wallet-created-hero";
|
|
8832
8925
|
const u = document.createElement("span");
|
|
8833
8926
|
u.className = "__crossx-wallet-created-illust", u.ariaHidden = "true";
|
|
8834
8927
|
const x = (m) => {
|
|
@@ -8845,28 +8938,28 @@ function hs(i, e) {
|
|
|
8845
8938
|
x("__crossx-wallet-created-sparkle __crossx-wallet-created-sparkle--teal"),
|
|
8846
8939
|
x("__crossx-wallet-created-dot __crossx-wallet-created-dot--one"),
|
|
8847
8940
|
x("__crossx-wallet-created-dot __crossx-wallet-created-dot--two")
|
|
8848
|
-
),
|
|
8941
|
+
), h.appendChild(u), p.appendChild(h);
|
|
8849
8942
|
const g = document.createElement("div");
|
|
8850
8943
|
g.className = "__crossx-wallet-created-footer";
|
|
8851
8944
|
const f = document.createElement("button");
|
|
8852
8945
|
return f.className = "__crossx-wallet-created-btn", f.id = "__crossx-wallet-created-done", f.type = "button", f.textContent = (e == null ? void 0 : e.wallet_created_button) ?? "Got it", g.appendChild(f), t.append(s, l, p, g), r.appendChild(t), r;
|
|
8853
8946
|
}
|
|
8854
|
-
const
|
|
8947
|
+
const Es = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8855
8948
|
<path d="M26.693 21.193c-.028-3.168 2.587-4.712 2.706-4.786-1.477-2.16-3.77-2.454-4.58-2.484-1.944-.197-3.804 1.148-4.793 1.148-.992 0-2.52-1.12-4.147-1.09-2.13.032-4.1 1.239-5.198 3.133-2.222 3.855-.569 9.562 1.593 12.69 1.061 1.535 2.318 3.258 3.975 3.196 1.6-.064 2.2-1.03 4.133-1.03 1.928 0 2.48 1.03 4.172.997 1.72-.03 2.806-1.56 3.862-3.1 1.211-1.779 1.713-3.495 1.74-3.583-.037-.017-3.427-1.316-3.463-5.09z" fill="currentColor"/>
|
|
8856
8949
|
<path d="M23.527 11.876c.877-1.065 1.471-2.545 1.31-4.024-1.266.053-2.807.845-3.718 1.907-.813.946-1.53 2.468-1.34 3.915 1.41.107 2.852-.716 3.748-1.798z" fill="currentColor"/>
|
|
8857
|
-
</svg>`,
|
|
8950
|
+
</svg>`, As = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8858
8951
|
<path d="M38.06 20.44c0-1.34-.12-2.63-.34-3.87H20.5v7.32h9.84c-.42 2.28-1.71 4.21-3.65 5.51v4.57h5.91c3.46-3.19 5.46-7.88 5.46-13.53z" fill="#4285F4"/>
|
|
8859
8952
|
<path d="M20.5 38.5c4.94 0 9.09-1.64 12.12-4.44l-5.91-4.57c-1.64 1.1-3.73 1.75-6.21 1.75-4.77 0-8.82-3.22-10.26-7.55H4.16v4.72A18.49 18.49 0 0 0 20.5 38.5z" fill="#34A853"/>
|
|
8860
8953
|
<path d="M10.24 23.69A11.16 11.16 0 0 1 9.66 20c0-1.28.22-2.52.58-3.69v-4.72H4.16A18.49 18.49 0 0 0 2 20c0 2.97.71 5.78 1.97 8.28l6.27-4.59z" fill="#FBBC05"/>
|
|
8861
8954
|
<path d="M20.5 8.76c2.69 0 5.1.92 7 2.73l5.24-5.24C29.58 3.36 25.43 1.5 20.5 1.5A18.49 18.49 0 0 0 4.16 11.59l6.08 4.72C11.68 11.98 15.73 8.76 20.5 8.76z" fill="#EA4335"/>
|
|
8862
8955
|
</svg>`;
|
|
8863
|
-
function
|
|
8864
|
-
const e =
|
|
8865
|
-
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${
|
|
8956
|
+
function Is(i) {
|
|
8957
|
+
const e = Ht(i);
|
|
8958
|
+
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${Qr[i] ?? ""}</span><span class="__crossx-connect-other-wallet-name">${w(e)}</span></span>`;
|
|
8866
8959
|
}
|
|
8867
|
-
function
|
|
8960
|
+
function ks(i) {
|
|
8868
8961
|
if (i.length === 0) return "";
|
|
8869
|
-
const e = (s) =>
|
|
8962
|
+
const e = (s) => Is(i[s]), r = "Supported wallets include ";
|
|
8870
8963
|
if (i.length === 1)
|
|
8871
8964
|
return `${r}${e(0)}.`;
|
|
8872
8965
|
if (i.length === 2)
|
|
@@ -8876,7 +8969,7 @@ function fs(i) {
|
|
|
8876
8969
|
const t = i.length - 3;
|
|
8877
8970
|
return `${r}${e(0)}, ${e(1)}, ${e(2)}, and ${t} more.`;
|
|
8878
8971
|
}
|
|
8879
|
-
function
|
|
8972
|
+
function Ts(i, e = [], r) {
|
|
8880
8973
|
const t = i, s = w(String(e[0])), o = w((r == null ? void 0 : r.login_selector_or) ?? "or"), n = e.length > 0 ? `
|
|
8881
8974
|
<div class="__crossx-login-or-divider">
|
|
8882
8975
|
<hr><span>${o}</span><hr>
|
|
@@ -8884,27 +8977,27 @@ function ws(i, e = [], r) {
|
|
|
8884
8977
|
<button type="button" class="__crossx-connect-other-block" id="__crossx-connect-other-wallet-btn" data-wallet-id="${s}" aria-labelledby="__crossx-connect-other-heading">
|
|
8885
8978
|
<span class="__crossx-connect-other-text">
|
|
8886
8979
|
<span class="__crossx-connect-other-title" id="__crossx-connect-other-heading">${w((r == null ? void 0 : r.login_selector_connect_other_wallets) ?? "Connect with Other Wallets")}</span>
|
|
8887
|
-
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${
|
|
8980
|
+
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${ks(e)}</span>
|
|
8888
8981
|
</span>
|
|
8889
8982
|
</button>` : "", a = document.createElement("div");
|
|
8890
8983
|
return a.id = F, a.innerHTML = `
|
|
8891
8984
|
<div class="__crossx-card __crossx-card--migration" style="${H(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8892
8985
|
<div class="__crossx-header">
|
|
8893
8986
|
<div style="display:flex;flex-direction:column;gap:4px;padding-right:36px;">
|
|
8894
|
-
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:0;">${w((r == null ? void 0 : r.login_selector_title) ??
|
|
8987
|
+
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:0;">${w((r == null ? void 0 : r.login_selector_title) ?? He)}</p>
|
|
8895
8988
|
<p class="__crossx-subtitle">${w((r == null ? void 0 : r.login_selector_subtitle) ?? "Sign in instantly with your social account")}</p>
|
|
8896
8989
|
</div>
|
|
8897
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
8990
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
8898
8991
|
</div>
|
|
8899
8992
|
<hr class="__crossx-divider">
|
|
8900
8993
|
<div class="__crossx-body">
|
|
8901
8994
|
<div class="__crossx-login-btn-row">
|
|
8902
8995
|
<button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
|
|
8903
|
-
<span class="__crossx-login-icon" style="color:var(--cx-value);">${
|
|
8996
|
+
<span class="__crossx-login-icon" style="color:var(--cx-value);">${Es}</span>
|
|
8904
8997
|
<span class="__crossx-login-btn-label">${w((r == null ? void 0 : r.login_selector_apple) ?? "Sign in with Apple")}</span>
|
|
8905
8998
|
</button>
|
|
8906
8999
|
<button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
|
|
8907
|
-
<span class="__crossx-login-icon">${
|
|
9000
|
+
<span class="__crossx-login-icon">${As}</span>
|
|
8908
9001
|
<span class="__crossx-login-btn-label">${w((r == null ? void 0 : r.login_selector_google) ?? "Sign in with Google")}</span>
|
|
8909
9002
|
</button>
|
|
8910
9003
|
</div>${n}
|
|
@@ -8915,7 +9008,7 @@ function ws(i, e = [], r) {
|
|
|
8915
9008
|
</div>
|
|
8916
9009
|
`, a;
|
|
8917
9010
|
}
|
|
8918
|
-
function
|
|
9011
|
+
function Rs(i, e) {
|
|
8919
9012
|
const r = i, t = document.createElement("div");
|
|
8920
9013
|
t.id = F;
|
|
8921
9014
|
const s = w(e.message).replace(/\n/g, "<br>"), o = e.email ? `<div class="__crossx-session-account-card">
|
|
@@ -8926,7 +9019,7 @@ function ms(i, e) {
|
|
|
8926
9019
|
<div class="__crossx-card __crossx-card--migration" style="${H(r)}" role="alertdialog" aria-modal="true" aria-labelledby="__crossx-session-header-title" aria-describedby="__crossx-session-msg">
|
|
8927
9020
|
<div class="__crossx-header">
|
|
8928
9021
|
<p class="__crossx-title" id="__crossx-session-header-title">${w(e.title)}</p>
|
|
8929
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9022
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
8930
9023
|
</div>
|
|
8931
9024
|
<hr class="__crossx-divider">
|
|
8932
9025
|
<div class="__crossx-body" style="padding:20px 24px 24px;display:flex;flex-direction:column;gap:16px;">
|
|
@@ -8943,8 +9036,8 @@ function ms(i, e) {
|
|
|
8943
9036
|
</div>
|
|
8944
9037
|
`, t;
|
|
8945
9038
|
}
|
|
8946
|
-
function
|
|
8947
|
-
const r = i, t = e ? `<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9039
|
+
function Cs(i, e = !0) {
|
|
9040
|
+
const r = i, t = e ? `<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>` : "", s = e ? '<button class="__crossx-skip-btn" id="__crossx-skip-btn">Skip for Now</button>' : "", o = document.createElement("div");
|
|
8948
9041
|
return o.id = F, o.innerHTML = `
|
|
8949
9042
|
<div class="__crossx-card __crossx-card--migration" style="${H(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8950
9043
|
<div class="__crossx-header">
|
|
@@ -8959,7 +9052,7 @@ function ys(i, e = !0) {
|
|
|
8959
9052
|
<p class="__crossx-mig-info-desc">It safely restores and integrates all your previous assets. Simply verify your PIN to get started.</p>
|
|
8960
9053
|
</div>
|
|
8961
9054
|
<button class="__crossx-recover-btn" id="__crossx-recover-btn">
|
|
8962
|
-
<span class="__crossx-recover-icon">${
|
|
9055
|
+
<span class="__crossx-recover-icon">${Yr}</span>
|
|
8963
9056
|
<span class="__crossx-recover-label">Import from Social Backup</span>
|
|
8964
9057
|
</button>
|
|
8965
9058
|
${s}
|
|
@@ -8967,13 +9060,13 @@ function ys(i, e = !0) {
|
|
|
8967
9060
|
</div>
|
|
8968
9061
|
`, o;
|
|
8969
9062
|
}
|
|
8970
|
-
function
|
|
8971
|
-
const r = i, { errorMessage: t, attemptCount: s, maxAttempts: o = 5 } = e ?? {}, n = !!t, a = n ? " --error" : "", l = s != null && s > 0 ? `<p class="__crossx-pin-attempt">${s}/${o}</p>` : "", p = s != null && s >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "",
|
|
9063
|
+
function Ps(i, e) {
|
|
9064
|
+
const r = i, { errorMessage: t, attemptCount: s, maxAttempts: o = 5 } = e ?? {}, n = !!t, a = n ? " --error" : "", l = s != null && s > 0 ? `<p class="__crossx-pin-attempt">${s}/${o}</p>` : "", p = s != null && s >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "", h = n ? `<p class="__crossx-pin-error-text">${t}</p>` : "", u = document.createElement("div");
|
|
8972
9065
|
return u.id = F, u.innerHTML = `
|
|
8973
9066
|
<div class="__crossx-card __crossx-card--migration" style="${H(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8974
9067
|
<div class="__crossx-header">
|
|
8975
9068
|
<p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
|
|
8976
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9069
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
8977
9070
|
</div>
|
|
8978
9071
|
<hr class="__crossx-divider">
|
|
8979
9072
|
<div class="__crossx-pin-center">
|
|
@@ -8986,22 +9079,22 @@ function bs(i, e) {
|
|
|
8986
9079
|
<input class="__crossx-pin-input${a}" type="tel" maxlength="1" inputmode="numeric" pattern="[0-9]" autocomplete="off">
|
|
8987
9080
|
</div>
|
|
8988
9081
|
<p class="__crossx-pin-hint">Enter your 4-digit PIN to recover your wallet.</p>
|
|
8989
|
-
${
|
|
9082
|
+
${h}
|
|
8990
9083
|
</div>
|
|
8991
9084
|
</div>
|
|
8992
9085
|
`, u;
|
|
8993
9086
|
}
|
|
8994
|
-
function
|
|
9087
|
+
function Ns(i) {
|
|
8995
9088
|
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");
|
|
8996
9089
|
return `${s}, ${o} ${n} ${a}:${l}`;
|
|
8997
9090
|
}
|
|
8998
|
-
function
|
|
8999
|
-
const t = i, s = e <= 0, o = s ? null : Date.now() + e * 1e3, n = o ?
|
|
9091
|
+
function Os(i, e, r) {
|
|
9092
|
+
const t = i, s = e <= 0, o = s ? null : Date.now() + e * 1e3, n = o ? Ns(o) : null, a = document.createElement("div");
|
|
9000
9093
|
return a.id = F, a.innerHTML = `
|
|
9001
9094
|
<div class="__crossx-card __crossx-card--migration" style="${H(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
9002
9095
|
<div class="__crossx-header">
|
|
9003
9096
|
<p class="__crossx-title" id="__crossx-ttl">Import from Social Backup</p>
|
|
9004
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9097
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
9005
9098
|
</div>
|
|
9006
9099
|
<hr class="__crossx-divider">
|
|
9007
9100
|
<div class="__crossx-pin-center">
|
|
@@ -9026,10 +9119,10 @@ function Ss(i, e, r) {
|
|
|
9026
9119
|
return () => clearInterval(u);
|
|
9027
9120
|
} };
|
|
9028
9121
|
}
|
|
9029
|
-
function
|
|
9122
|
+
function Ls(i) {
|
|
9030
9123
|
const r = [i.check1, i.check2].map((t, s) => `
|
|
9031
9124
|
<div class="__crossx-pw-notice-item" data-check-index="${s}" role="checkbox" aria-checked="false" tabindex="0">
|
|
9032
|
-
<div class="__crossx-pw-notice-check" id="__crossx-notice-check-${s}">${
|
|
9125
|
+
<div class="__crossx-pw-notice-check" id="__crossx-notice-check-${s}">${Fs}</div>
|
|
9033
9126
|
<span class="__crossx-pw-notice-item-text">${w(t)}</span>
|
|
9034
9127
|
</div>
|
|
9035
9128
|
`).join("");
|
|
@@ -9038,14 +9131,14 @@ function Es(i) {
|
|
|
9038
9131
|
<span class="__crossx-pin6-sheet-handle" aria-hidden="true"></span>
|
|
9039
9132
|
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${w(i.title)}</p>
|
|
9040
9133
|
<p class="__crossx-pw-subtitle">${w(i.headerSubtitle)}</p>
|
|
9041
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9134
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
9042
9135
|
</div>
|
|
9043
9136
|
<hr class="__crossx-divider">
|
|
9044
9137
|
<div class="__crossx-pw-body">
|
|
9045
9138
|
<div class="__crossx-pw-fields __crossx-pw-fields--notice">
|
|
9046
9139
|
<div class="__crossx-pw-notice-header">
|
|
9047
9140
|
<div class="__crossx-pw-notice-title-row">
|
|
9048
|
-
<span class="__crossx-pw-notice-icon">${
|
|
9141
|
+
<span class="__crossx-pw-notice-icon">${Bs}</span>
|
|
9049
9142
|
<p class="__crossx-pw-notice-title">${w(i.noticeTitle)}</p>
|
|
9050
9143
|
</div>
|
|
9051
9144
|
<p class="__crossx-pw-notice-desc">${w(i.noticeDesc)}</p>
|
|
@@ -9065,11 +9158,11 @@ function Es(i) {
|
|
|
9065
9158
|
<div class="__crossx-home-indicator"></div>
|
|
9066
9159
|
`;
|
|
9067
9160
|
}
|
|
9068
|
-
function
|
|
9161
|
+
function Oe(i) {
|
|
9069
9162
|
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">
|
|
9070
|
-
${
|
|
9163
|
+
${kt}
|
|
9071
9164
|
<span id="__crossx-pin6-lock-countdown"></span>
|
|
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" : "",
|
|
9165
|
+
</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" : "", h = Array.from(
|
|
9073
9166
|
{ length: 6 },
|
|
9074
9167
|
(m, y) => `<input class="__crossx-pin6-box${p}" type="tel" maxlength="1" inputmode="numeric" pattern="[0-9]" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" aria-label="PIN digit ${y + 1}"${e ? " disabled" : ""}>`
|
|
9075
9168
|
).join(""), u = e ? " --locked" : "", x = Array.from(
|
|
@@ -9095,7 +9188,7 @@ function Ce(i) {
|
|
|
9095
9188
|
<div class="__crossx-pin6-numpad-row">
|
|
9096
9189
|
<button type="button" class="__crossx-pin6-numpad-key --empty" aria-hidden="true"></button>
|
|
9097
9190
|
<button type="button" class="__crossx-pin6-numpad-key${g}" data-key="0">0</button>
|
|
9098
|
-
<button type="button" class="__crossx-pin6-numpad-key --delete${g}" data-key="backspace" aria-label="Delete">${
|
|
9191
|
+
<button type="button" class="__crossx-pin6-numpad-key --delete${g}" data-key="backspace" aria-label="Delete">${$s}</button>
|
|
9099
9192
|
</div>
|
|
9100
9193
|
</div>`;
|
|
9101
9194
|
return `
|
|
@@ -9103,13 +9196,13 @@ function Ce(i) {
|
|
|
9103
9196
|
<span class="__crossx-pin6-sheet-handle" aria-hidden="true"></span>
|
|
9104
9197
|
<p class="__crossx-title" id="__crossx-ttl" style="padding-right:48px;">${w(i.title)}</p>
|
|
9105
9198
|
${t}
|
|
9106
|
-
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${
|
|
9199
|
+
<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${U}</button>
|
|
9107
9200
|
</div>
|
|
9108
9201
|
<hr class="__crossx-divider">
|
|
9109
9202
|
<div class="__crossx-pin6-body"${r}>
|
|
9110
9203
|
${s}
|
|
9111
9204
|
<div class="__crossx-pin6-boxes" id="__crossx-pin6-boxes">
|
|
9112
|
-
${
|
|
9205
|
+
${h}
|
|
9113
9206
|
<div class="__crossx-pin6-dots" id="__crossx-pin6-dots">
|
|
9114
9207
|
${x}
|
|
9115
9208
|
</div>
|
|
@@ -9122,7 +9215,7 @@ function Ce(i) {
|
|
|
9122
9215
|
${f}
|
|
9123
9216
|
`;
|
|
9124
9217
|
}
|
|
9125
|
-
function
|
|
9218
|
+
function _t(i, e) {
|
|
9126
9219
|
const r = document.createElement("div");
|
|
9127
9220
|
return r.id = F, r.innerHTML = `
|
|
9128
9221
|
<div class="__crossx-card __crossx-card--pin6" style="${H(i)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -9130,99 +9223,99 @@ function lt(i, e) {
|
|
|
9130
9223
|
</div>
|
|
9131
9224
|
`, r;
|
|
9132
9225
|
}
|
|
9133
|
-
function
|
|
9226
|
+
function Ds(i, e) {
|
|
9134
9227
|
if (i.length !== 6) return e.tooShort;
|
|
9135
9228
|
if (!/^\d+$/.test(i)) return e.numbersOnly;
|
|
9136
9229
|
if (/(.)\1{2}/.test(i)) return e.repeatingDigit;
|
|
9137
9230
|
const r = i.split("").map(Number), t = r.every((o, n) => n === 0 || o === (r[n - 1] + 1) % 10), s = r.every((o, n) => n === 0 || o === (r[n - 1] + 9) % 10);
|
|
9138
9231
|
return t || s ? e.sequential : i[0] !== i[1] && i === i.slice(0, 2).repeat(3) ? e.alternatingPattern : null;
|
|
9139
9232
|
}
|
|
9140
|
-
function
|
|
9233
|
+
function Ms(i) {
|
|
9141
9234
|
const e = Math.max(0, Math.ceil(i / 1e3)), r = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), s = e % 60;
|
|
9142
9235
|
return r > 0 ? `${r}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
|
|
9143
9236
|
}
|
|
9144
|
-
function
|
|
9145
|
-
var
|
|
9237
|
+
function Le(i, e, r, t, s, o, n) {
|
|
9238
|
+
var je, Ye;
|
|
9146
9239
|
let a = !!(o && o > Date.now()), l = !1;
|
|
9147
|
-
const p = () => Array.from(i.querySelectorAll(".__crossx-pin6-box")),
|
|
9240
|
+
const p = () => Array.from(i.querySelectorAll(".__crossx-pin6-box")), h = () => 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
9241
|
b.dataset.digit = v, b.value = m;
|
|
9149
9242
|
}, S = (b) => {
|
|
9150
9243
|
delete b.dataset.digit, b.value = "";
|
|
9151
|
-
}, E = (b) => b.dataset.digit ?? "", A = () => p().map(E).join(""), T = () => Array.from(i.querySelectorAll(".__crossx-pin6-dot")),
|
|
9152
|
-
var
|
|
9244
|
+
}, E = (b) => b.dataset.digit ?? "", A = () => p().map(E).join(""), T = () => Array.from(i.querySelectorAll(".__crossx-pin6-dot")), R = () => {
|
|
9245
|
+
var k;
|
|
9153
9246
|
const b = p(), v = T();
|
|
9154
|
-
if (v.length && (v.forEach((
|
|
9155
|
-
const $ = !!(b[
|
|
9156
|
-
|
|
9247
|
+
if (v.length && (v.forEach((C, P) => {
|
|
9248
|
+
const $ = !!(b[P] && E(b[P]));
|
|
9249
|
+
C.classList.toggle("--filled", $), C.classList.toggle("--active", !1);
|
|
9157
9250
|
}), !a && !l)) {
|
|
9158
|
-
const
|
|
9159
|
-
(
|
|
9251
|
+
const C = b.findIndex(($) => !E($));
|
|
9252
|
+
(k = v[C === -1 ? 5 : C]) == null || k.classList.add("--active");
|
|
9160
9253
|
}
|
|
9161
|
-
},
|
|
9162
|
-
i.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((v) => v.classList.toggle("--disabled", a)), T().forEach((v) => v.classList.toggle("--locked", a)),
|
|
9163
|
-
},
|
|
9254
|
+
}, N = () => {
|
|
9255
|
+
i.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((v) => v.classList.toggle("--disabled", a)), T().forEach((v) => v.classList.toggle("--locked", a)), R();
|
|
9256
|
+
}, W = (b) => {
|
|
9164
9257
|
a = b, p().forEach((v) => {
|
|
9165
9258
|
v.disabled = b, v.classList.toggle("--locked", b);
|
|
9166
9259
|
});
|
|
9167
|
-
},
|
|
9260
|
+
}, Y = () => i.querySelector("#__crossx-pin6-attempt"), D = () => {
|
|
9168
9261
|
const b = u();
|
|
9169
9262
|
b && (b.textContent = "");
|
|
9170
|
-
},
|
|
9171
|
-
var
|
|
9172
|
-
let v =
|
|
9263
|
+
}, V = () => n ?? "Your account will be locked after further failures.", I = () => i.querySelector("#__crossx-pin6-warning"), O = (b) => {
|
|
9264
|
+
var k;
|
|
9265
|
+
let v = I();
|
|
9173
9266
|
if (!v) {
|
|
9174
9267
|
v = document.createElement("p"), v.className = "__crossx-pin6-warning", v.id = "__crossx-pin6-warning";
|
|
9175
|
-
const
|
|
9176
|
-
|
|
9268
|
+
const C = u();
|
|
9269
|
+
C ? C.insertAdjacentElement("afterend", v) : (k = f()) == null || k.appendChild(v);
|
|
9177
9270
|
}
|
|
9178
9271
|
v.textContent = b;
|
|
9179
|
-
},
|
|
9180
|
-
const b =
|
|
9272
|
+
}, M = () => {
|
|
9273
|
+
const b = I();
|
|
9181
9274
|
b && (b.textContent = "");
|
|
9182
|
-
},
|
|
9183
|
-
var
|
|
9184
|
-
let
|
|
9185
|
-
if (!
|
|
9186
|
-
|
|
9187
|
-
const
|
|
9188
|
-
|
|
9189
|
-
}
|
|
9190
|
-
|
|
9191
|
-
},
|
|
9192
|
-
const b =
|
|
9275
|
+
}, X = (b, v) => {
|
|
9276
|
+
var C;
|
|
9277
|
+
let k = Y();
|
|
9278
|
+
if (!k) {
|
|
9279
|
+
k = document.createElement("p"), k.className = "__crossx-pin6-attempt", k.id = "__crossx-pin6-attempt";
|
|
9280
|
+
const P = I() ?? u();
|
|
9281
|
+
P ? P.insertAdjacentElement("afterend", k) : (C = f()) == null || C.appendChild(k);
|
|
9282
|
+
}
|
|
9283
|
+
k.textContent = `${b}/${v}`;
|
|
9284
|
+
}, he = () => {
|
|
9285
|
+
const b = Y();
|
|
9193
9286
|
b && (b.textContent = "");
|
|
9194
|
-
},
|
|
9287
|
+
}, we = (b) => {
|
|
9195
9288
|
const v = u();
|
|
9196
9289
|
v && (v.textContent = b);
|
|
9197
|
-
const
|
|
9198
|
-
|
|
9199
|
-
var
|
|
9200
|
-
(
|
|
9290
|
+
const k = h();
|
|
9291
|
+
k == null || k.classList.add("--shake"), setTimeout(() => k == null ? void 0 : k.classList.remove("--shake"), 500), p().forEach(S), setTimeout(() => {
|
|
9292
|
+
var C;
|
|
9293
|
+
(C = p()[0]) == null || C.focus(), R();
|
|
9201
9294
|
}, 50);
|
|
9202
|
-
},
|
|
9295
|
+
}, _e = (b) => {
|
|
9203
9296
|
var $;
|
|
9204
|
-
|
|
9297
|
+
W(!0), p().forEach(S), N();
|
|
9205
9298
|
const v = u();
|
|
9206
9299
|
if (v && (v.textContent = "Too many failed attempts. Please wait."), !x()) {
|
|
9207
9300
|
const B = document.createElement("p");
|
|
9208
|
-
B.className = "__crossx-pin6-lock-msg", B.id = "__crossx-pin6-lock-msg", B.innerHTML = `${
|
|
9209
|
-
const
|
|
9210
|
-
|
|
9211
|
-
}
|
|
9212
|
-
const
|
|
9213
|
-
var
|
|
9214
|
-
const B = b - Date.now(),
|
|
9215
|
-
B <= 0 ? (clearInterval(
|
|
9216
|
-
var
|
|
9217
|
-
return (
|
|
9218
|
-
}, 50)) :
|
|
9219
|
-
},
|
|
9220
|
-
|
|
9221
|
-
const
|
|
9222
|
-
document.contains(i) || (clearInterval(
|
|
9301
|
+
B.className = "__crossx-pin6-lock-msg", B.id = "__crossx-pin6-lock-msg", B.innerHTML = `${kt}<span id="__crossx-pin6-lock-countdown"></span>`;
|
|
9302
|
+
const z = u();
|
|
9303
|
+
z ? z.insertAdjacentElement("afterend", B) : ($ = f()) == null || $.appendChild(B);
|
|
9304
|
+
}
|
|
9305
|
+
const k = () => {
|
|
9306
|
+
var re;
|
|
9307
|
+
const B = b - Date.now(), z = g();
|
|
9308
|
+
B <= 0 ? (clearInterval(C), W(!1), (re = x()) == null || re.remove(), v && (v.textContent = ""), N(), setTimeout(() => {
|
|
9309
|
+
var me;
|
|
9310
|
+
return (me = p()[0]) == null ? void 0 : me.focus();
|
|
9311
|
+
}, 50)) : z && (z.textContent = ` ${Ms(B)}`);
|
|
9312
|
+
}, C = setInterval(k, 1e3);
|
|
9313
|
+
k();
|
|
9314
|
+
const P = new MutationObserver(() => {
|
|
9315
|
+
document.contains(i) || (clearInterval(C), P.disconnect());
|
|
9223
9316
|
});
|
|
9224
|
-
|
|
9225
|
-
},
|
|
9317
|
+
P.observe(document.body, { childList: !0, subtree: !1 });
|
|
9318
|
+
}, se = async () => {
|
|
9226
9319
|
if (a || l) return;
|
|
9227
9320
|
const b = A();
|
|
9228
9321
|
if (b.length === 6) {
|
|
@@ -9232,7 +9325,7 @@ function Pe(i, e, r, t, s, o, n) {
|
|
|
9232
9325
|
try {
|
|
9233
9326
|
if (s) {
|
|
9234
9327
|
const v = await s(b);
|
|
9235
|
-
v.ok ? e(b) : v.lockExpiresAt ? (
|
|
9328
|
+
v.ok ? e(b) : v.lockExpiresAt ? (he(), _e(v.lockExpiresAt)) : (we(v.error ?? "Incorrect PIN. Please try again."), v.attemptCount != null && v.maxAttempts != null ? (O(V()), X(v.attemptCount, v.maxAttempts)) : (M(), he()));
|
|
9236
9329
|
} else
|
|
9237
9330
|
e(b);
|
|
9238
9331
|
} catch (v) {
|
|
@@ -9240,101 +9333,101 @@ function Pe(i, e, r, t, s, o, n) {
|
|
|
9240
9333
|
} finally {
|
|
9241
9334
|
l = !1, a || p().forEach((v) => {
|
|
9242
9335
|
v.disabled = !1;
|
|
9243
|
-
}),
|
|
9336
|
+
}), R();
|
|
9244
9337
|
}
|
|
9245
9338
|
}
|
|
9246
9339
|
};
|
|
9247
|
-
o && o > Date.now() ?
|
|
9340
|
+
o && o > Date.now() ? _e(o) : setTimeout(() => {
|
|
9248
9341
|
var b;
|
|
9249
9342
|
return (b = p()[0]) == null ? void 0 : b.focus();
|
|
9250
9343
|
}, 100);
|
|
9251
|
-
const
|
|
9344
|
+
const ue = () => {
|
|
9252
9345
|
if (a || l) return;
|
|
9253
|
-
const b = p(), v = b.find((
|
|
9346
|
+
const b = p(), v = b.find((k) => !E(k)) ?? b[b.length - 1];
|
|
9254
9347
|
v == null || v.focus();
|
|
9255
9348
|
};
|
|
9256
|
-
(
|
|
9257
|
-
b.target.classList.contains("__crossx-pin6-box") ||
|
|
9258
|
-
}), (
|
|
9349
|
+
(je = h()) == null || je.addEventListener("click", (b) => {
|
|
9350
|
+
b.target.classList.contains("__crossx-pin6-box") || ue();
|
|
9351
|
+
}), (Ye = f()) == null || Ye.addEventListener("click", (b) => {
|
|
9259
9352
|
const v = b.target;
|
|
9260
|
-
v.classList.contains("__crossx-pin6-box") || v.closest("button") ||
|
|
9353
|
+
v.classList.contains("__crossx-pin6-box") || v.closest("button") || ue();
|
|
9261
9354
|
}), p().forEach((b, v) => {
|
|
9262
9355
|
b.addEventListener("input", () => {
|
|
9263
|
-
var
|
|
9264
|
-
const
|
|
9265
|
-
|
|
9266
|
-
}), b.addEventListener("keydown", (
|
|
9267
|
-
var
|
|
9268
|
-
if (
|
|
9269
|
-
if (
|
|
9356
|
+
var C;
|
|
9357
|
+
const k = b.value.replace(/\D/g, "").slice(-1);
|
|
9358
|
+
k ? y(b, k) : S(b), D(), k && v < 5 && ((C = p()[v + 1]) == null || C.focus()), R(), A().length === 6 && setTimeout(se, 80);
|
|
9359
|
+
}), b.addEventListener("keydown", (k) => {
|
|
9360
|
+
var C, P;
|
|
9361
|
+
if (k.key === "Backspace") {
|
|
9362
|
+
if (k.preventDefault(), E(b))
|
|
9270
9363
|
S(b);
|
|
9271
9364
|
else if (v > 0) {
|
|
9272
9365
|
const $ = p()[v - 1];
|
|
9273
9366
|
S($), $.focus();
|
|
9274
9367
|
}
|
|
9275
|
-
|
|
9276
|
-
} else
|
|
9277
|
-
}), b.addEventListener("paste", (
|
|
9368
|
+
R();
|
|
9369
|
+
} else k.key === "ArrowLeft" && v > 0 ? (k.preventDefault(), (C = p()[v - 1]) == null || C.focus()) : k.key === "ArrowRight" && v < 5 ? (k.preventDefault(), (P = p()[v + 1]) == null || P.focus()) : k.key === "Escape" && r();
|
|
9370
|
+
}), b.addEventListener("paste", (k) => {
|
|
9278
9371
|
var $, B;
|
|
9279
|
-
|
|
9280
|
-
const
|
|
9281
|
-
if (!
|
|
9282
|
-
const
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
}), (B =
|
|
9372
|
+
k.preventDefault();
|
|
9373
|
+
const C = ((($ = k.clipboardData) == null ? void 0 : $.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
|
|
9374
|
+
if (!C) return;
|
|
9375
|
+
const P = p();
|
|
9376
|
+
C.split("").forEach((z, re) => {
|
|
9377
|
+
P[re] && y(P[re], z);
|
|
9378
|
+
}), (B = P[Math.min(C.length - 1, 5)]) == null || B.focus(), D(), R(), A().length === 6 && setTimeout(se, 80);
|
|
9286
9379
|
}), b.addEventListener("focus", () => b.select());
|
|
9287
9380
|
});
|
|
9288
|
-
const
|
|
9289
|
-
if (
|
|
9381
|
+
const J = i.querySelector("#__crossx-pin6-numpad");
|
|
9382
|
+
if (J) {
|
|
9290
9383
|
let b = null;
|
|
9291
9384
|
const v = () => {
|
|
9292
9385
|
b && (b.classList.remove("--pressed"), b = null);
|
|
9293
9386
|
};
|
|
9294
|
-
|
|
9295
|
-
const
|
|
9296
|
-
!
|
|
9387
|
+
J.addEventListener("pointerdown", (C) => {
|
|
9388
|
+
const P = C.target.closest(".__crossx-pin6-numpad-key");
|
|
9389
|
+
!P || a || l || (v(), b = P, P.classList.add("--pressed"), P.setPointerCapture(C.pointerId));
|
|
9297
9390
|
});
|
|
9298
|
-
const
|
|
9299
|
-
const
|
|
9300
|
-
if (!
|
|
9301
|
-
if (
|
|
9302
|
-
const
|
|
9303
|
-
|
|
9391
|
+
const k = (C) => {
|
|
9392
|
+
const P = C.dataset.key;
|
|
9393
|
+
if (!P) return;
|
|
9394
|
+
if (P === "backspace") {
|
|
9395
|
+
const re = [...p()].reverse().find((me) => E(me));
|
|
9396
|
+
re && (S(re), D()), R();
|
|
9304
9397
|
return;
|
|
9305
9398
|
}
|
|
9306
|
-
if (!/^\d$/.test(
|
|
9307
|
-
const B = p().find((
|
|
9308
|
-
B && (y(B,
|
|
9399
|
+
if (!/^\d$/.test(P)) return;
|
|
9400
|
+
const B = p().find((z) => !E(z));
|
|
9401
|
+
B && (y(B, P), D(), R(), A().length === 6 && setTimeout(se, 80));
|
|
9309
9402
|
};
|
|
9310
|
-
|
|
9403
|
+
J.addEventListener("pointerup", (C) => {
|
|
9311
9404
|
if (!b) return;
|
|
9312
|
-
const
|
|
9405
|
+
const P = b;
|
|
9313
9406
|
v();
|
|
9314
|
-
const $ =
|
|
9315
|
-
|
|
9316
|
-
}),
|
|
9407
|
+
const $ = P.getBoundingClientRect();
|
|
9408
|
+
C.clientX >= $.left && C.clientX <= $.right && C.clientY >= $.top && C.clientY <= $.bottom && !a && !l && k(P);
|
|
9409
|
+
}), J.addEventListener("pointercancel", v), J.addEventListener("pointerleave", v, !0), R(), o && o > Date.now() && N();
|
|
9317
9410
|
}
|
|
9318
9411
|
}
|
|
9319
|
-
const
|
|
9412
|
+
const $s = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9320
9413
|
<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"/>
|
|
9321
9414
|
<line x1="10" y1="5.5" x2="16" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9322
9415
|
<line x1="16" y1="5.5" x2="10" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9323
|
-
</svg>`,
|
|
9416
|
+
</svg>`, kt = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9324
9417
|
<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"/>
|
|
9325
|
-
</svg>`,
|
|
9418
|
+
</svg>`, Fs = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9326
9419
|
<path d="M1 4.5L4 7.5L10 1" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
9327
|
-
</svg>`,
|
|
9420
|
+
</svg>`, Bs = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9328
9421
|
<path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="currentColor"/>
|
|
9329
9422
|
</svg>`;
|
|
9330
|
-
function
|
|
9423
|
+
function Us(i, e, r) {
|
|
9331
9424
|
var o;
|
|
9332
9425
|
const t = i.querySelectorAll(".__crossx-pin-input");
|
|
9333
9426
|
t.forEach((n, a) => {
|
|
9334
9427
|
n.addEventListener("input", () => {
|
|
9335
9428
|
const l = n.value.replace(/\D/g, "");
|
|
9336
9429
|
n.value = l ? l[0] : "", l && a < 3 && t[a + 1].focus();
|
|
9337
|
-
const p = Array.from(t).map((
|
|
9430
|
+
const p = Array.from(t).map((h) => h.value).join("");
|
|
9338
9431
|
p.length === 4 && setTimeout(() => e(p), 200);
|
|
9339
9432
|
}), n.addEventListener("keydown", (l) => {
|
|
9340
9433
|
l.key === "Backspace" && !n.value && a > 0 && (t[a - 1].focus(), t[a - 1].value = ""), l.key === "Escape" && r();
|
|
@@ -9348,8 +9441,8 @@ function Cs(i, e, r) {
|
|
|
9348
9441
|
p.split("").forEach((x, g) => {
|
|
9349
9442
|
t[g] && (t[g].value = x);
|
|
9350
9443
|
});
|
|
9351
|
-
const
|
|
9352
|
-
t[
|
|
9444
|
+
const h = Math.min(p.length, 3);
|
|
9445
|
+
t[h].focus(), p.length === 4 && setTimeout(() => e(p), 200);
|
|
9353
9446
|
});
|
|
9354
9447
|
});
|
|
9355
9448
|
const s = i.querySelector(".__crossx-pin-inputs");
|
|
@@ -9360,9 +9453,9 @@ function Cs(i, e, r) {
|
|
|
9360
9453
|
}
|
|
9361
9454
|
}), (o = t[0]) == null || o.focus();
|
|
9362
9455
|
}
|
|
9363
|
-
class
|
|
9364
|
-
constructor(e = "light", r, t =
|
|
9365
|
-
this.theme = e, this.overrides = r, this.tokens =
|
|
9456
|
+
class Ws {
|
|
9457
|
+
constructor(e = "light", r, t = We, s) {
|
|
9458
|
+
this.theme = e, this.overrides = r, this.tokens = pt(e, r), this.displayDecimals = t, this.pinKeyboard = s, zr();
|
|
9366
9459
|
}
|
|
9367
9460
|
setPinKeyboard(e) {
|
|
9368
9461
|
this.pinKeyboard = e;
|
|
@@ -9382,7 +9475,7 @@ class Ps {
|
|
|
9382
9475
|
e && e.classList.toggle("--native-keypad", this.resolvePinKeyboardMode() === "native");
|
|
9383
9476
|
}
|
|
9384
9477
|
setTheme(e, r) {
|
|
9385
|
-
this.theme = e, r !== void 0 && (this.overrides = r), this.tokens =
|
|
9478
|
+
this.theme = e, r !== void 0 && (this.overrides = r), this.tokens = pt(e, this.overrides);
|
|
9386
9479
|
}
|
|
9387
9480
|
setMessages(e) {
|
|
9388
9481
|
this.messages = e;
|
|
@@ -9404,24 +9497,24 @@ class Ps {
|
|
|
9404
9497
|
showWalletSelector(e, r, t) {
|
|
9405
9498
|
return new Promise((s, o) => {
|
|
9406
9499
|
var E;
|
|
9407
|
-
|
|
9408
|
-
const n = [...e], a =
|
|
9409
|
-
|
|
9500
|
+
G();
|
|
9501
|
+
const n = [...e], a = vs(n, this.tokens, t, this.messages), l = oe();
|
|
9502
|
+
K(a);
|
|
9410
9503
|
let p = !1;
|
|
9411
|
-
const
|
|
9504
|
+
const h = () => {
|
|
9412
9505
|
p || (p = !0, a.remove(), l());
|
|
9413
9506
|
};
|
|
9414
9507
|
let u = null;
|
|
9415
9508
|
const x = (A) => {
|
|
9416
|
-
|
|
9509
|
+
h(), s(A);
|
|
9417
9510
|
}, g = () => {
|
|
9418
|
-
|
|
9511
|
+
h(), u ? o(u) : s(null);
|
|
9419
9512
|
};
|
|
9420
9513
|
(() => {
|
|
9421
9514
|
a.querySelectorAll(".__crossx-wallet-item").forEach((A) => {
|
|
9422
9515
|
A.addEventListener("click", () => {
|
|
9423
|
-
const T = A.dataset.walletAddress ?? "",
|
|
9424
|
-
x({ address: T, index:
|
|
9516
|
+
const T = A.dataset.walletAddress ?? "", R = parseInt(A.dataset.walletIndex ?? "0", 10), N = n.find((W) => W.index === R);
|
|
9517
|
+
x({ address: T, index: R, name: N == null ? void 0 : N.name });
|
|
9425
9518
|
});
|
|
9426
9519
|
});
|
|
9427
9520
|
})();
|
|
@@ -9433,17 +9526,17 @@ class Ps {
|
|
|
9433
9526
|
n.push(A);
|
|
9434
9527
|
const T = a.querySelector("#__crossx-wallet-list");
|
|
9435
9528
|
if (T) {
|
|
9436
|
-
const
|
|
9437
|
-
|
|
9529
|
+
const R = document.createElement("button");
|
|
9530
|
+
R.className = "__crossx-wallet-item", R.dataset.walletIndex = String(A.index), R.dataset.walletAddress = A.address, R.innerHTML = `${It(A.address, A.index, this.tokens.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${w(At(A))}</span><span class="__crossx-wallet-addr">${ft(A.address)}</span></span>`, R.addEventListener("click", () => x(A)), T.appendChild(R);
|
|
9438
9531
|
try {
|
|
9439
|
-
|
|
9532
|
+
R.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
9440
9533
|
} catch {
|
|
9441
9534
|
}
|
|
9442
9535
|
}
|
|
9443
9536
|
y.disabled = !1;
|
|
9444
9537
|
} catch (A) {
|
|
9445
|
-
const T = A instanceof
|
|
9446
|
-
m && (m.textContent =
|
|
9538
|
+
const T = A instanceof _ && A.code === d.ADDRESS_LIMIT_EXCEEDED, R = this.resolveAddWalletErrorMessage(A);
|
|
9539
|
+
m && (m.textContent = R, m.hidden = !1), T ? (y.disabled = !0, y.setAttribute("aria-disabled", "true")) : y.disabled = !1, u = A;
|
|
9447
9540
|
}
|
|
9448
9541
|
}), (E = a.querySelector("#__crossx-close-btn")) == null || E.addEventListener("click", g), a.addEventListener("click", (A) => {
|
|
9449
9542
|
A.target === a && g();
|
|
@@ -9457,9 +9550,9 @@ class Ps {
|
|
|
9457
9550
|
showWalletCreatedPrompt() {
|
|
9458
9551
|
return new Promise((e) => {
|
|
9459
9552
|
var a, l;
|
|
9460
|
-
|
|
9461
|
-
const r =
|
|
9462
|
-
|
|
9553
|
+
G();
|
|
9554
|
+
const r = Ss(this.tokens, this.messages), t = oe();
|
|
9555
|
+
K(r);
|
|
9463
9556
|
let s = !1, o = null;
|
|
9464
9557
|
const n = () => {
|
|
9465
9558
|
s || (s = !0, o && document.removeEventListener("keydown", o), r.remove(), t(), e());
|
|
@@ -9480,8 +9573,8 @@ class Ps {
|
|
|
9480
9573
|
*/
|
|
9481
9574
|
resolveAddWalletErrorMessage(e) {
|
|
9482
9575
|
const r = this.messages;
|
|
9483
|
-
if (e instanceof
|
|
9484
|
-
const s = e.details, o = typeof (s == null ? void 0 : s.limit) == "number" ? s.limit :
|
|
9576
|
+
if (e instanceof _ && e.code === d.ADDRESS_LIMIT_EXCEEDED) {
|
|
9577
|
+
const s = e.details, o = typeof (s == null ? void 0 : s.limit) == "number" ? s.limit : De;
|
|
9485
9578
|
return ((r == null ? void 0 : r.wallet_selector_add_error_limit_exceeded) ?? "Account limit reached. Maximum {limit} accounts allowed.").replace("{limit}", String(o));
|
|
9486
9579
|
}
|
|
9487
9580
|
return (r == null ? void 0 : r.wallet_selector_add_error_generic) ?? "Failed to add a new account. Please try again.";
|
|
@@ -9498,45 +9591,45 @@ class Ps {
|
|
|
9498
9591
|
)) ?? [];
|
|
9499
9592
|
return new Promise((s) => {
|
|
9500
9593
|
var x, g, f, m;
|
|
9501
|
-
|
|
9502
|
-
const o =
|
|
9503
|
-
|
|
9594
|
+
G();
|
|
9595
|
+
const o = Ts(this.tokens, r, this.messages), n = oe();
|
|
9596
|
+
K(o);
|
|
9504
9597
|
const a = () => {
|
|
9505
9598
|
o.remove(), n();
|
|
9506
9599
|
}, l = (y) => {
|
|
9507
9600
|
a(), s({ type: "oauth", provider: y });
|
|
9508
9601
|
}, p = (y) => {
|
|
9509
9602
|
a(), s({ type: "external", walletId: y });
|
|
9510
|
-
},
|
|
9603
|
+
}, h = () => {
|
|
9511
9604
|
a(), s(null);
|
|
9512
9605
|
};
|
|
9513
9606
|
(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) => {
|
|
9514
9607
|
const E = y.currentTarget.dataset.walletId ?? "";
|
|
9515
9608
|
E && p(E);
|
|
9516
|
-
}), (m = o.querySelector("#__crossx-close-btn")) == null || m.addEventListener("click",
|
|
9517
|
-
y.target === o &&
|
|
9609
|
+
}), (m = o.querySelector("#__crossx-close-btn")) == null || m.addEventListener("click", h), o.addEventListener("click", (y) => {
|
|
9610
|
+
y.target === o && h();
|
|
9518
9611
|
}), o.querySelectorAll(".__crossx-login-terms-link").forEach((y) => {
|
|
9519
9612
|
y.addEventListener("click", (S) => S.stopPropagation());
|
|
9520
9613
|
});
|
|
9521
9614
|
const u = (y) => {
|
|
9522
|
-
y.key === "Escape" && (document.removeEventListener("keydown", u),
|
|
9615
|
+
y.key === "Escape" && (document.removeEventListener("keydown", u), h());
|
|
9523
9616
|
};
|
|
9524
9617
|
document.addEventListener("keydown", u);
|
|
9525
9618
|
});
|
|
9526
9619
|
}
|
|
9527
9620
|
showSessionAlert(e) {
|
|
9528
9621
|
return new Promise((r) => {
|
|
9529
|
-
var
|
|
9530
|
-
|
|
9531
|
-
const t = this.messages, s =
|
|
9622
|
+
var h, u, x;
|
|
9623
|
+
G();
|
|
9624
|
+
const t = this.messages, s = Rs(this.tokens, {
|
|
9532
9625
|
title: e.title,
|
|
9533
9626
|
message: e.message,
|
|
9534
9627
|
email: e.email,
|
|
9535
9628
|
accountLabel: (t == null ? void 0 : t.session_alert_account_label) ?? "Account",
|
|
9536
9629
|
signOutLabel: (t == null ? void 0 : t.session_alert_sign_out_button) ?? "Sign out",
|
|
9537
9630
|
signInAgainLabel: (t == null ? void 0 : t.session_alert_sign_in_again_button) ?? "Sign in again"
|
|
9538
|
-
}), o =
|
|
9539
|
-
|
|
9631
|
+
}), o = oe();
|
|
9632
|
+
K(s);
|
|
9540
9633
|
let n = !1;
|
|
9541
9634
|
const a = () => {
|
|
9542
9635
|
n || (n = !0, s.remove(), o());
|
|
@@ -9545,7 +9638,7 @@ class Ps {
|
|
|
9545
9638
|
}, p = () => {
|
|
9546
9639
|
a(), r("signin-again");
|
|
9547
9640
|
};
|
|
9548
|
-
(
|
|
9641
|
+
(h = s.querySelector("#__crossx-session-signout")) == null || h.addEventListener("click", l), (u = s.querySelector("#__crossx-session-signin")) == null || u.addEventListener("click", p), (x = s.querySelector("#__crossx-close-btn")) == null || x.addEventListener("click", l);
|
|
9549
9642
|
});
|
|
9550
9643
|
}
|
|
9551
9644
|
/**
|
|
@@ -9557,21 +9650,21 @@ class Ps {
|
|
|
9557
9650
|
const r = (e == null ? void 0 : e.allowSkip) ?? !0;
|
|
9558
9651
|
return new Promise((t) => {
|
|
9559
9652
|
var a, l, p;
|
|
9560
|
-
|
|
9561
|
-
const s =
|
|
9562
|
-
|
|
9653
|
+
G();
|
|
9654
|
+
const s = Cs(this.tokens, r);
|
|
9655
|
+
K(s);
|
|
9563
9656
|
const o = () => s.remove(), n = () => {
|
|
9564
9657
|
o(), t("recover");
|
|
9565
9658
|
};
|
|
9566
9659
|
if ((a = s.querySelector("#__crossx-recover-btn")) == null || a.addEventListener("click", n), r) {
|
|
9567
|
-
const
|
|
9660
|
+
const h = () => {
|
|
9568
9661
|
o(), t("skip");
|
|
9569
9662
|
};
|
|
9570
|
-
(l = s.querySelector("#__crossx-skip-btn")) == null || l.addEventListener("click",
|
|
9571
|
-
x.target === s &&
|
|
9663
|
+
(l = s.querySelector("#__crossx-skip-btn")) == null || l.addEventListener("click", h), (p = s.querySelector("#__crossx-close-btn")) == null || p.addEventListener("click", h), s.addEventListener("click", (x) => {
|
|
9664
|
+
x.target === s && h();
|
|
9572
9665
|
});
|
|
9573
9666
|
const u = (x) => {
|
|
9574
|
-
x.key === "Escape" && (document.removeEventListener("keydown", u),
|
|
9667
|
+
x.key === "Escape" && (document.removeEventListener("keydown", u), h());
|
|
9575
9668
|
};
|
|
9576
9669
|
document.addEventListener("keydown", u);
|
|
9577
9670
|
}
|
|
@@ -9586,7 +9679,7 @@ class Ps {
|
|
|
9586
9679
|
*/
|
|
9587
9680
|
showPinSetupPrompt(e) {
|
|
9588
9681
|
return new Promise((r) => {
|
|
9589
|
-
|
|
9682
|
+
G();
|
|
9590
9683
|
const t = this.messages, s = {
|
|
9591
9684
|
title: (t == null ? void 0 : t.pin_setup_title) ?? "Create PIN",
|
|
9592
9685
|
headerSubtitle: (t == null ? void 0 : t.pin_notice_header_subtitle) ?? "Required for transactions, PK/mnemonic export & account deletion.",
|
|
@@ -9605,15 +9698,15 @@ class Ps {
|
|
|
9605
9698
|
title: (t == null ? void 0 : t.pin_setup_confirm_title) ?? "Confirm PIN",
|
|
9606
9699
|
headerSubtitle: (t == null ? void 0 : t.pin_setup_header_subtitle) ?? "This PIN is used to authorize your transactions.",
|
|
9607
9700
|
subtitle: (t == null ? void 0 : t.pin_setup_confirm_subtitle) ?? "Confirm your 6-digit PIN"
|
|
9608
|
-
}, a =
|
|
9609
|
-
|
|
9701
|
+
}, a = _t(this.tokens, Ls(s)), l = oe();
|
|
9702
|
+
K(a);
|
|
9610
9703
|
let p = !1;
|
|
9611
|
-
const
|
|
9704
|
+
const h = () => {
|
|
9612
9705
|
p || (p = !0, a.remove(), l());
|
|
9613
9706
|
}, u = (E) => {
|
|
9614
|
-
|
|
9707
|
+
h(), r(E);
|
|
9615
9708
|
}, x = () => {
|
|
9616
|
-
|
|
9709
|
+
h(), r(null);
|
|
9617
9710
|
}, g = a.querySelector(".__crossx-card"), f = {
|
|
9618
9711
|
tooShort: (t == null ? void 0 : t.pin_validation_too_short) ?? "Please enter a 6-digit PIN.",
|
|
9619
9712
|
numbersOnly: (t == null ? void 0 : t.pin_validation_numbers_only) ?? "Only numbers (0-9) are allowed.",
|
|
@@ -9622,63 +9715,63 @@ class Ps {
|
|
|
9622
9715
|
alternatingPattern: (t == null ? void 0 : t.pin_validation_alternating_pattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
9623
9716
|
}, m = (E) => {
|
|
9624
9717
|
var A;
|
|
9625
|
-
g.innerHTML =
|
|
9718
|
+
g.innerHTML = Oe({
|
|
9626
9719
|
title: n.title,
|
|
9627
9720
|
headerSubtitle: n.headerSubtitle,
|
|
9628
9721
|
subtitle: n.subtitle
|
|
9629
|
-
}), this.applyPinKeyboardMode(g), (A = g.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x),
|
|
9722
|
+
}), this.applyPinKeyboardMode(g), (A = g.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x), Le(g, (T) => {
|
|
9630
9723
|
T === E ? u(E) : y(o.mismatchError);
|
|
9631
9724
|
}, x);
|
|
9632
9725
|
}, y = (E) => {
|
|
9633
9726
|
var A;
|
|
9634
|
-
g.innerHTML =
|
|
9727
|
+
g.innerHTML = Oe({
|
|
9635
9728
|
title: o.title,
|
|
9636
9729
|
headerSubtitle: o.headerSubtitle,
|
|
9637
9730
|
subtitle: o.subtitle,
|
|
9638
9731
|
errorMessage: E
|
|
9639
|
-
}), this.applyPinKeyboardMode(g), (A = g.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x),
|
|
9640
|
-
const
|
|
9641
|
-
|
|
9732
|
+
}), this.applyPinKeyboardMode(g), (A = g.querySelector("#__crossx-close-btn")) == null || A.addEventListener("click", x), Le(g, (T) => {
|
|
9733
|
+
const R = Ds(T, f);
|
|
9734
|
+
R ? y(R) : m(T);
|
|
9642
9735
|
}, x);
|
|
9643
9736
|
};
|
|
9644
9737
|
(() => {
|
|
9645
|
-
var
|
|
9738
|
+
var V;
|
|
9646
9739
|
const E = Array.from(g.querySelectorAll(".__crossx-pw-notice-item")), A = g.querySelector("#__crossx-pin-notice-next"), T = /* @__PURE__ */ new Set();
|
|
9647
9740
|
A.removeAttribute("disabled");
|
|
9648
|
-
const
|
|
9649
|
-
const
|
|
9650
|
-
A.classList.toggle("--disabled", !
|
|
9651
|
-
},
|
|
9652
|
-
if (T.has(
|
|
9653
|
-
const
|
|
9654
|
-
T.add(
|
|
9655
|
-
},
|
|
9656
|
-
if (!T.has(
|
|
9657
|
-
const
|
|
9658
|
-
T.delete(
|
|
9741
|
+
const R = A.dataset.nextLabel ?? "Next", N = A.dataset.submitLabel ?? "I Understand", W = () => {
|
|
9742
|
+
const I = T.size === E.length;
|
|
9743
|
+
A.classList.toggle("--disabled", !I), A.textContent = N || R;
|
|
9744
|
+
}, Y = (I, O) => {
|
|
9745
|
+
if (T.has(O)) return;
|
|
9746
|
+
const M = I.querySelector(`#__crossx-notice-check-${O}`);
|
|
9747
|
+
T.add(O), M.classList.add("--checked"), I.setAttribute("aria-checked", "true"), W();
|
|
9748
|
+
}, D = (I, O) => {
|
|
9749
|
+
if (!T.has(O)) return;
|
|
9750
|
+
const M = I.querySelector(`#__crossx-notice-check-${O}`);
|
|
9751
|
+
T.delete(O), M.classList.remove("--checked"), I.setAttribute("aria-checked", "false"), W();
|
|
9659
9752
|
};
|
|
9660
|
-
E.forEach((
|
|
9661
|
-
const
|
|
9662
|
-
|
|
9663
|
-
T.has(
|
|
9664
|
-
}),
|
|
9665
|
-
(
|
|
9753
|
+
E.forEach((I) => {
|
|
9754
|
+
const O = parseInt(I.dataset.checkIndex ?? "0", 10);
|
|
9755
|
+
I.addEventListener("click", () => {
|
|
9756
|
+
T.has(O) ? D(I, O) : Y(I, O);
|
|
9757
|
+
}), I.addEventListener("keydown", (M) => {
|
|
9758
|
+
(M.key === " " || M.key === "Enter") && (M.preventDefault(), T.has(O) ? D(I, O) : Y(I, O));
|
|
9666
9759
|
});
|
|
9667
9760
|
}), A.addEventListener("click", () => {
|
|
9668
9761
|
if (T.size === E.length) {
|
|
9669
9762
|
y(e == null ? void 0 : e.errorMessage);
|
|
9670
9763
|
return;
|
|
9671
9764
|
}
|
|
9672
|
-
const
|
|
9673
|
-
const
|
|
9674
|
-
return !T.has(
|
|
9765
|
+
const I = E.find((M) => {
|
|
9766
|
+
const X = parseInt(M.dataset.checkIndex ?? "0", 10);
|
|
9767
|
+
return !T.has(X);
|
|
9675
9768
|
});
|
|
9676
|
-
if (!
|
|
9677
|
-
const
|
|
9678
|
-
|
|
9679
|
-
|
|
9769
|
+
if (!I) return;
|
|
9770
|
+
const O = parseInt(I.dataset.checkIndex ?? "0", 10);
|
|
9771
|
+
I.scrollIntoView({ behavior: "smooth", block: "nearest" }), I.classList.add("--highlight"), setTimeout(() => {
|
|
9772
|
+
I.classList.remove("--highlight"), Y(I, O);
|
|
9680
9773
|
}, 400);
|
|
9681
|
-
}), (
|
|
9774
|
+
}), (V = g.querySelector("#__crossx-close-btn")) == null || V.addEventListener("click", x);
|
|
9682
9775
|
})(), a.addEventListener("click", (E) => {
|
|
9683
9776
|
E.target === a && x();
|
|
9684
9777
|
});
|
|
@@ -9692,10 +9785,10 @@ class Ps {
|
|
|
9692
9785
|
showPinInputPrompt(e) {
|
|
9693
9786
|
return new Promise((r, t) => {
|
|
9694
9787
|
var S;
|
|
9695
|
-
|
|
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 =
|
|
9788
|
+
G();
|
|
9789
|
+
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 = _t(
|
|
9697
9790
|
this.tokens,
|
|
9698
|
-
|
|
9791
|
+
Oe({
|
|
9699
9792
|
title: n,
|
|
9700
9793
|
headerSubtitle: a,
|
|
9701
9794
|
errorMessage: e == null ? void 0 : e.errorMessage,
|
|
@@ -9704,11 +9797,11 @@ class Ps {
|
|
|
9704
9797
|
attemptCount: e == null ? void 0 : e.attemptCount,
|
|
9705
9798
|
maxAttempts: e == null ? void 0 : e.maxAttempts
|
|
9706
9799
|
})
|
|
9707
|
-
),
|
|
9708
|
-
|
|
9800
|
+
), h = oe();
|
|
9801
|
+
K(p);
|
|
9709
9802
|
let u = !1;
|
|
9710
9803
|
const x = () => {
|
|
9711
|
-
u || (u = !0, p.remove(),
|
|
9804
|
+
u || (u = !0, p.remove(), h());
|
|
9712
9805
|
}, g = (E) => {
|
|
9713
9806
|
x(), r(E);
|
|
9714
9807
|
}, f = () => {
|
|
@@ -9716,7 +9809,7 @@ class Ps {
|
|
|
9716
9809
|
}, m = (E) => {
|
|
9717
9810
|
x(), t(E);
|
|
9718
9811
|
}, y = p.querySelector(".__crossx-card");
|
|
9719
|
-
this.applyPinKeyboardMode(y), (S = y.querySelector("#__crossx-close-btn")) == null || S.addEventListener("click", f),
|
|
9812
|
+
this.applyPinKeyboardMode(y), (S = y.querySelector("#__crossx-close-btn")) == null || S.addEventListener("click", f), Le(y, g, f, m, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, l), p.addEventListener("click", (E) => {
|
|
9720
9813
|
E.target === p && f();
|
|
9721
9814
|
});
|
|
9722
9815
|
});
|
|
@@ -9731,15 +9824,15 @@ class Ps {
|
|
|
9731
9824
|
showRecoveryPinInputPrompt(e) {
|
|
9732
9825
|
return new Promise((r) => {
|
|
9733
9826
|
var l;
|
|
9734
|
-
|
|
9735
|
-
const t =
|
|
9736
|
-
|
|
9827
|
+
G();
|
|
9828
|
+
const t = Ps(this.tokens, e);
|
|
9829
|
+
K(t);
|
|
9737
9830
|
const s = () => t.remove(), o = (p) => {
|
|
9738
9831
|
s(), r(p);
|
|
9739
9832
|
}, n = () => {
|
|
9740
9833
|
s(), r(null);
|
|
9741
9834
|
}, a = t.querySelector(".__crossx-card");
|
|
9742
|
-
a && this.applyPinKeyboardMode(a),
|
|
9835
|
+
a && this.applyPinKeyboardMode(a), Us(t, o, n), (l = t.querySelector("#__crossx-close-btn")) == null || l.addEventListener("click", n), t.addEventListener("click", (p) => {
|
|
9743
9836
|
p.target === t && n();
|
|
9744
9837
|
});
|
|
9745
9838
|
});
|
|
@@ -9753,16 +9846,16 @@ class Ps {
|
|
|
9753
9846
|
showRecoveryPinLockedPrompt(e, r) {
|
|
9754
9847
|
return new Promise((t) => {
|
|
9755
9848
|
var p;
|
|
9756
|
-
|
|
9757
|
-
const { overlay: s, startCountdown: o } =
|
|
9758
|
-
|
|
9849
|
+
G();
|
|
9850
|
+
const { overlay: s, startCountdown: o } = Os(this.tokens, e, r);
|
|
9851
|
+
K(s);
|
|
9759
9852
|
const n = () => {
|
|
9760
9853
|
l(), s.remove();
|
|
9761
9854
|
}, a = () => {
|
|
9762
9855
|
n(), t();
|
|
9763
9856
|
}, l = o(a);
|
|
9764
|
-
(p = s.querySelector("#__crossx-close-btn")) == null || p.addEventListener("click", a), s.addEventListener("click", (
|
|
9765
|
-
|
|
9857
|
+
(p = s.querySelector("#__crossx-close-btn")) == null || p.addEventListener("click", a), s.addEventListener("click", (h) => {
|
|
9858
|
+
h.target === s && a();
|
|
9766
9859
|
});
|
|
9767
9860
|
});
|
|
9768
9861
|
}
|
|
@@ -9773,16 +9866,16 @@ class Ps {
|
|
|
9773
9866
|
showTransactionComplete(e) {
|
|
9774
9867
|
return new Promise((r) => {
|
|
9775
9868
|
var a, l;
|
|
9776
|
-
|
|
9777
|
-
const t =
|
|
9778
|
-
|
|
9869
|
+
G();
|
|
9870
|
+
const t = hs(e, this.tokens, this.messages);
|
|
9871
|
+
K(t);
|
|
9779
9872
|
const s = () => t.remove(), o = () => {
|
|
9780
9873
|
s(), r();
|
|
9781
9874
|
};
|
|
9782
9875
|
(a = t.querySelector("#__crossx-done-btn")) == null || a.addEventListener("click", o), (l = t.querySelector("#__crossx-close-btn")) == null || l.addEventListener("click", o), t.querySelectorAll(".__crossx-copy-btn").forEach((p) => {
|
|
9783
|
-
p.addEventListener("click", (
|
|
9876
|
+
p.addEventListener("click", (h) => {
|
|
9784
9877
|
var x;
|
|
9785
|
-
|
|
9878
|
+
h.stopPropagation();
|
|
9786
9879
|
const u = p.dataset.copy;
|
|
9787
9880
|
u && ((x = navigator.clipboard) == null || x.writeText(u).catch(() => {
|
|
9788
9881
|
}));
|
|
@@ -9802,16 +9895,16 @@ class Ps {
|
|
|
9802
9895
|
*/
|
|
9803
9896
|
showTransactionProgress(e, r) {
|
|
9804
9897
|
return new Promise((t) => {
|
|
9805
|
-
|
|
9806
|
-
const s =
|
|
9807
|
-
|
|
9898
|
+
G();
|
|
9899
|
+
const s = _s(e, this.tokens, this.messages);
|
|
9900
|
+
K(s);
|
|
9808
9901
|
const o = () => s.remove();
|
|
9809
9902
|
let n = !1;
|
|
9810
9903
|
const a = () => {
|
|
9811
9904
|
n || (n = !0, o(), t());
|
|
9812
9905
|
}, l = () => {
|
|
9813
|
-
var
|
|
9814
|
-
(
|
|
9906
|
+
var h, u;
|
|
9907
|
+
(h = s.querySelector("#__crossx-done-btn")) == null || h.addEventListener("click", a), (u = s.querySelector("#__crossx-close-btn")) == null || u.addEventListener("click", a), s.addEventListener("click", (x) => {
|
|
9815
9908
|
x.target === s && a();
|
|
9816
9909
|
});
|
|
9817
9910
|
const p = (x) => {
|
|
@@ -9820,18 +9913,18 @@ class Ps {
|
|
|
9820
9913
|
document.addEventListener("keydown", p);
|
|
9821
9914
|
};
|
|
9822
9915
|
r.then((p) => {
|
|
9823
|
-
n || (
|
|
9916
|
+
n || (us(s, p, this.tokens, this.messages), l());
|
|
9824
9917
|
});
|
|
9825
9918
|
});
|
|
9826
9919
|
}
|
|
9827
9920
|
requestConfirmation(e) {
|
|
9828
9921
|
return new Promise((r) => {
|
|
9829
|
-
var p,
|
|
9830
|
-
|
|
9922
|
+
var p, h, u;
|
|
9923
|
+
G();
|
|
9831
9924
|
let t;
|
|
9832
|
-
e.type === "sign-message" ? t =
|
|
9833
|
-
const s =
|
|
9834
|
-
|
|
9925
|
+
e.type === "sign-message" ? t = xs(e, this.tokens, this.messages) : e.type === "sign-typed-data" ? t = gs(e, this.tokens, this.messages) : e.type === "sign" ? t = ss(e, this.tokens, this.displayDecimals, this.messages) : t = ns(e, this.tokens, this.displayDecimals, this.messages);
|
|
9926
|
+
const s = oe();
|
|
9927
|
+
K(t);
|
|
9835
9928
|
const o = () => {
|
|
9836
9929
|
t.remove(), s();
|
|
9837
9930
|
}, n = () => {
|
|
@@ -9839,7 +9932,7 @@ class Ps {
|
|
|
9839
9932
|
}, a = () => {
|
|
9840
9933
|
o(), r(!1);
|
|
9841
9934
|
};
|
|
9842
|
-
(p = t.querySelector("#__crossx-confirm-btn")) == null || p.addEventListener("click", n), (
|
|
9935
|
+
(p = t.querySelector("#__crossx-confirm-btn")) == null || p.addEventListener("click", n), (h = t.querySelector("#__crossx-cancel-btn")) == null || h.addEventListener("click", a), (u = t.querySelector("#__crossx-close-btn")) == null || u.addEventListener("click", a), t.querySelectorAll(".__crossx-copy-btn").forEach((x) => {
|
|
9843
9936
|
x.addEventListener("click", (g) => {
|
|
9844
9937
|
var m;
|
|
9845
9938
|
g.stopPropagation();
|
|
@@ -9847,7 +9940,7 @@ class Ps {
|
|
|
9847
9940
|
f && ((m = navigator.clipboard) == null || m.writeText(f).catch(() => {
|
|
9848
9941
|
}));
|
|
9849
9942
|
});
|
|
9850
|
-
}),
|
|
9943
|
+
}), Kr(t), t.addEventListener("click", (x) => {
|
|
9851
9944
|
x.target === t && a();
|
|
9852
9945
|
});
|
|
9853
9946
|
const l = (x) => {
|
|
@@ -9857,7 +9950,7 @@ class Ps {
|
|
|
9857
9950
|
});
|
|
9858
9951
|
}
|
|
9859
9952
|
}
|
|
9860
|
-
class
|
|
9953
|
+
class Hs {
|
|
9861
9954
|
constructor(e, r, t, s = () => !1) {
|
|
9862
9955
|
this.browserConfirmation = e, this.getBridge = r, this.getOrigin = t, this.isAuthenticatedViaRNBridge = s;
|
|
9863
9956
|
}
|
|
@@ -9953,7 +10046,7 @@ class Ns {
|
|
|
9953
10046
|
};
|
|
9954
10047
|
}
|
|
9955
10048
|
default:
|
|
9956
|
-
throw new
|
|
10049
|
+
throw new _(
|
|
9957
10050
|
d.INVALID_CONFIG,
|
|
9958
10051
|
`Unknown confirmation type: ${String(r)}`
|
|
9959
10052
|
);
|
|
@@ -10027,7 +10120,7 @@ class Ns {
|
|
|
10027
10120
|
(t = (r = this.browserConfirmation).setPinKeyboard) == null || t.call(r, e);
|
|
10028
10121
|
}
|
|
10029
10122
|
}
|
|
10030
|
-
class
|
|
10123
|
+
class Gs {
|
|
10031
10124
|
constructor() {
|
|
10032
10125
|
this._accessToken = null, this._expiresAt = 0;
|
|
10033
10126
|
}
|
|
@@ -10059,7 +10152,7 @@ class Os {
|
|
|
10059
10152
|
return !this._accessToken || this._expiresAt <= 0 ? !0 : Date.now() >= this._expiresAt - e;
|
|
10060
10153
|
}
|
|
10061
10154
|
}
|
|
10062
|
-
function
|
|
10155
|
+
function ti(i, e) {
|
|
10063
10156
|
if (!i.projectId)
|
|
10064
10157
|
throw new Error(
|
|
10065
10158
|
`[CROSSx] Fatal: projectId is required but was not provided.
|
|
@@ -10067,61 +10160,62 @@ Set the projectId field in SDKConfig when calling createCROSSxSDK().
|
|
|
10067
10160
|
Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
10068
10161
|
);
|
|
10069
10162
|
i.debug;
|
|
10070
|
-
const r =
|
|
10163
|
+
const r = pe.production, t = {
|
|
10071
10164
|
...i,
|
|
10072
10165
|
oauthServiceUrl: r.oauthServiceUrl,
|
|
10166
|
+
legacyOauthServiceUrl: r.legacyOauthServiceUrl,
|
|
10073
10167
|
authApiUrl: r.authApiUrl,
|
|
10074
10168
|
walletGatewayUrl: r.walletGatewayUrl
|
|
10075
10169
|
}, s = {
|
|
10076
10170
|
gatewayUrl: r.walletGatewayUrl,
|
|
10077
10171
|
projectId: i.projectId
|
|
10078
|
-
}, o = t.authMode !== "cookie" &&
|
|
10172
|
+
}, o = t.authMode !== "cookie" && at.isAvailable();
|
|
10079
10173
|
!o && t.authMode !== "cookie" && c.warn(
|
|
10080
10174
|
"[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
|
|
10081
10175
|
"refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
|
|
10082
10176
|
"IndexedDB를 지원하는 브라우저 사용을 권장합니다."
|
|
10083
10177
|
), t.secureStorageAvailable = o;
|
|
10084
|
-
const n = o ? new
|
|
10178
|
+
const n = o ? new at(i.projectId) : new yr(), a = new Er(), l = new Tr(), p = new ne(), h = new Gs(), u = new xt();
|
|
10085
10179
|
let x;
|
|
10086
|
-
i.useMockWallet ? (c.log("[CROSSx] Mock Wallet Provider 사용"), x = new
|
|
10180
|
+
i.useMockWallet ? (c.log("[CROSSx] Mock Wallet Provider 사용"), x = new Fr(n, u)) : (c.log("[CROSSx] Remote Wallet Provider 사용"), x = new ae(
|
|
10087
10181
|
s,
|
|
10088
10182
|
n,
|
|
10089
10183
|
l,
|
|
10090
|
-
|
|
10184
|
+
h,
|
|
10091
10185
|
u
|
|
10092
10186
|
));
|
|
10093
10187
|
let g = null;
|
|
10094
10188
|
const f = () => {
|
|
10095
|
-
var
|
|
10096
|
-
return ((
|
|
10189
|
+
var N;
|
|
10190
|
+
return ((N = g == null ? void 0 : g.isAuthenticatedViaRNBridge) == null ? void 0 : N.call(g)) ?? !1;
|
|
10097
10191
|
}, m = () => {
|
|
10098
|
-
var
|
|
10099
|
-
return (
|
|
10192
|
+
var N;
|
|
10193
|
+
return (N = g == null ? void 0 : g.assertRNBridgeSessionActive) == null ? void 0 : N.call(g);
|
|
10100
10194
|
};
|
|
10101
|
-
x = new
|
|
10195
|
+
x = new Br(
|
|
10102
10196
|
x,
|
|
10103
10197
|
() => {
|
|
10104
|
-
var
|
|
10105
|
-
return (
|
|
10198
|
+
var N;
|
|
10199
|
+
return (N = g == null ? void 0 : g.getRNBridge) == null ? void 0 : N.call(g);
|
|
10106
10200
|
},
|
|
10107
10201
|
f,
|
|
10108
10202
|
m,
|
|
10109
10203
|
() => i.appName
|
|
10110
10204
|
);
|
|
10111
|
-
const y = new fe(s, l), S = new
|
|
10205
|
+
const y = new fe(s, l), S = new Ws(
|
|
10112
10206
|
i.theme ?? "light",
|
|
10113
10207
|
i.themeTokens,
|
|
10114
10208
|
i.displayDecimals,
|
|
10115
10209
|
i.pinKeyboard
|
|
10116
|
-
), E = new
|
|
10210
|
+
), E = new Hs(
|
|
10117
10211
|
S,
|
|
10118
10212
|
() => {
|
|
10119
|
-
var
|
|
10120
|
-
return (
|
|
10213
|
+
var N;
|
|
10214
|
+
return (N = g == null ? void 0 : g.getRNBridge) == null ? void 0 : N.call(g);
|
|
10121
10215
|
},
|
|
10122
10216
|
() => typeof window < "u" ? window.location.origin : "http://localhost",
|
|
10123
10217
|
f
|
|
10124
|
-
), A = e != null && e.wrapConfirmation ? e.wrapConfirmation(E) : E, T = new
|
|
10218
|
+
), A = e != null && e.wrapConfirmation ? e.wrapConfirmation(E) : E, T = new $e(
|
|
10125
10219
|
t,
|
|
10126
10220
|
s,
|
|
10127
10221
|
n,
|
|
@@ -10129,18 +10223,18 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10129
10223
|
l,
|
|
10130
10224
|
p,
|
|
10131
10225
|
x,
|
|
10132
|
-
|
|
10226
|
+
h,
|
|
10133
10227
|
A,
|
|
10134
10228
|
y,
|
|
10135
10229
|
u
|
|
10136
10230
|
);
|
|
10137
10231
|
g = T;
|
|
10138
|
-
const
|
|
10139
|
-
return
|
|
10232
|
+
const R = T.signInUseCase;
|
|
10233
|
+
return R && typeof R.setFreshTokenCallback == "function" && R.setFreshTokenCallback(() => T.requestFreshFirebaseIdTokenFromBridge()), typeof window < "u" && (window.__crossxSDK = T), T;
|
|
10140
10234
|
}
|
|
10141
|
-
function
|
|
10142
|
-
const e =
|
|
10143
|
-
|
|
10235
|
+
function ri(i) {
|
|
10236
|
+
const e = Ks(i), r = Vs(e), t = JSON.parse(r);
|
|
10237
|
+
qs(t);
|
|
10144
10238
|
const { data: s } = t;
|
|
10145
10239
|
return {
|
|
10146
10240
|
status: t.status,
|
|
@@ -10154,7 +10248,7 @@ function Ks(i) {
|
|
|
10154
10248
|
raw: t
|
|
10155
10249
|
};
|
|
10156
10250
|
}
|
|
10157
|
-
function
|
|
10251
|
+
function Ks(i) {
|
|
10158
10252
|
if (i.includes("://") && i.includes("?")) {
|
|
10159
10253
|
const e = new URL(i), r = e.searchParams.get("crossx_oauth_result");
|
|
10160
10254
|
if (r) return r;
|
|
@@ -10164,22 +10258,22 @@ function Ls(i) {
|
|
|
10164
10258
|
}
|
|
10165
10259
|
return i;
|
|
10166
10260
|
}
|
|
10167
|
-
function
|
|
10261
|
+
function Vs(i) {
|
|
10168
10262
|
if (i.startsWith("{"))
|
|
10169
10263
|
return i;
|
|
10170
10264
|
if (i.startsWith("%7B") || i.startsWith("%7b"))
|
|
10171
10265
|
return decodeURIComponent(i);
|
|
10172
|
-
const e =
|
|
10266
|
+
const e = zs(i);
|
|
10173
10267
|
return decodeURIComponent(e);
|
|
10174
10268
|
}
|
|
10175
|
-
function
|
|
10269
|
+
function zs(i) {
|
|
10176
10270
|
if (typeof atob == "function")
|
|
10177
10271
|
return atob(i);
|
|
10178
10272
|
if (typeof Buffer < "u")
|
|
10179
10273
|
return Buffer.from(i, "base64").toString("utf-8");
|
|
10180
10274
|
throw new Error("Base64 디코딩을 지원하는 환경이 아닙니다");
|
|
10181
10275
|
}
|
|
10182
|
-
function
|
|
10276
|
+
function qs(i) {
|
|
10183
10277
|
if (typeof i != "object" || i === null)
|
|
10184
10278
|
throw new Error("Deeplink payload가 유효한 객체가 아닙니다");
|
|
10185
10279
|
const e = i;
|
|
@@ -10196,18 +10290,21 @@ function $s(i) {
|
|
|
10196
10290
|
throw new Error("Deeplink data에 accessToken 필드가 없습니다");
|
|
10197
10291
|
}
|
|
10198
10292
|
export {
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10293
|
+
Wt as CONNECT_OTHER_WALLET_DISPLAY_ORDER,
|
|
10294
|
+
_ as CROSSxError,
|
|
10295
|
+
zt as CROSSxEthereumProvider,
|
|
10296
|
+
$e as CROSSxSDK,
|
|
10297
|
+
Zs as ChainId,
|
|
10204
10298
|
ge as ConnectOtherWalletItem,
|
|
10205
10299
|
d as ErrorCode,
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10300
|
+
De as MNEMONIC_ADDRESS_LIMIT,
|
|
10301
|
+
xt as PinMemoryStore,
|
|
10302
|
+
Gs as TokenMemoryStore,
|
|
10303
|
+
He as WALLET_BRAND_NAME,
|
|
10304
|
+
ti as createCROSSxSDK,
|
|
10305
|
+
Ht as getConnectOtherWalletLabel,
|
|
10306
|
+
ve as getWalletBrowserInfo,
|
|
10307
|
+
Qs as isWalletInAppBrowser,
|
|
10308
|
+
ri as parseOAuthDeeplink,
|
|
10309
|
+
ei as waitForWalletBrowser
|
|
10213
10310
|
};
|