@nexus-cross/crossx-sdk-core 1.2.6 → 1.2.8-beta.1

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/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var Ls = Object.defineProperty;
2
2
  var Ds = (r, e, s) => e in r ? Ls(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
- var T = (r, e, s) => Ds(r, typeof e != "symbol" ? e + "" : e, s);
3
+ var A = (r, e, s) => Ds(r, typeof e != "symbol" ? e + "" : e, s);
4
4
  import { createRemoteJWKSet as Ms, jwtVerify as $s, decodeJwt as Bs } from "jose";
5
- var p = /* @__PURE__ */ ((r) => (r.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", r.AUTH_FAILED = "AUTH_FAILED", r.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", r.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", r.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", r.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", r.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", r.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", r.SIGN_FAILED = "SIGN_FAILED", r.SIGN_REJECTED = "SIGN_REJECTED", r.TX_FAILED = "TX_FAILED", r.TX_REJECTED = "TX_REJECTED", r.USER_REJECTED = "USER_REJECTED", r.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", r.NETWORK_ERROR = "NETWORK_ERROR", r.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", r.INVALID_CHAIN = "INVALID_CHAIN", r.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", r.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", r.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", r.SIGNATURE_FAILED = "SIGNATURE_FAILED", r.TRANSACTION_FAILED = "TRANSACTION_FAILED", r.PREPARE_FAILED = "PREPARE_FAILED", r.PREPARE_EXPIRED = "PREPARE_EXPIRED", r.PREPARE_MISMATCH = "PREPARE_MISMATCH", r.MIGRATION_FAILED = "MIGRATION_FAILED", r.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", r.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", r.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", r.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", r.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", r.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", r.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", r.INVALID_APP_TYPE = "INVALID_APP_TYPE", r.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", r.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", r.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", r.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", r.PIN_NOT_SET = "PIN_NOT_SET", r.PIN_WRONG = "PIN_WRONG", r.PIN_INVALID = "PIN_INVALID", r.PIN_CANCELLED = "PIN_CANCELLED", r.PIN_LOCKED = "PIN_LOCKED", r.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(p || {});
5
+ var p = /* @__PURE__ */ ((r) => (r.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", r.AUTH_FAILED = "AUTH_FAILED", r.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", r.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", r.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", r.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", r.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", r.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", r.WALLET_ALREADY_EXISTS = "WALLET_ALREADY_EXISTS", r.SIGN_FAILED = "SIGN_FAILED", r.SIGN_REJECTED = "SIGN_REJECTED", r.TX_FAILED = "TX_FAILED", r.TX_REJECTED = "TX_REJECTED", r.BROADCAST_FAILED = "BROADCAST_FAILED", r.USER_REJECTED = "USER_REJECTED", r.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", r.NETWORK_ERROR = "NETWORK_ERROR", r.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", r.INVALID_CHAIN = "INVALID_CHAIN", r.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", r.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", r.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", r.SIGNATURE_FAILED = "SIGNATURE_FAILED", r.TRANSACTION_FAILED = "TRANSACTION_FAILED", r.PREPARE_FAILED = "PREPARE_FAILED", r.PREPARE_EXPIRED = "PREPARE_EXPIRED", r.PREPARE_MISMATCH = "PREPARE_MISMATCH", r.MIGRATION_FAILED = "MIGRATION_FAILED", r.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", r.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", r.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", r.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", r.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", r.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", r.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", r.INVALID_APP_TYPE = "INVALID_APP_TYPE", r.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", r.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", r.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", r.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", r.PIN_NOT_SET = "PIN_NOT_SET", r.PIN_WRONG = "PIN_WRONG", r.PIN_INVALID = "PIN_INVALID", r.PIN_REPEATED_PATTERN = "PIN_REPEATED_PATTERN", r.PIN_CANCELLED = "PIN_CANCELLED", r.PIN_LOCKED = "PIN_LOCKED", r.HMAC_REQUIRED = "HMAC_REQUIRED", r.HMAC_VERIFICATION_FAILED = "HMAC_VERIFICATION_FAILED", r.WITHDRAW_FAILED = "WITHDRAW_FAILED", r.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(p || {});
6
6
  class g extends Error {
7
7
  constructor(e, s, t) {
8
8
  super(s), this.code = e, this.details = t, this.name = "CROSSxError", Object.setPrototypeOf(this, g.prototype);
@@ -171,7 +171,7 @@ let Ee = null;
171
171
  function vt(r) {
172
172
  Ee = r;
173
173
  }
174
- const u = {
174
+ const d = {
175
175
  log(...r) {
176
176
  if (Ee) {
177
177
  Ee.log(...r);
@@ -327,7 +327,7 @@ const u = {
327
327
  function St(r = "en", e) {
328
328
  return Ws[r] ?? Qt;
329
329
  }
330
- const Et = "crossx_access_token", It = "crossx_refresh_token", Tt = "crossx_user_info";
330
+ const Et = "crossx_access_token", It = "crossx_refresh_token", At = "crossx_user_info";
331
331
  class qs {
332
332
  constructor(e, s, t, n, o, i, a) {
333
333
  this.config = e, this.storage = s, this.crypto = t, this.oauth = n, this.transport = o, this.walletProvider = i, this.tokenStore = a, this._refreshPromise = null, this._migrated = !1;
@@ -365,55 +365,55 @@ class qs {
365
365
  const c = e == null ? void 0 : e.provider;
366
366
  let l = "/login";
367
367
  c === "google" ? l = "/google" : c === "apple" && (l = "/apple");
368
- const { oauthServiceUrl: d, authApiUrl: h } = this.config, m = `${d}${l}`;
369
- u.log(`[CROSSx] OAuth 팝업 열기 (${c || "일반"} 로그인)`);
370
- const x = await this.oauth.openAuth({
368
+ const { oauthServiceUrl: u, authApiUrl: h } = this.config, m = `${u}${l}`;
369
+ d.log(`[CROSSx] OAuth 팝업 열기 (${c || "일반"} 로그인)`);
370
+ const _ = await this.oauth.openAuth({
371
371
  authUrl: m,
372
- expectedOrigin: new URL(d).origin
372
+ expectedOrigin: new URL(u).origin
373
373
  });
374
- u.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", x.length, ")");
375
- const { accessToken: w, refreshToken: E } = await this.exchangeFirebaseToken(x, h);
376
- let y, S;
374
+ d.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", _.length, ")");
375
+ const { accessToken: w, refreshToken: S } = await this.exchangeFirebaseToken(_, h);
376
+ let y, E;
377
377
  try {
378
- const B = this.crypto.decodeJWT(x);
379
- S = (n = B.firebase) == null ? void 0 : n.sign_in_provider;
378
+ const B = this.crypto.decodeJWT(_);
379
+ E = (n = B.firebase) == null ? void 0 : n.sign_in_provider;
380
380
  const b = ((o = B.firebase) == null ? void 0 : o.identities) ?? {};
381
- S === "google.com" ? y = (i = b["google.com"]) == null ? void 0 : i[0] : S === "apple.com" && (y = (a = b["apple.com"]) == null ? void 0 : a[0]), u.log("[CROSSx] OAuth provider sub 추출 — provider:", S, "hasProviderSub:", !!y);
381
+ E === "google.com" ? y = (i = b["google.com"]) == null ? void 0 : i[0] : E === "apple.com" && (y = (a = b["apple.com"]) == null ? void 0 : a[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", E, "hasProviderSub:", !!y);
382
382
  } catch {
383
- u.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
383
+ d.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
384
384
  }
385
385
  if (w) {
386
386
  const B = this.crypto.decodeJWT(w);
387
- u.log("[CROSSx] access_token 디코딩 — sub:", B.sub, "exp:", B.exp);
387
+ d.log("[CROSSx] access_token 디코딩 — sub:", B.sub, "exp:", B.exp);
388
388
  const b = await this.crypto.verifyJWT(w);
389
389
  if (t = b.signatureVerified ?? !1, !b.valid)
390
- throw u.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
390
+ throw d.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
391
391
  const k = b.payload;
392
392
  s = {
393
393
  id: k.sub,
394
394
  email: k.email,
395
- signInProvider: S,
395
+ signInProvider: E,
396
396
  providerSub: y
397
- }, this.tokenStore.set(w), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, w), E && this.config.secureStorageAvailable !== !1 ? await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, E) : E && u.warn("[CROSSx] 안전한 스토리지 미사용 — refresh_token 영속 저장을 건너뜁니다"));
397
+ }, this.tokenStore.set(w), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, w), S && this.config.secureStorageAvailable !== !1 ? await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, S) : S && d.warn("[CROSSx] 안전한 스토리지 미사용 — refresh_token 영속 저장을 건너뜁니다"));
398
398
  } else {
399
- const B = this.crypto.decodeJWT(x);
399
+ const B = this.crypto.decodeJWT(_);
400
400
  s = {
401
401
  id: B.sub,
402
402
  email: B.email,
403
- signInProvider: S,
403
+ signInProvider: E,
404
404
  providerSub: y
405
- }, u.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", s.id);
405
+ }, d.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", s.id);
406
406
  }
407
- u.log("[CROSSx] 사용자 정보 — id:", s.id);
407
+ d.log("[CROSSx] 사용자 정보 — id:", s.id);
408
408
  const C = this.useCookieAuth ? { id: s.id, signInProvider: s.signInProvider, providerSub: s.providerSub } : s;
409
- await this.storage.set(this.STORAGE_KEY_USER, C), u.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
409
+ await this.storage.set(this.STORAGE_KEY_USER, C), d.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
410
410
  } catch (c) {
411
- return u.error("[CROSSx] SignIn 에러 (OAuth/토큰 교환 단계):", c), {
411
+ return d.error("[CROSSx] SignIn 에러 (OAuth/토큰 교환 단계):", c), {
412
412
  success: !1,
413
413
  error: c instanceof Error ? c.message : "Sign in failed"
414
414
  };
415
415
  }
416
- return u.log("[CROSSx][Migration Phase 1] OAuth 로그인 완료, 지갑 로드 시작 — userId:", s.id), this.loadWallet(s, t);
416
+ return d.log("[CROSSx][Migration Phase 1] OAuth 로그인 완료, 지갑 로드 시작 — userId:", s.id), this.loadWallet(s, t);
417
417
  }
418
418
  /**
419
419
  * Firebase 토큰 → CROSSx 인증 교환
@@ -422,7 +422,7 @@ class qs {
422
422
  */
423
423
  async exchangeFirebaseToken(e, s) {
424
424
  const t = this.useCookieAuth, n = t ? `${s}/cross-auth/social/login/cookie` : `${s}/cross-auth/social/login`;
425
- u.log("[CROSSx] Firebase 토큰 교환 요청");
425
+ d.log("[CROSSx] Firebase 토큰 교환 요청");
426
426
  const o = await this.transport.request({
427
427
  url: n,
428
428
  method: "POST",
@@ -430,18 +430,18 @@ class qs {
430
430
  body: { auth_code: e, login_type: "firebase" },
431
431
  ...t ? { credentials: "include" } : {}
432
432
  });
433
- u.log("[CROSSx] 토큰 교환 응답 — status:", o.status);
433
+ d.log("[CROSSx] 토큰 교환 응답 — status:", o.status);
434
434
  const i = o.data;
435
435
  this.checkResponseError(i, "Token exchange");
436
436
  const a = this.extractAccessToken(i);
437
437
  if (t && !a)
438
- return u.log("[CROSSx] Cookie 모드 — 로그인 성공 (JWT는 HttpOnly 쿠키)"), {};
438
+ return d.log("[CROSSx] Cookie 모드 — 로그인 성공 (JWT는 HttpOnly 쿠키)"), {};
439
439
  if (!a)
440
440
  throw new g(
441
441
  p.AUTH_FAILED,
442
442
  "토큰 교환 응답에서 access_token을 찾을 수 없습니다"
443
443
  );
444
- u.log("[CROSSx] access_token 교환 성공");
444
+ d.log("[CROSSx] access_token 교환 성공");
445
445
  let c;
446
446
  return t || (c = this.extractRefreshToken(i)), { accessToken: a, refreshToken: c };
447
447
  }
@@ -504,38 +504,38 @@ class qs {
504
504
  if (t.valid) {
505
505
  const n = await this.storage.get(this.STORAGE_KEY_USER);
506
506
  if (n)
507
- return u.log("[CROSSx] restoreSession — 메모리 토큰 유효, 세션 복원"), this.loadWallet(n, t.signatureVerified);
507
+ return d.log("[CROSSx] restoreSession — 메모리 토큰 유효, 세션 복원"), this.loadWallet(n, t.signatureVerified);
508
508
  }
509
509
  this.tokenStore.clear();
510
510
  }
511
511
  if (this.useCookieAuth) {
512
- u.log("[CROSSx] restoreSession — 쿠키 기반 silentRefresh 시도");
512
+ d.log("[CROSSx] restoreSession — 쿠키 기반 silentRefresh 시도");
513
513
  const t = await this.silentRefresh();
514
514
  t && this.tokenStore.set(t);
515
515
  } else {
516
516
  const t = await this.storage.get(this.STORAGE_KEY_ACCESS_TOKEN), n = await this.storage.get(this.STORAGE_KEY_REFRESH_TOKEN);
517
- if (u.log(
517
+ if (d.log(
518
518
  "[CROSSx] restoreSession — access_token:",
519
519
  t ? "있음" : "없음",
520
520
  "refresh_token:",
521
521
  n ? "있음" : "없음"
522
522
  ), !n)
523
- return u.log("[CROSSx] restoreSession — refresh_token 없음, 세션 복원 생략"), null;
523
+ return d.log("[CROSSx] restoreSession — refresh_token 없음, 세션 복원 생략"), null;
524
524
  t && this.tokenStore.set(t);
525
525
  const o = await this.silentRefresh(n);
526
- u.log("[CROSSx] restoreSession — silentRefresh 결과:", o ? "토큰 발급 성공" : "토큰 없음"), o && this.tokenStore.set(o);
526
+ d.log("[CROSSx] restoreSession — silentRefresh 결과:", o ? "토큰 발급 성공" : "토큰 없음"), o && this.tokenStore.set(o);
527
527
  }
528
528
  const s = await this.storage.get(this.STORAGE_KEY_USER);
529
- if (u.log("[CROSSx] restoreSession — userInfo 조회:", s ? `있음 (id: ${s.id})` : "없음"), !s)
529
+ if (d.log("[CROSSx] restoreSession — userInfo 조회:", s ? `있음 (id: ${s.id})` : "없음"), !s)
530
530
  return null;
531
- u.log("[CROSSx] restoreSession — silentRefresh 성공, 세션 복원 — userId:", s.id);
531
+ d.log("[CROSSx] restoreSession — silentRefresh 성공, 세션 복원 — userId:", s.id);
532
532
  try {
533
533
  return await this.loadWallet(s, !1);
534
534
  } catch (t) {
535
- return u.warn("[CROSSx] restoreSession — 지갑 로드 실패 (세션은 유지):", t), { success: !0, user: s, tokenSignatureVerified: !1 };
535
+ return d.warn("[CROSSx] restoreSession — 지갑 로드 실패 (세션은 유지):", t), { success: !0, user: s, tokenSignatureVerified: !1 };
536
536
  }
537
537
  } catch (e) {
538
- return u.log("[CROSSx] restoreSession — 세션 복원 실패, 스토리지 정리:", e), this.tokenStore.clear(), this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN), await this.storage.remove(this.STORAGE_KEY_USER), null;
538
+ return d.log("[CROSSx] restoreSession — 세션 복원 실패, 스토리지 정리:", e), this.tokenStore.clear(), this.useCookieAuth || await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN), await this.storage.remove(this.STORAGE_KEY_USER), null;
539
539
  }
540
540
  }
541
541
  silentRefresh(e) {
@@ -556,12 +556,12 @@ class qs {
556
556
  body: o,
557
557
  ...t ? { credentials: "include" } : {}
558
558
  });
559
- u.log("[CROSSx] silentRefresh 응답 — status:", i.status);
559
+ d.log("[CROSSx] silentRefresh 응답 — status:", i.status);
560
560
  const a = i.data;
561
561
  this.checkResponseError(a, "Silent refresh");
562
562
  const c = this.extractAccessToken(a);
563
563
  if (t && !c) {
564
- u.log("[CROSSx] silentRefresh 성공 (cookie 갱신)");
564
+ d.log("[CROSSx] silentRefresh 성공 (cookie 갱신)");
565
565
  return;
566
566
  }
567
567
  if (!c)
@@ -571,7 +571,7 @@ class qs {
571
571
  const l = this.extractRefreshToken(a);
572
572
  l && this.config.secureStorageAvailable !== !1 && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, l);
573
573
  }
574
- return u.log("[CROSSx] silentRefresh 성공"), c;
574
+ return d.log("[CROSSx] silentRefresh 성공"), c;
575
575
  }
576
576
  /**
577
577
  * 외부에서 발급된 CROSSx JWT를 직접 주입하여 로그인합니다.
@@ -588,22 +588,22 @@ class qs {
588
588
  let o = await this.crypto.verifyJWT(e);
589
589
  if (n = o.signatureVerified ?? !1, !o.valid) {
590
590
  if (!s)
591
- return u.error("[CROSSx] signInWithJWT: access_token 검증 실패, refreshToken 없음"), { success: !1, error: "유효하지 않은 access token" };
592
- u.log("[CROSSx] signInWithJWT: access_token 만료, refreshToken으로 갱신 시도");
591
+ return d.error("[CROSSx] signInWithJWT: access_token 검증 실패, refreshToken 없음"), { success: !1, error: "유효하지 않은 access token" };
592
+ d.log("[CROSSx] signInWithJWT: access_token 만료, refreshToken으로 갱신 시도");
593
593
  const a = await this.silentRefresh(s);
594
594
  if (!a)
595
- return u.error("[CROSSx] signInWithJWT: silentRefresh 실패"), { success: !1, error: "access token이 만료되었고 갱신에 실패했습니다" };
595
+ return d.error("[CROSSx] signInWithJWT: silentRefresh 실패"), { success: !1, error: "access token이 만료되었고 갱신에 실패했습니다" };
596
596
  if (e = a, o = await this.crypto.verifyJWT(e), n = o.signatureVerified ?? !1, !o.valid)
597
- return u.error("[CROSSx] signInWithJWT: 갱신된 access_token도 유효하지 않음"), { success: !1, error: "갱신된 access token이 유효하지 않습니다" };
598
- u.log("[CROSSx] signInWithJWT: silentRefresh 성공, 새 access_token 사용");
597
+ return d.error("[CROSSx] signInWithJWT: 갱신된 access_token도 유효하지 않음"), { success: !1, error: "갱신된 access token이 유효하지 않습니다" };
598
+ d.log("[CROSSx] signInWithJWT: silentRefresh 성공, 새 access_token 사용");
599
599
  }
600
600
  const i = o.payload;
601
- u.log("[CROSSx] signInWithJWT — sub:", i.sub, "signatureVerified:", n), t = {
601
+ d.log("[CROSSx] signInWithJWT — sub:", i.sub, "signatureVerified:", n), t = {
602
602
  id: i.sub,
603
603
  email: i.email
604
- }, this.tokenStore.set(e), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, e), s && this.config.secureStorageAvailable !== !1 && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, s)), await this.storage.set(this.STORAGE_KEY_USER, t), u.log("[CROSSx] signInWithJWT — 토큰 및 사용자 정보 저장 완료");
604
+ }, this.tokenStore.set(e), this.useCookieAuth || (await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, e), s && this.config.secureStorageAvailable !== !1 && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, s)), await this.storage.set(this.STORAGE_KEY_USER, t), d.log("[CROSSx] signInWithJWT — 토큰 및 사용자 정보 저장 완료");
605
605
  } catch (o) {
606
- return u.error("[CROSSx] signInWithJWT 에러:", o), {
606
+ return d.error("[CROSSx] signInWithJWT 에러:", o), {
607
607
  success: !1,
608
608
  error: o instanceof Error ? o.message : "JWT sign in failed"
609
609
  };
@@ -618,15 +618,15 @@ class qs {
618
618
  if (!this._migrated) {
619
619
  this._migrated = !0;
620
620
  try {
621
- const e = await this.storage.get(Tt);
621
+ const e = await this.storage.get(At);
622
622
  if (!e || await this.storage.get(this.STORAGE_KEY_USER)) return;
623
623
  await this.storage.set(this.STORAGE_KEY_USER, e);
624
624
  const t = await this.storage.get(Et);
625
625
  t && await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, t);
626
626
  const n = await this.storage.get(It);
627
- n && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, n), await this.storage.remove(Tt), await this.storage.remove(Et), await this.storage.remove(It), u.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
627
+ n && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, n), await this.storage.remove(At), await this.storage.remove(Et), await this.storage.remove(It), d.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
628
628
  } catch (e) {
629
- u.warn("[CROSSx] 스토리지 키 마이그레이션 실패:", e);
629
+ d.warn("[CROSSx] 스토리지 키 마이그레이션 실패:", e);
630
630
  }
631
631
  }
632
632
  }
@@ -634,29 +634,29 @@ class qs {
634
634
  let t, n = !1;
635
635
  try {
636
636
  if (typeof this.walletProvider.checkWallet == "function") {
637
- u.log("[CROSSx] GET /mnemonic/check — 지갑 상태 확인 (비밀번호 불필요)");
637
+ d.log("[CROSSx] GET /mnemonic/check — 지갑 상태 확인 (비밀번호 불필요)");
638
638
  const o = await this.walletProvider.checkWallet();
639
- if (u.log("[CROSSx] 지갑 상태:", o), o === "migration_required")
640
- u.log("[CROSSx] migration_required → needsMigration = true"), n = !0;
639
+ if (d.log("[CROSSx] 지갑 상태:", o), o === "migration_required")
640
+ d.log("[CROSSx] migration_required → needsMigration = true"), n = !0;
641
641
  else if (o === "exists")
642
642
  try {
643
643
  const i = await this.walletProvider.getAddresses(e.id);
644
- i.length > 0 ? (t = i[0].address, u.log("[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):", t)) : u.log("[CROSSx] 주소 캐시 없음 — createWallet 단계에서 비밀번호 입력 후 로드");
644
+ i.length > 0 ? (t = i[0].address, d.log("[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):", t)) : d.log("[CROSSx] 주소 캐시 없음 — createWallet 단계에서 비밀번호 입력 후 로드");
645
645
  } catch (i) {
646
- u.warn("[CROSSx] getAddresses 실패, createWallet 단계에서 재시도:", i);
646
+ d.warn("[CROSSx] getAddresses 실패, createWallet 단계에서 재시도:", i);
647
647
  }
648
648
  } else
649
- u.log("[CROSSx] getOrCreateWallet 직접 호출 (폴백)"), t = (await this.walletProvider.getOrCreateWallet(e.id)).address, u.log("[CROSSx] 지갑 로드 완료 — address:", t);
649
+ d.log("[CROSSx] getOrCreateWallet 직접 호출 (폴백)"), t = (await this.walletProvider.getOrCreateWallet(e.id)).address, d.log("[CROSSx] 지갑 로드 완료 — address:", t);
650
650
  } catch (o) {
651
651
  if (o instanceof g && o.code === p.MIGRATION_BACKUP_EXISTS)
652
- u.log("[CROSSx] MIGRATION_BACKUP_EXISTS 감지 → needsMigration = true"), n = !0;
652
+ d.log("[CROSSx] MIGRATION_BACKUP_EXISTS 감지 → needsMigration = true"), n = !0;
653
653
  else {
654
654
  if (o instanceof g && (o.code === p.PROJECT_NOT_REGISTERED || o.code === p.PROJECT_ID_MISSING || o.code === p.ORIGIN_NOT_ALLOWED))
655
- throw u.error("[CROSSx] 프로젝트 설정 에러:", o.message), o;
656
- u.warn("[CROSSx] 지갑 상태 확인 실패 (로그인은 유지):", o);
655
+ throw d.error("[CROSSx] 프로젝트 설정 에러:", o.message), o;
656
+ d.warn("[CROSSx] 지갑 상태 확인 실패 (로그인은 유지):", o);
657
657
  }
658
658
  }
659
- return u.log("[CROSSx] loadWallet 결과 — address:", t, "needsMigration:", n), { success: !0, address: t, user: e, needsMigration: n, tokenSignatureVerified: s };
659
+ return d.log("[CROSSx] loadWallet 결과 — address:", t, "needsMigration:", n), { success: !0, address: t, user: e, needsMigration: n, tokenSignatureVerified: s };
660
660
  }
661
661
  }
662
662
  class Ks {
@@ -679,9 +679,9 @@ class Vs {
679
679
  p.NOT_IMPLEMENTED,
680
680
  "현재 환경에서는 마이그레이션이 지원되지 않습니다"
681
681
  );
682
- u.log("[CROSSx][Migration Phase 4] MigrateWalletUseCase.execute() — pin 길이:", e.length, "sub:", s);
682
+ d.log("[CROSSx][Migration Phase 4] MigrateWalletUseCase.execute() — pin 길이:", e.length, "sub:", s);
683
683
  const t = await this.walletProvider.migrateWallet(e, s);
684
- return u.log("[CROSSx][Migration Phase 5] MigrateWalletUseCase 완료 — address:", t.address), {
684
+ return d.log("[CROSSx][Migration Phase 5] MigrateWalletUseCase 완료 — address:", t.address), {
685
685
  address: t.address
686
686
  };
687
687
  }
@@ -819,10 +819,10 @@ function Js() {
819
819
  }
820
820
  return Ge.production;
821
821
  }
822
- const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA00", kt = 130, Pt = 6, Nt = 18, tr = 5 * 60 * 1e3, sr = 30 * 1e3, re = class re extends js {
823
- constructor(e, s, t, n, o, i, a, c, l, d, h) {
822
+ const Xs = 2e3, Tt = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA00", kt = 130, Pt = 6, Nt = 18, tr = 5 * 60 * 1e3, sr = 30 * 1e3, re = class re extends js {
823
+ constructor(e, s, t, n, o, i, a, c, l, u, h) {
824
824
  var m;
825
- super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && vt(e.logger), this.confirmation = l, this.pinStore = h ?? new es(), this.chainRegistry = d, this.jsonRpc = new zs(d, o), this.signInUseCase = new qs(
825
+ super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && vt(e.logger), this.confirmation = l, this.pinStore = h ?? new es(), this.chainRegistry = u, this.jsonRpc = new zs(u, o), this.signInUseCase = new qs(
826
826
  this.internalConfig,
827
827
  t,
828
828
  n,
@@ -856,7 +856,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
856
856
  }
857
857
  async _doInitialize(e) {
858
858
  var s, t;
859
- u.log("[CROSSx SDK] v1.2.6 초기화 중..."), this.confirmation.setMessages(St(this._config.locale));
859
+ d.log("[CROSSx SDK] v1.2.8 초기화 중..."), this.confirmation.setMessages(St(this._config.locale));
860
860
  try {
861
861
  const n = Js();
862
862
  this.internalConfig.oauthServiceUrl = n.oauthServiceUrl, this.internalConfig.authApiUrl = n.authApiUrl, this.internalConfig.walletGatewayUrl = n.walletGatewayUrl, this.adapterConfig.gatewayUrl = n.walletGatewayUrl, (t = (s = this.crypto).setJWKSEndpoint) == null || t.call(s, `${n.authApiUrl}/.well-known/jwks.json`);
@@ -868,7 +868,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
868
868
  } catch (i) {
869
869
  if (!(i instanceof g && i.code === p.PIN_CANCELLED))
870
870
  throw i;
871
- u.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
871
+ d.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
872
872
  }
873
873
  }
874
874
  return this.initialized = !0, this.emit("initialized", { restored: !!(o != null && o.success) }), o ?? null;
@@ -924,8 +924,8 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
924
924
  const t = await this.getAddresses(), n = await this.selectWalletIfMultiple(t);
925
925
  return { ...s, address: (n == null ? void 0 : n.address) ?? s.address, addresses: t };
926
926
  } catch (t) {
927
- throw t instanceof g && t.code === p.PIN_CANCELLED && (u.log("[CROSSx] signInWithCreate: 비밀번호 설정 취소 — 자동 로그아웃 진행"), await this.signOut().catch(
928
- (n) => u.warn("[CROSSx] signInWithCreate: 자동 로그아웃 실패", n)
927
+ throw t instanceof g && t.code === p.PIN_CANCELLED && (d.log("[CROSSx] signInWithCreate: 비밀번호 설정 취소 — 자동 로그아웃 진행"), await this.signOut().catch(
928
+ (n) => d.warn("[CROSSx] signInWithCreate: 자동 로그아웃 실패", n)
929
929
  )), t;
930
930
  }
931
931
  }
@@ -1027,7 +1027,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1027
1027
  try {
1028
1028
  await this.loadWalletAfterAuth();
1029
1029
  } catch (s) {
1030
- s instanceof g && s.code === p.PIN_CANCELLED || u.warn("[CROSSx] ensureLoggedIn: loadWalletAfterAuth 실패:", s);
1030
+ s instanceof g && s.code === p.PIN_CANCELLED || d.warn("[CROSSx] ensureLoggedIn: loadWalletAfterAuth 실패:", s);
1031
1031
  }
1032
1032
  return !0;
1033
1033
  }
@@ -1070,7 +1070,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1070
1070
  throw new g(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1071
1071
  try {
1072
1072
  const s = await this.migrateWalletUseCase.execute(e, this.userId);
1073
- return this.address = s.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: s.address, index: 0 }), u.log("[CROSSx] migrateWallet 완료 — address:", s.address), s;
1073
+ return this.address = s.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: s.address, index: 0 }), d.log("[CROSSx] migrateWallet 완료 — address:", s.address), s;
1074
1074
  } catch (s) {
1075
1075
  throw s instanceof g ? s : new g(
1076
1076
  p.MIGRATION_FAILED,
@@ -1239,11 +1239,11 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1239
1239
  async createWallet() {
1240
1240
  if (this.ensureAuthenticated(), !this.userId)
1241
1241
  throw new g(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1242
- u.log("[CROSSx] createWallet 시작");
1242
+ d.log("[CROSSx] createWallet 시작");
1243
1243
  const e = await this.fetchWalletStatus();
1244
- if (u.log("[CROSSx] 지갑 상태:", e), e === "migration_required") {
1244
+ if (d.log("[CROSSx] 지갑 상태:", e), e === "migration_required") {
1245
1245
  const s = this.providerSub ?? this.userId;
1246
- u.log("[CROSSx] migration_required → 마이그레이션 UI 시작 — sub:", s);
1246
+ d.log("[CROSSx] migration_required → 마이그레이션 UI 시작 — sub:", s);
1247
1247
  const t = await this.handleMigrationFlow(s);
1248
1248
  if (t)
1249
1249
  return this.address = t.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: t.address, index: 0 }), { address: t.address };
@@ -1258,11 +1258,11 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1258
1258
  const s = await this.withPinRetry(
1259
1259
  () => this.walletProvider.getOrCreateWallet(this.userId)
1260
1260
  );
1261
- return this.address = s.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: s.address, index: 0 }), u.log("[CROSSx] 지갑 준비 완료:", s.address), { address: s.address };
1261
+ return this.address = s.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: s.address, index: 0 }), d.log("[CROSSx] 지갑 준비 완료:", s.address), { address: s.address };
1262
1262
  } catch (s) {
1263
1263
  if (s instanceof g && s.code === p.MIGRATION_BACKUP_EXISTS) {
1264
1264
  const t = this.providerSub ?? this.userId;
1265
- u.log("[CROSSx] MIGRATION_BACKUP_EXISTS (폴백) → 마이그레이션 UI 시작");
1265
+ d.log("[CROSSx] MIGRATION_BACKUP_EXISTS (폴백) → 마이그레이션 UI 시작");
1266
1266
  const n = await this.handleMigrationFlow(t);
1267
1267
  if (n)
1268
1268
  return this.address = n.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: n.address, index: 0 }), { address: n.address };
@@ -1277,11 +1277,11 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1277
1277
  await this.ensurePinSetup();
1278
1278
  try {
1279
1279
  const s = await this.walletProvider.getOrCreateWallet(this.userId);
1280
- return this.address = s.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: s.address, index: 0 }), u.log("[CROSSx] 지갑 준비 완료:", s.address), { address: s.address };
1280
+ return this.address = s.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: s.address, index: 0 }), d.log("[CROSSx] 지갑 준비 완료:", s.address), { address: s.address };
1281
1281
  } catch (s) {
1282
1282
  if (s instanceof g && s.code === p.MIGRATION_BACKUP_EXISTS) {
1283
1283
  const t = this.providerSub ?? this.userId;
1284
- u.log("[CROSSx] MIGRATION_BACKUP_EXISTS (폴백) → 마이그레이션 UI 시작");
1284
+ d.log("[CROSSx] MIGRATION_BACKUP_EXISTS (폴백) → 마이그레이션 UI 시작");
1285
1285
  const n = await this.handleMigrationFlow(t);
1286
1286
  if (n)
1287
1287
  return this.address = n.address, this.activeWalletIndex = 0, this.emit("addressChanged", { address: n.address, index: 0 }), { address: n.address };
@@ -1299,7 +1299,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1299
1299
  try {
1300
1300
  return await this.walletProvider.checkWallet();
1301
1301
  } catch (e) {
1302
- return u.warn("[CROSSx] checkWallet 실패 (폴백: not_found 처리):", e), "not_found";
1302
+ return d.warn("[CROSSx] checkWallet 실패 (폴백: not_found 처리):", e), "not_found";
1303
1303
  }
1304
1304
  return null;
1305
1305
  }
@@ -1325,7 +1325,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1325
1325
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1326
1326
  accountName: t == null ? void 0 : t.accountName
1327
1327
  }))
1328
- throw new g(p.USER_REJECTED, "사용자가 메시지 서명을 거부했습니다");
1328
+ throw new g(p.USER_REJECTED, "User rejected the message signing request");
1329
1329
  try {
1330
1330
  const i = await this.withPinRetry(async () => {
1331
1331
  let a;
@@ -1384,7 +1384,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1384
1384
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1385
1385
  accountName: t == null ? void 0 : t.accountName
1386
1386
  }))
1387
- throw new g(p.USER_REJECTED, "사용자가 타입 데이터 서명을 거부했습니다");
1387
+ throw new g(p.USER_REJECTED, "User rejected the typed data signing request");
1388
1388
  try {
1389
1389
  const i = await this.withPinRetry(async () => {
1390
1390
  let a;
@@ -1459,7 +1459,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1459
1459
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1460
1460
  accountName: t == null ? void 0 : t.accountName
1461
1461
  }))
1462
- throw new g(p.USER_REJECTED, "사용자가 트랜잭션 서명을 거부했습니다");
1462
+ throw new g(p.USER_REJECTED, "User rejected the transaction signing request");
1463
1463
  try {
1464
1464
  const a = await this.withPinRetry(async () => {
1465
1465
  let c;
@@ -1514,7 +1514,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1514
1514
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1515
1515
  accountName: t == null ? void 0 : t.accountName
1516
1516
  }))
1517
- throw new g(p.USER_REJECTED, "사용자가 트랜잭션을 거부했습니다");
1517
+ throw new g(p.USER_REJECTED, "User rejected the transaction request");
1518
1518
  try {
1519
1519
  const a = await this.withPinRetry(async () => {
1520
1520
  let c;
@@ -1564,12 +1564,12 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1564
1564
  * @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
1565
1565
  */
1566
1566
  async waitForTxAndGetReceipt(e, s, t = {}) {
1567
- const n = t.intervalMs ?? Xs, o = Qs, i = t.timeoutMs ?? At, a = Date.now() + i;
1567
+ const n = t.intervalMs ?? Zs, o = Qs, i = t.timeoutMs ?? Tt, a = Date.now() + i;
1568
1568
  let c = n;
1569
1569
  for (; Date.now() < a; ) {
1570
1570
  const l = await this.getTransactionReceipt(e, s);
1571
1571
  if (l) return l;
1572
- await new Promise((d) => setTimeout(d, c)), c = Math.min(c * 2, o);
1572
+ await new Promise((u) => setTimeout(u, c)), c = Math.min(c * 2, o);
1573
1573
  }
1574
1574
  throw new g(
1575
1575
  p.UNKNOWN_ERROR,
@@ -1592,36 +1592,36 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1592
1592
  * logger.log(receipt.status); // '0x1' | '0x0'
1593
1593
  */
1594
1594
  async sendTransactionWithWaitForReceipt(e, s, t = {}) {
1595
- var E, y;
1596
- const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((E = this._config.receiptPolling) == null ? void 0 : E.intervalMs) ?? Zs, l = o ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? At, d = Je(e), h = s.from ?? "";
1597
- let m, x;
1598
- const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((S) => {
1599
- m = S;
1600
- const C = BigInt(S.gasUsed) * BigInt(S.effectiveGasPrice), B = s.value ? BigInt(s.value) : 0n, b = re.formatTxAmount(s.value, d.symbol, d.decimals), k = re.formatTxAmount("0x" + C.toString(16), d.symbol, d.decimals), P = re.formatTxAmount("0x" + (B + C).toString(16), d.symbol, d.decimals);
1595
+ var S, y;
1596
+ const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((S = this._config.receiptPolling) == null ? void 0 : S.intervalMs) ?? Xs, l = o ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? Tt, u = Je(e), h = s.from ?? "";
1597
+ let m, _;
1598
+ const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((E) => {
1599
+ m = E;
1600
+ const C = BigInt(E.gasUsed) * BigInt(E.effectiveGasPrice), B = s.value ? BigInt(s.value) : 0n, b = re.formatTxAmount(s.value, u.symbol, u.decimals), k = re.formatTxAmount("0x" + C.toString(16), u.symbol, u.decimals), P = re.formatTxAmount("0x" + (B + C).toString(16), u.symbol, u.decimals);
1601
1601
  return {
1602
1602
  chainId: e,
1603
1603
  txHash: a,
1604
- from: S.from,
1605
- to: S.to ?? s.to,
1604
+ from: E.from,
1605
+ to: E.to ?? s.to,
1606
1606
  amount: b,
1607
1607
  fees: k,
1608
1608
  total: P,
1609
- nativeSymbol: d.symbol,
1610
- status: S.status === "0x1" ? "success" : "reverted"
1609
+ nativeSymbol: u.symbol,
1610
+ status: E.status === "0x1" ? "success" : "reverted"
1611
1611
  };
1612
- }).catch((S) => (x = S instanceof Error ? S : new Error(String(S)), {
1612
+ }).catch((E) => (_ = E instanceof Error ? E : new Error(String(E)), {
1613
1613
  chainId: e,
1614
1614
  txHash: a,
1615
1615
  from: h,
1616
1616
  to: s.to,
1617
- amount: re.formatTxAmount(s.value, d.symbol, d.decimals),
1618
- nativeSymbol: d.symbol,
1617
+ amount: re.formatTxAmount(s.value, u.symbol, u.decimals),
1618
+ nativeSymbol: u.symbol,
1619
1619
  status: "timeout"
1620
1620
  }));
1621
1621
  if (await this.confirmation.showTransactionProgress(
1622
1622
  { chainId: e, txHash: a, from: h, to: s.to },
1623
1623
  w
1624
- ), x) throw x;
1624
+ ), _) throw _;
1625
1625
  return { chainId: e, txHash: a, receipt: m };
1626
1626
  }
1627
1627
  // ============================================================================
@@ -1673,7 +1673,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1673
1673
  throw new g(p.NOT_IMPLEMENTED, "changePin이 구현되어 있지 않습니다");
1674
1674
  this.pinStore.set(e);
1675
1675
  try {
1676
- await t.changePin(e, s), this.pinStore.set(s), u.log("[CROSSx] PIN 변경 완료");
1676
+ await t.changePin(e, s), this.pinStore.set(s), d.log("[CROSSx] PIN 변경 완료");
1677
1677
  } catch (n) {
1678
1678
  throw n instanceof g ? n : new g(p.UNKNOWN_ERROR, "PIN 변경에 실패했습니다", n);
1679
1679
  }
@@ -1877,62 +1877,62 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1877
1877
  * 4) PIN 잠금 발생 시 카운트다운 화면 표시 → 자동 해제 후 PIN 재입력
1878
1878
  */
1879
1879
  async handleMigrationFlow(e) {
1880
- var a, c;
1881
- u.log('[CROSSx][Migration Phase 3] "Wallet Found" 팝업 표시');
1882
- const s = await this.confirmation.showMigrationFoundPrompt();
1883
- if (u.log("[CROSSx][Migration Phase 3] 사용자 선택:", s), s === "skip")
1884
- return u.log("[CROSSx][Migration Phase 3] 사용자가 마이그레이션을 건너뜀 → 종료"), null;
1885
- let t, n = 0, o = 5, i = null;
1880
+ var c, l, u;
1881
+ d.log('[CROSSx][Migration Phase 3] "Wallet Found" 팝업 표시');
1882
+ const s = ((c = this._config.migration) == null ? void 0 : c.allowSkip) ?? !0, t = await this.confirmation.showMigrationFoundPrompt({ allowSkip: s });
1883
+ if (d.log("[CROSSx][Migration Phase 3] 사용자 선택:", t), t === "skip")
1884
+ return d.log("[CROSSx][Migration Phase 3] 사용자가 마이그레이션을 건너뜀 → 종료"), null;
1885
+ let n, o = 0, i = 5, a = null;
1886
1886
  for (; ; ) {
1887
- n++, u.log(
1888
- `[CROSSx][Migration Phase 4] PIN 입력 팝업 표시 (시도 #${n}/${o})`,
1889
- t ? `— 이전 메시지: ${t}` : ""
1887
+ o++, d.log(
1888
+ `[CROSSx][Migration Phase 4] PIN 입력 팝업 표시 (시도 #${o}/${i})`,
1889
+ n ? `— 이전 메시지: ${n}` : ""
1890
1890
  );
1891
- const l = await this.confirmation.showRecoveryPinInputPrompt({
1892
- errorMessage: t,
1893
- attemptCount: n > 1 ? n - 1 : void 0,
1894
- maxAttempts: o
1891
+ const h = await this.confirmation.showRecoveryPinInputPrompt({
1892
+ errorMessage: n,
1893
+ attemptCount: o > 1 ? o - 1 : void 0,
1894
+ maxAttempts: i
1895
1895
  });
1896
- if (l === null)
1897
- return u.log("[CROSSx][Migration Phase 4] 사용자가 PIN 입력을 취소함 → 종료"), null;
1898
- u.log("[CROSSx][Migration Phase 4] PIN 입력 완료 — verify-recovery-pin API 호출"), t = void 0;
1896
+ if (h === null)
1897
+ return d.log("[CROSSx][Migration Phase 4] 사용자가 PIN 입력을 취소함 → 종료"), null;
1898
+ d.log("[CROSSx][Migration Phase 4] PIN 입력 완료 — verify-recovery-pin API 호출"), n = void 0;
1899
1899
  try {
1900
- const d = await ((c = (a = this.walletProvider).verifyRecoveryPin) == null ? void 0 : c.call(a, l, e));
1901
- if (!d) {
1902
- u.log("[CROSSx][Migration Phase 4] verifyRecoveryPin 미지원 — PIN 검증 생략"), i = l;
1900
+ const m = await ((u = (l = this.walletProvider).verifyRecoveryPin) == null ? void 0 : u.call(l, h, e));
1901
+ if (!m) {
1902
+ d.log("[CROSSx][Migration Phase 4] verifyRecoveryPin 미지원 — PIN 검증 생략"), a = h;
1903
1903
  break;
1904
1904
  }
1905
- if (d.valid) {
1906
- u.log("[CROSSx][Migration Phase 4] PIN 검증 성공"), i = l;
1905
+ if (m.valid) {
1906
+ d.log("[CROSSx][Migration Phase 4] PIN 검증 성공"), a = h;
1907
1907
  break;
1908
1908
  }
1909
- const h = d.pinStatus;
1910
- if (o = h.maxAttempts, n = o - h.remainingAttempts, h.remainingAttempts === 0 && h.lockExpiresAt) {
1911
- const m = h.lockExpiresAt * 1e3, x = Math.max(1, Math.round((m - Date.now()) / 1e3)), w = x <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
1912
- u.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${x}초, 메시지: ${w}`), await this.confirmation.showRecoveryPinLockedPrompt(x, w), n = 0, t = "Your account lock has been lifted. You may try again.";
1909
+ const _ = m.pinStatus;
1910
+ if (i = _.maxAttempts, o = i - _.remainingAttempts, _.remainingAttempts === 0 && _.lockExpiresAt) {
1911
+ const w = _.lockExpiresAt * 1e3, S = Math.max(1, Math.round((w - Date.now()) / 1e3)), y = S <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
1912
+ d.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${S}초, 메시지: ${y}`), await this.confirmation.showRecoveryPinLockedPrompt(S, y), o = 0, n = "Your account lock has been lifted. You may try again.";
1913
1913
  } else
1914
- u.warn(`[CROSSx][Migration Phase 4] PIN 불일치 (시도 ${n}/${o})`), t = "Incorrect PIN.";
1915
- } catch (d) {
1916
- if (!(d instanceof g)) throw d;
1917
- if (d.code === p.MIGRATION_PIN_LOCKED) {
1918
- const h = d.details;
1919
- if (o = (h == null ? void 0 : h.maxAttempts) ?? 5, (h == null ? void 0 : h.permanent) === !0)
1920
- return u.warn("[CROSSx][Migration Phase 4] PIN 영구 잠금 (verify-recovery-pin)"), await this.confirmation.showRecoveryPinLockedPrompt(0, "Your account has been permanently locked due to too many failed attempts."), null;
1921
- const m = ((h == null ? void 0 : h.lockExpiresAt) ?? 0) * 1e3, x = Math.max(1, Math.round((m - Date.now()) / 1e3)), w = x <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
1922
- u.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${x}초`), await this.confirmation.showRecoveryPinLockedPrompt(x, w), n = 0, t = "Your account lock has been lifted. You may try again.";
1914
+ d.warn(`[CROSSx][Migration Phase 4] PIN 불일치 (시도 ${o}/${i})`), n = "Incorrect PIN.";
1915
+ } catch (m) {
1916
+ if (!(m instanceof g)) throw m;
1917
+ if (m.code === p.MIGRATION_PIN_LOCKED) {
1918
+ const _ = m.details;
1919
+ if (i = (_ == null ? void 0 : _.maxAttempts) ?? 5, (_ == null ? void 0 : _.permanent) === !0)
1920
+ return d.warn("[CROSSx][Migration Phase 4] PIN 영구 잠금 (verify-recovery-pin)"), await this.confirmation.showRecoveryPinLockedPrompt(0, "Your account has been permanently locked due to too many failed attempts."), null;
1921
+ const w = ((_ == null ? void 0 : _.lockExpiresAt) ?? 0) * 1e3, S = Math.max(1, Math.round((w - Date.now()) / 1e3)), y = S <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
1922
+ d.warn(`[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${S}초`), await this.confirmation.showRecoveryPinLockedPrompt(S, y), o = 0, n = "Your account lock has been lifted. You may try again.";
1923
1923
  } else
1924
- throw u.error("[CROSSx][Migration Phase 4] verify-recovery-pin 실패 (복구 불가):", d), d;
1924
+ throw d.error("[CROSSx][Migration Phase 4] verify-recovery-pin 실패 (복구 불가):", m), m;
1925
1925
  }
1926
1926
  }
1927
- u.log("[CROSSx][Migration Phase 5] PIN 검증 완료 — 비밀번호 설정 및 마이그레이션 진행");
1927
+ d.log("[CROSSx][Migration Phase 5] PIN 검증 완료 — 비밀번호 설정 및 마이그레이션 진행");
1928
1928
  try {
1929
1929
  await this.ensurePinSetup();
1930
- const l = await this.migrateWalletUseCase.execute(i, e);
1931
- return u.log("[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:", l.address), l;
1932
- } catch (l) {
1933
- if (l instanceof g && l.code === p.MIGRATION_FAILED)
1934
- return u.warn("[CROSSx][Migration Phase 5] migrate PIN 불일치 (경합) — 처음부터 재시도"), this.handleMigrationFlow(e);
1935
- throw u.error("[CROSSx][Migration Phase 5] 마이그레이션 실패 (복구 불가):", l), l;
1930
+ const h = await this.migrateWalletUseCase.execute(a, e);
1931
+ return d.log("[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:", h.address), h;
1932
+ } catch (h) {
1933
+ if (h instanceof g && h.code === p.MIGRATION_FAILED)
1934
+ return d.warn("[CROSSx][Migration Phase 5] migrate PIN 불일치 (경합) — 처음부터 재시도"), this.handleMigrationFlow(e);
1935
+ throw d.error("[CROSSx][Migration Phase 5] 마이그레이션 실패 (복구 불가):", h), h;
1936
1936
  }
1937
1937
  }
1938
1938
  /**
@@ -1954,21 +1954,21 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
1954
1954
  if (n) {
1955
1955
  const l = c.from ?? this.address;
1956
1956
  if (l) {
1957
- u.log("[CROSSx] nonce 비어있음 → eth_getTransactionCount 호출 (from:", l, ")");
1958
- const d = await this.jsonRpc.call("eth_getTransactionCount", [l, "pending"], s);
1959
- c.nonce = parseInt(d ?? "0x0", 16), u.log("[CROSSx] nonce 결과:", c.nonce);
1957
+ d.log("[CROSSx] nonce 비어있음 → eth_getTransactionCount 호출 (from:", l, ")");
1958
+ const u = await this.jsonRpc.call("eth_getTransactionCount", [l, "pending"], s);
1959
+ c.nonce = parseInt(u ?? "0x0", 16), d.log("[CROSSx] nonce 결과:", c.nonce);
1960
1960
  }
1961
1961
  }
1962
- if (o && (u.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), c.gasLimit = await this.estimateGas(e, s), u.log("[CROSSx] estimateGas 결과:", c.gasLimit)), i) {
1963
- u.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
1962
+ if (o && (d.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), c.gasLimit = await this.estimateGas(e, s), d.log("[CROSSx] estimateGas 결과:", c.gasLimit)), i) {
1963
+ d.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
1964
1964
  const l = await this.getBaseFeePerGas(s);
1965
1965
  if (l) {
1966
- const d = Rt;
1967
- c.maxFeePerGas = "0x" + (BigInt(l) + BigInt(d)).toString(16), c.maxPriorityFeePerGas = d, u.log("[CROSSx] Dynamic 체인 감지 — baseFee:", l, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
1966
+ const u = Rt;
1967
+ c.maxFeePerGas = "0x" + (BigInt(l) + BigInt(u)).toString(16), c.maxPriorityFeePerGas = u, d.log("[CROSSx] Dynamic 체인 감지 — baseFee:", l, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
1968
1968
  } else
1969
- c.gasPrice = er, u.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
1969
+ c.gasPrice = er, d.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
1970
1970
  }
1971
- return !i && a && (c.maxPriorityFeePerGas = Rt, u.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
1971
+ return !i && a && (c.maxPriorityFeePerGas = Rt, d.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
1972
1972
  }
1973
1973
  /**
1974
1974
  * EIP-712 signTypedData 호출 시 chainId와 typedData.domain.chainId 정합성 검증.
@@ -2040,17 +2040,17 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2040
2040
  try {
2041
2041
  const n = this.crypto.recoverPersonalSignSigner(e, s);
2042
2042
  if (n.toLowerCase() !== t.toLowerCase())
2043
- throw u.error("[CROSSx] 서명 검증 실패: 서명자 주소 불일치", {
2043
+ throw d.error("[CROSSx] 서명 검증 실패: 서명자 주소 불일치", {
2044
2044
  expected: t,
2045
2045
  recovered: n
2046
2046
  }), new g(
2047
2047
  p.SIGNATURE_SIGNER_MISMATCH,
2048
2048
  `서명자 주소가 일치하지 않습니다: 예상 ${t}, 복원된 주소 ${n}`
2049
2049
  );
2050
- u.log("[CROSSx] 서명 ecrecover 검증 성공");
2050
+ d.log("[CROSSx] 서명 ecrecover 검증 성공");
2051
2051
  } catch (n) {
2052
2052
  if (n instanceof g) throw n;
2053
- u.warn("[CROSSx] ecrecover 검증 중 예외 (무시):", n);
2053
+ d.warn("[CROSSx] ecrecover 검증 중 예외 (무시):", n);
2054
2054
  }
2055
2055
  }
2056
2056
  /** AuthResult를 내부 상태에 반영합니다. */
@@ -2076,7 +2076,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2076
2076
  * (서버 세션 종료 API를 호출하면 또 다시 -10002가 날 수 있으므로 스킵)
2077
2077
  */
2078
2078
  forceLogout() {
2079
- this.authenticated && (u.warn("[CROSSx] 인증 만료(Gateway -10002) — 강제 로그아웃"), this.clearAuthState());
2079
+ this.authenticated && (d.warn("[CROSSx] 인증 만료(Gateway -10002) — 강제 로그아웃"), this.clearAuthState());
2080
2080
  }
2081
2081
  /**
2082
2082
  * Firebase sign_in_provider 값을 정규화합니다.
@@ -2095,7 +2095,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2095
2095
  const e = await this.confirmation.showPinSetupPrompt();
2096
2096
  if (!e)
2097
2097
  throw new g(p.PIN_CANCELLED, "사용자가 PIN 설정을 취소했습니다");
2098
- this.pinStore.set(e), u.log("[CROSSx] PIN 설정 완료 (메모리 캐시)");
2098
+ this.pinStore.set(e), d.log("[CROSSx] PIN 설정 완료 (메모리 캐시)");
2099
2099
  }
2100
2100
  /**
2101
2101
  * 서명/전송 전 PIN 입력 모달 표시 후 메모리 캐시
@@ -2109,7 +2109,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2109
2109
  const s = await this.confirmation.showPinInputPrompt({ errorMessage: e });
2110
2110
  if (!s)
2111
2111
  throw new g(p.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
2112
- this.pinStore.set(s), u.log("[CROSSx] PIN 입력 완료 (메모리 캐시)");
2112
+ this.pinStore.set(s), d.log("[CROSSx] PIN 입력 완료 (메모리 캐시)");
2113
2113
  }
2114
2114
  /**
2115
2115
  * PIN 입력 + verify-password API로 서버 검증
@@ -2129,7 +2129,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2129
2129
  else if (this.pinStore.has())
2130
2130
  return;
2131
2131
  if (this._verifyPinMutex && !e) {
2132
- u.log("[CROSSx] ensureVerifiedPin: 진행 중인 검증 대기"), await this._verifyPinMutex;
2132
+ d.log("[CROSSx] ensureVerifiedPin: 진행 중인 검증 대기"), await this._verifyPinMutex;
2133
2133
  return;
2134
2134
  }
2135
2135
  let t, n;
@@ -2145,7 +2145,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2145
2145
  });
2146
2146
  if (!i)
2147
2147
  throw new g(p.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
2148
- this.pinStore.set(i), u.log("[CROSSx] PIN 캐시 완료 (verifyPin 미지원, 로컬 전용)"), t();
2148
+ this.pinStore.set(i), d.log("[CROSSx] PIN 캐시 완료 (verifyPin 미지원, 로컬 전용)"), t();
2149
2149
  return;
2150
2150
  }
2151
2151
  const o = await this.confirmation.showPinInputPrompt({
@@ -2156,7 +2156,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2156
2156
  var a;
2157
2157
  this.pinStore.set(i);
2158
2158
  try {
2159
- return await this.walletProvider.verifyPin(i) ? (u.log("[CROSSx] PIN 서버 검증 완료 (verify-password)"), { ok: !0 }) : (this.pinStore.clear(), { ok: !1, error: "Incorrect PIN. Please try again." });
2159
+ return await this.walletProvider.verifyPin(i) ? (d.log("[CROSSx] PIN 서버 검증 완료 (verify-password)"), { ok: !0 }) : (this.pinStore.clear(), { ok: !1, error: "Incorrect PIN. Please try again." });
2160
2160
  } catch (c) {
2161
2161
  if (this.pinStore.clear(), c instanceof g) {
2162
2162
  if (c.code === p.PIN_WRONG)
@@ -2172,7 +2172,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2172
2172
  });
2173
2173
  if (!o)
2174
2174
  throw new g(p.PIN_CANCELLED, "사용자가 PIN 입력을 취소했습니다");
2175
- this.pinStore.set(o), u.log("[CROSSx] PIN 갱신 완료 (verify 모달 닫힘)"), t();
2175
+ this.pinStore.set(o), d.log("[CROSSx] PIN 갱신 완료 (verify 모달 닫힘)"), t();
2176
2176
  } catch (o) {
2177
2177
  throw n(o), o;
2178
2178
  } finally {
@@ -2189,16 +2189,16 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2189
2189
  async loadWalletAfterAuth(e) {
2190
2190
  if (!this.userId) return;
2191
2191
  const s = await this.fetchWalletStatus();
2192
- if (u.log("[CROSSx] loadWalletAfterAuth 지갑 상태:", s), s !== "exists") return;
2192
+ if (d.log("[CROSSx] loadWalletAfterAuth 지갑 상태:", s), s !== "exists") return;
2193
2193
  const t = await this.walletProvider.getAddresses(this.userId);
2194
2194
  if (t.length > 0) {
2195
2195
  const o = e !== void 0 ? t.find((i) => i.index === e) ?? t[0] : t[0];
2196
- this.address = o.address, this.activeWalletIndex = o.index, u.log("[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):", this.address), this.emit("addressChanged", { address: o.address, index: o.index });
2196
+ this.address = o.address, this.activeWalletIndex = o.index, d.log("[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):", this.address), this.emit("addressChanged", { address: o.address, index: o.index });
2197
2197
  return;
2198
2198
  }
2199
- u.log("[CROSSx] 주소 캐시 없음 — 비밀번호 확인 후 address(0) 조회"), await this.ensureVerifiedPin();
2199
+ d.log("[CROSSx] 주소 캐시 없음 — 비밀번호 확인 후 address(0) 조회"), await this.ensureVerifiedPin();
2200
2200
  const n = await this.walletProvider.getAddress(this.userId, 0);
2201
- this.address = n.address, this.activeWalletIndex = 0, u.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", this.address), this.emit("addressChanged", { address: n.address, index: 0 });
2201
+ this.address = n.address, this.activeWalletIndex = 0, d.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", this.address), this.emit("addressChanged", { address: n.address, index: 0 });
2202
2202
  }
2203
2203
  /**
2204
2204
  * PIN_WRONG 에러 시 서버 검증 포함 PIN 재입력 모달을 표시하고 재시도합니다.
@@ -2232,7 +2232,7 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2232
2232
  throw n;
2233
2233
  }
2234
2234
  for (; ; ) {
2235
- u.warn("[CROSSx] PIN 불일치/잠금 — 재입력 요청:", s), this.pinStore.clear(), await this.ensureVerifiedPin(s, t), t = void 0;
2235
+ d.warn("[CROSSx] PIN 불일치/잠금 — 재입력 요청:", s), this.pinStore.clear(), await this.ensureVerifiedPin(s, t), t = void 0;
2236
2236
  try {
2237
2237
  return await e();
2238
2238
  } catch (n) {
@@ -2292,6 +2292,23 @@ const Zs = 2e3, At = 6e4, Xs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA0
2292
2292
  dispose() {
2293
2293
  this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), vt(null);
2294
2294
  }
2295
+ /**
2296
+ * @internal internal 패키지 전용 — 공개 문서에 기재하지 않음
2297
+ *
2298
+ * Internal/Private SDK가 Core의 내부 인프라에 접근하기 위한 컨텍스트를 반환합니다.
2299
+ * iOS SDK의 makePrivateContext()에 대응합니다.
2300
+ */
2301
+ _getInternalContext() {
2302
+ return {
2303
+ transport: this.transport,
2304
+ storage: this.storage,
2305
+ walletProvider: this.walletProvider,
2306
+ confirmation: this.confirmation,
2307
+ tokenStore: this.tokenStore,
2308
+ pinStore: this.pinStore,
2309
+ adapterConfig: this.adapterConfig
2310
+ };
2311
+ }
2295
2312
  };
2296
2313
  re.OFFCHAIN_CHAIN_ID = "0";
2297
2314
  let it = re;
@@ -2304,7 +2321,7 @@ class rr {
2304
2321
  const t = JSON.stringify(s);
2305
2322
  localStorage.setItem(this.prefix + e, t);
2306
2323
  } catch (t) {
2307
- throw u.error("Storage set error:", t), t;
2324
+ throw d.error("Storage set error:", t), t;
2308
2325
  }
2309
2326
  }
2310
2327
  async get(e) {
@@ -2312,14 +2329,14 @@ class rr {
2312
2329
  const s = localStorage.getItem(this.prefix + e);
2313
2330
  return s ? JSON.parse(s) : null;
2314
2331
  } catch (s) {
2315
- return u.error("Storage get error:", s), null;
2332
+ return d.error("Storage get error:", s), null;
2316
2333
  }
2317
2334
  }
2318
2335
  async remove(e) {
2319
2336
  try {
2320
2337
  localStorage.removeItem(this.prefix + e);
2321
2338
  } catch (s) {
2322
- throw u.error("Storage remove error:", s), s;
2339
+ throw d.error("Storage remove error:", s), s;
2323
2340
  }
2324
2341
  }
2325
2342
  async clear() {
@@ -2328,11 +2345,11 @@ class rr {
2328
2345
  s.startsWith(this.prefix) && localStorage.removeItem(s);
2329
2346
  });
2330
2347
  } catch (e) {
2331
- throw u.error("Storage clear error:", e), e;
2348
+ throw d.error("Storage clear error:", e), e;
2332
2349
  }
2333
2350
  }
2334
2351
  }
2335
- const Ze = "crossx-sdk", nr = 1, de = "data", Se = "keys", $e = "aes-primary", or = 12;
2352
+ const Xe = "crossx-sdk", nr = 1, de = "data", Se = "keys", $e = "aes-primary", or = 12;
2336
2353
  class Ot {
2337
2354
  constructor(e) {
2338
2355
  this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
@@ -2396,27 +2413,27 @@ class Ot {
2396
2413
  * 마이그레이션 성공 시 레거시 DB 삭제.
2397
2414
  */
2398
2415
  async migrateFromLegacyDB() {
2399
- if (this.dbName === Ze) return null;
2416
+ if (this.dbName === Xe) return null;
2400
2417
  try {
2401
- const e = await this.openDB(Ze), s = e.transaction([Se, de], "readonly"), t = s.objectStore(Se).get($e), n = await new Promise((l, d) => {
2402
- t.onsuccess = () => l(t.result), t.onerror = () => d(t.error);
2418
+ const e = await this.openDB(Xe), s = e.transaction([Se, de], "readonly"), t = s.objectStore(Se).get($e), n = await new Promise((l, u) => {
2419
+ t.onsuccess = () => l(t.result), t.onerror = () => u(t.error);
2403
2420
  });
2404
2421
  if (!n)
2405
2422
  return e.close(), null;
2406
2423
  const o = s.objectStore(de).getAll(), i = s.objectStore(de).getAllKeys(), [a, c] = await Promise.all([
2407
- new Promise((l, d) => {
2408
- o.onsuccess = () => l(o.result), o.onerror = () => d(o.error);
2424
+ new Promise((l, u) => {
2425
+ o.onsuccess = () => l(o.result), o.onerror = () => u(o.error);
2409
2426
  }),
2410
- new Promise((l, d) => {
2411
- i.onsuccess = () => l(i.result), i.onerror = () => d(i.error);
2427
+ new Promise((l, u) => {
2428
+ i.onsuccess = () => l(i.result), i.onerror = () => u(i.error);
2412
2429
  })
2413
2430
  ]);
2414
2431
  e.close(), await this.idbPut(Se, $e, n);
2415
2432
  for (let l = 0; l < c.length; l++)
2416
2433
  await this.idbPut(de, String(c[l]), a[l]);
2417
- return indexedDB.deleteDatabase(Ze), u.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
2434
+ return indexedDB.deleteDatabase(Xe), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
2418
2435
  } catch (e) {
2419
- return u.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
2436
+ return d.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
2420
2437
  }
2421
2438
  }
2422
2439
  async encrypt(e) {
@@ -2443,7 +2460,7 @@ class Ot {
2443
2460
  const t = JSON.stringify(s), n = await this.encrypt(t);
2444
2461
  await this.idbPut(de, e, n);
2445
2462
  } catch (t) {
2446
- throw u.error("[CROSSx] IndexedDB set error:", t), t;
2463
+ throw d.error("[CROSSx] IndexedDB set error:", t), t;
2447
2464
  }
2448
2465
  }
2449
2466
  async get(e) {
@@ -2454,21 +2471,21 @@ class Ot {
2454
2471
  const t = await this.decrypt(s);
2455
2472
  return JSON.parse(t);
2456
2473
  } catch (s) {
2457
- return u.error("[CROSSx] IndexedDB get error:", s), null;
2474
+ return d.error("[CROSSx] IndexedDB get error:", s), null;
2458
2475
  }
2459
2476
  }
2460
2477
  async remove(e) {
2461
2478
  try {
2462
2479
  await this.ensureReady(), await this.idbDelete(de, e);
2463
2480
  } catch (s) {
2464
- throw u.error("[CROSSx] IndexedDB remove error:", s), s;
2481
+ throw d.error("[CROSSx] IndexedDB remove error:", s), s;
2465
2482
  }
2466
2483
  }
2467
2484
  async clear() {
2468
2485
  try {
2469
2486
  await this.ensureReady(), await this.idbClear(de);
2470
2487
  } catch (e) {
2471
- throw u.error("[CROSSx] IndexedDB clear error:", e), e;
2488
+ throw d.error("[CROSSx] IndexedDB clear error:", e), e;
2472
2489
  }
2473
2490
  }
2474
2491
  /**
@@ -2520,7 +2537,7 @@ function Pe(...r) {
2520
2537
  for (let e = 0; e < r.length; e++)
2521
2538
  r[e].fill(0);
2522
2539
  }
2523
- function Xe(r) {
2540
+ function Ze(r) {
2524
2541
  return new DataView(r.buffer, r.byteOffset, r.byteLength);
2525
2542
  }
2526
2543
  function ue(r, e) {
@@ -2606,18 +2623,18 @@ function pr(r, e, s) {
2606
2623
  }
2607
2624
  class fr {
2608
2625
  constructor(e, s, t, n) {
2609
- T(this, "blockLen");
2610
- T(this, "outputLen");
2611
- T(this, "padOffset");
2612
- T(this, "isLE");
2626
+ A(this, "blockLen");
2627
+ A(this, "outputLen");
2628
+ A(this, "padOffset");
2629
+ A(this, "isLE");
2613
2630
  // For partial updates less than block size
2614
- T(this, "buffer");
2615
- T(this, "view");
2616
- T(this, "finished", !1);
2617
- T(this, "length", 0);
2618
- T(this, "pos", 0);
2619
- T(this, "destroyed", !1);
2620
- this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = Xe(this.buffer);
2631
+ A(this, "buffer");
2632
+ A(this, "view");
2633
+ A(this, "finished", !1);
2634
+ A(this, "length", 0);
2635
+ A(this, "pos", 0);
2636
+ A(this, "destroyed", !1);
2637
+ this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = Ze(this.buffer);
2621
2638
  }
2622
2639
  update(e) {
2623
2640
  ke(this), V(e);
@@ -2625,7 +2642,7 @@ class fr {
2625
2642
  for (let i = 0; i < o; ) {
2626
2643
  const a = Math.min(n - this.pos, o - i);
2627
2644
  if (a === n) {
2628
- const c = Xe(e);
2645
+ const c = Ze(e);
2629
2646
  for (; n <= o - i; i += n)
2630
2647
  this.process(c, i);
2631
2648
  continue;
@@ -2642,14 +2659,14 @@ class fr {
2642
2659
  for (let h = i; h < n; h++)
2643
2660
  s[h] = 0;
2644
2661
  t.setBigUint64(n - 8, BigInt(this.length * 8), o), this.process(t, 0);
2645
- const a = Xe(e), c = this.outputLen;
2662
+ const a = Ze(e), c = this.outputLen;
2646
2663
  if (c % 4)
2647
2664
  throw new Error("_sha2: outputLen must be aligned to 32bit");
2648
- const l = c / 4, d = this.get();
2649
- if (l > d.length)
2665
+ const l = c / 4, u = this.get();
2666
+ if (l > u.length)
2650
2667
  throw new Error("_sha2: outputLen bigger than state");
2651
2668
  for (let h = 0; h < l; h++)
2652
- a.setUint32(4 * h, d[h], o);
2669
+ a.setUint32(4 * h, u[h], o);
2653
2670
  }
2654
2671
  digest() {
2655
2672
  const { buffer: e, outputLen: s } = this;
@@ -2770,15 +2787,15 @@ class vr extends fr {
2770
2787
  for (let h = 0; h < 16; h++, s += 4)
2771
2788
  we[h] = e.getUint32(s, !1);
2772
2789
  for (let h = 16; h < 64; h++) {
2773
- const m = we[h - 15], x = we[h - 2], w = ue(m, 7) ^ ue(m, 18) ^ m >>> 3, E = ue(x, 17) ^ ue(x, 19) ^ x >>> 10;
2774
- we[h] = E + we[h - 7] + w + we[h - 16] | 0;
2790
+ const m = we[h - 15], _ = we[h - 2], w = ue(m, 7) ^ ue(m, 18) ^ m >>> 3, S = ue(_, 17) ^ ue(_, 19) ^ _ >>> 10;
2791
+ we[h] = S + we[h - 7] + w + we[h - 16] | 0;
2775
2792
  }
2776
- let { A: t, B: n, C: o, D: i, E: a, F: c, G: l, H: d } = this;
2793
+ let { A: t, B: n, C: o, D: i, E: a, F: c, G: l, H: u } = this;
2777
2794
  for (let h = 0; h < 64; h++) {
2778
- const m = ue(a, 6) ^ ue(a, 11) ^ ue(a, 25), x = d + m + hr(a, c, l) + br[h] + we[h] | 0, E = (ue(t, 2) ^ ue(t, 13) ^ ue(t, 22)) + pr(t, n, o) | 0;
2779
- d = l, l = c, c = a, a = i + x | 0, i = o, o = n, n = t, t = x + E | 0;
2795
+ const m = ue(a, 6) ^ ue(a, 11) ^ ue(a, 25), _ = u + m + hr(a, c, l) + br[h] + we[h] | 0, S = (ue(t, 2) ^ ue(t, 13) ^ ue(t, 22)) + pr(t, n, o) | 0;
2796
+ u = l, l = c, c = a, a = i + _ | 0, i = o, o = n, n = t, t = _ + S | 0;
2780
2797
  }
2781
- t = t + this.A | 0, n = n + this.B | 0, o = o + this.C | 0, i = i + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(t, n, o, i, a, c, l, d);
2798
+ t = t + this.A | 0, n = n + this.B | 0, o = o + this.C | 0, i = i + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, u = u + this.H | 0, this.set(t, n, o, i, a, c, l, u);
2782
2799
  }
2783
2800
  roundClean() {
2784
2801
  Pe(we);
@@ -2792,14 +2809,14 @@ class Sr extends vr {
2792
2809
  super(32);
2793
2810
  // We cannot use array here since array allows indexing by variable
2794
2811
  // which means optimizer/compiler cannot use registers.
2795
- T(this, "A", me[0] | 0);
2796
- T(this, "B", me[1] | 0);
2797
- T(this, "C", me[2] | 0);
2798
- T(this, "D", me[3] | 0);
2799
- T(this, "E", me[4] | 0);
2800
- T(this, "F", me[5] | 0);
2801
- T(this, "G", me[6] | 0);
2802
- T(this, "H", me[7] | 0);
2812
+ A(this, "A", me[0] | 0);
2813
+ A(this, "B", me[1] | 0);
2814
+ A(this, "C", me[2] | 0);
2815
+ A(this, "D", me[3] | 0);
2816
+ A(this, "E", me[4] | 0);
2817
+ A(this, "F", me[5] | 0);
2818
+ A(this, "G", me[6] | 0);
2819
+ A(this, "H", me[7] | 0);
2803
2820
  }
2804
2821
  }
2805
2822
  const Er = /* @__PURE__ */ ns(
@@ -2852,11 +2869,11 @@ function Ir(r) {
2852
2869
  return Uint8Array.from(r);
2853
2870
  }
2854
2871
  const Fe = (r) => typeof r == "bigint" && ht <= r;
2855
- function Tr(r, e, s) {
2872
+ function Ar(r, e, s) {
2856
2873
  return Fe(r) && Fe(e) && Fe(s) && e <= r && r < s;
2857
2874
  }
2858
- function Ar(r, e, s, t) {
2859
- if (!Tr(e, s, t))
2875
+ function Tr(r, e, s, t) {
2876
+ if (!Ar(e, s, t))
2860
2877
  throw new Error("expected valid " + r + ": " + s + " <= n < " + t + ", got " + e);
2861
2878
  }
2862
2879
  function Rr(r) {
@@ -2870,28 +2887,28 @@ function kr(r, e, s) {
2870
2887
  if (ge(r, "hashLen"), ge(e, "qByteLen"), typeof s != "function")
2871
2888
  throw new Error("hmacFn must be a function");
2872
2889
  const t = (y) => new Uint8Array(y), n = Uint8Array.of(), o = Uint8Array.of(0), i = Uint8Array.of(1), a = 1e3;
2873
- let c = t(r), l = t(r), d = 0;
2890
+ let c = t(r), l = t(r), u = 0;
2874
2891
  const h = () => {
2875
- c.fill(1), l.fill(0), d = 0;
2876
- }, m = (...y) => s(l, ve(c, ...y)), x = (y = n) => {
2892
+ c.fill(1), l.fill(0), u = 0;
2893
+ }, m = (...y) => s(l, ve(c, ...y)), _ = (y = n) => {
2877
2894
  l = m(o, y), c = m(), y.length !== 0 && (l = m(i, y), c = m());
2878
2895
  }, w = () => {
2879
- if (d++ >= a)
2896
+ if (u++ >= a)
2880
2897
  throw new Error("drbg: tried max amount of iterations");
2881
2898
  let y = 0;
2882
- const S = [];
2899
+ const E = [];
2883
2900
  for (; y < e; ) {
2884
2901
  c = m();
2885
2902
  const C = c.slice();
2886
- S.push(C), y += c.length;
2903
+ E.push(C), y += c.length;
2887
2904
  }
2888
- return ve(...S);
2905
+ return ve(...E);
2889
2906
  };
2890
- return (y, S) => {
2891
- h(), x(y);
2907
+ return (y, E) => {
2908
+ h(), _(y);
2892
2909
  let C;
2893
- for (; !(C = S(w())); )
2894
- x();
2910
+ for (; !(C = E(w())); )
2911
+ _();
2895
2912
  return h(), C;
2896
2913
  };
2897
2914
  }
@@ -2960,10 +2977,10 @@ function Or(r, e) {
2960
2977
  function Cr(r) {
2961
2978
  const e = je(r), s = xs(r), t = s(e, e.neg(e.ONE)), n = s(e, t), o = s(e, e.neg(t)), i = (r + Pr) / fs;
2962
2979
  return (a, c) => {
2963
- let l = a.pow(c, i), d = a.mul(l, t);
2964
- const h = a.mul(l, n), m = a.mul(l, o), x = a.eql(a.sqr(d), c), w = a.eql(a.sqr(h), c);
2965
- l = a.cmov(l, d, x), d = a.cmov(m, h, w);
2966
- const E = a.eql(a.sqr(d), c), y = a.cmov(l, d, E);
2980
+ let l = a.pow(c, i), u = a.mul(l, t);
2981
+ const h = a.mul(l, n), m = a.mul(l, o), _ = a.eql(a.sqr(u), c), w = a.eql(a.sqr(h), c);
2982
+ l = a.cmov(l, u, _), u = a.cmov(m, h, w);
2983
+ const S = a.eql(a.sqr(u), c), y = a.cmov(l, u, S);
2967
2984
  return xt(a, y, c), y;
2968
2985
  };
2969
2986
  }
@@ -2987,18 +3004,18 @@ function xs(r) {
2987
3004
  return l;
2988
3005
  if (Bt(c, l) !== 1)
2989
3006
  throw new Error("Cannot find square root");
2990
- let d = s, h = c.mul(c.ONE, o), m = c.pow(l, e), x = c.pow(l, i);
3007
+ let u = s, h = c.mul(c.ONE, o), m = c.pow(l, e), _ = c.pow(l, i);
2991
3008
  for (; !c.eql(m, c.ONE); ) {
2992
3009
  if (c.is0(m))
2993
3010
  return c.ZERO;
2994
- let w = 1, E = c.sqr(m);
2995
- for (; !c.eql(E, c.ONE); )
2996
- if (w++, E = c.sqr(E), w === d)
3011
+ let w = 1, S = c.sqr(m);
3012
+ for (; !c.eql(S, c.ONE); )
3013
+ if (w++, S = c.sqr(S), w === u)
2997
3014
  throw new Error("Cannot find square root");
2998
- const y = ee << BigInt(d - w - 1), S = c.pow(h, y);
2999
- d = w, h = c.sqr(S), m = c.mul(m, h), x = c.mul(x, S);
3015
+ const y = ee << BigInt(u - w - 1), E = c.pow(h, y);
3016
+ u = w, h = c.sqr(E), m = c.mul(m, h), _ = c.mul(_, E);
3000
3017
  }
3001
- return x;
3018
+ return _;
3002
3019
  };
3003
3020
  }
3004
3021
  function Lr(r) {
@@ -3060,16 +3077,16 @@ function Br(r, e) {
3060
3077
  }
3061
3078
  class Ur {
3062
3079
  constructor(e, s = {}) {
3063
- T(this, "ORDER");
3064
- T(this, "BITS");
3065
- T(this, "BYTES");
3066
- T(this, "isLE");
3067
- T(this, "ZERO", ne);
3068
- T(this, "ONE", ee);
3069
- T(this, "_lengths");
3070
- T(this, "_sqrt");
3080
+ A(this, "ORDER");
3081
+ A(this, "BITS");
3082
+ A(this, "BYTES");
3083
+ A(this, "isLE");
3084
+ A(this, "ZERO", ne);
3085
+ A(this, "ONE", ee);
3086
+ A(this, "_lengths");
3087
+ A(this, "_sqrt");
3071
3088
  // cached sqrt
3072
- T(this, "_mod");
3089
+ A(this, "_mod");
3073
3090
  var i;
3074
3091
  if (e <= ne)
3075
3092
  throw new Error("invalid field: expected ORDER > 0, got " + e);
@@ -3192,7 +3209,7 @@ function Hr(r, e, s = !1) {
3192
3209
  return s ? ls(a, n) : pt(a, n);
3193
3210
  }
3194
3211
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3195
- const Ne = /* @__PURE__ */ BigInt(0), Te = /* @__PURE__ */ BigInt(1);
3212
+ const Ne = /* @__PURE__ */ BigInt(0), Ae = /* @__PURE__ */ BigInt(1);
3196
3213
  function Ke(r, e) {
3197
3214
  const s = e.negate();
3198
3215
  return r ? s : e;
@@ -3213,9 +3230,9 @@ function Qe(r, e) {
3213
3230
  function Ht(r, e, s) {
3214
3231
  const { windowSize: t, mask: n, maxNumber: o, shiftBy: i } = s;
3215
3232
  let a = Number(r & n), c = r >> i;
3216
- a > t && (a -= o, c += Te);
3217
- const l = e * t, d = l + Math.abs(a) - 1, h = a === 0, m = a < 0, x = e % 2 !== 0;
3218
- return { nextN: c, offset: d, isZero: h, isNeg: m, isNegF: x, offsetF: l };
3233
+ a > t && (a -= o, c += Ae);
3234
+ const l = e * t, u = l + Math.abs(a) - 1, h = a === 0, m = a < 0, _ = e % 2 !== 0;
3235
+ return { nextN: c, offset: u, isZero: h, isNeg: m, isNegF: _, offsetF: l };
3219
3236
  }
3220
3237
  const et = /* @__PURE__ */ new WeakMap(), bs = /* @__PURE__ */ new WeakMap();
3221
3238
  function tt(r) {
@@ -3228,17 +3245,17 @@ function Ft(r) {
3228
3245
  class Fr {
3229
3246
  // Parametrized with a given Point class (not individual point)
3230
3247
  constructor(e, s) {
3231
- T(this, "BASE");
3232
- T(this, "ZERO");
3233
- T(this, "Fn");
3234
- T(this, "bits");
3248
+ A(this, "BASE");
3249
+ A(this, "ZERO");
3250
+ A(this, "Fn");
3251
+ A(this, "bits");
3235
3252
  this.BASE = e.BASE, this.ZERO = e.ZERO, this.Fn = e.Fn, this.bits = s;
3236
3253
  }
3237
3254
  // non-const time multiplication ladder
3238
3255
  _unsafeLadder(e, s, t = this.ZERO) {
3239
3256
  let n = e;
3240
3257
  for (; s > Ne; )
3241
- s & Te && (t = t.add(n)), n = n.double(), s >>= Te;
3258
+ s & Ae && (t = t.add(n)), n = n.double(), s >>= Ae;
3242
3259
  return t;
3243
3260
  }
3244
3261
  /**
@@ -3276,8 +3293,8 @@ class Fr {
3276
3293
  let n = this.ZERO, o = this.BASE;
3277
3294
  const i = Qe(e, this.bits);
3278
3295
  for (let a = 0; a < i.windows; a++) {
3279
- const { nextN: c, offset: l, isZero: d, isNeg: h, isNegF: m, offsetF: x } = Ht(t, a, i);
3280
- t = c, d ? o = o.add(Ke(m, s[x])) : n = n.add(Ke(h, s[l]));
3296
+ const { nextN: c, offset: l, isZero: u, isNeg: h, isNegF: m, offsetF: _ } = Ht(t, a, i);
3297
+ t = c, u ? o = o.add(Ke(m, s[_])) : n = n.add(Ke(h, s[l]));
3281
3298
  }
3282
3299
  return Ft(t), { p: n, f: o };
3283
3300
  }
@@ -3289,10 +3306,10 @@ class Fr {
3289
3306
  wNAFUnsafe(e, s, t, n = this.ZERO) {
3290
3307
  const o = Qe(e, this.bits);
3291
3308
  for (let i = 0; i < o.windows && t !== Ne; i++) {
3292
- const { nextN: a, offset: c, isZero: l, isNeg: d } = Ht(t, i, o);
3309
+ const { nextN: a, offset: c, isZero: l, isNeg: u } = Ht(t, i, o);
3293
3310
  if (t = a, !l) {
3294
3311
  const h = s[c];
3295
- n = n.add(d ? h.negate() : h);
3312
+ n = n.add(u ? h.negate() : h);
3296
3313
  }
3297
3314
  }
3298
3315
  return Ft(t), n;
@@ -3322,7 +3339,7 @@ class Fr {
3322
3339
  function Gr(r, e, s, t) {
3323
3340
  let n = e, o = r.ZERO, i = r.ZERO;
3324
3341
  for (; s > Ne || t > Ne; )
3325
- s & Te && (o = o.add(n)), t & Te && (i = i.add(n)), n = n.double(), s >>= Te, t >>= Te;
3342
+ s & Ae && (o = o.add(n)), t & Ae && (i = i.add(n)), n = n.double(), s >>= Ae, t >>= Ae;
3326
3343
  return { p1: o, p2: i };
3327
3344
  }
3328
3345
  function Gt(r, e, s) {
@@ -3355,12 +3372,12 @@ function qr(r, e) {
3355
3372
  }
3356
3373
  class vs {
3357
3374
  constructor(e, s) {
3358
- T(this, "oHash");
3359
- T(this, "iHash");
3360
- T(this, "blockLen");
3361
- T(this, "outputLen");
3362
- T(this, "finished", !1);
3363
- T(this, "destroyed", !1);
3375
+ A(this, "oHash");
3376
+ A(this, "iHash");
3377
+ A(this, "blockLen");
3378
+ A(this, "outputLen");
3379
+ A(this, "finished", !1);
3380
+ A(this, "destroyed", !1);
3364
3381
  if (ts(e), V(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
3365
3382
  throw new Error("Expected instance of class which extends utils.Hash");
3366
3383
  this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
@@ -3401,13 +3418,13 @@ Ss.create = (r, e) => new vs(r, e);
3401
3418
  const Wt = (r, e) => (r + (r >= 0 ? e : -e) / Es) / e;
3402
3419
  function Kr(r, e, s) {
3403
3420
  const [[t, n], [o, i]] = e, a = Wt(i * r, s), c = Wt(-n * r, s);
3404
- let l = r - a * t - c * o, d = -a * n - c * i;
3405
- const h = l < _e, m = d < _e;
3406
- h && (l = -l), m && (d = -d);
3407
- const x = ft(Math.ceil(Rr(s) / 2)) + Re;
3408
- if (l < _e || l >= x || d < _e || d >= x)
3421
+ let l = r - a * t - c * o, u = -a * n - c * i;
3422
+ const h = l < _e, m = u < _e;
3423
+ h && (l = -l), m && (u = -u);
3424
+ const _ = ft(Math.ceil(Rr(s) / 2)) + Re;
3425
+ if (l < _e || l >= _ || u < _e || u >= _)
3409
3426
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
3410
- return { k1neg: h, k1: l, k2neg: m, k2: d };
3427
+ return { k1neg: h, k1: l, k2neg: m, k2: u };
3411
3428
  }
3412
3429
  function ct(r) {
3413
3430
  if (!["compact", "recovered", "der"].includes(r))
@@ -3465,8 +3482,8 @@ const ye = {
3465
3482
  throw new s("tlv.decode: length bytes not complete");
3466
3483
  if (l[0] === 0)
3467
3484
  throw new s("tlv.decode(long): zero leftmost byte");
3468
- for (const d of l)
3469
- i = i << 8 | d;
3485
+ for (const u of l)
3486
+ i = i << 8 | u;
3470
3487
  if (t += c, i < 128)
3471
3488
  throw new s("tlv.decode(long): not minimal encoding");
3472
3489
  }
@@ -3503,8 +3520,8 @@ const ye = {
3503
3520
  const { Err: e, _int: s, _tlv: t } = ye, n = V(r, void 0, "signature"), { v: o, l: i } = t.decode(48, n);
3504
3521
  if (i.length)
3505
3522
  throw new e("invalid signature: left bytes after parsing");
3506
- const { v: a, l: c } = t.decode(2, o), { v: l, l: d } = t.decode(2, c);
3507
- if (d.length)
3523
+ const { v: a, l: c } = t.decode(2, o), { v: l, l: u } = t.decode(2, c);
3524
+ if (u.length)
3508
3525
  throw new e("invalid signature: left bytes after parsing");
3509
3526
  return { r: s.decode(a), s: s.decode(l) };
3510
3527
  },
@@ -3528,15 +3545,15 @@ function jr(r, e = {}) {
3528
3545
  const { endo: c } = e;
3529
3546
  if (c && (!t.is0(o.a) || typeof c.beta != "bigint" || !Array.isArray(c.basises)))
3530
3547
  throw new Error('invalid endo: expected "beta": bigint and "basises": array');
3531
- const l = Ts(t, n);
3532
- function d() {
3548
+ const l = As(t, n);
3549
+ function u() {
3533
3550
  if (!t.isOdd)
3534
3551
  throw new Error("compression is not supported: Field does not have .isOdd()");
3535
3552
  }
3536
- function h(N, f, _) {
3553
+ function h(N, f, x) {
3537
3554
  const { x: v, y: I } = f.toAffine(), L = t.toBytes(v);
3538
- if (qe(_, "isCompressed"), _) {
3539
- d();
3555
+ if (qe(x, "isCompressed"), x) {
3556
+ u();
3540
3557
  const O = !t.isOdd(I);
3541
3558
  return ve(Is(O), L);
3542
3559
  } else
@@ -3544,46 +3561,46 @@ function jr(r, e = {}) {
3544
3561
  }
3545
3562
  function m(N) {
3546
3563
  V(N, void 0, "Point");
3547
- const { publicKey: f, publicKeyUncompressed: _ } = l, v = N.length, I = N[0], L = N.subarray(1);
3564
+ const { publicKey: f, publicKeyUncompressed: x } = l, v = N.length, I = N[0], L = N.subarray(1);
3548
3565
  if (v === f && (I === 2 || I === 3)) {
3549
3566
  const O = t.fromBytes(L);
3550
3567
  if (!t.isValid(O))
3551
3568
  throw new Error("bad point: is not on curve, wrong x");
3552
- const M = E(O);
3553
- let A;
3569
+ const M = S(O);
3570
+ let T;
3554
3571
  try {
3555
- A = t.sqrt(M);
3572
+ T = t.sqrt(M);
3556
3573
  } catch (J) {
3557
3574
  const K = J instanceof Error ? ": " + J.message : "";
3558
3575
  throw new Error("bad point: is not on curve, sqrt error" + K);
3559
3576
  }
3560
- d();
3561
- const $ = t.isOdd(A);
3562
- return (I & 1) === 1 !== $ && (A = t.neg(A)), { x: O, y: A };
3563
- } else if (v === _ && I === 4) {
3564
- const O = t.BYTES, M = t.fromBytes(L.subarray(0, O)), A = t.fromBytes(L.subarray(O, O * 2));
3565
- if (!y(M, A))
3577
+ u();
3578
+ const $ = t.isOdd(T);
3579
+ return (I & 1) === 1 !== $ && (T = t.neg(T)), { x: O, y: T };
3580
+ } else if (v === x && I === 4) {
3581
+ const O = t.BYTES, M = t.fromBytes(L.subarray(0, O)), T = t.fromBytes(L.subarray(O, O * 2));
3582
+ if (!y(M, T))
3566
3583
  throw new Error("bad point: is not on curve");
3567
- return { x: M, y: A };
3584
+ return { x: M, y: T };
3568
3585
  } else
3569
- throw new Error(`bad point: got length ${v}, expected compressed=${f} or uncompressed=${_}`);
3586
+ throw new Error(`bad point: got length ${v}, expected compressed=${f} or uncompressed=${x}`);
3570
3587
  }
3571
- const x = e.toBytes || h, w = e.fromBytes || m;
3572
- function E(N) {
3573
- const f = t.sqr(N), _ = t.mul(f, N);
3574
- return t.add(t.add(_, t.mul(N, o.a)), o.b);
3588
+ const _ = e.toBytes || h, w = e.fromBytes || m;
3589
+ function S(N) {
3590
+ const f = t.sqr(N), x = t.mul(f, N);
3591
+ return t.add(t.add(x, t.mul(N, o.a)), o.b);
3575
3592
  }
3576
3593
  function y(N, f) {
3577
- const _ = t.sqr(f), v = E(N);
3578
- return t.eql(_, v);
3594
+ const x = t.sqr(f), v = S(N);
3595
+ return t.eql(x, v);
3579
3596
  }
3580
3597
  if (!y(o.Gx, o.Gy))
3581
3598
  throw new Error("bad curve params: generator point");
3582
- const S = t.mul(t.pow(o.a, He), zr), C = t.mul(t.sqr(o.b), BigInt(27));
3583
- if (t.is0(t.add(S, C)))
3599
+ const E = t.mul(t.pow(o.a, He), zr), C = t.mul(t.sqr(o.b), BigInt(27));
3600
+ if (t.is0(t.add(E, C)))
3584
3601
  throw new Error("bad curve params: a or b");
3585
- function B(N, f, _ = !1) {
3586
- if (!t.isValid(f) || _ && t.is0(f))
3602
+ function B(N, f, x = !1) {
3603
+ if (!t.isValid(f) || x && t.is0(f))
3587
3604
  throw new Error(`bad point coordinate ${N}`);
3588
3605
  return f;
3589
3606
  }
@@ -3597,15 +3614,15 @@ function jr(r, e = {}) {
3597
3614
  return Kr(N, c.basises, n.ORDER);
3598
3615
  }
3599
3616
  const P = Mt((N, f) => {
3600
- const { X: _, Y: v, Z: I } = N;
3617
+ const { X: x, Y: v, Z: I } = N;
3601
3618
  if (t.eql(I, t.ONE))
3602
- return { x: _, y: v };
3619
+ return { x, y: v };
3603
3620
  const L = N.is0();
3604
3621
  f == null && (f = L ? t.ONE : t.inv(I));
3605
- const O = t.mul(_, f), M = t.mul(v, f), A = t.mul(I, f);
3622
+ const O = t.mul(x, f), M = t.mul(v, f), T = t.mul(I, f);
3606
3623
  if (L)
3607
3624
  return { x: t.ZERO, y: t.ZERO };
3608
- if (!t.eql(A, t.ONE))
3625
+ if (!t.eql(T, t.ONE))
3609
3626
  throw new Error("invZ was invalid");
3610
3627
  return { x: O, y: M };
3611
3628
  }), G = Mt((N) => {
@@ -3614,41 +3631,41 @@ function jr(r, e = {}) {
3614
3631
  return;
3615
3632
  throw new Error("bad point: ZERO");
3616
3633
  }
3617
- const { x: f, y: _ } = N.toAffine();
3618
- if (!t.isValid(f) || !t.isValid(_))
3634
+ const { x: f, y: x } = N.toAffine();
3635
+ if (!t.isValid(f) || !t.isValid(x))
3619
3636
  throw new Error("bad point: x or y not field elements");
3620
- if (!y(f, _))
3637
+ if (!y(f, x))
3621
3638
  throw new Error("bad point: equation left != right");
3622
3639
  if (!N.isTorsionFree())
3623
3640
  throw new Error("bad point: not in prime-order subgroup");
3624
3641
  return !0;
3625
3642
  });
3626
- function z(N, f, _, v, I) {
3627
- return _ = new W(t.mul(_.X, N), _.Y, _.Z), f = Ke(v, f), _ = Ke(I, _), f.add(_);
3643
+ function z(N, f, x, v, I) {
3644
+ return x = new W(t.mul(x.X, N), x.Y, x.Z), f = Ke(v, f), x = Ke(I, x), f.add(x);
3628
3645
  }
3629
3646
  const R = class R {
3630
3647
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
3631
- constructor(f, _, v) {
3632
- T(this, "X");
3633
- T(this, "Y");
3634
- T(this, "Z");
3635
- this.X = B("x", f), this.Y = B("y", _, !0), this.Z = B("z", v), Object.freeze(this);
3648
+ constructor(f, x, v) {
3649
+ A(this, "X");
3650
+ A(this, "Y");
3651
+ A(this, "Z");
3652
+ this.X = B("x", f), this.Y = B("y", x, !0), this.Z = B("z", v), Object.freeze(this);
3636
3653
  }
3637
3654
  static CURVE() {
3638
3655
  return o;
3639
3656
  }
3640
3657
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
3641
3658
  static fromAffine(f) {
3642
- const { x: _, y: v } = f || {};
3643
- if (!f || !t.isValid(_) || !t.isValid(v))
3659
+ const { x, y: v } = f || {};
3660
+ if (!f || !t.isValid(x) || !t.isValid(v))
3644
3661
  throw new Error("invalid affine point");
3645
3662
  if (f instanceof R)
3646
3663
  throw new Error("projective point not allowed");
3647
- return t.is0(_) && t.is0(v) ? R.ZERO : new R(_, v, t.ONE);
3664
+ return t.is0(x) && t.is0(v) ? R.ZERO : new R(x, v, t.ONE);
3648
3665
  }
3649
3666
  static fromBytes(f) {
3650
- const _ = R.fromAffine(w(V(f, void 0, "point")));
3651
- return _.assertValidity(), _;
3667
+ const x = R.fromAffine(w(V(f, void 0, "point")));
3668
+ return x.assertValidity(), x;
3652
3669
  }
3653
3670
  static fromHex(f) {
3654
3671
  return R.fromBytes(We(f));
@@ -3665,8 +3682,8 @@ function jr(r, e = {}) {
3665
3682
  * @param isLazy true will defer table computation until the first multiplication
3666
3683
  * @returns
3667
3684
  */
3668
- precompute(f = 8, _ = !0) {
3669
- return D.createCache(this, f), _ || this.multiply(He), this;
3685
+ precompute(f = 8, x = !0) {
3686
+ return D.createCache(this, f), x || this.multiply(He), this;
3670
3687
  }
3671
3688
  // TODO: return `this`
3672
3689
  /** A point on curve is valid if it conforms to equation. */
@@ -3682,8 +3699,8 @@ function jr(r, e = {}) {
3682
3699
  /** Compare one point to another. */
3683
3700
  equals(f) {
3684
3701
  b(f);
3685
- const { X: _, Y: v, Z: I } = this, { X: L, Y: O, Z: M } = f, A = t.eql(t.mul(_, M), t.mul(L, I)), $ = t.eql(t.mul(v, M), t.mul(O, I));
3686
- return A && $;
3702
+ const { X: x, Y: v, Z: I } = this, { X: L, Y: O, Z: M } = f, T = t.eql(t.mul(x, M), t.mul(L, I)), $ = t.eql(t.mul(v, M), t.mul(O, I));
3703
+ return T && $;
3687
3704
  }
3688
3705
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
3689
3706
  negate() {
@@ -3694,9 +3711,9 @@ function jr(r, e = {}) {
3694
3711
  // https://eprint.iacr.org/2015/1060, algorithm 3
3695
3712
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
3696
3713
  double() {
3697
- const { a: f, b: _ } = o, v = t.mul(_, He), { X: I, Y: L, Z: O } = this;
3698
- let M = t.ZERO, A = t.ZERO, $ = t.ZERO, F = t.mul(I, I), J = t.mul(L, L), K = t.mul(O, O), H = t.mul(I, L);
3699
- return H = t.add(H, H), $ = t.mul(I, O), $ = t.add($, $), M = t.mul(f, $), A = t.mul(v, K), A = t.add(M, A), M = t.sub(J, A), A = t.add(J, A), A = t.mul(M, A), M = t.mul(H, M), $ = t.mul(v, $), K = t.mul(f, K), H = t.sub(F, K), H = t.mul(f, H), H = t.add(H, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, K), F = t.mul(F, H), A = t.add(A, F), K = t.mul(L, O), K = t.add(K, K), F = t.mul(K, H), M = t.sub(M, F), $ = t.mul(K, J), $ = t.add($, $), $ = t.add($, $), new R(M, A, $);
3714
+ const { a: f, b: x } = o, v = t.mul(x, He), { X: I, Y: L, Z: O } = this;
3715
+ let M = t.ZERO, T = t.ZERO, $ = t.ZERO, F = t.mul(I, I), J = t.mul(L, L), K = t.mul(O, O), H = t.mul(I, L);
3716
+ return H = t.add(H, H), $ = t.mul(I, O), $ = t.add($, $), M = t.mul(f, $), T = t.mul(v, K), T = t.add(M, T), M = t.sub(J, T), T = t.add(J, T), T = t.mul(M, T), M = t.mul(H, M), $ = t.mul(v, $), K = t.mul(f, K), H = t.sub(F, K), H = t.mul(f, H), H = t.add(H, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, K), F = t.mul(F, H), T = t.add(T, F), K = t.mul(L, O), K = t.add(K, K), F = t.mul(K, H), M = t.sub(M, F), $ = t.mul(K, J), $ = t.add($, $), $ = t.add($, $), new R(M, T, $);
3700
3717
  }
3701
3718
  // Renes-Costello-Batina exception-free addition formula.
3702
3719
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -3704,13 +3721,13 @@ function jr(r, e = {}) {
3704
3721
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
3705
3722
  add(f) {
3706
3723
  b(f);
3707
- const { X: _, Y: v, Z: I } = this, { X: L, Y: O, Z: M } = f;
3708
- let A = t.ZERO, $ = t.ZERO, F = t.ZERO;
3724
+ const { X: x, Y: v, Z: I } = this, { X: L, Y: O, Z: M } = f;
3725
+ let T = t.ZERO, $ = t.ZERO, F = t.ZERO;
3709
3726
  const J = o.a, K = t.mul(o.b, He);
3710
- let H = t.mul(_, L), Z = t.mul(v, O), X = t.mul(I, M), oe = t.add(_, v), j = t.add(L, O);
3711
- oe = t.mul(oe, j), j = t.add(H, Z), oe = t.sub(oe, j), j = t.add(_, I);
3727
+ let H = t.mul(x, L), X = t.mul(v, O), Z = t.mul(I, M), oe = t.add(x, v), j = t.add(L, O);
3728
+ oe = t.mul(oe, j), j = t.add(H, X), oe = t.sub(oe, j), j = t.add(x, I);
3712
3729
  let Q = t.add(L, M);
3713
- return j = t.mul(j, Q), Q = t.add(H, X), j = t.sub(j, Q), Q = t.add(v, I), A = t.add(O, M), Q = t.mul(Q, A), A = t.add(Z, X), Q = t.sub(Q, A), F = t.mul(J, j), A = t.mul(K, X), F = t.add(A, F), A = t.sub(Z, F), F = t.add(Z, F), $ = t.mul(A, F), Z = t.add(H, H), Z = t.add(Z, H), X = t.mul(J, X), j = t.mul(K, j), Z = t.add(Z, X), X = t.sub(H, X), X = t.mul(J, X), j = t.add(j, X), H = t.mul(Z, j), $ = t.add($, H), H = t.mul(Q, j), A = t.mul(oe, A), A = t.sub(A, H), H = t.mul(oe, Z), F = t.mul(Q, F), F = t.add(F, H), new R(A, $, F);
3730
+ return j = t.mul(j, Q), Q = t.add(H, Z), j = t.sub(j, Q), Q = t.add(v, I), T = t.add(O, M), Q = t.mul(Q, T), T = t.add(X, Z), Q = t.sub(Q, T), F = t.mul(J, j), T = t.mul(K, Z), F = t.add(T, F), T = t.sub(X, F), F = t.add(X, F), $ = t.mul(T, F), X = t.add(H, H), X = t.add(X, H), Z = t.mul(J, Z), j = t.mul(K, j), X = t.add(X, Z), Z = t.sub(H, Z), Z = t.mul(J, Z), j = t.add(j, Z), H = t.mul(X, j), $ = t.add($, H), H = t.mul(Q, j), T = t.mul(oe, T), T = t.sub(T, H), H = t.mul(oe, X), F = t.mul(Q, F), F = t.add(F, H), new R(T, $, F);
3714
3731
  }
3715
3732
  subtract(f) {
3716
3733
  return this.add(f.negate());
@@ -3728,14 +3745,14 @@ function jr(r, e = {}) {
3728
3745
  * @returns New point
3729
3746
  */
3730
3747
  multiply(f) {
3731
- const { endo: _ } = e;
3748
+ const { endo: x } = e;
3732
3749
  if (!n.isValidNot0(f))
3733
3750
  throw new Error("invalid scalar: out of range");
3734
3751
  let v, I;
3735
3752
  const L = (O) => D.cached(this, O, (M) => Ut(R, M));
3736
- if (_) {
3737
- const { k1neg: O, k1: M, k2neg: A, k2: $ } = k(f), { p: F, f: J } = L(M), { p: K, f: H } = L($);
3738
- I = J.add(H), v = z(_.beta, F, K, O, A);
3753
+ if (x) {
3754
+ const { k1neg: O, k1: M, k2neg: T, k2: $ } = k(f), { p: F, f: J } = L(M), { p: K, f: H } = L($);
3755
+ I = J.add(H), v = z(x.beta, F, K, O, T);
3739
3756
  } else {
3740
3757
  const { p: O, f: M } = L(f);
3741
3758
  v = O, I = M;
@@ -3748,7 +3765,7 @@ function jr(r, e = {}) {
3748
3765
  * an exposed secret key e.g. sig verification, which works over *public* keys.
3749
3766
  */
3750
3767
  multiplyUnsafe(f) {
3751
- const { endo: _ } = e, v = this;
3768
+ const { endo: x } = e, v = this;
3752
3769
  if (!n.isValid(f))
3753
3770
  throw new Error("invalid scalar: out of range");
3754
3771
  if (f === _e || v.is0())
@@ -3757,9 +3774,9 @@ function jr(r, e = {}) {
3757
3774
  return v;
3758
3775
  if (D.hasCache(this))
3759
3776
  return this.multiply(f);
3760
- if (_) {
3761
- const { k1neg: I, k1: L, k2neg: O, k2: M } = k(f), { p1: A, p2: $ } = Gr(R, v, L, M);
3762
- return z(_.beta, A, $, I, O);
3777
+ if (x) {
3778
+ const { k1neg: I, k1: L, k2neg: O, k2: M } = k(f), { p1: T, p2: $ } = Gr(R, v, L, M);
3779
+ return z(x.beta, T, $, I, O);
3763
3780
  } else
3764
3781
  return D.unsafe(v, f);
3765
3782
  }
@@ -3786,7 +3803,7 @@ function jr(r, e = {}) {
3786
3803
  return this.multiplyUnsafe(i).is0();
3787
3804
  }
3788
3805
  toBytes(f = !0) {
3789
- return qe(f, "isCompressed"), this.assertValidity(), x(R, this, f);
3806
+ return qe(f, "isCompressed"), this.assertValidity(), _(R, this, f);
3790
3807
  }
3791
3808
  toHex(f = !0) {
3792
3809
  return Me(this.toBytes(f));
@@ -3796,11 +3813,11 @@ function jr(r, e = {}) {
3796
3813
  }
3797
3814
  };
3798
3815
  // base / generator point
3799
- T(R, "BASE", new R(o.Gx, o.Gy, t.ONE)), // zero / infinity / identity point
3800
- T(R, "ZERO", new R(t.ZERO, t.ONE, t.ZERO)), // 0, 1, 0
3816
+ A(R, "BASE", new R(o.Gx, o.Gy, t.ONE)), // zero / infinity / identity point
3817
+ A(R, "ZERO", new R(t.ZERO, t.ONE, t.ZERO)), // 0, 1, 0
3801
3818
  // math field
3802
- T(R, "Fp", t), // scalar field
3803
- T(R, "Fn", n);
3819
+ A(R, "Fp", t), // scalar field
3820
+ A(R, "Fn", n);
3804
3821
  let W = R;
3805
3822
  const q = n.BITS, D = new Fr(W, e.endo ? Math.ceil(q / 2) : q);
3806
3823
  return W.BASE.precompute(8), W;
@@ -3808,7 +3825,7 @@ function jr(r, e = {}) {
3808
3825
  function Is(r) {
3809
3826
  return Uint8Array.of(r ? 2 : 3);
3810
3827
  }
3811
- function Ts(r, e) {
3828
+ function As(r, e) {
3812
3829
  return {
3813
3830
  secretKey: e.BYTES,
3814
3831
  publicKey: 1 + r.BYTES,
@@ -3818,51 +3835,51 @@ function Ts(r, e) {
3818
3835
  };
3819
3836
  }
3820
3837
  function Yr(r, e = {}) {
3821
- const { Fn: s } = r, t = e.randomBytes || os, n = Object.assign(Ts(r.Fp, s), { seed: ws(s.ORDER) });
3822
- function o(x) {
3838
+ const { Fn: s } = r, t = e.randomBytes || os, n = Object.assign(As(r.Fp, s), { seed: ws(s.ORDER) });
3839
+ function o(_) {
3823
3840
  try {
3824
- const w = s.fromBytes(x);
3841
+ const w = s.fromBytes(_);
3825
3842
  return s.isValidNot0(w);
3826
3843
  } catch {
3827
3844
  return !1;
3828
3845
  }
3829
3846
  }
3830
- function i(x, w) {
3831
- const { publicKey: E, publicKeyUncompressed: y } = n;
3847
+ function i(_, w) {
3848
+ const { publicKey: S, publicKeyUncompressed: y } = n;
3832
3849
  try {
3833
- const S = x.length;
3834
- return w === !0 && S !== E || w === !1 && S !== y ? !1 : !!r.fromBytes(x);
3850
+ const E = _.length;
3851
+ return w === !0 && E !== S || w === !1 && E !== y ? !1 : !!r.fromBytes(_);
3835
3852
  } catch {
3836
3853
  return !1;
3837
3854
  }
3838
3855
  }
3839
- function a(x = t(n.seed)) {
3840
- return Hr(V(x, n.seed, "seed"), s.ORDER);
3856
+ function a(_ = t(n.seed)) {
3857
+ return Hr(V(_, n.seed, "seed"), s.ORDER);
3841
3858
  }
3842
- function c(x, w = !0) {
3843
- return r.BASE.multiply(s.fromBytes(x)).toBytes(w);
3859
+ function c(_, w = !0) {
3860
+ return r.BASE.multiply(s.fromBytes(_)).toBytes(w);
3844
3861
  }
3845
- function l(x) {
3846
- const { secretKey: w, publicKey: E, publicKeyUncompressed: y } = n;
3847
- if (!ut(x) || "_lengths" in s && s._lengths || w === E)
3862
+ function l(_) {
3863
+ const { secretKey: w, publicKey: S, publicKeyUncompressed: y } = n;
3864
+ if (!ut(_) || "_lengths" in s && s._lengths || w === S)
3848
3865
  return;
3849
- const S = V(x, void 0, "key").length;
3850
- return S === E || S === y;
3866
+ const E = V(_, void 0, "key").length;
3867
+ return E === S || E === y;
3851
3868
  }
3852
- function d(x, w, E = !0) {
3853
- if (l(x) === !0)
3869
+ function u(_, w, S = !0) {
3870
+ if (l(_) === !0)
3854
3871
  throw new Error("first arg must be private key");
3855
3872
  if (l(w) === !1)
3856
3873
  throw new Error("second arg must be public key");
3857
- const y = s.fromBytes(x);
3858
- return r.fromBytes(w).multiply(y).toBytes(E);
3874
+ const y = s.fromBytes(_);
3875
+ return r.fromBytes(w).multiply(y).toBytes(S);
3859
3876
  }
3860
3877
  const h = {
3861
3878
  isValidSecretKey: o,
3862
3879
  isValidPublicKey: i,
3863
3880
  randomSecretKey: a
3864
3881
  }, m = qr(a, c);
3865
- return Object.freeze({ getPublicKey: c, getSharedSecret: d, keygen: m, Point: r, utils: h, lengths: n });
3882
+ return Object.freeze({ getPublicKey: c, getSharedSecret: u, keygen: m, Point: r, utils: h, lengths: n });
3866
3883
  }
3867
3884
  function Jr(r, e, s = {}) {
3868
3885
  ts(e), _t(s, {}, {
@@ -3872,70 +3889,70 @@ function Jr(r, e, s = {}) {
3872
3889
  bits2int: "function",
3873
3890
  bits2int_modN: "function"
3874
3891
  }), s = Object.assign({}, s);
3875
- const t = s.randomBytes || os, n = s.hmac || ((f, _) => Ss(e, f, _)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: d, getSharedSecret: h, utils: m, lengths: x } = Yr(r, s), w = {
3892
+ const t = s.randomBytes || os, n = s.hmac || ((f, x) => Ss(e, f, x)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: u, getSharedSecret: h, utils: m, lengths: _ } = Yr(r, s), w = {
3876
3893
  prehash: !0,
3877
3894
  lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
3878
3895
  format: "compact",
3879
3896
  extraEntropy: !1
3880
- }, E = a * Es < o.ORDER;
3897
+ }, S = a * Es < o.ORDER;
3881
3898
  function y(f) {
3882
- const _ = a >> Re;
3883
- return f > _;
3899
+ const x = a >> Re;
3900
+ return f > x;
3884
3901
  }
3885
- function S(f, _) {
3886
- if (!i.isValidNot0(_))
3902
+ function E(f, x) {
3903
+ if (!i.isValidNot0(x))
3887
3904
  throw new Error(`invalid signature ${f}: out of range 1..Point.Fn.ORDER`);
3888
- return _;
3905
+ return x;
3889
3906
  }
3890
3907
  function C() {
3891
- if (E)
3908
+ if (S)
3892
3909
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
3893
3910
  }
3894
- function B(f, _) {
3895
- ct(_);
3896
- const v = x.signature, I = _ === "compact" ? v : _ === "recovered" ? v + 1 : void 0;
3911
+ function B(f, x) {
3912
+ ct(x);
3913
+ const v = _.signature, I = x === "compact" ? v : x === "recovered" ? v + 1 : void 0;
3897
3914
  return V(f, I);
3898
3915
  }
3899
3916
  class b {
3900
- constructor(_, v, I) {
3901
- T(this, "r");
3902
- T(this, "s");
3903
- T(this, "recovery");
3904
- if (this.r = S("r", _), this.s = S("s", v), I != null) {
3917
+ constructor(x, v, I) {
3918
+ A(this, "r");
3919
+ A(this, "s");
3920
+ A(this, "recovery");
3921
+ if (this.r = E("r", x), this.s = E("s", v), I != null) {
3905
3922
  if (C(), ![0, 1, 2, 3].includes(I))
3906
3923
  throw new Error("invalid recovery id");
3907
3924
  this.recovery = I;
3908
3925
  }
3909
3926
  Object.freeze(this);
3910
3927
  }
3911
- static fromBytes(_, v = w.format) {
3912
- B(_, v);
3928
+ static fromBytes(x, v = w.format) {
3929
+ B(x, v);
3913
3930
  let I;
3914
3931
  if (v === "der") {
3915
- const { r: A, s: $ } = ye.toSig(V(_));
3916
- return new b(A, $);
3932
+ const { r: T, s: $ } = ye.toSig(V(x));
3933
+ return new b(T, $);
3917
3934
  }
3918
- v === "recovered" && (I = _[0], v = "compact", _ = _.subarray(1));
3919
- const L = x.signature / 2, O = _.subarray(0, L), M = _.subarray(L, L * 2);
3935
+ v === "recovered" && (I = x[0], v = "compact", x = x.subarray(1));
3936
+ const L = _.signature / 2, O = x.subarray(0, L), M = x.subarray(L, L * 2);
3920
3937
  return new b(i.fromBytes(O), i.fromBytes(M), I);
3921
3938
  }
3922
- static fromHex(_, v) {
3923
- return this.fromBytes(We(_), v);
3939
+ static fromHex(x, v) {
3940
+ return this.fromBytes(We(x), v);
3924
3941
  }
3925
3942
  assertRecovery() {
3926
- const { recovery: _ } = this;
3927
- if (_ == null)
3943
+ const { recovery: x } = this;
3944
+ if (x == null)
3928
3945
  throw new Error("invalid recovery id: must be present");
3929
- return _;
3946
+ return x;
3930
3947
  }
3931
- addRecoveryBit(_) {
3932
- return new b(this.r, this.s, _);
3948
+ addRecoveryBit(x) {
3949
+ return new b(this.r, this.s, x);
3933
3950
  }
3934
- recoverPublicKey(_) {
3951
+ recoverPublicKey(x) {
3935
3952
  const { r: v, s: I } = this, L = this.assertRecovery(), O = L === 2 || L === 3 ? v + a : v;
3936
3953
  if (!o.isValid(O))
3937
3954
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
3938
- const M = o.toBytes(O), A = r.fromBytes(ve(Is((L & 1) === 0), M)), $ = i.inv(O), F = P(V(_, void 0, "msgHash")), J = i.create(-F * $), K = i.create(I * $), H = r.BASE.multiplyUnsafe(J).add(A.multiplyUnsafe(K));
3955
+ const M = o.toBytes(O), T = r.fromBytes(ve(Is((L & 1) === 0), M)), $ = i.inv(O), F = P(V(x, void 0, "msgHash")), J = i.create(-F * $), K = i.create(I * $), H = r.BASE.multiplyUnsafe(J).add(T.multiplyUnsafe(K));
3939
3956
  if (H.is0())
3940
3957
  throw new Error("invalid recovery: point at infinify");
3941
3958
  return H.assertValidity(), H;
@@ -3944,88 +3961,88 @@ function Jr(r, e, s = {}) {
3944
3961
  hasHighS() {
3945
3962
  return y(this.s);
3946
3963
  }
3947
- toBytes(_ = w.format) {
3948
- if (ct(_), _ === "der")
3964
+ toBytes(x = w.format) {
3965
+ if (ct(x), x === "der")
3949
3966
  return We(ye.hexFromSig(this));
3950
3967
  const { r: v, s: I } = this, L = i.toBytes(v), O = i.toBytes(I);
3951
- return _ === "recovered" ? (C(), ve(Uint8Array.of(this.assertRecovery()), L, O)) : ve(L, O);
3968
+ return x === "recovered" ? (C(), ve(Uint8Array.of(this.assertRecovery()), L, O)) : ve(L, O);
3952
3969
  }
3953
- toHex(_) {
3954
- return Me(this.toBytes(_));
3970
+ toHex(x) {
3971
+ return Me(this.toBytes(x));
3955
3972
  }
3956
3973
  }
3957
- const k = s.bits2int || function(_) {
3958
- if (_.length > 8192)
3974
+ const k = s.bits2int || function(x) {
3975
+ if (x.length > 8192)
3959
3976
  throw new Error("input is too large");
3960
- const v = ze(_), I = _.length * 8 - c;
3977
+ const v = ze(x), I = x.length * 8 - c;
3961
3978
  return I > 0 ? v >> BigInt(I) : v;
3962
- }, P = s.bits2int_modN || function(_) {
3963
- return i.create(k(_));
3979
+ }, P = s.bits2int_modN || function(x) {
3980
+ return i.create(k(x));
3964
3981
  }, G = ft(c);
3965
3982
  function z(f) {
3966
- return Ar("num < 2^" + c, f, _e, G), i.toBytes(f);
3983
+ return Tr("num < 2^" + c, f, _e, G), i.toBytes(f);
3967
3984
  }
3968
- function W(f, _) {
3969
- return V(f, void 0, "message"), _ ? V(e(f), void 0, "prehashed message") : f;
3985
+ function W(f, x) {
3986
+ return V(f, void 0, "message"), x ? V(e(f), void 0, "prehashed message") : f;
3970
3987
  }
3971
- function q(f, _, v) {
3988
+ function q(f, x, v) {
3972
3989
  const { lowS: I, prehash: L, extraEntropy: O } = st(v, w);
3973
3990
  f = W(f, L);
3974
- const M = P(f), A = i.fromBytes(_);
3975
- if (!i.isValidNot0(A))
3991
+ const M = P(f), T = i.fromBytes(x);
3992
+ if (!i.isValidNot0(T))
3976
3993
  throw new Error("invalid private key");
3977
- const $ = [z(A), z(M)];
3994
+ const $ = [z(T), z(M)];
3978
3995
  if (O != null && O !== !1) {
3979
- const H = O === !0 ? t(x.secretKey) : O;
3996
+ const H = O === !0 ? t(_.secretKey) : O;
3980
3997
  $.push(V(H, void 0, "extraEntropy"));
3981
3998
  }
3982
3999
  const F = ve(...$), J = M;
3983
4000
  function K(H) {
3984
- const Z = k(H);
3985
- if (!i.isValidNot0(Z))
4001
+ const X = k(H);
4002
+ if (!i.isValidNot0(X))
3986
4003
  return;
3987
- const X = i.inv(Z), oe = r.BASE.multiply(Z).toAffine(), j = i.create(oe.x);
4004
+ const Z = i.inv(X), oe = r.BASE.multiply(X).toAffine(), j = i.create(oe.x);
3988
4005
  if (j === _e)
3989
4006
  return;
3990
- const Q = i.create(X * i.create(J + j * A));
4007
+ const Q = i.create(Z * i.create(J + j * T));
3991
4008
  if (Q === _e)
3992
4009
  return;
3993
4010
  let yt = (oe.x === j ? 0 : 2) | Number(oe.y & Re), bt = Q;
3994
- return I && y(Q) && (bt = i.neg(Q), yt ^= 1), new b(j, bt, E ? void 0 : yt);
4011
+ return I && y(Q) && (bt = i.neg(Q), yt ^= 1), new b(j, bt, S ? void 0 : yt);
3995
4012
  }
3996
4013
  return { seed: F, k2sig: K };
3997
4014
  }
3998
- function D(f, _, v = {}) {
3999
- const { seed: I, k2sig: L } = q(f, _, v);
4015
+ function D(f, x, v = {}) {
4016
+ const { seed: I, k2sig: L } = q(f, x, v);
4000
4017
  return kr(e.outputLen, i.BYTES, n)(I, L).toBytes(v.format);
4001
4018
  }
4002
- function R(f, _, v, I = {}) {
4019
+ function R(f, x, v, I = {}) {
4003
4020
  const { lowS: L, prehash: O, format: M } = st(I, w);
4004
- if (v = V(v, void 0, "publicKey"), _ = W(_, O), !ut(f)) {
4005
- const A = f instanceof b ? ", use sig.toBytes()" : "";
4006
- throw new Error("verify expects Uint8Array signature" + A);
4021
+ if (v = V(v, void 0, "publicKey"), x = W(x, O), !ut(f)) {
4022
+ const T = f instanceof b ? ", use sig.toBytes()" : "";
4023
+ throw new Error("verify expects Uint8Array signature" + T);
4007
4024
  }
4008
4025
  B(f, M);
4009
4026
  try {
4010
- const A = b.fromBytes(f, M), $ = r.fromBytes(v);
4011
- if (L && A.hasHighS())
4027
+ const T = b.fromBytes(f, M), $ = r.fromBytes(v);
4028
+ if (L && T.hasHighS())
4012
4029
  return !1;
4013
- const { r: F, s: J } = A, K = P(_), H = i.inv(J), Z = i.create(K * H), X = i.create(F * H), oe = r.BASE.multiplyUnsafe(Z).add($.multiplyUnsafe(X));
4030
+ const { r: F, s: J } = T, K = P(x), H = i.inv(J), X = i.create(K * H), Z = i.create(F * H), oe = r.BASE.multiplyUnsafe(X).add($.multiplyUnsafe(Z));
4014
4031
  return oe.is0() ? !1 : i.create(oe.x) === F;
4015
4032
  } catch {
4016
4033
  return !1;
4017
4034
  }
4018
4035
  }
4019
- function N(f, _, v = {}) {
4036
+ function N(f, x, v = {}) {
4020
4037
  const { prehash: I } = st(v, w);
4021
- return _ = W(_, I), b.fromBytes(f, "recovered").recoverPublicKey(_).toBytes();
4038
+ return x = W(x, I), b.fromBytes(f, "recovered").recoverPublicKey(x).toBytes();
4022
4039
  }
4023
4040
  return Object.freeze({
4024
4041
  keygen: l,
4025
- getPublicKey: d,
4042
+ getPublicKey: u,
4026
4043
  getSharedSecret: h,
4027
4044
  utils: m,
4028
- lengths: x,
4045
+ lengths: _,
4029
4046
  Point: r,
4030
4047
  sign: D,
4031
4048
  verify: R,
@@ -4043,25 +4060,25 @@ const gt = {
4043
4060
  b: BigInt(7),
4044
4061
  Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
4045
4062
  Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
4046
- }, Zr = {
4063
+ }, Xr = {
4047
4064
  beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
4048
4065
  basises: [
4049
4066
  [BigInt("0x3086d221a7d46bcde86c90e49284eb15"), -BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],
4050
4067
  [BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
4051
4068
  ]
4052
4069
  }, qt = /* @__PURE__ */ BigInt(2);
4053
- function Xr(r) {
4054
- const e = gt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, d = l * l * r % e, h = ae(d, s, e) * d % e, m = ae(h, s, e) * d % e, x = ae(m, qt, e) * l % e, w = ae(x, n, e) * x % e, E = ae(w, o, e) * w % e, y = ae(E, a, e) * E % e, S = ae(y, c, e) * y % e, C = ae(S, a, e) * E % e, B = ae(C, s, e) * d % e, b = ae(B, i, e) * w % e, k = ae(b, t, e) * l % e, P = ae(k, qt, e);
4070
+ function Zr(r) {
4071
+ const e = gt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, h = ae(u, s, e) * u % e, m = ae(h, s, e) * u % e, _ = ae(m, qt, e) * l % e, w = ae(_, n, e) * _ % e, S = ae(w, o, e) * w % e, y = ae(S, a, e) * S % e, E = ae(y, c, e) * y % e, C = ae(E, a, e) * S % e, B = ae(C, s, e) * u % e, b = ae(B, i, e) * w % e, k = ae(b, t, e) * l % e, P = ae(k, qt, e);
4055
4072
  if (!lt.eql(lt.sqr(P), r))
4056
4073
  throw new Error("Cannot find square root");
4057
4074
  return P;
4058
4075
  }
4059
- const lt = je(gt.p, { sqrt: Xr }), Qr = /* @__PURE__ */ jr(gt, {
4076
+ const lt = je(gt.p, { sqrt: Zr }), Qr = /* @__PURE__ */ jr(gt, {
4060
4077
  Fp: lt,
4061
- endo: Zr
4062
- }), en = /* @__PURE__ */ Jr(Qr, Er), tn = BigInt(0), Oe = BigInt(1), sn = BigInt(2), rn = BigInt(7), nn = BigInt(256), on = BigInt(113), As = [], Rs = [], ks = [];
4078
+ endo: Xr
4079
+ }), en = /* @__PURE__ */ Jr(Qr, Er), tn = BigInt(0), Oe = BigInt(1), sn = BigInt(2), rn = BigInt(7), nn = BigInt(256), on = BigInt(113), Ts = [], Rs = [], ks = [];
4063
4080
  for (let r = 0, e = Oe, s = 1, t = 0; r < 24; r++) {
4064
- [s, t] = [t, (2 * s + 3 * t) % 5], As.push(2 * (5 * t + s)), Rs.push((r + 1) * (r + 2) / 2 % 64);
4081
+ [s, t] = [t, (2 * s + 3 * t) % 5], Ts.push(2 * (5 * t + s)), Rs.push((r + 1) * (r + 2) / 2 % 64);
4065
4082
  let n = tn;
4066
4083
  for (let o = 0; o < 7; o++)
4067
4084
  e = (e << Oe ^ (e >> rn) * on) % nn, e & sn && (n ^= Oe << (Oe << BigInt(o)) - Oe);
@@ -4074,14 +4091,14 @@ function ln(r, e = 24) {
4074
4091
  for (let i = 0; i < 10; i++)
4075
4092
  s[i] = r[i] ^ r[i + 10] ^ r[i + 20] ^ r[i + 30] ^ r[i + 40];
4076
4093
  for (let i = 0; i < 10; i += 2) {
4077
- const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], d = s[c + 1], h = Kt(l, d, 1) ^ s[a], m = Vt(l, d, 1) ^ s[a + 1];
4078
- for (let x = 0; x < 50; x += 10)
4079
- r[i + x] ^= h, r[i + x + 1] ^= m;
4094
+ const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], u = s[c + 1], h = Kt(l, u, 1) ^ s[a], m = Vt(l, u, 1) ^ s[a + 1];
4095
+ for (let _ = 0; _ < 50; _ += 10)
4096
+ r[i + _] ^= h, r[i + _ + 1] ^= m;
4080
4097
  }
4081
4098
  let n = r[2], o = r[3];
4082
4099
  for (let i = 0; i < 24; i++) {
4083
- const a = Rs[i], c = Kt(n, o, a), l = Vt(n, o, a), d = As[i];
4084
- n = r[d], o = r[d + 1], r[d] = c, r[d + 1] = l;
4100
+ const a = Rs[i], c = Kt(n, o, a), l = Vt(n, o, a), u = Ts[i];
4101
+ n = r[u], o = r[u + 1], r[u] = c, r[u + 1] = l;
4085
4102
  }
4086
4103
  for (let i = 0; i < 50; i += 10) {
4087
4104
  for (let a = 0; a < 10; a++)
@@ -4096,17 +4113,17 @@ function ln(r, e = 24) {
4096
4113
  class mt {
4097
4114
  // NOTE: we accept arguments in bytes instead of bits here.
4098
4115
  constructor(e, s, t, n = !1, o = 24) {
4099
- T(this, "state");
4100
- T(this, "pos", 0);
4101
- T(this, "posOut", 0);
4102
- T(this, "finished", !1);
4103
- T(this, "state32");
4104
- T(this, "destroyed", !1);
4105
- T(this, "blockLen");
4106
- T(this, "suffix");
4107
- T(this, "outputLen");
4108
- T(this, "enableXOF", !1);
4109
- T(this, "rounds");
4116
+ A(this, "state");
4117
+ A(this, "pos", 0);
4118
+ A(this, "posOut", 0);
4119
+ A(this, "finished", !1);
4120
+ A(this, "state32");
4121
+ A(this, "destroyed", !1);
4122
+ A(this, "blockLen");
4123
+ A(this, "suffix");
4124
+ A(this, "outputLen");
4125
+ A(this, "enableXOF", !1);
4126
+ A(this, "rounds");
4110
4127
  if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = o, ge(t, "outputLen"), !(0 < e && e < 200))
4111
4128
  throw new Error("only keccak-f1600 function is supported");
4112
4129
  this.state = new Uint8Array(200), this.state32 = ir(this.state);
@@ -4176,46 +4193,46 @@ class hn {
4176
4193
  }
4177
4194
  setJWKSEndpoint(e) {
4178
4195
  try {
4179
- this.jwks = Ms(new URL(e)), u.log("[CROSSx] JWKS 엔드포인트 설정:", e);
4196
+ this.jwks = Ms(new URL(e)), d.log("[CROSSx] JWKS 엔드포인트 설정:", e);
4180
4197
  } catch (s) {
4181
- u.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", s);
4198
+ d.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", s);
4182
4199
  }
4183
4200
  }
4184
4201
  async verifyJWT(e, s) {
4185
4202
  try {
4186
4203
  const t = this.decodeJWT(e);
4187
- u.log("[CROSSx] JWT 디코딩 성공:", {
4204
+ d.log("[CROSSx] JWT 디코딩 성공:", {
4188
4205
  sub: t.sub,
4189
4206
  exp: t.exp,
4190
4207
  iat: t.iat
4191
4208
  });
4192
4209
  const n = Math.floor(Date.now() / 1e3);
4193
4210
  if (t.exp && t.exp + un < n)
4194
- return u.warn("[CROSSx] 토큰 만료:", {
4211
+ return d.warn("[CROSSx] 토큰 만료:", {
4195
4212
  exp: t.exp,
4196
4213
  now: n,
4197
4214
  만료시간: new Date(t.exp * 1e3).toISOString()
4198
4215
  }), { payload: t, valid: !1, signatureVerified: !1 };
4199
4216
  if (!t.sub)
4200
- return u.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: t, valid: !1, signatureVerified: !1 };
4217
+ return d.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: t, valid: !1, signatureVerified: !1 };
4201
4218
  if (this.jwks)
4202
4219
  try {
4203
4220
  const { payload: o } = await $s(e, this.jwks, {
4204
4221
  algorithms: ["RS256", "ES256"]
4205
4222
  });
4206
- return u.log("[CROSSx] JWT 서명 검증 성공"), {
4223
+ return d.log("[CROSSx] JWT 서명 검증 성공"), {
4207
4224
  payload: o,
4208
4225
  valid: !0,
4209
4226
  signatureVerified: !0
4210
4227
  };
4211
4228
  } catch (o) {
4212
4229
  if (o instanceof Error && (o.name === "JWSSignatureVerificationFailed" || o.name === "JWTClaimValidationFailed"))
4213
- return u.error("[CROSSx] JWT 서명 검증 실패:", o), { payload: t, valid: !1, signatureVerified: !1 };
4214
- u.warn("[CROSSx] JWKS 엔드포인트 접근 불가 — 서명 미검증 모드로 전환");
4230
+ return d.error("[CROSSx] JWT 서명 검증 실패:", o), { payload: t, valid: !1, signatureVerified: !1 };
4231
+ d.warn("[CROSSx] JWKS 엔드포인트 접근 불가 — 서명 미검증 모드로 전환");
4215
4232
  }
4216
- return u.log("[CROSSx] JWT 검증 성공 (서명 미검증 — JWKS 미설정 또는 접근 불가)"), { payload: t, valid: !0, signatureVerified: !1 };
4233
+ return d.log("[CROSSx] JWT 검증 성공 (서명 미검증 — JWKS 미설정 또는 접근 불가)"), { payload: t, valid: !0, signatureVerified: !1 };
4217
4234
  } catch (t) {
4218
- throw u.error("[CROSSx] JWT 검증 중 에러:", t), t;
4235
+ throw d.error("[CROSSx] JWT 검증 중 에러:", t), t;
4219
4236
  }
4220
4237
  }
4221
4238
  decodeJWT(e) {
@@ -4237,10 +4254,10 @@ ${t.length}`
4237
4254
  const i = zt(o), a = s.startsWith("0x") ? s.slice(2) : s;
4238
4255
  if (a.length !== 130)
4239
4256
  throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${a.length}`);
4240
- const c = pn(a), l = c.slice(0, 32), d = c.slice(32, 64), h = c[64], m = h >= 27 ? h - 27 : h, E = new en.Signature(
4257
+ const c = pn(a), l = c.slice(0, 32), u = c.slice(32, 64), h = c[64], m = h >= 27 ? h - 27 : h, S = new en.Signature(
4241
4258
  jt(l),
4242
- jt(d)
4243
- ).addRecoveryBit(m).recoverPublicKey(i).toBytes(!1).slice(1), y = zt(E);
4259
+ jt(u)
4260
+ ).addRecoveryBit(m).recoverPublicKey(i).toBytes(!1).slice(1), y = zt(S);
4244
4261
  return "0x" + Me(y.slice(12));
4245
4262
  }
4246
4263
  }
@@ -4332,21 +4349,21 @@ class be {
4332
4349
  */
4333
4350
  static async verifyIdTokenNonce(e, s) {
4334
4351
  const t = be.parseJwtPayload(e), n = t.nonce, o = typeof t.iss == "string" ? t.iss : "(unknown)";
4335
- if (u.log("[CROSSx] nonce 검증 시작 —", {
4352
+ if (d.log("[CROSSx] nonce 검증 시작 —", {
4336
4353
  iss: o,
4337
4354
  nonceClaimType: typeof n,
4338
4355
  nonceClaimPresent: typeof n == "string" && n !== "",
4339
4356
  // Apple의 nonce_supported 플래그 확인 (false면 서버가 nonce를 전달하지 않은 것)
4340
4357
  appleNonceSupported: t.nonce_supported ?? "(field absent)"
4341
4358
  }), o.includes("securetoken.google.com")) {
4342
- u.log(
4359
+ d.log(
4343
4360
  "[CROSSx] Firebase ID Token 감지 — nonce 검증 skip.",
4344
4361
  "서버 측에서 Google/Apple nonce 검증이 완료된 것으로 간주합니다."
4345
4362
  );
4346
4363
  return;
4347
4364
  }
4348
4365
  if (typeof n != "string" || n === "")
4349
- throw u.error("[CROSSx] nonce claim 누락 — JWT payload 전체 키 목록:", Object.keys(t)), u.error(
4366
+ throw d.error("[CROSSx] nonce claim 누락 — JWT payload 전체 키 목록:", Object.keys(t)), d.error(
4350
4367
  "[CROSSx] 원인 추정: OAuth 서버가 Google/Apple 인증 요청에 nonce 파라미터를 포함하지 않았을 수 있습니다.",
4351
4368
  "서버 로그에서 /auth/google, /auth/apple 요청 URL에 nonce 쿼리가 있는지 확인하세요."
4352
4369
  ), new Error(
@@ -4354,24 +4371,24 @@ class be {
4354
4371
  );
4355
4372
  if (o.includes("appleid.apple.com")) {
4356
4373
  const i = await be.sha256Hex(s);
4357
- if (u.log("[CROSSx] Apple nonce 검증 —", {
4374
+ if (d.log("[CROSSx] Apple nonce 검증 —", {
4358
4375
  expectedHashLength: i.length,
4359
4376
  receivedHashLength: n.length,
4360
4377
  match: n === i
4361
4378
  }), n !== i)
4362
4379
  throw new Error("ID Token nonce 불일치 — replay attack 가능성이 있습니다");
4363
- } else if (u.log("[CROSSx] Google nonce 검증 —", {
4380
+ } else if (d.log("[CROSSx] Google nonce 검증 —", {
4364
4381
  expectedLength: s.length,
4365
4382
  receivedLength: n.length,
4366
4383
  match: n === s
4367
4384
  }), n !== s)
4368
4385
  throw new Error("ID Token nonce 불일치 — replay attack 가능성이 있습니다");
4369
- u.log("[CROSSx] nonce 검증 성공 —", { iss: o });
4386
+ d.log("[CROSSx] nonce 검증 성공 —", { iss: o });
4370
4387
  }
4371
4388
  openAuth(e) {
4372
4389
  return new Promise((s, t) => {
4373
- const n = Math.max(e.width ?? 500, 500), o = Math.max(e.height ?? 700, 700), i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c = be.generateRandom16Hex(), l = be.generateRandom16Hex(), d = e.authUrl.includes("?") ? "&" : "?", h = `${e.authUrl}${d}state=${c}&nonce=${l}`;
4374
- u.log("[CROSSx] OAuth 팝업 열기 — state, nonce 생성 완료:", {
4390
+ const n = Math.max(e.width ?? 500, 500), o = Math.max(e.height ?? 700, 700), i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c = be.generateRandom16Hex(), l = be.generateRandom16Hex(), u = e.authUrl.includes("?") ? "&" : "?", h = `${e.authUrl}${u}state=${c}&nonce=${l}`;
4391
+ d.log("[CROSSx] OAuth 팝업 열기 — state, nonce 생성 완료:", {
4375
4392
  stateLength: c.length,
4376
4393
  nonceLength: l.length,
4377
4394
  authUrlBase: e.authUrl
@@ -4385,16 +4402,16 @@ class be {
4385
4402
  t(new Error("팝업 창을 열 수 없습니다. 팝업 차단을 해제해 주세요."));
4386
4403
  return;
4387
4404
  }
4388
- const x = setTimeout(() => {
4389
- u.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), b(), t(new Error("Authentication timeout"));
4390
- }, 5 * 60 * 1e3), w = 10, E = 30;
4391
- let y = 0, S = null;
4405
+ const _ = setTimeout(() => {
4406
+ d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), b(), t(new Error("Authentication timeout"));
4407
+ }, 5 * 60 * 1e3), w = 10, S = 30;
4408
+ let y = 0, E = null;
4392
4409
  const C = () => {
4393
- clearInterval(B), u.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + E + "초간 대기합니다"), S = setTimeout(() => {
4410
+ clearInterval(B), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + S + "초간 대기합니다"), E = setTimeout(() => {
4394
4411
  b(), t(new Error(
4395
4412
  "OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
4396
4413
  ));
4397
- }, E * 1e3);
4414
+ }, S * 1e3);
4398
4415
  }, B = setInterval(() => {
4399
4416
  y++;
4400
4417
  try {
@@ -4403,45 +4420,45 @@ class be {
4403
4420
  C();
4404
4421
  }
4405
4422
  }, 1e3), b = () => {
4406
- clearTimeout(x), clearInterval(B), S && clearTimeout(S), window.removeEventListener("message", k);
4423
+ clearTimeout(_), clearInterval(B), E && clearTimeout(E), window.removeEventListener("message", k);
4407
4424
  }, k = (P) => {
4408
4425
  var z, W, q, D, R;
4409
4426
  if (P.origin !== e.expectedOrigin) return;
4410
4427
  if (!gn.has(P.origin)) {
4411
- u.error("[CROSSx] postMessage origin이 허용 목록에 없음:", P.origin), b(), t(new Error("Unauthorized OAuth origin"));
4428
+ d.error("[CROSSx] postMessage origin이 허용 목록에 없음:", P.origin), b(), t(new Error("Unauthorized OAuth origin"));
4412
4429
  return;
4413
4430
  }
4414
- b(), u.log("[CROSSx] OAuth postMessage 수신 — status:", P.data.status);
4431
+ b(), d.log("[CROSSx] OAuth postMessage 수신 — status:", P.data.status);
4415
4432
  const G = P.data.state ?? ((z = P.data.data) == null ? void 0 : z.state);
4416
4433
  if (!G || G !== c) {
4417
4434
  t(new Error("OAuth state mismatch — possible CSRF attack"));
4418
4435
  return;
4419
4436
  }
4420
4437
  if (P.data.status === "success") {
4421
- const N = (W = P.data.data) == null ? void 0 : W.idToken, f = (q = P.data.data) == null ? void 0 : q.accessToken, _ = f ?? N;
4422
- if (u.log("[CROSSx] OAuth 토큰 수신:", {
4438
+ const N = (W = P.data.data) == null ? void 0 : W.idToken, f = (q = P.data.data) == null ? void 0 : q.accessToken, x = f ?? N;
4439
+ if (d.log("[CROSSx] OAuth 토큰 수신:", {
4423
4440
  hasAccessToken: !!f,
4424
4441
  hasIdToken: !!N
4425
- }), !_) {
4426
- u.error("[CROSSx] 토큰을 찾을 수 없음:", P.data), t(new Error("Token not found in response"));
4442
+ }), !x) {
4443
+ d.error("[CROSSx] 토큰을 찾을 수 없음:", P.data), t(new Error("Token not found in response"));
4427
4444
  return;
4428
4445
  }
4429
- N ? be.verifyIdTokenNonce(N, l).then(() => s(_)).catch((v) => {
4430
- u.error("[CROSSx] nonce 검증 실패:", v), t(v instanceof Error ? v : new Error("nonce verification failed"));
4431
- }) : f ? f.split(".").length === 3 ? be.verifyIdTokenNonce(f, l).then(() => s(_)).catch((I) => {
4432
- u.error("[CROSSx] accessToken nonce 검증 실패:", I), t(I instanceof Error ? I : new Error("nonce verification failed"));
4433
- }) : (u.warn(
4446
+ N ? be.verifyIdTokenNonce(N, l).then(() => s(x)).catch((v) => {
4447
+ d.error("[CROSSx] nonce 검증 실패:", v), t(v instanceof Error ? v : new Error("nonce verification failed"));
4448
+ }) : f ? f.split(".").length === 3 ? be.verifyIdTokenNonce(f, l).then(() => s(x)).catch((I) => {
4449
+ d.error("[CROSSx] accessToken nonce 검증 실패:", I), t(I instanceof Error ? I : new Error("nonce verification failed"));
4450
+ }) : (d.warn(
4434
4451
  "[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
4435
4452
  "서버 측 nonce 검증이 필요합니다."
4436
- ), s(_)) : t(new Error("Token not found in response"));
4453
+ ), s(x)) : t(new Error("Token not found in response"));
4437
4454
  } else
4438
- u.error("[CROSSx] OAuth 실패:", (D = P.data.data) == null ? void 0 : D.error), t(new Error(((R = P.data.data) == null ? void 0 : R.error) || "Authentication failed"));
4455
+ d.error("[CROSSx] OAuth 실패:", (D = P.data.data) == null ? void 0 : D.error), t(new Error(((R = P.data.data) == null ? void 0 : R.error) || "Authentication failed"));
4439
4456
  };
4440
4457
  window.addEventListener("message", k);
4441
4458
  });
4442
4459
  }
4443
4460
  }
4444
- const Ce = "crossx_wallet_data", Ae = "crossx_mock_pin_hash";
4461
+ const Ce = "crossx_wallet_data", Te = "crossx_mock_pin_hash";
4445
4462
  class mn {
4446
4463
  constructor(e, s) {
4447
4464
  this.storage = e, this.pinStore = s ?? null;
@@ -4454,9 +4471,9 @@ class mn {
4454
4471
  */
4455
4472
  async checkWallet() {
4456
4473
  if (this.migrateScenario !== void 0)
4457
- return u.log("[Mock] checkWallet → migration_required"), "migration_required";
4474
+ return d.log("[Mock] checkWallet → migration_required"), "migration_required";
4458
4475
  const s = await this.storage.get(Ce) ? "exists" : "not_found";
4459
- return u.log(`[Mock] checkWallet → ${s}`), s;
4476
+ return d.log(`[Mock] checkWallet → ${s}`), s;
4460
4477
  }
4461
4478
  async getOrCreateWallet(e) {
4462
4479
  var s;
@@ -4471,7 +4488,7 @@ class mn {
4471
4488
  };
4472
4489
  await this.storage.set(Ce, n);
4473
4490
  const o = (s = this.pinStore) == null ? void 0 : s.get();
4474
- return o && (await this.storage.set(Ae, o), u.log("[Mock] 지갑 생성 — PIN 저장됨")), n;
4491
+ return o && (await this.storage.set(Te, o), d.log("[Mock] 지갑 생성 — PIN 저장됨")), n;
4475
4492
  } catch (t) {
4476
4493
  throw new g(p.WALLET_CREATION_FAILED, "지갑 생성에 실패했습니다", t);
4477
4494
  }
@@ -4489,21 +4506,21 @@ class mn {
4489
4506
  }
4490
4507
  async prepare(e, s) {
4491
4508
  const t = "mock-" + crypto.randomUUID();
4492
- return u.log(`[Mock] prepare action=${e} → uuid=${t}`), { uuid: t, expiresAt: new Date(Date.now() + 5 * 6e4).toISOString() };
4509
+ return d.log(`[Mock] prepare action=${e} → uuid=${t}`), { uuid: t, expiresAt: new Date(Date.now() + 5 * 6e4).toISOString() };
4493
4510
  }
4494
4511
  async signMessage(e, s, t, n = 0, o, i) {
4495
- return u.log(`[Mock] signMessage chainId=${s} index=${n} uuid=${o} from=${i}: "${t}"`), { chainId: s, signature: this.generateMockSignature(), format: "hex" };
4512
+ return d.log(`[Mock] signMessage chainId=${s} index=${n} uuid=${o} from=${i}: "${t}"`), { chainId: s, signature: this.generateMockSignature(), format: "hex" };
4496
4513
  }
4497
4514
  async signTypedData(e, s, t, n = 0, o, i) {
4498
- return u.log(`[Mock] signTypedData chainId=${s} index=${n} uuid=${o} from=${i}`), { chainId: s, signature: this.generateMockSignature(), format: "hex" };
4515
+ return d.log(`[Mock] signTypedData chainId=${s} index=${n} uuid=${o} from=${i}`), { chainId: s, signature: this.generateMockSignature(), format: "hex" };
4499
4516
  }
4500
4517
  async signTransaction(e, s, t, n = 0, o) {
4501
- u.log(`[Mock] signTransaction chainId=${s} index=${n} uuid=${o}:`, t);
4518
+ d.log(`[Mock] signTransaction chainId=${s} index=${n} uuid=${o}:`, t);
4502
4519
  const i = "0x" + Array(64).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join("");
4503
4520
  return { chainId: s, signature: this.generateMockSignature(), txHash: i, format: "hex" };
4504
4521
  }
4505
4522
  async sendTransaction(e, s, t, n) {
4506
- return u.log(`[Mock] sendTransaction chainId=${s} uuid=${n}:`, t), { txHash: "0x" + Array(64).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join("") };
4523
+ return d.log(`[Mock] sendTransaction chainId=${s} uuid=${n}:`, t), { txHash: "0x" + Array(64).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join("") };
4507
4524
  }
4508
4525
  /**
4509
4526
  * POST /mnemonic/verify-password 모킹
@@ -4511,10 +4528,10 @@ class mn {
4511
4528
  */
4512
4529
  async verifyPin(e) {
4513
4530
  var t;
4514
- if (u.log("[Mock] verifyPin"), this.pinScenario === "wrong")
4531
+ if (d.log("[Mock] verifyPin"), this.pinScenario === "wrong")
4515
4532
  return !1;
4516
- const s = await this.storage.get(Ae);
4517
- return s && s !== e ? !1 : (s || await this.storage.set(Ae, e), (t = this.pinStore) == null || t.set(e), u.log("[Mock] verifyPin → 성공"), !0);
4533
+ const s = await this.storage.get(Te);
4534
+ return s && s !== e ? !1 : (s || await this.storage.set(Te, e), (t = this.pinStore) == null || t.set(e), d.log("[Mock] verifyPin → 성공"), !0);
4518
4535
  }
4519
4536
  /**
4520
4537
  * POST /mnemonic/change-password 모킹
@@ -4522,16 +4539,16 @@ class mn {
4522
4539
  */
4523
4540
  async changePin(e, s) {
4524
4541
  var o;
4525
- if (u.log("[Mock] changePin"), this.pinScenario === "wrong")
4542
+ if (d.log("[Mock] changePin"), this.pinScenario === "wrong")
4526
4543
  throw new g(p.PIN_WRONG, "Incorrect PIN.");
4527
- const t = (o = this.pinStore) == null ? void 0 : o.get(), n = await this.storage.get(Ae);
4544
+ const t = (o = this.pinStore) == null ? void 0 : o.get(), n = await this.storage.get(Te);
4528
4545
  if (n && t && n !== t)
4529
4546
  throw new g(p.PIN_WRONG, "Incorrect PIN.");
4530
- await this.storage.set(Ae, s), u.log("[Mock] changePin 완료");
4547
+ await this.storage.set(Te, s), d.log("[Mock] changePin 완료");
4531
4548
  }
4532
4549
  async migrateWallet(e, s) {
4533
4550
  var o;
4534
- if (u.log(`[Mock] migrateWallet pin=${e} sub=${s}`), this.migrateScenario === "wrong_pin")
4551
+ if (d.log(`[Mock] migrateWallet pin=${e} sub=${s}`), this.migrateScenario === "wrong_pin")
4535
4552
  throw new g(p.MIGRATION_FAILED, "Incorrect PIN.", {
4536
4553
  permanent: !1,
4537
4554
  lockExpiresAt: 0,
@@ -4560,21 +4577,21 @@ class mn {
4560
4577
  };
4561
4578
  await this.storage.set(Ce, t);
4562
4579
  const n = (o = this.pinStore) == null ? void 0 : o.get();
4563
- return n && (await this.storage.set(Ae, n), u.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
4580
+ return n && (await this.storage.set(Te, n), d.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
4564
4581
  }
4565
4582
  /**
4566
4583
  * POST /mnemonic/share-c 모킹
4567
4584
  * 새로운 Share-C 문자열을 반환합니다.
4568
4585
  */
4569
4586
  async getShareC() {
4570
- return u.log("[Mock] getShareC"), "mock-share-c-" + crypto.randomUUID();
4587
+ return d.log("[Mock] getShareC"), "mock-share-c-" + crypto.randomUUID();
4571
4588
  }
4572
4589
  /**
4573
4590
  * POST /mnemonic/verify-recovery-pin 모킹
4574
4591
  * CROSSx 4자리 복구 PIN 검증
4575
4592
  */
4576
4593
  async verifyRecoveryPin(e, s) {
4577
- return u.log("[Mock] verifyRecoveryPin"), { valid: !0 };
4594
+ return d.log("[Mock] verifyRecoveryPin"), { valid: !0 };
4578
4595
  }
4579
4596
  generateMockEvmAddress() {
4580
4597
  return "0x" + Array(40).fill(0).map(
@@ -4618,32 +4635,32 @@ class Le {
4618
4635
  "X-Project-Id": this.projectId
4619
4636
  };
4620
4637
  try {
4621
- const d = (await this.transport.request({
4638
+ const u = (await this.transport.request({
4622
4639
  url: o,
4623
4640
  method: e,
4624
4641
  headers: i,
4625
4642
  body: t ?? void 0
4626
4643
  })).data;
4627
- if (d && typeof d.code == "number") {
4628
- if (d.code < 0 || d.code >= 400) {
4629
- const h = d.message || d.data || "API 요청에 실패했습니다";
4630
- u.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
4631
- code: d.code,
4644
+ if (u && typeof u.code == "number") {
4645
+ if (u.code < 0 || u.code >= 400) {
4646
+ const h = u.message || u.data || "API 요청에 실패했습니다";
4647
+ d.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
4648
+ code: u.code,
4632
4649
  message: h,
4633
4650
  url: o,
4634
4651
  method: e
4635
4652
  });
4636
- const m = Le.mapGatewayError(d.code, d.data), x = Le.getGatewayErrorMessage(d.code, h), w = d.data, E = m === p.PIN_LOCKED ? Le.extractLockDetails(w) : w ?? void 0, y = new g(m, x, E);
4637
- throw m === p.AUTH_NOT_AUTHENTICATED && this._onUnauthorized && (u.warn("[CROSSx] Gateway -10002 감지 — 강제 로그아웃 실행"), this._onUnauthorized()), y;
4653
+ const m = Le.mapGatewayError(u.code, u.data), _ = Le.getGatewayErrorMessage(u.code, h), w = u.data, S = m === p.PIN_LOCKED ? Le.extractLockDetails(w) : w ?? void 0, y = new g(m, _, S);
4654
+ throw m === p.AUTH_NOT_AUTHENTICATED && this._onUnauthorized && (d.warn("[CROSSx] Gateway -10002 감지 — 강제 로그아웃 실행"), this._onUnauthorized()), y;
4638
4655
  }
4639
- return u.log("[CROSSx] Wallet Gateway API 성공:", { code: d.code, url: o, method: e }), d.data ?? d;
4656
+ return d.log("[CROSSx] Wallet Gateway API 성공:", { code: u.code, url: o, method: e }), u.data ?? u;
4640
4657
  }
4641
- return d;
4658
+ return u;
4642
4659
  } catch (l) {
4643
4660
  if (l instanceof g) throw l;
4644
4661
  if ((a = l.response) != null && a.data) {
4645
- const d = l.response.data, h = d.message || d.data || "API 요청에 실패했습니다", m = d.code || "UNKNOWN";
4646
- throw u.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
4662
+ const u = l.response.data, h = u.message || u.data || "API 요청에 실패했습니다", m = u.code || "UNKNOWN";
4663
+ throw d.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
4647
4664
  code: m,
4648
4665
  message: h,
4649
4666
  url: o,
@@ -4662,9 +4679,9 @@ class Le {
4662
4679
  * 결과를 내부 캐시에 저장하여 getOrCreateWallet에서 재사용합니다.
4663
4680
  */
4664
4681
  async checkWallet() {
4665
- u.log("[CROSSx] GET /mnemonic/check");
4682
+ d.log("[CROSSx] GET /mnemonic/check");
4666
4683
  const e = await this.request("GET", "/mnemonic/check");
4667
- return u.log("[CROSSx] /mnemonic/check 결과:", e.result), this._walletStatusCache = e.result, e.result;
4684
+ return d.log("[CROSSx] /mnemonic/check 결과:", e.result), this._walletStatusCache = e.result, e.result;
4668
4685
  }
4669
4686
  /**
4670
4687
  * 지갑 생성 또는 로드
@@ -4675,24 +4692,24 @@ class Le {
4675
4692
  */
4676
4693
  async getOrCreateWallet(e) {
4677
4694
  let s;
4678
- if (this._walletStatusCache !== null ? (s = this._walletStatusCache, this._walletStatusCache = null, u.log("[CROSSx] getOrCreateWallet — 캐시된 상태 사용:", s)) : (u.log("[CROSSx] GET /mnemonic/check — 지갑 상태 확인"), s = await this.checkWallet(), this._walletStatusCache = null), s === "migration_required")
4679
- throw u.log("[CROSSx] migration_required → MIGRATION_BACKUP_EXISTS throw"), new g(
4695
+ if (this._walletStatusCache !== null ? (s = this._walletStatusCache, this._walletStatusCache = null, d.log("[CROSSx] getOrCreateWallet — 캐시된 상태 사용:", s)) : (d.log("[CROSSx] GET /mnemonic/check — 지갑 상태 확인"), s = await this.checkWallet(), this._walletStatusCache = null), s === "migration_required")
4696
+ throw d.log("[CROSSx] migration_required → MIGRATION_BACKUP_EXISTS throw"), new g(
4680
4697
  p.MIGRATION_BACKUP_EXISTS,
4681
4698
  "CROSSx 백업이 존재합니다. 마이그레이션을 진행해 주세요."
4682
4699
  );
4683
4700
  if (s === "exists") {
4684
- u.log("[CROSSx] 기존 지갑 발견 — POST /mnemonic/address(0)로 주소 조회");
4701
+ d.log("[CROSSx] 기존 지갑 발견 — POST /mnemonic/address(0)로 주소 조회");
4685
4702
  const o = await this.getAddress(e, 0);
4686
- return u.log("[CROSSx] 주소 조회 완료 — address:", o.address), {
4703
+ return d.log("[CROSSx] 주소 조회 완료 — address:", o.address), {
4687
4704
  id: e,
4688
4705
  address: o.address,
4689
4706
  derivationPath: "m/44'/60'/0'/0/0",
4690
4707
  createdAt: Date.now()
4691
4708
  };
4692
4709
  }
4693
- u.log("[CROSSx] POST /mnemonic/create — 신규 지갑 생성");
4710
+ d.log("[CROSSx] POST /mnemonic/create — 신규 지갑 생성");
4694
4711
  const t = { ignoreBackup: !1, password: this.requirePin() }, n = await this.request("POST", "/mnemonic/create", t);
4695
- return u.log("[CROSSx] /mnemonic/create 완료 — address:", n.address), {
4712
+ return d.log("[CROSSx] /mnemonic/create 완료 — address:", n.address), {
4696
4713
  id: e,
4697
4714
  address: n.address,
4698
4715
  derivationPath: "m/44'/60'/0'/0/0",
@@ -4786,13 +4803,13 @@ class Le {
4786
4803
  )).txHash };
4787
4804
  }
4788
4805
  async migrateWallet(e, s) {
4789
- u.log("[CROSSx][Migration Phase 4] POST /mnemonic/migrate 호출");
4806
+ d.log("[CROSSx][Migration Phase 4] POST /mnemonic/migrate 호출");
4790
4807
  const t = { recoveryPin: e, sub: s, password: this.requirePin() }, n = await this.request(
4791
4808
  "POST",
4792
4809
  "/mnemonic/migrate",
4793
4810
  t
4794
4811
  );
4795
- return u.log("[CROSSx][Migration Phase 4] /mnemonic/migrate 완료 — address:", n.address), {
4812
+ return d.log("[CROSSx][Migration Phase 4] /mnemonic/migrate 완료 — address:", n.address), {
4796
4813
  id: s,
4797
4814
  address: n.address,
4798
4815
  derivationPath: "m/44'/60'/0'/0/0",
@@ -4865,16 +4882,27 @@ class Le {
4865
4882
  case -10002:
4866
4883
  return p.AUTH_NOT_AUTHENTICATED;
4867
4884
  case -10001:
4868
- case -10009:
4869
4885
  return p.UNKNOWN_ERROR;
4870
4886
  case -10006:
4871
4887
  return p.GATEWAY_INTERNAL_ERROR;
4888
+ case -10007:
4889
+ return p.BROADCAST_FAILED;
4872
4890
  case -10008:
4873
4891
  return p.GATEWAY_LOCK_CONFLICT;
4892
+ case -10004:
4893
+ return p.WALLET_ALREADY_EXISTS;
4894
+ case -10005:
4895
+ return p.WALLET_NOT_FOUND;
4896
+ case -10011:
4897
+ return p.WALLET_NOT_FOUND;
4898
+ case -10030:
4899
+ return p.WALLET_INCONSISTENT_STATE;
4874
4900
  case -10010:
4875
4901
  return p.MIGRATION_FAILED;
4876
4902
  case -10012:
4877
4903
  return p.MIGRATION_BACKUP_EXISTS;
4904
+ case -10013:
4905
+ return p.WITHDRAW_FAILED;
4878
4906
  case -10027:
4879
4907
  return p.MIGRATION_PIN_LOCKED;
4880
4908
  case -10022:
@@ -4883,14 +4911,16 @@ class Le {
4883
4911
  return p.PROJECT_ID_MISSING;
4884
4912
  case -10024:
4885
4913
  return p.ORIGIN_NOT_ALLOWED;
4914
+ case -10025:
4915
+ return p.INVALID_APP_TYPE;
4886
4916
  case -10028:
4887
4917
  return p.PIN_WRONG;
4888
4918
  case -10029:
4889
4919
  return p.PIN_INVALID;
4890
4920
  case -10031:
4891
4921
  return p.PIN_LOCKED;
4892
- case -10030:
4893
- return p.WALLET_INCONSISTENT_STATE;
4922
+ case -10032:
4923
+ return p.PIN_REPEATED_PATTERN;
4894
4924
  case -10026:
4895
4925
  return p.TYPED_DATA_CHAIN_ID_MISMATCH;
4896
4926
  case -10014:
@@ -4902,6 +4932,14 @@ class Le {
4902
4932
  case -10017:
4903
4933
  case -10018:
4904
4934
  return p.PREPARE_MISMATCH;
4935
+ case -10020:
4936
+ return p.CHAIN_NOT_SUPPORTED;
4937
+ case -10021:
4938
+ return p.INVALID_CHAIN;
4939
+ case -10040:
4940
+ return p.HMAC_REQUIRED;
4941
+ case -10041:
4942
+ return p.HMAC_VERIFICATION_FAILED;
4905
4943
  default:
4906
4944
  return p.UNKNOWN_ERROR;
4907
4945
  }
@@ -4910,28 +4948,44 @@ class Le {
4910
4948
  switch (e) {
4911
4949
  case -10002:
4912
4950
  return "Session expired. Please sign in again.";
4951
+ case -10004:
4952
+ return "Wallet already exists for this user.";
4953
+ case -10005:
4954
+ return "User wallet not found.";
4913
4955
  case -10006:
4914
4956
  return "Internal server error. Please try again later.";
4957
+ case -10007:
4958
+ return "Transaction broadcast failed. Please try again.";
4915
4959
  case -10008:
4916
4960
  return "Another operation is in progress. Please try again later.";
4961
+ case -10013:
4962
+ return "Withdraw failed. Please try again.";
4917
4963
  case -10022:
4918
4964
  return "Project is not whitelisted. Verify your projectId and register the current origin in the management console.";
4919
4965
  case -10023:
4920
4966
  return "Project ID is required. Set the projectId field in SDKConfig.";
4921
4967
  case -10024:
4922
- return "Origin is not in the allowed list. Register the current domain in the management console.";
4968
+ return "Origin or App ID is required. Register the current domain or set X-App-Id header.";
4969
+ case -10025:
4970
+ return "Invalid app type. X-App-Type must be android, ios, or windows.";
4923
4971
  case -10026:
4924
4972
  return "Domain chainId mismatch: the chainId in typedData.domain does not match the request chainId.";
4973
+ case -10027:
4974
+ return "Too many incorrect PIN attempts. Your account has been temporarily locked.";
4925
4975
  case -10028:
4926
4976
  return "Incorrect PIN. Please try again.";
4927
4977
  case -10029:
4928
- return "Invalid PIN format. Please enter a 6-digit numeric PIN.";
4929
- case -10031:
4930
- return "Too many failed PIN attempts. Your account is temporarily locked.";
4931
- case -10027:
4932
- return "Too many incorrect PIN attempts. Your account has been temporarily locked.";
4978
+ return "Sequential PIN is not allowed. Please choose a different PIN.";
4933
4979
  case -10030:
4934
4980
  return "Wallet is in an inconsistent state. Please contact support.";
4981
+ case -10031:
4982
+ return "Too many failed PIN attempts. Your account is temporarily locked.";
4983
+ case -10032:
4984
+ return "Repeated digit pattern is not allowed. Please choose a different PIN.";
4985
+ case -10040:
4986
+ return "HMAC signature header is required.";
4987
+ case -10041:
4988
+ return "HMAC signature verification failed.";
4935
4989
  default:
4936
4990
  return `Request failed (${e}): ${s}`;
4937
4991
  }
@@ -6797,7 +6851,7 @@ function bn(r, e = "CROSS", s = 18) {
6797
6851
  return null;
6798
6852
  }
6799
6853
  }
6800
- const Zt = {
6854
+ const Xt = {
6801
6855
  1: "Ethereum Mainnet",
6802
6856
  5: "Goerli Testnet",
6803
6857
  11155111: "Ethereum Sepolia",
@@ -6822,7 +6876,7 @@ const Zt = {
6822
6876
  };
6823
6877
  function Ns(r) {
6824
6878
  const e = parseInt(r.split(":")[1] ?? "", 10);
6825
- return !isNaN(e) && Zt[e] ? Zt[e] : r;
6879
+ return !isNaN(e) && Xt[e] ? Xt[e] : r;
6826
6880
  }
6827
6881
  function dt(r, e) {
6828
6882
  if (r === 0n) return "0";
@@ -6894,7 +6948,7 @@ const xe = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="
6894
6948
  <rect x="12.5" y="11.5" width="3.5" height="2.5" rx="0.75" fill="currentColor"/>
6895
6949
  </svg>`, In = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
6896
6950
  <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)"/>
6897
- </svg>`, Tn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
6951
+ </svg>`, An = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
6898
6952
  <circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
6899
6953
  <circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
6900
6954
  <path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
@@ -6932,7 +6986,7 @@ function Y(r, e) {
6932
6986
  <div class="__crossx-row-value">${e}</div>
6933
6987
  </div>`;
6934
6988
  }
6935
- function An(r, e) {
6989
+ function Tn(r, e) {
6936
6990
  const s = e, t = Ye(r.dappName), n = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
6937
6991
  <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${xe}</button>` : "<span>—</span>", o = Os(r), i = r.data ?? "0x", a = document.createElement("div");
6938
6992
  return a.id = te, a.innerHTML = `
@@ -6974,8 +7028,8 @@ function An(r, e) {
6974
7028
  }
6975
7029
  function Rn(r, e) {
6976
7030
  const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, o = Ye(r.dappName), i = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
6977
- <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${xe}</button>` : "<span>—</span>", a = Os(r), l = bn(r.value, t, n) ?? "—", d = document.createElement("div");
6978
- return d.id = te, d.innerHTML = `
7031
+ <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${xe}</button>` : "<span>—</span>", a = Os(r), l = bn(r.value, t, n) ?? "—", u = document.createElement("div");
7032
+ return u.id = te, u.innerHTML = `
6979
7033
  <div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ce(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
6980
7034
  <div class="__crossx-header">
6981
7035
  <p class="__crossx-title" id="__crossx-ttl">Approve transaction</p>
@@ -7000,7 +7054,7 @@ function Rn(r, e) {
7000
7054
  <button class="__crossx-approve-btn" id="__crossx-confirm-btn">Approve</button>
7001
7055
  </div>
7002
7056
  </div>
7003
- `, d;
7057
+ `, u;
7004
7058
  }
7005
7059
  function Ye(r) {
7006
7060
  var e;
@@ -7078,8 +7132,8 @@ function On(r, e) {
7078
7132
  function Cn(r, e, s) {
7079
7133
  const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", o = r.querySelector("#__crossx-ttl"), i = r.querySelector(".__crossx-header");
7080
7134
  if (o) {
7081
- const w = n ? Tn : t ? "" : In, E = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
7082
- w ? (o.style.display = "flex", o.style.alignItems = "center", o.style.gap = "8px", o.innerHTML = `${w}<span>${E}</span>`) : o.textContent = E;
7135
+ const w = n ? An : t ? "" : In, S = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
7136
+ w ? (o.style.display = "flex", o.style.alignItems = "center", o.style.gap = "8px", o.innerHTML = `${w}<span>${S}</span>`) : o.textContent = S;
7083
7137
  }
7084
7138
  if (i && !r.querySelector("#__crossx-close-btn")) {
7085
7139
  const w = document.createElement("button");
@@ -7089,8 +7143,8 @@ function Cn(r, e, s) {
7089
7143
  if (!a) return;
7090
7144
  const c = e.from ? Y("From", `<span class="__crossx-addr-text">${se(e.from)}</span>
7091
7145
  <button class="__crossx-copy-btn" data-copy="${U(e.from)}" title="Copy address">${xe}</button>`) : "", l = e.to ? Y("To", `<span class="__crossx-addr-text">${se(e.to)}</span>
7092
- <button class="__crossx-copy-btn" data-copy="${U(e.to)}" title="Copy address">${xe}</button>`) : "", d = e.amount ? Y("Transfer", `<span>${U(e.amount)}</span>`) : "", h = e.fees ? Y("Tx Fee", `<span>${U(e.fees)}</span>`) : "", m = e.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(e.txHash)}</span>
7093
- <button class="__crossx-copy-btn" data-copy="${U(e.txHash)}" title="Copy hash">${xe}</button>`) : "", x = e.total ? `<div class="__crossx-total-pill">
7146
+ <button class="__crossx-copy-btn" data-copy="${U(e.to)}" title="Copy address">${xe}</button>`) : "", u = e.amount ? Y("Transfer", `<span>${U(e.amount)}</span>`) : "", h = e.fees ? Y("Tx Fee", `<span>${U(e.fees)}</span>`) : "", m = e.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(e.txHash)}</span>
7147
+ <button class="__crossx-copy-btn" data-copy="${U(e.txHash)}" title="Copy hash">${xe}</button>`) : "", _ = e.total ? `<div class="__crossx-total-pill">
7094
7148
  <span class="__crossx-total-label">Total<br>(including fees)</span>
7095
7149
  <span class="__crossx-total-amount">${U(e.total)}</span>
7096
7150
  </div>` : "";
@@ -7098,18 +7152,18 @@ function Cn(r, e, s) {
7098
7152
  <div class="__crossx-rows">
7099
7153
  ${c}
7100
7154
  ${l}
7101
- ${d}
7155
+ ${u}
7102
7156
  ${h}
7103
7157
  ${m}
7104
7158
  </div>
7105
- ${x}
7159
+ ${_}
7106
7160
  <button class="__crossx-approve-btn" id="__crossx-done-btn">${t ? "All Done" : "Done"}</button>
7107
7161
  `, a.querySelectorAll(".__crossx-copy-btn").forEach((w) => {
7108
- w.addEventListener("click", (E) => {
7109
- var S;
7110
- E.stopPropagation();
7162
+ w.addEventListener("click", (S) => {
7163
+ var E;
7164
+ S.stopPropagation();
7111
7165
  const y = w.dataset.copy;
7112
- y && ((S = navigator.clipboard) == null || S.writeText(y).catch(() => {
7166
+ y && ((E = navigator.clipboard) == null || E.writeText(y).catch(() => {
7113
7167
  }));
7114
7168
  });
7115
7169
  });
@@ -7161,13 +7215,13 @@ function Dn(r, e) {
7161
7215
  <span class="__crossx-td-label">Primary Type</span>
7162
7216
  <span class="__crossx-td-value">${U(o)}</span>
7163
7217
  </div>`;
7164
- for (const [l, d] of Object.entries(i)) {
7165
- const h = Pn(d), x = kn(d) ? `<span class="__crossx-addr-text">${se(d)}</span>
7166
- <button class="__crossx-copy-btn" data-copy="${U(String(d))}" title="Copy">${xe}</button>` : `<span>${h}</span>`;
7218
+ for (const [l, u] of Object.entries(i)) {
7219
+ const h = Pn(u), _ = kn(u) ? `<span class="__crossx-addr-text">${se(u)}</span>
7220
+ <button class="__crossx-copy-btn" data-copy="${U(String(u))}" title="Copy">${xe}</button>` : `<span>${h}</span>`;
7167
7221
  a += `
7168
7222
  <div class="__crossx-td-row">
7169
7223
  <span class="__crossx-td-label">${U(l)}</span>
7170
- <div class="__crossx-td-value">${x}</div>
7224
+ <div class="__crossx-td-value">${_}</div>
7171
7225
  </div>`;
7172
7226
  }
7173
7227
  const c = document.createElement("div");
@@ -7285,14 +7339,14 @@ function Hn(r) {
7285
7339
  </div>
7286
7340
  `, s;
7287
7341
  }
7288
- function Fn(r) {
7289
- const e = r, s = document.createElement("div");
7290
- return s.id = te, s.innerHTML = `
7291
- <div class="__crossx-card __crossx-card--migration" style="${ce(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7342
+ function Fn(r, e = !0) {
7343
+ const s = r, t = e ? `<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ie}</button>` : "", n = e ? '<button class="__crossx-skip-btn" id="__crossx-skip-btn">Skip for Now</button>' : "", o = document.createElement("div");
7344
+ return o.id = te, o.innerHTML = `
7345
+ <div class="__crossx-card __crossx-card--migration" style="${ce(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7292
7346
  <div class="__crossx-header">
7293
7347
  <p class="__crossx-title" id="__crossx-ttl">Wallet Found on Social Account 🎉</p>
7294
7348
  <p class="__crossx-subtitle--body">We found a wallet linked to your social account. Enter your 4-digit PIN to restore your assets.</p>
7295
- <button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ie}</button>
7349
+ ${t}
7296
7350
  </div>
7297
7351
  <hr class="__crossx-divider">
7298
7352
  <div class="__crossx-body">
@@ -7304,13 +7358,13 @@ function Fn(r) {
7304
7358
  <span class="__crossx-recover-icon">${En}</span>
7305
7359
  <span class="__crossx-recover-label">Import from Social Backup</span>
7306
7360
  </button>
7307
- <button class="__crossx-skip-btn" id="__crossx-skip-btn">Skip for Now</button>
7361
+ ${n}
7308
7362
  </div>
7309
7363
  </div>
7310
- `, s;
7364
+ `, o;
7311
7365
  }
7312
7366
  function Gn(r, e) {
7313
- const s = r, { errorMessage: t, attemptCount: n, maxAttempts: o = 5 } = e ?? {}, i = !!t, a = i ? " --error" : "", c = n != null && n > 0 ? `<p class="__crossx-pin-attempt">${n}/${o}</p>` : "", l = n != null && n >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "", d = i ? `<p class="__crossx-pin-error-text">${t}</p>` : "", h = document.createElement("div");
7367
+ const s = r, { errorMessage: t, attemptCount: n, maxAttempts: o = 5 } = e ?? {}, i = !!t, a = i ? " --error" : "", c = n != null && n > 0 ? `<p class="__crossx-pin-attempt">${n}/${o}</p>` : "", l = n != null && n >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "", u = i ? `<p class="__crossx-pin-error-text">${t}</p>` : "", h = document.createElement("div");
7314
7368
  return h.id = te, h.innerHTML = `
7315
7369
  <div class="__crossx-card __crossx-card--migration" style="${ce(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7316
7370
  <div class="__crossx-header">
@@ -7328,7 +7382,7 @@ function Gn(r, e) {
7328
7382
  <input class="__crossx-pin-input${a}" type="tel" maxlength="1" inputmode="numeric" pattern="[0-9]" autocomplete="off">
7329
7383
  </div>
7330
7384
  <p class="__crossx-pin-hint">Enter your 4-digit PIN to recover your wallet.</p>
7331
- ${d}
7385
+ ${u}
7332
7386
  </div>
7333
7387
  </div>
7334
7388
  `, h;
@@ -7410,7 +7464,7 @@ function nt(r) {
7410
7464
  <span id="__crossx-pin6-lock-countdown"></span>
7411
7465
  </p>` : "", a = e ? " --locked" : "", c = Array.from(
7412
7466
  { length: 6 },
7413
- (l, d) => `<input class="__crossx-pin6-box${a}" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]" autocomplete="off" aria-label="PIN digit ${d + 1}"${e ? " disabled" : ""}>`
7467
+ (l, u) => `<input class="__crossx-pin6-box${a}" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]" autocomplete="off" aria-label="PIN digit ${u + 1}"${e ? " disabled" : ""}>`
7414
7468
  ).join("");
7415
7469
  return `
7416
7470
  <div class="__crossx-header">
@@ -7430,7 +7484,7 @@ function nt(r) {
7430
7484
  <div class="__crossx-home-indicator"></div>
7431
7485
  `;
7432
7486
  }
7433
- function Xt(r, e) {
7487
+ function Zt(r, e) {
7434
7488
  const s = document.createElement("div");
7435
7489
  return s.id = te, s.innerHTML = `
7436
7490
  <div class="__crossx-card __crossx-card--pin6" style="${ce(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -7451,15 +7505,15 @@ function zn(r) {
7451
7505
  }
7452
7506
  function ot(r, e, s, t, n, o) {
7453
7507
  let i = !!(o && o > Date.now()), a = !1;
7454
- const c = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), l = () => r.querySelector("#__crossx-pin6-boxes"), d = () => r.querySelector("#__crossx-pin6-error"), h = () => r.querySelector("#__crossx-pin6-lock-msg"), m = () => r.querySelector("#__crossx-pin6-lock-countdown"), x = () => r.querySelector(".__crossx-pin6-body"), w = () => c().map((b) => b.value).join(""), E = (b) => {
7508
+ const c = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), l = () => r.querySelector("#__crossx-pin6-boxes"), u = () => r.querySelector("#__crossx-pin6-error"), h = () => r.querySelector("#__crossx-pin6-lock-msg"), m = () => r.querySelector("#__crossx-pin6-lock-countdown"), _ = () => r.querySelector(".__crossx-pin6-body"), w = () => c().map((b) => b.value).join(""), S = (b) => {
7455
7509
  i = b, c().forEach((k) => {
7456
7510
  k.disabled = b, k.classList.toggle("--locked", b);
7457
7511
  });
7458
7512
  }, y = () => {
7459
- const b = d();
7513
+ const b = u();
7460
7514
  b && (b.textContent = "");
7461
- }, S = (b) => {
7462
- const k = d();
7515
+ }, E = (b) => {
7516
+ const k = u();
7463
7517
  k && (k.textContent = b);
7464
7518
  const P = l();
7465
7519
  P == null || P.classList.add("--shake"), setTimeout(() => P == null ? void 0 : P.classList.remove("--shake"), 500), c().forEach((G) => {
@@ -7470,20 +7524,20 @@ function ot(r, e, s, t, n, o) {
7470
7524
  }, 50);
7471
7525
  }, C = (b) => {
7472
7526
  var W;
7473
- E(!0), c().forEach((q) => {
7527
+ S(!0), c().forEach((q) => {
7474
7528
  q.value = "";
7475
7529
  });
7476
- const k = d();
7530
+ const k = u();
7477
7531
  if (k && (k.textContent = "Too many failed attempts. Please wait."), !h()) {
7478
7532
  const q = document.createElement("p");
7479
7533
  q.className = "__crossx-pin6-lock-msg", q.id = "__crossx-pin6-lock-msg", q.innerHTML = `${Cs}<span id="__crossx-pin6-lock-countdown"></span>`;
7480
- const D = d();
7481
- D ? D.insertAdjacentElement("afterend", q) : (W = x()) == null || W.appendChild(q);
7534
+ const D = u();
7535
+ D ? D.insertAdjacentElement("afterend", q) : (W = _()) == null || W.appendChild(q);
7482
7536
  }
7483
7537
  const P = () => {
7484
7538
  var R;
7485
7539
  const q = b - Date.now(), D = m();
7486
- q <= 0 ? (clearInterval(G), E(!1), (R = h()) == null || R.remove(), k && (k.textContent = ""), setTimeout(() => {
7540
+ q <= 0 ? (clearInterval(G), S(!1), (R = h()) == null || R.remove(), k && (k.textContent = ""), setTimeout(() => {
7487
7541
  var N;
7488
7542
  return (N = c()[0]) == null ? void 0 : N.focus();
7489
7543
  }, 50)) : D && (D.textContent = ` ${zn(q)}`);
@@ -7503,7 +7557,7 @@ function ot(r, e, s, t, n, o) {
7503
7557
  try {
7504
7558
  if (n) {
7505
7559
  const k = await n(b);
7506
- k.ok ? e(b) : k.lockExpiresAt ? C(k.lockExpiresAt) : S(k.error ?? "Incorrect PIN. Please try again.");
7560
+ k.ok ? e(b) : k.lockExpiresAt ? C(k.lockExpiresAt) : E(k.error ?? "Incorrect PIN. Please try again.");
7507
7561
  } else
7508
7562
  e(b);
7509
7563
  } catch (k) {
@@ -7566,9 +7620,9 @@ function Jn(r, e, s) {
7566
7620
  }), o.addEventListener("keypress", (a) => {
7567
7621
  /[0-9]/.test(a.key) || a.preventDefault();
7568
7622
  }), o.addEventListener("paste", (a) => {
7569
- var d;
7623
+ var u;
7570
7624
  a.preventDefault();
7571
- const c = (((d = a.clipboardData) == null ? void 0 : d.getData("text")) ?? "").replace(/\D/g, "").slice(0, 4);
7625
+ const c = (((u = a.clipboardData) == null ? void 0 : u.getData("text")) ?? "").replace(/\D/g, "").slice(0, 4);
7572
7626
  if (!c) return;
7573
7627
  c.split("").forEach((h, m) => {
7574
7628
  t[m] && (t[m].value = h);
@@ -7578,7 +7632,7 @@ function Jn(r, e, s) {
7578
7632
  });
7579
7633
  }), (n = t[0]) == null || n.focus();
7580
7634
  }
7581
- class Zn {
7635
+ class Xn {
7582
7636
  constructor(e = "light", s) {
7583
7637
  this.theme = e, this.overrides = s, this.tokens = Jt(e, s);
7584
7638
  }
@@ -7598,14 +7652,14 @@ class Zn {
7598
7652
  */
7599
7653
  showWalletSelector(e, s, t) {
7600
7654
  return new Promise((n) => {
7601
- var E;
7655
+ var S;
7602
7656
  he();
7603
7657
  const o = [...e], i = $n(o, this.tokens, t), a = document.body.style.overflow;
7604
7658
  document.body.style.overflow = "hidden", pe(i);
7605
7659
  let c = !1;
7606
7660
  const l = () => {
7607
7661
  c || (c = !0, i.remove(), document.body.style.overflow = a);
7608
- }, d = (y) => {
7662
+ }, u = (y) => {
7609
7663
  l(), n(y);
7610
7664
  }, h = () => {
7611
7665
  l(), n(null);
@@ -7613,27 +7667,27 @@ class Zn {
7613
7667
  (() => {
7614
7668
  i.querySelectorAll(".__crossx-wallet-item").forEach((y) => {
7615
7669
  y.addEventListener("click", () => {
7616
- const S = y.dataset.walletAddress ?? "", C = parseInt(y.dataset.walletIndex ?? "0", 10);
7617
- d({ address: S, index: C });
7670
+ const E = y.dataset.walletAddress ?? "", C = parseInt(y.dataset.walletIndex ?? "0", 10);
7671
+ u({ address: E, index: C });
7618
7672
  });
7619
7673
  });
7620
7674
  })();
7621
- const x = i.querySelector("#__crossx-add-wallet-btn");
7622
- x && x.addEventListener("click", async () => {
7623
- x.disabled = !0;
7675
+ const _ = i.querySelector("#__crossx-add-wallet-btn");
7676
+ _ && _.addEventListener("click", async () => {
7677
+ _.disabled = !0;
7624
7678
  try {
7625
7679
  const y = await s();
7626
7680
  o.push(y);
7627
- const S = i.querySelector("#__crossx-wallet-list");
7628
- if (S) {
7681
+ const E = i.querySelector("#__crossx-wallet-list");
7682
+ if (E) {
7629
7683
  const C = document.createElement("button");
7630
- C.className = "__crossx-wallet-item", C.dataset.walletIndex = String(y.index), C.dataset.walletAddress = y.address, C.innerHTML = `<span class="__crossx-wallet-addr">${se(y.address)}</span>`, C.addEventListener("click", () => d(y)), S.appendChild(C), C.scrollIntoView({ behavior: "smooth", block: "nearest" });
7684
+ C.className = "__crossx-wallet-item", C.dataset.walletIndex = String(y.index), C.dataset.walletAddress = y.address, C.innerHTML = `<span class="__crossx-wallet-addr">${se(y.address)}</span>`, C.addEventListener("click", () => u(y)), E.appendChild(C), C.scrollIntoView({ behavior: "smooth", block: "nearest" });
7631
7685
  }
7632
7686
  } catch {
7633
7687
  } finally {
7634
- x.disabled = !1;
7688
+ _.disabled = !1;
7635
7689
  }
7636
- }), (E = i.querySelector("#__crossx-close-btn")) == null || E.addEventListener("click", h), i.addEventListener("click", (y) => {
7690
+ }), (S = i.querySelector("#__crossx-close-btn")) == null || S.addEventListener("click", h), i.addEventListener("click", (y) => {
7637
7691
  y.target === i && h();
7638
7692
  });
7639
7693
  const w = (y) => {
@@ -7653,44 +7707,49 @@ class Zn {
7653
7707
  he();
7654
7708
  const s = Hn(this.tokens);
7655
7709
  pe(s);
7656
- const t = () => s.remove(), n = (d) => {
7657
- t(), e(d);
7710
+ const t = () => s.remove(), n = (u) => {
7711
+ t(), e(u);
7658
7712
  }, o = () => {
7659
7713
  t(), e(null);
7660
7714
  };
7661
- (a = s.querySelector("#__crossx-apple-btn")) == null || a.addEventListener("click", () => n("apple")), (c = s.querySelector("#__crossx-google-btn")) == null || c.addEventListener("click", () => n("google")), (l = s.querySelector("#__crossx-close-btn")) == null || l.addEventListener("click", o), s.addEventListener("click", (d) => {
7662
- d.target === s && o();
7663
- }), s.querySelectorAll(".__crossx-login-terms-link").forEach((d) => {
7664
- d.addEventListener("click", (h) => h.stopPropagation());
7715
+ (a = s.querySelector("#__crossx-apple-btn")) == null || a.addEventListener("click", () => n("apple")), (c = s.querySelector("#__crossx-google-btn")) == null || c.addEventListener("click", () => n("google")), (l = s.querySelector("#__crossx-close-btn")) == null || l.addEventListener("click", o), s.addEventListener("click", (u) => {
7716
+ u.target === s && o();
7717
+ }), s.querySelectorAll(".__crossx-login-terms-link").forEach((u) => {
7718
+ u.addEventListener("click", (h) => h.stopPropagation());
7665
7719
  });
7666
- const i = (d) => {
7667
- d.key === "Escape" && (document.removeEventListener("keydown", i), o());
7720
+ const i = (u) => {
7721
+ u.key === "Escape" && (document.removeEventListener("keydown", i), o());
7668
7722
  };
7669
7723
  document.addEventListener("keydown", i);
7670
7724
  });
7671
7725
  }
7672
7726
  /**
7673
7727
  * 마이그레이션 발견 팝업: "Wallet Found on Social Account"
7728
+ * @param options.allowSkip false이면 Skip/닫기/오버레이/ESC 모두 비활성화
7674
7729
  * @returns 'recover' 또는 'skip'
7675
7730
  */
7676
- showMigrationFoundPrompt() {
7677
- return new Promise((e) => {
7731
+ showMigrationFoundPrompt(e) {
7732
+ const s = (e == null ? void 0 : e.allowSkip) ?? !0;
7733
+ return new Promise((t) => {
7678
7734
  var a, c, l;
7679
7735
  he();
7680
- const s = Fn(this.tokens);
7681
- pe(s);
7682
- const t = () => s.remove(), n = () => {
7683
- t(), e("recover");
7684
- }, o = () => {
7685
- t(), e("skip");
7686
- };
7687
- (a = s.querySelector("#__crossx-recover-btn")) == null || a.addEventListener("click", n), (c = s.querySelector("#__crossx-skip-btn")) == null || c.addEventListener("click", o), (l = s.querySelector("#__crossx-close-btn")) == null || l.addEventListener("click", o), s.addEventListener("click", (d) => {
7688
- d.target === s && o();
7689
- });
7690
- const i = (d) => {
7691
- d.key === "Escape" && (document.removeEventListener("keydown", i), o());
7736
+ const n = Fn(this.tokens, s);
7737
+ pe(n);
7738
+ const o = () => n.remove(), i = () => {
7739
+ o(), t("recover");
7692
7740
  };
7693
- document.addEventListener("keydown", i);
7741
+ if ((a = n.querySelector("#__crossx-recover-btn")) == null || a.addEventListener("click", i), s) {
7742
+ const u = () => {
7743
+ o(), t("skip");
7744
+ };
7745
+ (c = n.querySelector("#__crossx-skip-btn")) == null || c.addEventListener("click", u), (l = n.querySelector("#__crossx-close-btn")) == null || l.addEventListener("click", u), n.addEventListener("click", (m) => {
7746
+ m.target === n && u();
7747
+ });
7748
+ const h = (m) => {
7749
+ m.key === "Escape" && (document.removeEventListener("keydown", h), u());
7750
+ };
7751
+ document.addEventListener("keydown", h);
7752
+ }
7694
7753
  });
7695
7754
  }
7696
7755
  /**
@@ -7720,44 +7779,44 @@ class Zn {
7720
7779
  }, i = {
7721
7780
  title: (t == null ? void 0 : t.pinSetup_confirmTitle) ?? "Confirm PIN",
7722
7781
  headerSubtitle: (t == null ? void 0 : t.pinSetup_confirmSubtitle) ?? "Enter your PIN again to confirm."
7723
- }, a = Xt(this.tokens, Kn(n)), c = document.body.style.overflow;
7782
+ }, a = Zt(this.tokens, Kn(n)), c = document.body.style.overflow;
7724
7783
  document.body.style.overflow = "hidden", pe(a);
7725
7784
  let l = !1;
7726
- const d = () => {
7785
+ const u = () => {
7727
7786
  l || (l = !0, a.remove(), document.body.style.overflow = c);
7728
7787
  }, h = (C) => {
7729
- d(), s(C);
7788
+ u(), s(C);
7730
7789
  }, m = () => {
7731
- d(), s(null);
7732
- }, x = a.querySelector(".__crossx-card"), w = {
7790
+ u(), s(null);
7791
+ }, _ = a.querySelector(".__crossx-card"), w = {
7733
7792
  tooShort: (t == null ? void 0 : t.pinValidation_tooShort) ?? "Please enter a 6-digit PIN.",
7734
7793
  numbersOnly: (t == null ? void 0 : t.pinValidation_numbersOnly) ?? "Only numbers (0-9) are allowed.",
7735
7794
  repeatingDigit: (t == null ? void 0 : t.pinValidation_repeatingDigit) ?? "Cannot use the same number 3+ times in a row.",
7736
7795
  sequential: (t == null ? void 0 : t.pinValidation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
7737
7796
  alternatingPattern: (t == null ? void 0 : t.pinValidation_alternatingPattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
7738
- }, E = (C) => {
7797
+ }, S = (C) => {
7739
7798
  var B;
7740
- x.innerHTML = nt({
7799
+ _.innerHTML = nt({
7741
7800
  title: i.title,
7742
7801
  headerSubtitle: i.headerSubtitle
7743
- }), (B = x.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), ot(x, (b) => {
7802
+ }), (B = _.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), ot(_, (b) => {
7744
7803
  b === C ? h(C) : y(o.mismatchError);
7745
7804
  }, m);
7746
7805
  }, y = (C) => {
7747
7806
  var B;
7748
- x.innerHTML = nt({
7807
+ _.innerHTML = nt({
7749
7808
  title: o.title,
7750
7809
  headerSubtitle: o.headerSubtitle,
7751
7810
  subtitle: o.subtitle,
7752
7811
  errorMessage: C
7753
- }), (B = x.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), ot(x, (b) => {
7812
+ }), (B = _.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), ot(_, (b) => {
7754
7813
  const k = Vn(b, w);
7755
- k ? y(k) : E(b);
7814
+ k ? y(k) : S(b);
7756
7815
  }, m);
7757
7816
  };
7758
7817
  (() => {
7759
7818
  var q;
7760
- const C = Array.from(x.querySelectorAll(".__crossx-pw-notice-item")), B = x.querySelector("#__crossx-pin-notice-next"), b = /* @__PURE__ */ new Set();
7819
+ const C = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), B = _.querySelector("#__crossx-pin-notice-next"), b = /* @__PURE__ */ new Set();
7761
7820
  B.removeAttribute("disabled");
7762
7821
  const k = B.dataset.nextLabel ?? "Next", P = B.dataset.submitLabel ?? "I Understand", G = () => {
7763
7822
  const D = b.size === C.length;
@@ -7792,7 +7851,7 @@ class Zn {
7792
7851
  D.scrollIntoView({ behavior: "smooth", block: "nearest" }), D.classList.add("--highlight"), setTimeout(() => {
7793
7852
  D.classList.remove("--highlight"), z(D, R);
7794
7853
  }, 400);
7795
- }), (q = x.querySelector("#__crossx-close-btn")) == null || q.addEventListener("click", m);
7854
+ }), (q = _.querySelector("#__crossx-close-btn")) == null || q.addEventListener("click", m);
7796
7855
  })(), a.addEventListener("click", (C) => {
7797
7856
  C.target === a && m();
7798
7857
  });
@@ -7807,7 +7866,7 @@ class Zn {
7807
7866
  return new Promise((s, t) => {
7808
7867
  var y;
7809
7868
  he();
7810
- const n = this.messages, o = (e == null ? void 0 : e.verifyMode) === !0, i = o ? (n == null ? void 0 : n.verifyPin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pinInput_title) ?? "Enter PIN", a = o ? (n == null ? void 0 : n.verifyPin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pinInput_subtitle) ?? "Enter your 6-digit PIN to continue.", c = Xt(
7869
+ const n = this.messages, o = (e == null ? void 0 : e.verifyMode) === !0, i = o ? (n == null ? void 0 : n.verifyPin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pinInput_title) ?? "Enter PIN", a = o ? (n == null ? void 0 : n.verifyPin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pinInput_subtitle) ?? "Enter your 6-digit PIN to continue.", c = Zt(
7811
7870
  this.tokens,
7812
7871
  nt({
7813
7872
  title: i,
@@ -7817,18 +7876,18 @@ class Zn {
7817
7876
  })
7818
7877
  ), l = document.body.style.overflow;
7819
7878
  document.body.style.overflow = "hidden", pe(c);
7820
- let d = !1;
7879
+ let u = !1;
7821
7880
  const h = () => {
7822
- d || (d = !0, c.remove(), document.body.style.overflow = l);
7823
- }, m = (S) => {
7824
- h(), s(S);
7825
- }, x = () => {
7881
+ u || (u = !0, c.remove(), document.body.style.overflow = l);
7882
+ }, m = (E) => {
7883
+ h(), s(E);
7884
+ }, _ = () => {
7826
7885
  h(), s(null);
7827
- }, w = (S) => {
7828
- h(), t(S);
7829
- }, E = c.querySelector(".__crossx-card");
7830
- (y = E.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", x), ot(E, m, x, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (S) => {
7831
- S.target === c && x();
7886
+ }, w = (E) => {
7887
+ h(), t(E);
7888
+ }, S = c.querySelector(".__crossx-card");
7889
+ (y = S.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", _), ot(S, m, _, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (E) => {
7890
+ E.target === c && _();
7832
7891
  });
7833
7892
  });
7834
7893
  }
@@ -7872,8 +7931,8 @@ class Zn {
7872
7931
  }, a = () => {
7873
7932
  i(), t();
7874
7933
  }, c = o(a);
7875
- (l = n.querySelector("#__crossx-close-btn")) == null || l.addEventListener("click", a), n.addEventListener("click", (d) => {
7876
- d.target === n && a();
7934
+ (l = n.querySelector("#__crossx-close-btn")) == null || l.addEventListener("click", a), n.addEventListener("click", (u) => {
7935
+ u.target === n && a();
7877
7936
  });
7878
7937
  });
7879
7938
  }
@@ -7891,9 +7950,9 @@ class Zn {
7891
7950
  n(), s();
7892
7951
  };
7893
7952
  (a = t.querySelector("#__crossx-done-btn")) == null || a.addEventListener("click", o), (c = t.querySelector("#__crossx-close-btn")) == null || c.addEventListener("click", o), t.querySelectorAll(".__crossx-copy-btn").forEach((l) => {
7894
- l.addEventListener("click", (d) => {
7953
+ l.addEventListener("click", (u) => {
7895
7954
  var m;
7896
- d.stopPropagation();
7955
+ u.stopPropagation();
7897
7956
  const h = l.dataset.copy;
7898
7957
  h && ((m = navigator.clipboard) == null || m.writeText(h).catch(() => {
7899
7958
  }));
@@ -7921,8 +7980,8 @@ class Zn {
7921
7980
  const a = () => {
7922
7981
  i || (i = !0, o(), t());
7923
7982
  }, c = () => {
7924
- var d, h;
7925
- (d = n.querySelector("#__crossx-done-btn")) == null || d.addEventListener("click", a), (h = n.querySelector("#__crossx-close-btn")) == null || h.addEventListener("click", a), n.addEventListener("click", (m) => {
7983
+ var u, h;
7984
+ (u = n.querySelector("#__crossx-done-btn")) == null || u.addEventListener("click", a), (h = n.querySelector("#__crossx-close-btn")) == null || h.addEventListener("click", a), n.addEventListener("click", (m) => {
7926
7985
  m.target === n && a();
7927
7986
  });
7928
7987
  const l = (m) => {
@@ -7937,21 +7996,21 @@ class Zn {
7937
7996
  }
7938
7997
  requestConfirmation(e) {
7939
7998
  return new Promise((s) => {
7940
- var c, l, d;
7999
+ var c, l, u;
7941
8000
  he();
7942
8001
  let t;
7943
- e.type === "sign-message" ? t = Ln(e, this.tokens) : e.type === "sign-typed-data" ? t = Dn(e, this.tokens) : e.type === "sign" ? t = An(e, this.tokens) : t = Rn(e, this.tokens), pe(t);
8002
+ e.type === "sign-message" ? t = Ln(e, this.tokens) : e.type === "sign-typed-data" ? t = Dn(e, this.tokens) : e.type === "sign" ? t = Tn(e, this.tokens) : t = Rn(e, this.tokens), pe(t);
7944
8003
  const n = () => t.remove(), o = () => {
7945
8004
  n(), s(!0);
7946
8005
  }, i = () => {
7947
8006
  n(), s(!1);
7948
8007
  };
7949
- (c = t.querySelector("#__crossx-confirm-btn")) == null || c.addEventListener("click", o), (l = t.querySelector("#__crossx-cancel-btn")) == null || l.addEventListener("click", i), (d = t.querySelector("#__crossx-close-btn")) == null || d.addEventListener("click", i), t.querySelectorAll(".__crossx-copy-btn").forEach((h) => {
8008
+ (c = t.querySelector("#__crossx-confirm-btn")) == null || c.addEventListener("click", o), (l = t.querySelector("#__crossx-cancel-btn")) == null || l.addEventListener("click", i), (u = t.querySelector("#__crossx-close-btn")) == null || u.addEventListener("click", i), t.querySelectorAll(".__crossx-copy-btn").forEach((h) => {
7950
8009
  h.addEventListener("click", (m) => {
7951
8010
  var w;
7952
8011
  m.stopPropagation();
7953
- const x = h.dataset.copy;
7954
- x && ((w = navigator.clipboard) == null || w.writeText(x).catch(() => {
8012
+ const _ = h.dataset.copy;
8013
+ _ && ((w = navigator.clipboard) == null || w.writeText(_).catch(() => {
7955
8014
  }));
7956
8015
  });
7957
8016
  }), t.addEventListener("click", (h) => {
@@ -7964,7 +8023,7 @@ class Zn {
7964
8023
  });
7965
8024
  }
7966
8025
  }
7967
- class Xn {
8026
+ class Zn {
7968
8027
  constructor() {
7969
8028
  this._accessToken = null, this._expiresAt = 0;
7970
8029
  }
@@ -7998,21 +8057,21 @@ function so(r, e) {
7998
8057
  gatewayUrl: s.walletGatewayUrl,
7999
8058
  projectId: r.projectId
8000
8059
  }, o = t.authMode !== "cookie" && Ot.isAvailable();
8001
- !o && t.authMode !== "cookie" && u.warn(
8060
+ !o && t.authMode !== "cookie" && d.warn(
8002
8061
  "[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
8003
8062
  "refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
8004
8063
  "IndexedDB를 지원하는 브라우저 사용을 권장합니다."
8005
8064
  ), t.secureStorageAvailable = o;
8006
- const i = o ? new Ot(r.projectId) : new rr(), a = new hn(), c = new xn(), l = new be(), d = new Xn(), h = new es();
8065
+ const i = o ? new Ot(r.projectId) : new rr(), a = new hn(), c = new xn(), l = new be(), u = new Zn(), h = new es();
8007
8066
  let m;
8008
- r.useMockWallet ? (u.log("[CROSSx] Mock Wallet Provider 사용"), m = new mn(i, h)) : (u.log("[CROSSx] Remote Wallet Provider 사용"), m = new Le(
8067
+ r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), m = new mn(i, h)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), m = new Le(
8009
8068
  n,
8010
8069
  i,
8011
8070
  c,
8012
- d,
8071
+ u,
8013
8072
  h
8014
8073
  ));
8015
- const x = new De(n, c), w = new Zn(r.theme ?? "light", r.themeTokens), E = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w;
8074
+ const _ = new De(n, c), w = new Xn(r.theme ?? "light", r.themeTokens), S = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w;
8016
8075
  return new it(
8017
8076
  t,
8018
8077
  n,
@@ -8021,9 +8080,9 @@ function so(r, e) {
8021
8080
  c,
8022
8081
  l,
8023
8082
  m,
8024
- d,
8025
- E,
8026
- x,
8083
+ u,
8084
+ S,
8085
+ _,
8027
8086
  h
8028
8087
  );
8029
8088
  }
@@ -8033,5 +8092,7 @@ export {
8033
8092
  it as CROSSxSDK,
8034
8093
  to as ChainId,
8035
8094
  p as ErrorCode,
8095
+ es as PinMemoryStore,
8096
+ Zn as TokenMemoryStore,
8036
8097
  so as createCROSSxSDK
8037
8098
  };