@nexus-cross/crossx-sdk-core 1.0.1 → 1.0.2-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
@@ -3,9 +3,9 @@ var Is = (r, e, s) => e in r ? Ts(r, e, { enumerable: !0, configurable: !0, writ
3
3
  var v = (r, e, s) => Is(r, typeof e != "symbol" ? e + "" : e, s);
4
4
  import { decodeJwt as As } from "jose";
5
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.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.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", 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.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(p || {});
6
- class x extends Error {
6
+ class _ extends Error {
7
7
  constructor(e, s, t) {
8
- super(s), this.code = e, this.details = t, this.name = "CROSSxError", Object.setPrototypeOf(this, x.prototype);
8
+ super(s), this.code = e, this.details = t, this.name = "CROSSxError", Object.setPrototypeOf(this, _.prototype);
9
9
  }
10
10
  toJSON() {
11
11
  return {
@@ -106,7 +106,7 @@ class Cs {
106
106
  }
107
107
  case "personal_sign":
108
108
  case "eth_sign":
109
- throw new x(
109
+ throw new _(
110
110
  p.NOT_IMPLEMENTED,
111
111
  `${e} is not yet supported. Use sdk.signMessage() directly.`
112
112
  );
@@ -114,7 +114,7 @@ class Cs {
114
114
  case "eth_signTypedData_v1":
115
115
  case "eth_signTypedData_v3":
116
116
  case "eth_signTypedData_v4":
117
- throw new x(
117
+ throw new _(
118
118
  p.NOT_IMPLEMENTED,
119
119
  `${e} is not yet supported. Use sdk.signTypedData() or sdk.signTypedDataOffchain() directly.`
120
120
  );
@@ -168,7 +168,7 @@ let we = null;
168
168
  function wt(r) {
169
169
  we = r;
170
170
  }
171
- const g = {
171
+ const f = {
172
172
  log(...r) {
173
173
  if (we) {
174
174
  we.log(...r);
@@ -202,7 +202,7 @@ class ks {
202
202
  */
203
203
  checkResponseError(e, s) {
204
204
  if (e != null && e.code && e.code !== 200 && e.code > 0)
205
- throw new x(
205
+ throw new _(
206
206
  p.AUTH_FAILED,
207
207
  `${s} failed (code ${e.code}): ${e.message}`
208
208
  );
@@ -210,7 +210,7 @@ class ks {
210
210
  if (typeof t == "object" && t !== null && "code" in t) {
211
211
  const n = t;
212
212
  if (n.code && n.code !== 200 && n.code > 0)
213
- throw new x(
213
+ throw new _(
214
214
  p.AUTH_FAILED,
215
215
  `${s} failed (code ${n.code}): ${n.message}`
216
216
  );
@@ -223,55 +223,55 @@ class ks {
223
223
  const c = e == null ? void 0 : e.provider;
224
224
  let l = "/login";
225
225
  c === "google" ? l = "/google" : c === "apple" && (l = "/apple");
226
- const { oauthServiceUrl: d, authApiUrl: f } = this.config, w = `${d}${l}`;
227
- g.log(`[CROSSx] OAuth 팝업 열기 (${c || "일반"} 로그인):`, w);
228
- const m = await this.oauth.openAuth({
229
- authUrl: w,
226
+ const { oauthServiceUrl: d, authApiUrl: g } = this.config, m = `${d}${l}`;
227
+ f.log(`[CROSSx] OAuth 팝업 열기 (${c || "일반"} 로그인):`, m);
228
+ const x = await this.oauth.openAuth({
229
+ authUrl: m,
230
230
  expectedOrigin: new URL(d).origin
231
231
  });
232
- g.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", m.length, ")");
233
- const { accessToken: _, refreshToken: T } = await this.exchangeFirebaseToken(m, f);
234
- let b, A;
232
+ f.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", x.length, ")");
233
+ const { accessToken: w, refreshToken: b } = await this.exchangeFirebaseToken(x, g);
234
+ let S, E;
235
235
  try {
236
- const M = this.crypto.decodeJWT(m);
237
- A = (n = M.firebase) == null ? void 0 : n.sign_in_provider;
236
+ const M = this.crypto.decodeJWT(x);
237
+ E = (n = M.firebase) == null ? void 0 : n.sign_in_provider;
238
238
  const D = ((o = M.firebase) == null ? void 0 : o.identities) ?? {};
239
- A === "google.com" ? b = (i = D["google.com"]) == null ? void 0 : i[0] : A === "apple.com" && (b = (a = D["apple.com"]) == null ? void 0 : a[0]), g.log("[CROSSx] OAuth provider sub 추출 — provider:", A, "hasProviderSub:", !!b);
239
+ E === "google.com" ? S = (i = D["google.com"]) == null ? void 0 : i[0] : E === "apple.com" && (S = (a = D["apple.com"]) == null ? void 0 : a[0]), f.log("[CROSSx] OAuth provider sub 추출 — provider:", E, "hasProviderSub:", !!S);
240
240
  } catch {
241
- g.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
241
+ f.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
242
242
  }
243
- if (_) {
244
- const M = this.crypto.decodeJWT(_);
245
- g.log("[CROSSx] access_token 디코딩 — sub:", M.sub, "exp:", M.exp);
246
- const D = await this.crypto.verifyJWT(_);
243
+ if (w) {
244
+ const M = this.crypto.decodeJWT(w);
245
+ f.log("[CROSSx] access_token 디코딩 — sub:", M.sub, "exp:", M.exp);
246
+ const D = await this.crypto.verifyJWT(w);
247
247
  if (t = D.signatureVerified ?? !1, !D.valid)
248
- throw g.error("[CROSSx] access_token 검증 실패"), new Error("Invalid access token");
248
+ throw f.error("[CROSSx] access_token 검증 실패"), new Error("Invalid access token");
249
249
  const B = D.payload;
250
250
  s = {
251
251
  id: B.sub,
252
252
  email: B.email,
253
- signInProvider: A,
254
- providerSub: b
255
- }, this.tokenStore.set(_), this.useCookieAuth || (await this.storage.set(Ye, _), T && await this.storage.set(Ne, T));
253
+ signInProvider: E,
254
+ providerSub: S
255
+ }, this.tokenStore.set(w), this.useCookieAuth || (await this.storage.set(Ye, w), b && await this.storage.set(Ne, b));
256
256
  } else {
257
- const M = this.crypto.decodeJWT(m);
257
+ const M = this.crypto.decodeJWT(x);
258
258
  s = {
259
259
  id: M.sub,
260
260
  email: M.email,
261
- signInProvider: A,
262
- providerSub: b
263
- }, g.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", s.id);
261
+ signInProvider: E,
262
+ providerSub: S
263
+ }, f.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", s.id);
264
264
  }
265
- g.log("[CROSSx] 사용자 정보 — id:", s.id);
265
+ f.log("[CROSSx] 사용자 정보 — id:", s.id);
266
266
  const q = this.useCookieAuth ? { id: s.id, signInProvider: s.signInProvider, providerSub: s.providerSub } : s;
267
- await this.storage.set(Pe, q), g.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
267
+ await this.storage.set(Pe, q), f.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
268
268
  } catch (c) {
269
- return g.error("[CROSSx] SignIn 에러 (OAuth/토큰 교환 단계):", c), {
269
+ return f.error("[CROSSx] SignIn 에러 (OAuth/토큰 교환 단계):", c), {
270
270
  success: !1,
271
271
  error: c instanceof Error ? c.message : "Sign in failed"
272
272
  };
273
273
  }
274
- return g.log("[CROSSx][Migration Phase 1] OAuth 로그인 완료, 지갑 로드 시작 — userId:", s.id), this.loadWallet(s, t);
274
+ return f.log("[CROSSx][Migration Phase 1] OAuth 로그인 완료, 지갑 로드 시작 — userId:", s.id), this.loadWallet(s, t);
275
275
  }
276
276
  /**
277
277
  * Firebase 토큰 → CROSSx 인증 교환
@@ -280,7 +280,7 @@ class ks {
280
280
  */
281
281
  async exchangeFirebaseToken(e, s) {
282
282
  const t = this.useCookieAuth, n = t ? `${s}/cross-auth/social/login/cookie` : `${s}/cross-auth/social/login`;
283
- g.log("[CROSSx] Firebase 토큰 교환 요청:", n);
283
+ f.log("[CROSSx] Firebase 토큰 교환 요청:", n);
284
284
  const o = await this.transport.request({
285
285
  url: n,
286
286
  method: "POST",
@@ -288,18 +288,18 @@ class ks {
288
288
  body: { auth_code: e, login_type: "firebase" },
289
289
  ...t ? { credentials: "include" } : {}
290
290
  });
291
- g.log("[CROSSx] 토큰 교환 응답 — status:", o.status);
291
+ f.log("[CROSSx] 토큰 교환 응답 — status:", o.status);
292
292
  const i = o.data;
293
293
  this.checkResponseError(i, "Token exchange");
294
294
  const a = this.extractAccessToken(i);
295
295
  if (t && !a)
296
- return g.log("[CROSSx] Cookie 모드 — 로그인 성공 (JWT는 HttpOnly 쿠키)"), {};
296
+ return f.log("[CROSSx] Cookie 모드 — 로그인 성공 (JWT는 HttpOnly 쿠키)"), {};
297
297
  if (!a)
298
- throw new x(
298
+ throw new _(
299
299
  p.AUTH_FAILED,
300
300
  "access_token not found in exchange response"
301
301
  );
302
- g.log("[CROSSx] access_token 교환 성공");
302
+ f.log("[CROSSx] access_token 교환 성공");
303
303
  let c;
304
304
  return t || (c = this.extractRefreshToken(i)), { accessToken: a, refreshToken: c };
305
305
  }
@@ -361,38 +361,38 @@ class ks {
361
361
  if (t.valid) {
362
362
  const n = await this.storage.get(Pe);
363
363
  if (n)
364
- return g.log("[CROSSx] restoreSession — 메모리 토큰 유효, 세션 복원"), this.loadWallet(n, t.signatureVerified);
364
+ return f.log("[CROSSx] restoreSession — 메모리 토큰 유효, 세션 복원"), this.loadWallet(n, t.signatureVerified);
365
365
  }
366
366
  this.tokenStore.clear();
367
367
  }
368
368
  if (this.useCookieAuth) {
369
- g.log("[CROSSx] restoreSession — 쿠키 기반 silentRefresh 시도");
369
+ f.log("[CROSSx] restoreSession — 쿠키 기반 silentRefresh 시도");
370
370
  const t = await this.silentRefresh();
371
371
  t && this.tokenStore.set(t);
372
372
  } else {
373
373
  const t = await this.storage.get(Ye), n = await this.storage.get(Ne);
374
- if (g.log(
374
+ if (f.log(
375
375
  "[CROSSx] restoreSession — access_token:",
376
376
  t ? "있음" : "없음",
377
377
  "refresh_token:",
378
378
  n ? "있음" : "없음"
379
379
  ), !n)
380
- return g.log("[CROSSx] restoreSession — refresh_token 없음, 세션 복원 생략"), null;
380
+ return f.log("[CROSSx] restoreSession — refresh_token 없음, 세션 복원 생략"), null;
381
381
  t && this.tokenStore.set(t);
382
382
  const o = await this.silentRefresh(n);
383
- g.log("[CROSSx] restoreSession — silentRefresh 결과:", o ? "토큰 발급 성공" : "토큰 없음"), o && this.tokenStore.set(o);
383
+ f.log("[CROSSx] restoreSession — silentRefresh 결과:", o ? "토큰 발급 성공" : "토큰 없음"), o && this.tokenStore.set(o);
384
384
  }
385
385
  const s = await this.storage.get(Pe);
386
- if (g.log("[CROSSx] restoreSession — userInfo 조회:", s ? `있음 (id: ${s.id})` : "없음"), !s)
386
+ if (f.log("[CROSSx] restoreSession — userInfo 조회:", s ? `있음 (id: ${s.id})` : "없음"), !s)
387
387
  return null;
388
- g.log("[CROSSx] restoreSession — silentRefresh 성공, 세션 복원 — userId:", s.id);
388
+ f.log("[CROSSx] restoreSession — silentRefresh 성공, 세션 복원 — userId:", s.id);
389
389
  try {
390
390
  return await this.loadWallet(s, !1);
391
391
  } catch (t) {
392
- return g.warn("[CROSSx] restoreSession — 지갑 로드 실패 (세션은 유지):", t), { success: !0, user: s, tokenSignatureVerified: !1 };
392
+ return f.warn("[CROSSx] restoreSession — 지갑 로드 실패 (세션은 유지):", t), { success: !0, user: s, tokenSignatureVerified: !1 };
393
393
  }
394
394
  } catch (e) {
395
- return g.log("[CROSSx] restoreSession — 세션 복원 실패, 스토리지 정리:", e), this.tokenStore.clear(), this.useCookieAuth || await this.storage.remove(Ne), await this.storage.remove(Pe), null;
395
+ return f.log("[CROSSx] restoreSession — 세션 복원 실패, 스토리지 정리:", e), this.tokenStore.clear(), this.useCookieAuth || await this.storage.remove(Ne), await this.storage.remove(Pe), null;
396
396
  }
397
397
  }
398
398
  /**
@@ -418,37 +418,37 @@ class ks {
418
418
  body: o,
419
419
  ...t ? { credentials: "include" } : {}
420
420
  });
421
- g.log("[CROSSx] silentRefresh 응답 — status:", i.status);
421
+ f.log("[CROSSx] silentRefresh 응답 — status:", i.status);
422
422
  const a = i.data;
423
423
  this.checkResponseError(a, "Silent refresh");
424
424
  const c = this.extractAccessToken(a);
425
425
  if (t && !c) {
426
- g.log("[CROSSx] silentRefresh 성공 (cookie 갱신)");
426
+ f.log("[CROSSx] silentRefresh 성공 (cookie 갱신)");
427
427
  return;
428
428
  }
429
429
  if (!c)
430
- throw new x(p.AUTH_FAILED, "Silent refresh failed: no token in response");
430
+ throw new _(p.AUTH_FAILED, "Silent refresh failed: no token in response");
431
431
  if (this.tokenStore.set(c), !t) {
432
432
  await this.storage.set(Ye, c);
433
433
  const l = this.extractRefreshToken(a);
434
434
  l && await this.storage.set(Ne, l);
435
435
  }
436
- return g.log("[CROSSx] silentRefresh 성공"), c;
436
+ return f.log("[CROSSx] silentRefresh 성공"), c;
437
437
  }
438
438
  async loadWallet(e, s) {
439
439
  let t, n = !1;
440
440
  try {
441
- g.log("[CROSSx][Migration Phase 2] POST /mnemonic/create 호출 — userId:", e.id), t = (await this.walletProvider.getOrCreateWallet(e.id)).address, g.log("[CROSSx][Migration Phase 2] 지갑 로드 완료 (기존 백업 없음) — address:", t);
441
+ f.log("[CROSSx][Migration Phase 2] POST /mnemonic/create 호출 — userId:", e.id), t = (await this.walletProvider.getOrCreateWallet(e.id)).address, f.log("[CROSSx][Migration Phase 2] 지갑 로드 완료 (기존 백업 없음) — address:", t);
442
442
  } catch (o) {
443
- if (o instanceof x && o.code === p.MIGRATION_BACKUP_EXISTS)
444
- g.log("[CROSSx][Migration Phase 2] Gateway -10012 감지 → needsMigration = true"), n = !0;
443
+ if (o instanceof _ && o.code === p.MIGRATION_BACKUP_EXISTS)
444
+ f.log("[CROSSx][Migration Phase 2] Gateway -10012 감지 → needsMigration = true"), n = !0;
445
445
  else {
446
- if (o instanceof x && (o.code === p.PROJECT_NOT_REGISTERED || o.code === p.PROJECT_ID_MISSING || o.code === p.ORIGIN_NOT_ALLOWED))
447
- throw g.error("[CROSSx][Migration Phase 2] 프로젝트 설정 에러:", o.message), o;
448
- g.warn("[CROSSx][Migration Phase 2] 지갑 로드 실패 (로그인은 유지):", o);
446
+ if (o instanceof _ && (o.code === p.PROJECT_NOT_REGISTERED || o.code === p.PROJECT_ID_MISSING || o.code === p.ORIGIN_NOT_ALLOWED))
447
+ throw f.error("[CROSSx][Migration Phase 2] 프로젝트 설정 에러:", o.message), o;
448
+ f.warn("[CROSSx][Migration Phase 2] 지갑 로드 실패 (로그인은 유지):", o);
449
449
  }
450
450
  }
451
- return g.log("[CROSSx][Migration Phase 2] loadWallet 결과 — address:", t, "needsMigration:", n), { success: !0, address: t, user: e, needsMigration: n, tokenSignatureVerified: s };
451
+ return f.log("[CROSSx][Migration Phase 2] loadWallet 결과 — address:", t, "needsMigration:", n), { success: !0, address: t, user: e, needsMigration: n, tokenSignatureVerified: s };
452
452
  }
453
453
  }
454
454
  const Ns = "crossx_access_token", Ps = "crossx_refresh_token", Ls = "crossx_user_info";
@@ -466,13 +466,13 @@ class $s {
466
466
  }
467
467
  async execute(e, s) {
468
468
  if (!this.walletProvider.migrateWallet)
469
- throw new x(
469
+ throw new _(
470
470
  p.NOT_IMPLEMENTED,
471
471
  "Migration is not supported in the current environment"
472
472
  );
473
- g.log("[CROSSx][Migration Phase 4] MigrateWalletUseCase.execute() — pin 길이:", e.length, "sub:", s);
473
+ f.log("[CROSSx][Migration Phase 4] MigrateWalletUseCase.execute() — pin 길이:", e.length, "sub:", s);
474
474
  const t = await this.walletProvider.migrateWallet(e, s);
475
- return g.log("[CROSSx][Migration Phase 5] MigrateWalletUseCase 완료 — address:", t.address), {
475
+ return f.log("[CROSSx][Migration Phase 5] MigrateWalletUseCase 완료 — address:", t.address), {
476
476
  address: t.address
477
477
  };
478
478
  }
@@ -502,7 +502,7 @@ class Bs {
502
502
  body: o
503
503
  })).data;
504
504
  if (a != null && a.error)
505
- throw new x(
505
+ throw new _(
506
506
  p.UNKNOWN_ERROR,
507
507
  `RPC error [${e}] (${t}): ${a.error.message} (code: ${a.error.code})`
508
508
  );
@@ -609,7 +609,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
609
609
  const s = await this.signInUseCase.restoreSession();
610
610
  return s != null && s.success && this.applyAuthResult(s), this.initialized = !0, this.emit("initialized", { restored: !!(s != null && s.success) }), s ?? null;
611
611
  } catch (e) {
612
- throw new x(p.AUTH_NOT_INITIALIZED, "SDK initialization failed", e);
612
+ throw new _(p.AUTH_NOT_INITIALIZED, "SDK initialization failed", e);
613
613
  }
614
614
  }
615
615
  async signIn(e) {
@@ -625,7 +625,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
625
625
  const t = await this.signInUseCase.execute(s);
626
626
  return t.success && this.applyAuthResult(t), t;
627
627
  } catch (t) {
628
- throw new x(p.AUTH_FAILED, "Sign in failed", t);
628
+ throw new _(p.AUTH_FAILED, "Sign in failed", t);
629
629
  }
630
630
  }
631
631
  async signOut() {
@@ -633,7 +633,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
633
633
  try {
634
634
  await this.signOutUseCase.execute(), this.clearAuthState();
635
635
  } catch (e) {
636
- throw new x(p.UNKNOWN_ERROR, "Sign out failed", e);
636
+ throw new _(p.UNKNOWN_ERROR, "Sign out failed", e);
637
637
  }
638
638
  }
639
639
  isAuthenticated() {
@@ -709,12 +709,12 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
709
709
  */
710
710
  async migrateWallet(e) {
711
711
  if (this.ensureAuthenticated(), !this.userId)
712
- throw new x(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
712
+ throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
713
713
  try {
714
714
  const s = await this.migrateWalletUseCase.execute(e, this.userId);
715
- return this.address = s.address, this.emit("addressChanged", { address: s.address, index: 0 }), g.log("[CROSSx] migrateWallet 완료 — address:", s.address), s;
715
+ return this.address = s.address, this.emit("addressChanged", { address: s.address, index: 0 }), f.log("[CROSSx] migrateWallet 완료 — address:", s.address), s;
716
716
  } catch (s) {
717
- throw s instanceof x ? s : new x(
717
+ throw s instanceof _ ? s : new _(
718
718
  p.MIGRATION_FAILED,
719
719
  "Wallet migration failed",
720
720
  s
@@ -736,7 +736,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
736
736
  async getAddress(e) {
737
737
  if (e !== void 0) {
738
738
  if (this.ensureAuthenticated(), !this.userId)
739
- throw new x(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
739
+ throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
740
740
  return { address: (await this.walletProvider.getAddress(this.userId, e)).address, index: e };
741
741
  }
742
742
  return !this.authenticated || !this.address ? null : { address: this.address, index: 0 };
@@ -770,7 +770,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
770
770
  */
771
771
  async selectWallet() {
772
772
  if (this.ensureAuthenticated(), !this.userId)
773
- throw new x(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
773
+ throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
774
774
  const e = await this.walletProvider.getAddresses(this.userId);
775
775
  return this.confirmation.showWalletSelector(
776
776
  e,
@@ -800,7 +800,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
800
800
  try {
801
801
  return await this.chainRegistry.getChains();
802
802
  } catch (e) {
803
- throw e instanceof x ? e : new x(p.UNKNOWN_ERROR, "Failed to fetch chains", e);
803
+ throw e instanceof _ ? e : new _(p.UNKNOWN_ERROR, "Failed to fetch chains", e);
804
804
  }
805
805
  }
806
806
  /**
@@ -819,7 +819,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
819
819
  try {
820
820
  return await this.chainRegistry.getChain(e);
821
821
  } catch (s) {
822
- throw s instanceof x ? s : new x(p.CHAIN_NOT_SUPPORTED, `Failed to fetch chain: ${e}`, s);
822
+ throw s instanceof _ ? s : new _(p.CHAIN_NOT_SUPPORTED, `Failed to fetch chain: ${e}`, s);
823
823
  }
824
824
  }
825
825
  // ============================================================================
@@ -845,19 +845,19 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
845
845
  */
846
846
  async createWallet() {
847
847
  if (this.ensureAuthenticated(), !this.userId)
848
- throw new x(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
849
- g.log("[CROSSx] 지갑 생성 시작");
848
+ throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
849
+ f.log("[CROSSx] 지갑 생성 시작");
850
850
  try {
851
851
  const e = await this.walletProvider.getOrCreateWallet(this.userId);
852
- return this.address = e.address, this.emit("addressChanged", { address: e.address, index: 0 }), g.log("[CROSSx] 지갑 생성 완료:", e.address), { address: e.address };
852
+ return this.address = e.address, this.emit("addressChanged", { address: e.address, index: 0 }), f.log("[CROSSx] 지갑 생성 완료:", e.address), { address: e.address };
853
853
  } catch (e) {
854
- if (e instanceof x && e.code === p.MIGRATION_BACKUP_EXISTS) {
854
+ if (e instanceof _ && e.code === p.MIGRATION_BACKUP_EXISTS) {
855
855
  const s = this.providerSub ?? this.userId;
856
- g.log("[CROSSx][Migration Phase 3] createWallet() — Gateway -10012 감지, 마이그레이션 UI 시작 — migrationSub:", s);
856
+ f.log("[CROSSx][Migration Phase 3] createWallet() — Gateway -10012 감지, 마이그레이션 UI 시작 — migrationSub:", s);
857
857
  const t = await this.handleMigrationFlow(s);
858
858
  if (t)
859
859
  return this.address = t.address, this.emit("addressChanged", { address: t.address, index: 0 }), { address: t.address };
860
- throw new x(
860
+ throw new _(
861
861
  p.MIGRATION_FAILED,
862
862
  "Migration skipped by user"
863
863
  );
@@ -877,7 +877,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
877
877
  */
878
878
  async signMessage(e, s, t) {
879
879
  if (this.ensureAuthenticated(), !this.userId)
880
- throw new x(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
880
+ throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
881
881
  const n = t == null ? void 0 : t.index, o = await this.walletProvider.getAddress(this.userId, n ?? 0);
882
882
  let i;
883
883
  if (this.walletProvider.prepare && (i = (await this.walletProvider.prepare("sign-message", { message: s, from: o.address })).uuid), !await this.confirmation.requestConfirmation({
@@ -888,7 +888,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
888
888
  dappName: t == null ? void 0 : t.dappName,
889
889
  accountName: t == null ? void 0 : t.accountName
890
890
  }))
891
- throw new x(p.USER_REJECTED, "User rejected message signing");
891
+ throw new _(p.USER_REJECTED, "User rejected message signing");
892
892
  try {
893
893
  const c = await this.walletProvider.signMessage(
894
894
  this.userId,
@@ -905,7 +905,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
905
905
  address: o.address
906
906
  };
907
907
  } catch (c) {
908
- throw c instanceof x ? c : new x(p.SIGNATURE_FAILED, `Message signing failed (${e})`, c);
908
+ throw c instanceof _ ? c : new _(p.SIGNATURE_FAILED, `Message signing failed (${e})`, c);
909
909
  }
910
910
  }
911
911
  /**
@@ -931,9 +931,9 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
931
931
  */
932
932
  async signTypedData(e, s, t) {
933
933
  if (this.ensureAuthenticated(), !this.userId)
934
- throw new x(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
934
+ throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
935
935
  if (!this.walletProvider.signTypedData)
936
- throw new x(p.NOT_IMPLEMENTED, "signTypedData is not implemented");
936
+ throw new _(p.NOT_IMPLEMENTED, "signTypedData is not implemented");
937
937
  X.validateTypedDataChainId(e, s);
938
938
  const n = await this.walletProvider.getAddress(this.userId, (t == null ? void 0 : t.index) ?? 0);
939
939
  let o;
@@ -945,7 +945,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
945
945
  dappName: t == null ? void 0 : t.dappName,
946
946
  accountName: t == null ? void 0 : t.accountName
947
947
  }))
948
- throw new x(p.USER_REJECTED, "User rejected typed data signing");
948
+ throw new _(p.USER_REJECTED, "User rejected typed data signing");
949
949
  try {
950
950
  const a = await this.walletProvider.signTypedData(
951
951
  this.userId,
@@ -961,7 +961,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
961
961
  address: n.address
962
962
  };
963
963
  } catch (a) {
964
- throw a instanceof x ? a : new x(p.SIGNATURE_FAILED, `Typed data signing failed (${e})`, a);
964
+ throw a instanceof _ ? a : new _(p.SIGNATURE_FAILED, `Typed data signing failed (${e})`, a);
965
965
  }
966
966
  }
967
967
  /**
@@ -997,7 +997,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
997
997
  */
998
998
  async signTransaction(e, s, t) {
999
999
  if (this.ensureAuthenticated(), !this.userId)
1000
- throw new x(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
1000
+ throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
1001
1001
  const n = await this.withResolvedGasAndFee(s, e);
1002
1002
  let o;
1003
1003
  this.walletProvider.prepare && (o = (await this.walletProvider.prepare("sign", { tx: n })).uuid);
@@ -1018,7 +1018,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1018
1018
  dappName: t == null ? void 0 : t.dappName,
1019
1019
  accountName: t == null ? void 0 : t.accountName
1020
1020
  }))
1021
- throw new x(p.USER_REJECTED, "User rejected transaction signing");
1021
+ throw new _(p.USER_REJECTED, "User rejected transaction signing");
1022
1022
  try {
1023
1023
  const c = await this.walletProvider.signTransaction(
1024
1024
  this.userId,
@@ -1033,9 +1033,9 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1033
1033
  txHash: c.txHash ?? ""
1034
1034
  };
1035
1035
  } catch (c) {
1036
- if (c instanceof x) throw c;
1036
+ if (c instanceof _) throw c;
1037
1037
  const l = c instanceof Error ? c.message : String(c);
1038
- throw new x(
1038
+ throw new _(
1039
1039
  p.SIGNATURE_FAILED,
1040
1040
  `Transaction signing failed (${e}): ${l}`,
1041
1041
  c
@@ -1050,7 +1050,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1050
1050
  */
1051
1051
  async sendTransaction(e, s, t) {
1052
1052
  if (this.ensureAuthenticated(), !this.userId)
1053
- throw new x(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
1053
+ throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
1054
1054
  const n = await this.withResolvedGasAndFee(s, e);
1055
1055
  let o;
1056
1056
  this.walletProvider.prepare && (o = (await this.walletProvider.prepare("send", { tx: n })).uuid);
@@ -1071,7 +1071,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1071
1071
  dappName: t == null ? void 0 : t.dappName,
1072
1072
  accountName: t == null ? void 0 : t.accountName
1073
1073
  }))
1074
- throw new x(p.USER_REJECTED, "User rejected transaction");
1074
+ throw new _(p.USER_REJECTED, "User rejected transaction");
1075
1075
  try {
1076
1076
  let c;
1077
1077
  if (this.walletProvider.sendTransaction)
@@ -1094,7 +1094,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1094
1094
  return { chainId: e, txHash: c, status: "pending" };
1095
1095
  } catch (c) {
1096
1096
  const l = c instanceof Error ? c.message : String(c);
1097
- throw new x(
1097
+ throw new _(
1098
1098
  p.TRANSACTION_FAILED,
1099
1099
  `Transaction failed (${e}): ${l}`,
1100
1100
  c
@@ -1127,7 +1127,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1127
1127
  if (l) return l;
1128
1128
  await new Promise((d) => setTimeout(d, c)), c = Math.min(c * 2, o);
1129
1129
  }
1130
- throw new x(
1130
+ throw new _(
1131
1131
  p.UNKNOWN_ERROR,
1132
1132
  `Transaction receipt timeout (${e})`
1133
1133
  );
@@ -1148,37 +1148,37 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1148
1148
  * logger.log(receipt.status); // '0x1' | '0x0'
1149
1149
  */
1150
1150
  async sendTransactionWithWaitForReceipt(e, s, t = {}) {
1151
- var T, b;
1152
- const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((T = this._config.receiptPolling) == null ? void 0 : T.intervalMs) ?? Hs, l = o ?? ((b = this._config.receiptPolling) == null ? void 0 : b.timeoutMs) ?? bt, d = ze(e), f = s.from ?? "";
1153
- let w, m;
1154
- const _ = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((A) => {
1155
- w = A;
1156
- const q = BigInt(A.gasUsed) * BigInt(A.effectiveGasPrice), M = s.value ? BigInt(s.value) : 0n, D = X.formatTxAmount(s.value, d.symbol, d.decimals), B = X.formatTxAmount("0x" + q.toString(16), d.symbol, d.decimals), Q = X.formatTxAmount("0x" + (M + q).toString(16), d.symbol, d.decimals);
1151
+ var b, S;
1152
+ const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((b = this._config.receiptPolling) == null ? void 0 : b.intervalMs) ?? Hs, l = o ?? ((S = this._config.receiptPolling) == null ? void 0 : S.timeoutMs) ?? bt, d = ze(e), g = s.from ?? "";
1153
+ let m, x;
1154
+ const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((E) => {
1155
+ m = E;
1156
+ const q = BigInt(E.gasUsed) * BigInt(E.effectiveGasPrice), M = s.value ? BigInt(s.value) : 0n, D = X.formatTxAmount(s.value, d.symbol, d.decimals), B = X.formatTxAmount("0x" + q.toString(16), d.symbol, d.decimals), Q = X.formatTxAmount("0x" + (M + q).toString(16), d.symbol, d.decimals);
1157
1157
  return {
1158
1158
  chainId: e,
1159
1159
  txHash: a,
1160
- from: A.from,
1161
- to: A.to ?? s.to,
1160
+ from: E.from,
1161
+ to: E.to ?? s.to,
1162
1162
  amount: D,
1163
1163
  fees: B,
1164
1164
  total: Q,
1165
1165
  nativeSymbol: d.symbol,
1166
- status: A.status === "0x1" ? "success" : "reverted"
1166
+ status: E.status === "0x1" ? "success" : "reverted"
1167
1167
  };
1168
- }).catch((A) => (m = A instanceof Error ? A : new Error(String(A)), {
1168
+ }).catch((E) => (x = E instanceof Error ? E : new Error(String(E)), {
1169
1169
  chainId: e,
1170
1170
  txHash: a,
1171
- from: f,
1171
+ from: g,
1172
1172
  to: s.to,
1173
1173
  amount: X.formatTxAmount(s.value, d.symbol, d.decimals),
1174
1174
  nativeSymbol: d.symbol,
1175
1175
  status: "timeout"
1176
1176
  }));
1177
1177
  if (await this.confirmation.showTransactionProgress(
1178
- { chainId: e, txHash: a, from: f, to: s.to },
1179
- _
1180
- ), m) throw m;
1181
- return { chainId: e, txHash: a, receipt: w };
1178
+ { chainId: e, txHash: a, from: g, to: s.to },
1179
+ w
1180
+ ), x) throw x;
1181
+ return { chainId: e, txHash: a, receipt: m };
1182
1182
  }
1183
1183
  // ============================================================================
1184
1184
  // Gas 조회
@@ -1198,7 +1198,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1198
1198
  return await this.walletRpc("eth_gasPrice", [], e);
1199
1199
  } catch (s) {
1200
1200
  const t = s instanceof Error ? s.message : String(s);
1201
- throw new x(p.GAS_ESTIMATION_FAILED, `Failed to get gas price (${e}): ${t}`, s);
1201
+ throw new _(p.GAS_ESTIMATION_FAILED, `Failed to get gas price (${e}): ${t}`, s);
1202
1202
  }
1203
1203
  }
1204
1204
  /**
@@ -1219,7 +1219,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1219
1219
  return await this.walletRpc("eth_estimateGas", [t], s);
1220
1220
  } catch (n) {
1221
1221
  const o = n instanceof Error ? n.message : String(n);
1222
- throw new x(p.GAS_ESTIMATION_FAILED, `Failed to estimate gas (${s}): ${o}`, n);
1222
+ throw new _(p.GAS_ESTIMATION_FAILED, `Failed to estimate gas (${s}): ${o}`, n);
1223
1223
  }
1224
1224
  }
1225
1225
  /**
@@ -1240,7 +1240,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1240
1240
  return (s == null ? void 0 : s.baseFeePerGas) ?? null;
1241
1241
  } catch (s) {
1242
1242
  const t = s instanceof Error ? s.message : String(s);
1243
- throw new x(p.GAS_ESTIMATION_FAILED, `Failed to get baseFeePerGas (${e}): ${t}`, s);
1243
+ throw new _(p.GAS_ESTIMATION_FAILED, `Failed to get baseFeePerGas (${e}): ${t}`, s);
1244
1244
  }
1245
1245
  }
1246
1246
  /**
@@ -1259,7 +1259,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1259
1259
  return await this.walletRpc("eth_maxPriorityFeePerGas", [], e);
1260
1260
  } catch (s) {
1261
1261
  const t = s instanceof Error ? s.message : String(s);
1262
- throw new x(p.GAS_ESTIMATION_FAILED, `Failed to get maxPriorityFeePerGas (${e}): ${t}`, s);
1262
+ throw new _(p.GAS_ESTIMATION_FAILED, `Failed to get maxPriorityFeePerGas (${e}): ${t}`, s);
1263
1263
  }
1264
1264
  }
1265
1265
  // ============================================================================
@@ -1277,9 +1277,9 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1277
1277
  const t = await this.jsonRpc.call("eth_getTransactionCount", [s, "pending"], e);
1278
1278
  return parseInt(t ?? "0x0", 16);
1279
1279
  } catch (t) {
1280
- if (t instanceof x) throw t;
1280
+ if (t instanceof _) throw t;
1281
1281
  const n = t instanceof Error ? t.message : String(t);
1282
- throw new x(p.UNKNOWN_ERROR, `Failed to get nonce: ${n}`, t);
1282
+ throw new _(p.UNKNOWN_ERROR, `Failed to get nonce: ${n}`, t);
1283
1283
  }
1284
1284
  }
1285
1285
  /**
@@ -1296,9 +1296,9 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1296
1296
  const n = await this.jsonRpc.call("eth_getBalance", [s, "latest"], e) ?? "0x0";
1297
1297
  return { wei: n, formatted: X.formatWei(n), chainId: e };
1298
1298
  } catch (t) {
1299
- if (t instanceof x) throw t;
1299
+ if (t instanceof _) throw t;
1300
1300
  const n = t instanceof Error ? t.message : String(t);
1301
- throw new x(p.UNKNOWN_ERROR, `Failed to get balance (${e}): ${n}`, t);
1301
+ throw new _(p.UNKNOWN_ERROR, `Failed to get balance (${e}): ${n}`, t);
1302
1302
  }
1303
1303
  }
1304
1304
  static formatWei(e) {
@@ -1347,9 +1347,9 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1347
1347
  try {
1348
1348
  return await this.jsonRpc.call(e, s, t);
1349
1349
  } catch (n) {
1350
- if (n instanceof x) throw n;
1350
+ if (n instanceof _) throw n;
1351
1351
  const o = n instanceof Error ? n.message : String(n);
1352
- throw new x(p.UNKNOWN_ERROR, `walletRpc failed [${e}] (${t}): ${o}`, n);
1352
+ throw new _(p.UNKNOWN_ERROR, `walletRpc failed [${e}] (${t}): ${o}`, n);
1353
1353
  }
1354
1354
  }
1355
1355
  // ============================================================================
@@ -1377,26 +1377,26 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1377
1377
  * 3) migrateWallet API 호출
1378
1378
  */
1379
1379
  async handleMigrationFlow(e) {
1380
- g.log('[CROSSx][Migration Phase 3] "Wallet Found" 팝업 표시');
1380
+ f.log('[CROSSx][Migration Phase 3] "Wallet Found" 팝업 표시');
1381
1381
  const s = await this.confirmation.showMigrationFoundPrompt();
1382
- if (g.log("[CROSSx][Migration Phase 3] 사용자 선택:", s), s === "skip")
1383
- return g.log("[CROSSx][Migration Phase 3] 사용자가 마이그레이션을 건너뜀 → 종료"), null;
1382
+ if (f.log("[CROSSx][Migration Phase 3] 사용자 선택:", s), s === "skip")
1383
+ return f.log("[CROSSx][Migration Phase 3] 사용자가 마이그레이션을 건너뜀 → 종료"), null;
1384
1384
  let t, n = 0;
1385
1385
  for (; ; ) {
1386
- n++, g.log(`[CROSSx][Migration Phase 4] PIN 입력 팝업 표시 (시도 #${n})`, t ? `— 이전 에러: ${t}` : "");
1386
+ n++, f.log(`[CROSSx][Migration Phase 4] PIN 입력 팝업 표시 (시도 #${n})`, t ? `— 이전 에러: ${t}` : "");
1387
1387
  const o = await this.confirmation.showPinInputPrompt(t);
1388
1388
  if (o === null)
1389
- return g.log("[CROSSx][Migration Phase 4] 사용자가 PIN 입력을 취소함 → 종료"), null;
1390
- g.log(`[CROSSx][Migration Phase 4] PIN 입력 완료 (${o.length}자리), Gateway 마이그레이션 API 호출`);
1389
+ return f.log("[CROSSx][Migration Phase 4] 사용자가 PIN 입력을 취소함 → 종료"), null;
1390
+ f.log(`[CROSSx][Migration Phase 4] PIN 입력 완료 (${o.length}자리), Gateway 마이그레이션 API 호출`);
1391
1391
  try {
1392
1392
  const i = await this.migrateWalletUseCase.execute(o, e);
1393
- return g.log("[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:", i.address), i;
1393
+ return f.log("[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:", i.address), i;
1394
1394
  } catch (i) {
1395
- if (i instanceof x && i.code === p.MIGRATION_FAILED) {
1396
- g.warn(`[CROSSx][Migration Phase 4] PIN 불일치 (시도 #${n}) — 재시도 요청`), t = "Incorrect PIN. Please try again.";
1395
+ if (i instanceof _ && i.code === p.MIGRATION_FAILED) {
1396
+ f.warn(`[CROSSx][Migration Phase 4] PIN 불일치 (시도 #${n}) — 재시도 요청`), t = "Incorrect PIN. Please try again.";
1397
1397
  continue;
1398
1398
  }
1399
- throw g.error("[CROSSx][Migration Phase 4] 마이그레이션 실패 (복구 불가):", i), i;
1399
+ throw f.error("[CROSSx][Migration Phase 4] 마이그레이션 실패 (복구 불가):", i), i;
1400
1400
  }
1401
1401
  }
1402
1402
  }
@@ -1416,16 +1416,16 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1416
1416
  const t = (l) => !(l != null && l.trim()), n = e.nonce === void 0 || e.nonce === null, o = t(e.gasLimit), i = t(e.gasPrice) && t(e.maxFeePerGas), a = !t(e.maxFeePerGas) && t(e.maxPriorityFeePerGas);
1417
1417
  if (!n && !o && !i && !a) return e;
1418
1418
  const c = { ...e };
1419
- if (n && (g.log("[CROSSx] nonce 비어있음 → eth_getTransactionCount 호출"), c.nonce = await this.getNonce(s), g.log("[CROSSx] nonce 결과:", c.nonce)), o && (g.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), c.gasLimit = await this.estimateGas(e, s), g.log("[CROSSx] estimateGas 결과:", c.gasLimit)), i) {
1420
- g.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
1419
+ if (n && (f.log("[CROSSx] nonce 비어있음 → eth_getTransactionCount 호출"), c.nonce = await this.getNonce(s), f.log("[CROSSx] nonce 결과:", c.nonce)), o && (f.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), c.gasLimit = await this.estimateGas(e, s), f.log("[CROSSx] estimateGas 결과:", c.gasLimit)), i) {
1420
+ f.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
1421
1421
  const l = await this.getBaseFeePerGas(s);
1422
1422
  if (l) {
1423
1423
  const d = vt;
1424
- c.maxFeePerGas = "0x" + (BigInt(l) + BigInt(d)).toString(16), c.maxPriorityFeePerGas = d, g.log("[CROSSx] Dynamic 체인 감지 — baseFee:", l, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
1424
+ c.maxFeePerGas = "0x" + (BigInt(l) + BigInt(d)).toString(16), c.maxPriorityFeePerGas = d, f.log("[CROSSx] Dynamic 체인 감지 — baseFee:", l, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
1425
1425
  } else
1426
- c.gasPrice = Ws, g.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
1426
+ c.gasPrice = Ws, f.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
1427
1427
  }
1428
- return !i && a && (c.maxPriorityFeePerGas = vt, g.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
1428
+ return !i && a && (c.maxPriorityFeePerGas = vt, f.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
1429
1429
  }
1430
1430
  /**
1431
1431
  * EIP-712 signTypedData 호출 시 chainId와 typedData.domain.chainId 정합성 검증.
@@ -1437,7 +1437,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1437
1437
  const t = X.extractDomainChainId(s);
1438
1438
  if (e === "0") {
1439
1439
  if (t !== void 0 && t !== 0)
1440
- throw new x(
1440
+ throw new _(
1441
1441
  p.TYPED_DATA_CHAIN_ID_MISMATCH,
1442
1442
  `Off-chain signing (chainId=0) requires typedData.domain.chainId to be absent or 0, got ${t}`
1443
1443
  );
@@ -1447,12 +1447,12 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1447
1447
  if (n) {
1448
1448
  const o = Number(n[1]);
1449
1449
  if (t === void 0)
1450
- throw new x(
1450
+ throw new _(
1451
1451
  p.TYPED_DATA_CHAIN_ID_MISMATCH,
1452
1452
  `On-chain signing (${e}) requires typedData.domain.chainId to be present`
1453
1453
  );
1454
1454
  if (t !== o)
1455
- throw new x(
1455
+ throw new _(
1456
1456
  p.TYPED_DATA_CHAIN_ID_MISMATCH,
1457
1457
  `typedData.domain.chainId (${t}) does not match chainId (${e}, expected ${o})`
1458
1458
  );
@@ -1471,9 +1471,9 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1471
1471
  static validateSignatureFormat(e) {
1472
1472
  const s = e.startsWith("0x") ? e.slice(2) : e;
1473
1473
  if (!/^[0-9a-fA-F]+$/.test(s))
1474
- throw new x(p.SIGNATURE_FAILED, "Invalid signature: not a valid hex string");
1474
+ throw new _(p.SIGNATURE_FAILED, "Invalid signature: not a valid hex string");
1475
1475
  if (s.length !== St)
1476
- throw new x(
1476
+ throw new _(
1477
1477
  p.SIGNATURE_FAILED,
1478
1478
  `Invalid signature length: expected ${St} hex chars (65 bytes), got ${s.length}`
1479
1479
  );
@@ -1482,9 +1482,9 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1482
1482
  static validateSignedTxFormat(e) {
1483
1483
  const s = e.startsWith("0x") ? e.slice(2) : e;
1484
1484
  if (!/^[0-9a-fA-F]+$/.test(s))
1485
- throw new x(p.SIGNATURE_FAILED, "Invalid signedTx: not a valid hex string");
1485
+ throw new _(p.SIGNATURE_FAILED, "Invalid signedTx: not a valid hex string");
1486
1486
  if (s.length < 2)
1487
- throw new x(p.SIGNATURE_FAILED, "Invalid signedTx: too short");
1487
+ throw new _(p.SIGNATURE_FAILED, "Invalid signedTx: too short");
1488
1488
  }
1489
1489
  /**
1490
1490
  * Gateway 서명 응답의 ecrecover 검증 (XF-036)
@@ -1497,17 +1497,17 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1497
1497
  try {
1498
1498
  const n = this.crypto.recoverPersonalSignSigner(e, s);
1499
1499
  if (n.toLowerCase() !== t.toLowerCase())
1500
- throw g.error("[CROSSx] 서명 검증 실패: 서명자 주소 불일치", {
1500
+ throw f.error("[CROSSx] 서명 검증 실패: 서명자 주소 불일치", {
1501
1501
  expected: t,
1502
1502
  recovered: n
1503
- }), new x(
1503
+ }), new _(
1504
1504
  p.SIGNATURE_SIGNER_MISMATCH,
1505
1505
  `Signature signer mismatch: expected ${t}, recovered ${n}`
1506
1506
  );
1507
- g.log("[CROSSx] 서명 ecrecover 검증 성공");
1507
+ f.log("[CROSSx] 서명 ecrecover 검증 성공");
1508
1508
  } catch (n) {
1509
- if (n instanceof x) throw n;
1510
- g.warn("[CROSSx] ecrecover 검증 중 예외 (무시):", n);
1509
+ if (n instanceof _) throw n;
1510
+ f.warn("[CROSSx] ecrecover 검증 중 예외 (무시):", n);
1511
1511
  }
1512
1512
  }
1513
1513
  /** AuthResult를 내부 상태에 반영합니다. */
@@ -1536,14 +1536,14 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1536
1536
  }
1537
1537
  ensureInitialized() {
1538
1538
  if (!this.initialized)
1539
- throw new x(
1539
+ throw new _(
1540
1540
  p.AUTH_NOT_INITIALIZED,
1541
1541
  "SDK is not initialized. Call initialize() first."
1542
1542
  );
1543
1543
  }
1544
1544
  ensureAuthenticated() {
1545
1545
  if (this.ensureInitialized(), !this.authenticated)
1546
- throw new x(
1546
+ throw new _(
1547
1547
  p.AUTH_NOT_AUTHENTICATED,
1548
1548
  "Not authenticated. Call signIn() first."
1549
1549
  );
@@ -1569,7 +1569,7 @@ class Ks {
1569
1569
  const t = JSON.stringify(s);
1570
1570
  localStorage.setItem(this.prefix + e, t);
1571
1571
  } catch (t) {
1572
- throw g.error("Storage set error:", t), t;
1572
+ throw f.error("Storage set error:", t), t;
1573
1573
  }
1574
1574
  }
1575
1575
  async get(e) {
@@ -1577,14 +1577,14 @@ class Ks {
1577
1577
  const s = localStorage.getItem(this.prefix + e);
1578
1578
  return s ? JSON.parse(s) : null;
1579
1579
  } catch (s) {
1580
- return g.error("Storage get error:", s), null;
1580
+ return f.error("Storage get error:", s), null;
1581
1581
  }
1582
1582
  }
1583
1583
  async remove(e) {
1584
1584
  try {
1585
1585
  localStorage.removeItem(this.prefix + e);
1586
1586
  } catch (s) {
1587
- throw g.error("Storage remove error:", s), s;
1587
+ throw f.error("Storage remove error:", s), s;
1588
1588
  }
1589
1589
  }
1590
1590
  async clear() {
@@ -1593,7 +1593,7 @@ class Ks {
1593
1593
  s.startsWith(this.prefix) && localStorage.removeItem(s);
1594
1594
  });
1595
1595
  } catch (e) {
1596
- throw g.error("Storage clear error:", e), e;
1596
+ throw f.error("Storage clear error:", e), e;
1597
1597
  }
1598
1598
  }
1599
1599
  }
@@ -1675,7 +1675,7 @@ class At {
1675
1675
  const t = JSON.stringify(s), n = await this.encrypt(t);
1676
1676
  await this.idbPut(Se, e, n);
1677
1677
  } catch (t) {
1678
- throw g.error("[CROSSx] IndexedDB set error:", t), t;
1678
+ throw f.error("[CROSSx] IndexedDB set error:", t), t;
1679
1679
  }
1680
1680
  }
1681
1681
  async get(e) {
@@ -1686,21 +1686,21 @@ class At {
1686
1686
  const t = await this.decrypt(s);
1687
1687
  return JSON.parse(t);
1688
1688
  } catch (s) {
1689
- return g.error("[CROSSx] IndexedDB get error:", s), null;
1689
+ return f.error("[CROSSx] IndexedDB get error:", s), null;
1690
1690
  }
1691
1691
  }
1692
1692
  async remove(e) {
1693
1693
  try {
1694
1694
  await this.ensureReady(), await this.idbDelete(Se, e);
1695
1695
  } catch (s) {
1696
- throw g.error("[CROSSx] IndexedDB remove error:", s), s;
1696
+ throw f.error("[CROSSx] IndexedDB remove error:", s), s;
1697
1697
  }
1698
1698
  }
1699
1699
  async clear() {
1700
1700
  try {
1701
1701
  await this.ensureReady(), await this.idbClear(Se);
1702
1702
  } catch (e) {
1703
- throw g.error("[CROSSx] IndexedDB clear error:", e), e;
1703
+ throw f.error("[CROSSx] IndexedDB clear error:", e), e;
1704
1704
  }
1705
1705
  }
1706
1706
  /**
@@ -1871,8 +1871,8 @@ class or {
1871
1871
  const { buffer: s, view: t, blockLen: n, isLE: o } = this;
1872
1872
  let { pos: i } = this;
1873
1873
  s[i++] = 128, Ie(this.buffer.subarray(i)), this.padOffset > n - i && (this.process(t, 0), i = 0);
1874
- for (let f = i; f < n; f++)
1875
- s[f] = 0;
1874
+ for (let g = i; g < n; g++)
1875
+ s[g] = 0;
1876
1876
  t.setBigUint64(n - 8, BigInt(this.length * 8), o), this.process(t, 0);
1877
1877
  const a = Ze(e), c = this.outputLen;
1878
1878
  if (c % 4)
@@ -1880,8 +1880,8 @@ class or {
1880
1880
  const l = c / 4, d = this.get();
1881
1881
  if (l > d.length)
1882
1882
  throw new Error("_sha2: outputLen bigger than state");
1883
- for (let f = 0; f < l; f++)
1884
- a.setUint32(4 * f, d[f], o);
1883
+ for (let g = 0; g < l; g++)
1884
+ a.setUint32(4 * g, d[g], o);
1885
1885
  }
1886
1886
  digest() {
1887
1887
  const { buffer: e, outputLen: s } = this;
@@ -1999,16 +1999,16 @@ class fr extends or {
1999
1999
  this.A = e | 0, this.B = s | 0, this.C = t | 0, this.D = n | 0, this.E = o | 0, this.F = i | 0, this.G = a | 0, this.H = c | 0;
2000
2000
  }
2001
2001
  process(e, s) {
2002
- for (let f = 0; f < 16; f++, s += 4)
2003
- ge[f] = e.getUint32(s, !1);
2004
- for (let f = 16; f < 64; f++) {
2005
- const w = ge[f - 15], m = ge[f - 2], _ = oe(w, 7) ^ oe(w, 18) ^ w >>> 3, T = oe(m, 17) ^ oe(m, 19) ^ m >>> 10;
2006
- ge[f] = T + ge[f - 7] + _ + ge[f - 16] | 0;
2002
+ for (let g = 0; g < 16; g++, s += 4)
2003
+ ge[g] = e.getUint32(s, !1);
2004
+ for (let g = 16; g < 64; g++) {
2005
+ const m = ge[g - 15], x = ge[g - 2], w = oe(m, 7) ^ oe(m, 18) ^ m >>> 3, b = oe(x, 17) ^ oe(x, 19) ^ x >>> 10;
2006
+ ge[g] = b + ge[g - 7] + w + ge[g - 16] | 0;
2007
2007
  }
2008
2008
  let { A: t, B: n, C: o, D: i, E: a, F: c, G: l, H: d } = this;
2009
- for (let f = 0; f < 64; f++) {
2010
- const w = oe(a, 6) ^ oe(a, 11) ^ oe(a, 25), m = d + w + rr(a, c, l) + hr[f] + ge[f] | 0, T = (oe(t, 2) ^ oe(t, 13) ^ oe(t, 22)) + nr(t, n, o) | 0;
2011
- d = l, l = c, c = a, a = i + m | 0, i = o, o = n, n = t, t = m + T | 0;
2009
+ for (let g = 0; g < 64; g++) {
2010
+ const m = oe(a, 6) ^ oe(a, 11) ^ oe(a, 25), x = d + m + rr(a, c, l) + hr[g] + ge[g] | 0, b = (oe(t, 2) ^ oe(t, 13) ^ oe(t, 22)) + nr(t, n, o) | 0;
2011
+ d = l, l = c, c = a, a = i + x | 0, i = o, o = n, n = t, t = x + b | 0;
2012
2012
  }
2013
2013
  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);
2014
2014
  }
@@ -2101,30 +2101,30 @@ const dt = (r) => (rt << BigInt(r)) - rt;
2101
2101
  function yr(r, e, s) {
2102
2102
  if (ue(r, "hashLen"), ue(e, "qByteLen"), typeof s != "function")
2103
2103
  throw new Error("hmacFn must be a function");
2104
- const t = (b) => new Uint8Array(b), n = Uint8Array.of(), o = Uint8Array.of(0), i = Uint8Array.of(1), a = 1e3;
2104
+ const t = (S) => new Uint8Array(S), n = Uint8Array.of(), o = Uint8Array.of(0), i = Uint8Array.of(1), a = 1e3;
2105
2105
  let c = t(r), l = t(r), d = 0;
2106
- const f = () => {
2106
+ const g = () => {
2107
2107
  c.fill(1), l.fill(0), d = 0;
2108
- }, w = (...b) => s(l, _e(c, ...b)), m = (b = n) => {
2109
- l = w(o, b), c = w(), b.length !== 0 && (l = w(i, b), c = w());
2110
- }, _ = () => {
2108
+ }, m = (...S) => s(l, _e(c, ...S)), x = (S = n) => {
2109
+ l = m(o, S), c = m(), S.length !== 0 && (l = m(i, S), c = m());
2110
+ }, w = () => {
2111
2111
  if (d++ >= a)
2112
2112
  throw new Error("drbg: tried max amount of iterations");
2113
- let b = 0;
2114
- const A = [];
2115
- for (; b < e; ) {
2116
- c = w();
2113
+ let S = 0;
2114
+ const E = [];
2115
+ for (; S < e; ) {
2116
+ c = m();
2117
2117
  const q = c.slice();
2118
- A.push(q), b += c.length;
2118
+ E.push(q), S += c.length;
2119
2119
  }
2120
- return _e(...A);
2120
+ return _e(...E);
2121
2121
  };
2122
- return (b, A) => {
2123
- f(), m(b);
2122
+ return (S, E) => {
2123
+ g(), x(S);
2124
2124
  let q;
2125
- for (; !(q = A(_())); )
2126
- m();
2127
- return f(), q;
2125
+ for (; !(q = E(w())); )
2126
+ x();
2127
+ return g(), q;
2128
2128
  };
2129
2129
  }
2130
2130
  function ut(r, e = {}, s = {}) {
@@ -2193,10 +2193,10 @@ function Er(r) {
2193
2193
  const e = Ve(r), s = cs(r), t = s(e, e.neg(e.ONE)), n = s(e, t), o = s(e, e.neg(t)), i = (r + br) / is;
2194
2194
  return (a, c) => {
2195
2195
  let l = a.pow(c, i), d = a.mul(l, t);
2196
- const f = a.mul(l, n), w = a.mul(l, o), m = a.eql(a.sqr(d), c), _ = a.eql(a.sqr(f), c);
2197
- l = a.cmov(l, d, m), d = a.cmov(w, f, _);
2198
- const T = a.eql(a.sqr(d), c), b = a.cmov(l, d, T);
2199
- return ht(a, b, c), b;
2196
+ const g = a.mul(l, n), m = a.mul(l, o), x = a.eql(a.sqr(d), c), w = a.eql(a.sqr(g), c);
2197
+ l = a.cmov(l, d, x), d = a.cmov(m, g, w);
2198
+ const b = a.eql(a.sqr(d), c), S = a.cmov(l, d, b);
2199
+ return ht(a, S, c), S;
2200
2200
  };
2201
2201
  }
2202
2202
  function cs(r) {
@@ -2219,18 +2219,18 @@ function cs(r) {
2219
2219
  return l;
2220
2220
  if (Pt(c, l) !== 1)
2221
2221
  throw new Error("Cannot find square root");
2222
- let d = s, f = c.mul(c.ONE, o), w = c.pow(l, e), m = c.pow(l, i);
2223
- for (; !c.eql(w, c.ONE); ) {
2224
- if (c.is0(w))
2222
+ let d = s, g = c.mul(c.ONE, o), m = c.pow(l, e), x = c.pow(l, i);
2223
+ for (; !c.eql(m, c.ONE); ) {
2224
+ if (c.is0(m))
2225
2225
  return c.ZERO;
2226
- let _ = 1, T = c.sqr(w);
2227
- for (; !c.eql(T, c.ONE); )
2228
- if (_++, T = c.sqr(T), _ === d)
2226
+ let w = 1, b = c.sqr(m);
2227
+ for (; !c.eql(b, c.ONE); )
2228
+ if (w++, b = c.sqr(b), w === d)
2229
2229
  throw new Error("Cannot find square root");
2230
- const b = z << BigInt(d - _ - 1), A = c.pow(f, b);
2231
- d = _, f = c.sqr(A), w = c.mul(w, f), m = c.mul(m, A);
2230
+ const S = z << BigInt(d - w - 1), E = c.pow(g, S);
2231
+ d = w, g = c.sqr(E), m = c.mul(m, g), x = c.mul(x, E);
2232
2232
  }
2233
- return m;
2233
+ return x;
2234
2234
  };
2235
2235
  }
2236
2236
  function Tr(r) {
@@ -2446,8 +2446,8 @@ function Dt(r, e, s) {
2446
2446
  const { windowSize: t, mask: n, maxNumber: o, shiftBy: i } = s;
2447
2447
  let a = Number(r & n), c = r >> i;
2448
2448
  a > t && (a -= o, c += be);
2449
- const l = e * t, d = l + Math.abs(a) - 1, f = a === 0, w = a < 0, m = e % 2 !== 0;
2450
- return { nextN: c, offset: d, isZero: f, isNeg: w, isNegF: m, offsetF: l };
2449
+ const l = e * t, d = l + Math.abs(a) - 1, g = a === 0, m = a < 0, x = e % 2 !== 0;
2450
+ return { nextN: c, offset: d, isZero: g, isNeg: m, isNegF: x, offsetF: l };
2451
2451
  }
2452
2452
  const Je = /* @__PURE__ */ new WeakMap(), fs = /* @__PURE__ */ new WeakMap();
2453
2453
  function Qe(r) {
@@ -2508,8 +2508,8 @@ class Nr {
2508
2508
  let n = this.ZERO, o = this.BASE;
2509
2509
  const i = Xe(e, this.bits);
2510
2510
  for (let a = 0; a < i.windows; a++) {
2511
- const { nextN: c, offset: l, isZero: d, isNeg: f, isNegF: w, offsetF: m } = Dt(t, a, i);
2512
- t = c, d ? o = o.add(Ge(w, s[m])) : n = n.add(Ge(f, s[l]));
2511
+ const { nextN: c, offset: l, isZero: d, isNeg: g, isNegF: m, offsetF: x } = Dt(t, a, i);
2512
+ t = c, d ? o = o.add(Ge(m, s[x])) : n = n.add(Ge(g, s[l]));
2513
2513
  }
2514
2514
  return $t(t), { p: n, f: o };
2515
2515
  }
@@ -2523,8 +2523,8 @@ class Nr {
2523
2523
  for (let i = 0; i < o.windows && t !== Ae; i++) {
2524
2524
  const { nextN: a, offset: c, isZero: l, isNeg: d } = Dt(t, i, o);
2525
2525
  if (t = a, !l) {
2526
- const f = s[c];
2527
- n = n.add(d ? f.negate() : f);
2526
+ const g = s[c];
2527
+ n = n.add(d ? g.negate() : g);
2528
2528
  }
2529
2529
  }
2530
2530
  return $t(t), n;
@@ -2634,12 +2634,12 @@ const Mt = (r, e) => (r + (r >= 0 ? e : -e) / _s) / e;
2634
2634
  function $r(r, e, s) {
2635
2635
  const [[t, n], [o, i]] = e, a = Mt(i * r, s), c = Mt(-n * r, s);
2636
2636
  let l = r - a * t - c * o, d = -a * n - c * i;
2637
- const f = l < le, w = d < le;
2638
- f && (l = -l), w && (d = -d);
2639
- const m = dt(Math.ceil(wr(s) / 2)) + Ee;
2640
- if (l < le || l >= m || d < le || d >= m)
2637
+ const g = l < le, m = d < le;
2638
+ g && (l = -l), m && (d = -d);
2639
+ const x = dt(Math.ceil(wr(s) / 2)) + Ee;
2640
+ if (l < le || l >= x || d < le || d >= x)
2641
2641
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
2642
- return { k1neg: f, k1: l, k2neg: w, k2: d };
2642
+ return { k1neg: g, k1: l, k2neg: m, k2: d };
2643
2643
  }
2644
2644
  function nt(r) {
2645
2645
  if (!["compact", "recovered", "der"].includes(r))
@@ -2765,54 +2765,54 @@ function Ur(r, e = {}) {
2765
2765
  if (!t.isOdd)
2766
2766
  throw new Error("compression is not supported: Field does not have .isOdd()");
2767
2767
  }
2768
- function f(P, u, h) {
2769
- const { x: y, y: E } = u.toAffine(), R = t.toBytes(y);
2768
+ function g(P, u, h) {
2769
+ const { x: y, y: I } = u.toAffine(), R = t.toBytes(y);
2770
2770
  if (He(h, "isCompressed"), h) {
2771
2771
  d();
2772
- const I = !t.isOdd(E);
2773
- return _e(xs(I), R);
2772
+ const A = !t.isOdd(I);
2773
+ return _e(xs(A), R);
2774
2774
  } else
2775
- return _e(Uint8Array.of(4), R, t.toBytes(E));
2775
+ return _e(Uint8Array.of(4), R, t.toBytes(I));
2776
2776
  }
2777
- function w(P) {
2777
+ function m(P) {
2778
2778
  F(P, void 0, "Point");
2779
- const { publicKey: u, publicKeyUncompressed: h } = l, y = P.length, E = P[0], R = P.subarray(1);
2780
- if (y === u && (E === 2 || E === 3)) {
2781
- const I = t.fromBytes(R);
2782
- if (!t.isValid(I))
2779
+ const { publicKey: u, publicKeyUncompressed: h } = l, y = P.length, I = P[0], R = P.subarray(1);
2780
+ if (y === u && (I === 2 || I === 3)) {
2781
+ const A = t.fromBytes(R);
2782
+ if (!t.isValid(A))
2783
2783
  throw new Error("bad point: is not on curve, wrong x");
2784
- const O = T(I);
2785
- let S;
2784
+ const O = b(A);
2785
+ let T;
2786
2786
  try {
2787
- S = t.sqrt(O);
2787
+ T = t.sqrt(O);
2788
2788
  } catch (W) {
2789
2789
  const U = W instanceof Error ? ": " + W.message : "";
2790
2790
  throw new Error("bad point: is not on curve, sqrt error" + U);
2791
2791
  }
2792
2792
  d();
2793
- const C = t.isOdd(S);
2794
- return (E & 1) === 1 !== C && (S = t.neg(S)), { x: I, y: S };
2795
- } else if (y === h && E === 4) {
2796
- const I = t.BYTES, O = t.fromBytes(R.subarray(0, I)), S = t.fromBytes(R.subarray(I, I * 2));
2797
- if (!b(O, S))
2793
+ const C = t.isOdd(T);
2794
+ return (I & 1) === 1 !== C && (T = t.neg(T)), { x: A, y: T };
2795
+ } else if (y === h && I === 4) {
2796
+ const A = t.BYTES, O = t.fromBytes(R.subarray(0, A)), T = t.fromBytes(R.subarray(A, A * 2));
2797
+ if (!S(O, T))
2798
2798
  throw new Error("bad point: is not on curve");
2799
- return { x: O, y: S };
2799
+ return { x: O, y: T };
2800
2800
  } else
2801
2801
  throw new Error(`bad point: got length ${y}, expected compressed=${u} or uncompressed=${h}`);
2802
2802
  }
2803
- const m = e.toBytes || f, _ = e.fromBytes || w;
2804
- function T(P) {
2803
+ const x = e.toBytes || g, w = e.fromBytes || m;
2804
+ function b(P) {
2805
2805
  const u = t.sqr(P), h = t.mul(u, P);
2806
2806
  return t.add(t.add(h, t.mul(P, o.a)), o.b);
2807
2807
  }
2808
- function b(P, u) {
2809
- const h = t.sqr(u), y = T(P);
2808
+ function S(P, u) {
2809
+ const h = t.sqr(u), y = b(P);
2810
2810
  return t.eql(h, y);
2811
2811
  }
2812
- if (!b(o.Gx, o.Gy))
2812
+ if (!S(o.Gx, o.Gy))
2813
2813
  throw new Error("bad curve params: generator point");
2814
- const A = t.mul(t.pow(o.a, Be), Mr), q = t.mul(t.sqr(o.b), BigInt(27));
2815
- if (t.is0(t.add(A, q)))
2814
+ const E = t.mul(t.pow(o.a, Be), Mr), q = t.mul(t.sqr(o.b), BigInt(27));
2815
+ if (t.is0(t.add(E, q)))
2816
2816
  throw new Error("bad curve params: a or b");
2817
2817
  function M(P, u, h = !1) {
2818
2818
  if (!t.isValid(u) || h && t.is0(u))
@@ -2829,17 +2829,17 @@ function Ur(r, e = {}) {
2829
2829
  return $r(P, c.basises, n.ORDER);
2830
2830
  }
2831
2831
  const Q = kt((P, u) => {
2832
- const { X: h, Y: y, Z: E } = P;
2833
- if (t.eql(E, t.ONE))
2832
+ const { X: h, Y: y, Z: I } = P;
2833
+ if (t.eql(I, t.ONE))
2834
2834
  return { x: h, y };
2835
2835
  const R = P.is0();
2836
- u == null && (u = R ? t.ONE : t.inv(E));
2837
- const I = t.mul(h, u), O = t.mul(y, u), S = t.mul(E, u);
2836
+ u == null && (u = R ? t.ONE : t.inv(I));
2837
+ const A = t.mul(h, u), O = t.mul(y, u), T = t.mul(I, u);
2838
2838
  if (R)
2839
2839
  return { x: t.ZERO, y: t.ZERO };
2840
- if (!t.eql(S, t.ONE))
2840
+ if (!t.eql(T, t.ONE))
2841
2841
  throw new Error("invZ was invalid");
2842
- return { x: I, y: O };
2842
+ return { x: A, y: O };
2843
2843
  }), ve = kt((P) => {
2844
2844
  if (P.is0()) {
2845
2845
  if (e.allowInfinityPoint && !t.is0(P.Y))
@@ -2849,14 +2849,14 @@ function Ur(r, e = {}) {
2849
2849
  const { x: u, y: h } = P.toAffine();
2850
2850
  if (!t.isValid(u) || !t.isValid(h))
2851
2851
  throw new Error("bad point: x or y not field elements");
2852
- if (!b(u, h))
2852
+ if (!S(u, h))
2853
2853
  throw new Error("bad point: equation left != right");
2854
2854
  if (!P.isTorsionFree())
2855
2855
  throw new Error("bad point: not in prime-order subgroup");
2856
2856
  return !0;
2857
2857
  });
2858
- function he(P, u, h, y, E) {
2859
- return h = new Z(t.mul(h.X, P), h.Y, h.Z), u = Ge(y, u), h = Ge(E, h), u.add(h);
2858
+ function he(P, u, h, y, I) {
2859
+ return h = new Z(t.mul(h.X, P), h.Y, h.Z), u = Ge(y, u), h = Ge(I, h), u.add(h);
2860
2860
  }
2861
2861
  const L = class L {
2862
2862
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
@@ -2879,7 +2879,7 @@ function Ur(r, e = {}) {
2879
2879
  return t.is0(h) && t.is0(y) ? L.ZERO : new L(h, y, t.ONE);
2880
2880
  }
2881
2881
  static fromBytes(u) {
2882
- const h = L.fromAffine(_(F(u, void 0, "point")));
2882
+ const h = L.fromAffine(w(F(u, void 0, "point")));
2883
2883
  return h.assertValidity(), h;
2884
2884
  }
2885
2885
  static fromHex(u) {
@@ -2914,8 +2914,8 @@ function Ur(r, e = {}) {
2914
2914
  /** Compare one point to another. */
2915
2915
  equals(u) {
2916
2916
  D(u);
2917
- const { X: h, Y: y, Z: E } = this, { X: R, Y: I, Z: O } = u, S = t.eql(t.mul(h, O), t.mul(R, E)), C = t.eql(t.mul(y, O), t.mul(I, E));
2918
- return S && C;
2917
+ const { X: h, Y: y, Z: I } = this, { X: R, Y: A, Z: O } = u, T = t.eql(t.mul(h, O), t.mul(R, I)), C = t.eql(t.mul(y, O), t.mul(A, I));
2918
+ return T && C;
2919
2919
  }
2920
2920
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
2921
2921
  negate() {
@@ -2926,9 +2926,9 @@ function Ur(r, e = {}) {
2926
2926
  // https://eprint.iacr.org/2015/1060, algorithm 3
2927
2927
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
2928
2928
  double() {
2929
- const { a: u, b: h } = o, y = t.mul(h, Be), { X: E, Y: R, Z: I } = this;
2930
- let O = t.ZERO, S = t.ZERO, C = t.ZERO, N = t.mul(E, E), W = t.mul(R, R), U = t.mul(I, I), k = t.mul(E, R);
2931
- return k = t.add(k, k), C = t.mul(E, I), C = t.add(C, C), O = t.mul(u, C), S = t.mul(y, U), S = t.add(O, S), O = t.sub(W, S), S = t.add(W, S), S = t.mul(O, S), O = t.mul(k, O), C = t.mul(y, C), U = t.mul(u, U), k = t.sub(N, U), k = t.mul(u, k), k = t.add(k, C), C = t.add(N, N), N = t.add(C, N), N = t.add(N, U), N = t.mul(N, k), S = t.add(S, N), U = t.mul(R, I), U = t.add(U, U), N = t.mul(U, k), O = t.sub(O, N), C = t.mul(U, W), C = t.add(C, C), C = t.add(C, C), new L(O, S, C);
2929
+ const { a: u, b: h } = o, y = t.mul(h, Be), { X: I, Y: R, Z: A } = this;
2930
+ let O = t.ZERO, T = t.ZERO, C = t.ZERO, N = t.mul(I, I), W = t.mul(R, R), U = t.mul(A, A), k = t.mul(I, R);
2931
+ return k = t.add(k, k), C = t.mul(I, A), C = t.add(C, C), O = t.mul(u, C), T = t.mul(y, U), T = t.add(O, T), O = t.sub(W, T), T = t.add(W, T), T = t.mul(O, T), O = t.mul(k, O), C = t.mul(y, C), U = t.mul(u, U), k = t.sub(N, U), k = t.mul(u, k), k = t.add(k, C), C = t.add(N, N), N = t.add(C, N), N = t.add(N, U), N = t.mul(N, k), T = t.add(T, N), U = t.mul(R, A), U = t.add(U, U), N = t.mul(U, k), O = t.sub(O, N), C = t.mul(U, W), C = t.add(C, C), C = t.add(C, C), new L(O, T, C);
2932
2932
  }
2933
2933
  // Renes-Costello-Batina exception-free addition formula.
2934
2934
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -2936,13 +2936,13 @@ function Ur(r, e = {}) {
2936
2936
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
2937
2937
  add(u) {
2938
2938
  D(u);
2939
- const { X: h, Y: y, Z: E } = this, { X: R, Y: I, Z: O } = u;
2940
- let S = t.ZERO, C = t.ZERO, N = t.ZERO;
2939
+ const { X: h, Y: y, Z: I } = this, { X: R, Y: A, Z: O } = u;
2940
+ let T = t.ZERO, C = t.ZERO, N = t.ZERO;
2941
2941
  const W = o.a, U = t.mul(o.b, Be);
2942
- let k = t.mul(h, R), j = t.mul(y, I), V = t.mul(E, O), ee = t.add(h, y), H = t.add(R, I);
2943
- ee = t.mul(ee, H), H = t.add(k, j), ee = t.sub(ee, H), H = t.add(h, E);
2942
+ let k = t.mul(h, R), j = t.mul(y, A), V = t.mul(I, O), ee = t.add(h, y), H = t.add(R, A);
2943
+ ee = t.mul(ee, H), H = t.add(k, j), ee = t.sub(ee, H), H = t.add(h, I);
2944
2944
  let K = t.add(R, O);
2945
- return H = t.mul(H, K), K = t.add(k, V), H = t.sub(H, K), K = t.add(y, E), S = t.add(I, O), K = t.mul(K, S), S = t.add(j, V), K = t.sub(K, S), N = t.mul(W, H), S = t.mul(U, V), N = t.add(S, N), S = t.sub(j, N), N = t.add(j, N), C = t.mul(S, N), j = t.add(k, k), j = t.add(j, k), V = t.mul(W, V), H = t.mul(U, H), j = t.add(j, V), V = t.sub(k, V), V = t.mul(W, V), H = t.add(H, V), k = t.mul(j, H), C = t.add(C, k), k = t.mul(K, H), S = t.mul(ee, S), S = t.sub(S, k), k = t.mul(ee, j), N = t.mul(K, N), N = t.add(N, k), new L(S, C, N);
2945
+ return H = t.mul(H, K), K = t.add(k, V), H = t.sub(H, K), K = t.add(y, I), T = t.add(A, O), K = t.mul(K, T), T = t.add(j, V), K = t.sub(K, T), N = t.mul(W, H), T = t.mul(U, V), N = t.add(T, N), T = t.sub(j, N), N = t.add(j, N), C = t.mul(T, N), j = t.add(k, k), j = t.add(j, k), V = t.mul(W, V), H = t.mul(U, H), j = t.add(j, V), V = t.sub(k, V), V = t.mul(W, V), H = t.add(H, V), k = t.mul(j, H), C = t.add(C, k), k = t.mul(K, H), T = t.mul(ee, T), T = t.sub(T, k), k = t.mul(ee, j), N = t.mul(K, N), N = t.add(N, k), new L(T, C, N);
2946
2946
  }
2947
2947
  subtract(u) {
2948
2948
  return this.add(u.negate());
@@ -2963,16 +2963,16 @@ function Ur(r, e = {}) {
2963
2963
  const { endo: h } = e;
2964
2964
  if (!n.isValidNot0(u))
2965
2965
  throw new Error("invalid scalar: out of range");
2966
- let y, E;
2967
- const R = (I) => ne.cached(this, I, (O) => Lt(L, O));
2966
+ let y, I;
2967
+ const R = (A) => ne.cached(this, A, (O) => Lt(L, O));
2968
2968
  if (h) {
2969
- const { k1neg: I, k1: O, k2neg: S, k2: C } = B(u), { p: N, f: W } = R(O), { p: U, f: k } = R(C);
2970
- E = W.add(k), y = he(h.beta, N, U, I, S);
2969
+ const { k1neg: A, k1: O, k2neg: T, k2: C } = B(u), { p: N, f: W } = R(O), { p: U, f: k } = R(C);
2970
+ I = W.add(k), y = he(h.beta, N, U, A, T);
2971
2971
  } else {
2972
- const { p: I, f: O } = R(u);
2973
- y = I, E = O;
2972
+ const { p: A, f: O } = R(u);
2973
+ y = A, I = O;
2974
2974
  }
2975
- return Lt(L, [y, E])[0];
2975
+ return Lt(L, [y, I])[0];
2976
2976
  }
2977
2977
  /**
2978
2978
  * Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -2990,8 +2990,8 @@ function Ur(r, e = {}) {
2990
2990
  if (ne.hasCache(this))
2991
2991
  return this.multiply(u);
2992
2992
  if (h) {
2993
- const { k1neg: E, k1: R, k2neg: I, k2: O } = B(u), { p1: S, p2: C } = Pr(L, y, R, O);
2994
- return he(h.beta, S, C, E, I);
2993
+ const { k1neg: I, k1: R, k2neg: A, k2: O } = B(u), { p1: T, p2: C } = Pr(L, y, R, O);
2994
+ return he(h.beta, T, C, I, A);
2995
2995
  } else
2996
2996
  return ne.unsafe(y, u);
2997
2997
  }
@@ -3018,7 +3018,7 @@ function Ur(r, e = {}) {
3018
3018
  return this.multiplyUnsafe(i).is0();
3019
3019
  }
3020
3020
  toBytes(u = !0) {
3021
- return He(u, "isCompressed"), this.assertValidity(), m(L, this, u);
3021
+ return He(u, "isCompressed"), this.assertValidity(), x(L, this, u);
3022
3022
  }
3023
3023
  toHex(u = !0) {
3024
3024
  return ke(this.toBytes(u));
@@ -3051,50 +3051,50 @@ function ms(r, e) {
3051
3051
  }
3052
3052
  function Fr(r, e = {}) {
3053
3053
  const { Fn: s } = r, t = e.randomBytes || Xt, n = Object.assign(ms(r.Fp, s), { seed: us(s.ORDER) });
3054
- function o(m) {
3054
+ function o(x) {
3055
3055
  try {
3056
- const _ = s.fromBytes(m);
3057
- return s.isValidNot0(_);
3056
+ const w = s.fromBytes(x);
3057
+ return s.isValidNot0(w);
3058
3058
  } catch {
3059
3059
  return !1;
3060
3060
  }
3061
3061
  }
3062
- function i(m, _) {
3063
- const { publicKey: T, publicKeyUncompressed: b } = n;
3062
+ function i(x, w) {
3063
+ const { publicKey: b, publicKeyUncompressed: S } = n;
3064
3064
  try {
3065
- const A = m.length;
3066
- return _ === !0 && A !== T || _ === !1 && A !== b ? !1 : !!r.fromBytes(m);
3065
+ const E = x.length;
3066
+ return w === !0 && E !== b || w === !1 && E !== S ? !1 : !!r.fromBytes(x);
3067
3067
  } catch {
3068
3068
  return !1;
3069
3069
  }
3070
3070
  }
3071
- function a(m = t(n.seed)) {
3072
- return kr(F(m, n.seed, "seed"), s.ORDER);
3071
+ function a(x = t(n.seed)) {
3072
+ return kr(F(x, n.seed, "seed"), s.ORDER);
3073
3073
  }
3074
- function c(m, _ = !0) {
3075
- return r.BASE.multiply(s.fromBytes(m)).toBytes(_);
3074
+ function c(x, w = !0) {
3075
+ return r.BASE.multiply(s.fromBytes(x)).toBytes(w);
3076
3076
  }
3077
- function l(m) {
3078
- const { secretKey: _, publicKey: T, publicKeyUncompressed: b } = n;
3079
- if (!at(m) || "_lengths" in s && s._lengths || _ === T)
3077
+ function l(x) {
3078
+ const { secretKey: w, publicKey: b, publicKeyUncompressed: S } = n;
3079
+ if (!at(x) || "_lengths" in s && s._lengths || w === b)
3080
3080
  return;
3081
- const A = F(m, void 0, "key").length;
3082
- return A === T || A === b;
3081
+ const E = F(x, void 0, "key").length;
3082
+ return E === b || E === S;
3083
3083
  }
3084
- function d(m, _, T = !0) {
3085
- if (l(m) === !0)
3084
+ function d(x, w, b = !0) {
3085
+ if (l(x) === !0)
3086
3086
  throw new Error("first arg must be private key");
3087
- if (l(_) === !1)
3087
+ if (l(w) === !1)
3088
3088
  throw new Error("second arg must be public key");
3089
- const b = s.fromBytes(m);
3090
- return r.fromBytes(_).multiply(b).toBytes(T);
3089
+ const S = s.fromBytes(x);
3090
+ return r.fromBytes(w).multiply(S).toBytes(b);
3091
3091
  }
3092
- const f = {
3092
+ const g = {
3093
3093
  isValidSecretKey: o,
3094
3094
  isValidPublicKey: i,
3095
3095
  randomSecretKey: a
3096
- }, w = Dr(a, c);
3097
- return Object.freeze({ getPublicKey: c, getSharedSecret: d, keygen: w, Point: r, utils: f, lengths: n });
3096
+ }, m = Dr(a, c);
3097
+ return Object.freeze({ getPublicKey: c, getSharedSecret: d, keygen: m, Point: r, utils: g, lengths: n });
3098
3098
  }
3099
3099
  function Hr(r, e, s = {}) {
3100
3100
  Kt(e), ut(s, {}, {
@@ -3104,52 +3104,52 @@ function Hr(r, e, s = {}) {
3104
3104
  bits2int: "function",
3105
3105
  bits2int_modN: "function"
3106
3106
  }), s = Object.assign({}, s);
3107
- const t = s.randomBytes || Xt, n = s.hmac || ((u, h) => ps(e, u, h)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: d, getSharedSecret: f, utils: w, lengths: m } = Fr(r, s), _ = {
3107
+ const t = s.randomBytes || Xt, n = s.hmac || ((u, h) => ps(e, u, h)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: d, getSharedSecret: g, utils: m, lengths: x } = Fr(r, s), w = {
3108
3108
  prehash: !0,
3109
3109
  lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
3110
3110
  format: "compact",
3111
3111
  extraEntropy: !1
3112
- }, T = a * _s < o.ORDER;
3113
- function b(u) {
3112
+ }, b = a * _s < o.ORDER;
3113
+ function S(u) {
3114
3114
  const h = a >> Ee;
3115
3115
  return u > h;
3116
3116
  }
3117
- function A(u, h) {
3117
+ function E(u, h) {
3118
3118
  if (!i.isValidNot0(h))
3119
3119
  throw new Error(`invalid signature ${u}: out of range 1..Point.Fn.ORDER`);
3120
3120
  return h;
3121
3121
  }
3122
3122
  function q() {
3123
- if (T)
3123
+ if (b)
3124
3124
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
3125
3125
  }
3126
3126
  function M(u, h) {
3127
3127
  nt(h);
3128
- const y = m.signature, E = h === "compact" ? y : h === "recovered" ? y + 1 : void 0;
3129
- return F(u, E);
3128
+ const y = x.signature, I = h === "compact" ? y : h === "recovered" ? y + 1 : void 0;
3129
+ return F(u, I);
3130
3130
  }
3131
3131
  class D {
3132
- constructor(h, y, E) {
3132
+ constructor(h, y, I) {
3133
3133
  v(this, "r");
3134
3134
  v(this, "s");
3135
3135
  v(this, "recovery");
3136
- if (this.r = A("r", h), this.s = A("s", y), E != null) {
3137
- if (q(), ![0, 1, 2, 3].includes(E))
3136
+ if (this.r = E("r", h), this.s = E("s", y), I != null) {
3137
+ if (q(), ![0, 1, 2, 3].includes(I))
3138
3138
  throw new Error("invalid recovery id");
3139
- this.recovery = E;
3139
+ this.recovery = I;
3140
3140
  }
3141
3141
  Object.freeze(this);
3142
3142
  }
3143
- static fromBytes(h, y = _.format) {
3143
+ static fromBytes(h, y = w.format) {
3144
3144
  M(h, y);
3145
- let E;
3145
+ let I;
3146
3146
  if (y === "der") {
3147
- const { r: S, s: C } = pe.toSig(F(h));
3148
- return new D(S, C);
3147
+ const { r: T, s: C } = pe.toSig(F(h));
3148
+ return new D(T, C);
3149
3149
  }
3150
- y === "recovered" && (E = h[0], y = "compact", h = h.subarray(1));
3151
- const R = m.signature / 2, I = h.subarray(0, R), O = h.subarray(R, R * 2);
3152
- return new D(i.fromBytes(I), i.fromBytes(O), E);
3150
+ y === "recovered" && (I = h[0], y = "compact", h = h.subarray(1));
3151
+ const R = x.signature / 2, A = h.subarray(0, R), O = h.subarray(R, R * 2);
3152
+ return new D(i.fromBytes(A), i.fromBytes(O), I);
3153
3153
  }
3154
3154
  static fromHex(h, y) {
3155
3155
  return this.fromBytes(Fe(h), y);
@@ -3164,23 +3164,23 @@ function Hr(r, e, s = {}) {
3164
3164
  return new D(this.r, this.s, h);
3165
3165
  }
3166
3166
  recoverPublicKey(h) {
3167
- const { r: y, s: E } = this, R = this.assertRecovery(), I = R === 2 || R === 3 ? y + a : y;
3168
- if (!o.isValid(I))
3167
+ const { r: y, s: I } = this, R = this.assertRecovery(), A = R === 2 || R === 3 ? y + a : y;
3168
+ if (!o.isValid(A))
3169
3169
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
3170
- const O = o.toBytes(I), S = r.fromBytes(_e(xs((R & 1) === 0), O)), C = i.inv(I), N = Q(F(h, void 0, "msgHash")), W = i.create(-N * C), U = i.create(E * C), k = r.BASE.multiplyUnsafe(W).add(S.multiplyUnsafe(U));
3170
+ const O = o.toBytes(A), T = r.fromBytes(_e(xs((R & 1) === 0), O)), C = i.inv(A), N = Q(F(h, void 0, "msgHash")), W = i.create(-N * C), U = i.create(I * C), k = r.BASE.multiplyUnsafe(W).add(T.multiplyUnsafe(U));
3171
3171
  if (k.is0())
3172
3172
  throw new Error("invalid recovery: point at infinify");
3173
3173
  return k.assertValidity(), k;
3174
3174
  }
3175
3175
  // Signatures should be low-s, to prevent malleability.
3176
3176
  hasHighS() {
3177
- return b(this.s);
3177
+ return S(this.s);
3178
3178
  }
3179
- toBytes(h = _.format) {
3179
+ toBytes(h = w.format) {
3180
3180
  if (nt(h), h === "der")
3181
3181
  return Fe(pe.hexFromSig(this));
3182
- const { r: y, s: E } = this, R = i.toBytes(y), I = i.toBytes(E);
3183
- return h === "recovered" ? (q(), _e(Uint8Array.of(this.assertRecovery()), R, I)) : _e(R, I);
3182
+ const { r: y, s: I } = this, R = i.toBytes(y), A = i.toBytes(I);
3183
+ return h === "recovered" ? (q(), _e(Uint8Array.of(this.assertRecovery()), R, A)) : _e(R, A);
3184
3184
  }
3185
3185
  toHex(h) {
3186
3186
  return ke(this.toBytes(h));
@@ -3189,8 +3189,8 @@ function Hr(r, e, s = {}) {
3189
3189
  const B = s.bits2int || function(h) {
3190
3190
  if (h.length > 8192)
3191
3191
  throw new Error("input is too large");
3192
- const y = je(h), E = h.length * 8 - c;
3193
- return E > 0 ? y >> BigInt(E) : y;
3192
+ const y = je(h), I = h.length * 8 - c;
3193
+ return I > 0 ? y >> BigInt(I) : y;
3194
3194
  }, Q = s.bits2int_modN || function(h) {
3195
3195
  return i.create(B(h));
3196
3196
  }, ve = dt(c);
@@ -3201,14 +3201,14 @@ function Hr(r, e, s = {}) {
3201
3201
  return F(u, void 0, "message"), h ? F(e(u), void 0, "prehashed message") : u;
3202
3202
  }
3203
3203
  function xe(u, h, y) {
3204
- const { lowS: E, prehash: R, extraEntropy: I } = et(y, _);
3204
+ const { lowS: I, prehash: R, extraEntropy: A } = et(y, w);
3205
3205
  u = Z(u, R);
3206
- const O = Q(u), S = i.fromBytes(h);
3207
- if (!i.isValidNot0(S))
3206
+ const O = Q(u), T = i.fromBytes(h);
3207
+ if (!i.isValidNot0(T))
3208
3208
  throw new Error("invalid private key");
3209
- const C = [he(S), he(O)];
3210
- if (I != null && I !== !1) {
3211
- const k = I === !0 ? t(m.secretKey) : I;
3209
+ const C = [he(T), he(O)];
3210
+ if (A != null && A !== !1) {
3211
+ const k = A === !0 ? t(x.secretKey) : A;
3212
3212
  C.push(F(k, void 0, "extraEntropy"));
3213
3213
  }
3214
3214
  const N = _e(...C), W = O;
@@ -3219,45 +3219,45 @@ function Hr(r, e, s = {}) {
3219
3219
  const V = i.inv(j), ee = r.BASE.multiply(j).toAffine(), H = i.create(ee.x);
3220
3220
  if (H === le)
3221
3221
  return;
3222
- const K = i.create(V * i.create(W + H * S));
3222
+ const K = i.create(V * i.create(W + H * T));
3223
3223
  if (K === le)
3224
3224
  return;
3225
3225
  let xt = (ee.x === H ? 0 : 2) | Number(ee.y & Ee), mt = K;
3226
- return E && b(K) && (mt = i.neg(K), xt ^= 1), new D(H, mt, T ? void 0 : xt);
3226
+ return I && S(K) && (mt = i.neg(K), xt ^= 1), new D(H, mt, b ? void 0 : xt);
3227
3227
  }
3228
3228
  return { seed: N, k2sig: U };
3229
3229
  }
3230
3230
  function ne(u, h, y = {}) {
3231
- const { seed: E, k2sig: R } = xe(u, h, y);
3232
- return yr(e.outputLen, i.BYTES, n)(E, R).toBytes(y.format);
3233
- }
3234
- function L(u, h, y, E = {}) {
3235
- const { lowS: R, prehash: I, format: O } = et(E, _);
3236
- if (y = F(y, void 0, "publicKey"), h = Z(h, I), !at(u)) {
3237
- const S = u instanceof D ? ", use sig.toBytes()" : "";
3238
- throw new Error("verify expects Uint8Array signature" + S);
3231
+ const { seed: I, k2sig: R } = xe(u, h, y);
3232
+ return yr(e.outputLen, i.BYTES, n)(I, R).toBytes(y.format);
3233
+ }
3234
+ function L(u, h, y, I = {}) {
3235
+ const { lowS: R, prehash: A, format: O } = et(I, w);
3236
+ if (y = F(y, void 0, "publicKey"), h = Z(h, A), !at(u)) {
3237
+ const T = u instanceof D ? ", use sig.toBytes()" : "";
3238
+ throw new Error("verify expects Uint8Array signature" + T);
3239
3239
  }
3240
3240
  M(u, O);
3241
3241
  try {
3242
- const S = D.fromBytes(u, O), C = r.fromBytes(y);
3243
- if (R && S.hasHighS())
3242
+ const T = D.fromBytes(u, O), C = r.fromBytes(y);
3243
+ if (R && T.hasHighS())
3244
3244
  return !1;
3245
- const { r: N, s: W } = S, U = Q(h), k = i.inv(W), j = i.create(U * k), V = i.create(N * k), ee = r.BASE.multiplyUnsafe(j).add(C.multiplyUnsafe(V));
3245
+ const { r: N, s: W } = T, U = Q(h), k = i.inv(W), j = i.create(U * k), V = i.create(N * k), ee = r.BASE.multiplyUnsafe(j).add(C.multiplyUnsafe(V));
3246
3246
  return ee.is0() ? !1 : i.create(ee.x) === N;
3247
3247
  } catch {
3248
3248
  return !1;
3249
3249
  }
3250
3250
  }
3251
3251
  function P(u, h, y = {}) {
3252
- const { prehash: E } = et(y, _);
3253
- return h = Z(h, E), D.fromBytes(u, "recovered").recoverPublicKey(h).toBytes();
3252
+ const { prehash: I } = et(y, w);
3253
+ return h = Z(h, I), D.fromBytes(u, "recovered").recoverPublicKey(h).toBytes();
3254
3254
  }
3255
3255
  return Object.freeze({
3256
3256
  keygen: l,
3257
3257
  getPublicKey: d,
3258
- getSharedSecret: f,
3259
- utils: w,
3260
- lengths: m,
3258
+ getSharedSecret: g,
3259
+ utils: m,
3260
+ lengths: x,
3261
3261
  Point: r,
3262
3262
  sign: ne,
3263
3263
  verify: L,
@@ -3283,7 +3283,7 @@ const ft = {
3283
3283
  ]
3284
3284
  }, Ut = /* @__PURE__ */ BigInt(2);
3285
3285
  function qr(r) {
3286
- const e = ft.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, f = se(d, s, e) * d % e, w = se(f, s, e) * d % e, m = se(w, Ut, e) * l % e, _ = se(m, n, e) * m % e, T = se(_, o, e) * _ % e, b = se(T, a, e) * T % e, A = se(b, c, e) * b % e, q = se(A, a, e) * T % e, M = se(q, s, e) * d % e, D = se(M, i, e) * _ % e, B = se(D, t, e) * l % e, Q = se(B, Ut, e);
3286
+ const e = ft.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, g = se(d, s, e) * d % e, m = se(g, s, e) * d % e, x = se(m, Ut, e) * l % e, w = se(x, n, e) * x % e, b = se(w, o, e) * w % e, S = se(b, a, e) * b % e, E = se(S, c, e) * S % e, q = se(E, a, e) * b % e, M = se(q, s, e) * d % e, D = se(M, i, e) * w % e, B = se(D, t, e) * l % e, Q = se(B, Ut, e);
3287
3287
  if (!ot.eql(ot.sqr(Q), r))
3288
3288
  throw new Error("Cannot find square root");
3289
3289
  return Q;
@@ -3306,9 +3306,9 @@ function Qr(r, e = 24) {
3306
3306
  for (let i = 0; i < 10; i++)
3307
3307
  s[i] = r[i] ^ r[i + 10] ^ r[i + 20] ^ r[i + 30] ^ r[i + 40];
3308
3308
  for (let i = 0; i < 10; i += 2) {
3309
- const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], d = s[c + 1], f = Ft(l, d, 1) ^ s[a], w = Ht(l, d, 1) ^ s[a + 1];
3310
- for (let m = 0; m < 50; m += 10)
3311
- r[i + m] ^= f, r[i + m + 1] ^= w;
3309
+ const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], d = s[c + 1], g = Ft(l, d, 1) ^ s[a], m = Ht(l, d, 1) ^ s[a + 1];
3310
+ for (let x = 0; x < 50; x += 10)
3311
+ r[i + x] ^= g, r[i + x + 1] ^= m;
3312
3312
  }
3313
3313
  let n = r[2], o = r[3];
3314
3314
  for (let i = 0; i < 24; i++) {
@@ -3406,20 +3406,20 @@ class tn {
3406
3406
  async verifyJWT(e, s) {
3407
3407
  try {
3408
3408
  const t = this.decodeJWT(e);
3409
- g.log("[CROSSx] JWT 디코딩 성공:", {
3409
+ f.log("[CROSSx] JWT 디코딩 성공:", {
3410
3410
  sub: t.sub,
3411
3411
  exp: t.exp,
3412
3412
  iat: t.iat,
3413
3413
  "현재 시간": Math.floor(Date.now() / 1e3)
3414
3414
  });
3415
3415
  const n = Math.floor(Date.now() / 1e3);
3416
- return t.exp && t.exp < n ? (g.warn("[CROSSx] 토큰 만료:", {
3416
+ return t.exp && t.exp < n ? (f.warn("[CROSSx] 토큰 만료:", {
3417
3417
  exp: t.exp,
3418
3418
  now: n,
3419
3419
  만료시간: new Date(t.exp * 1e3).toISOString()
3420
- }), { payload: t, valid: !1, signatureVerified: !1 }) : t.sub ? (g.log("[CROSSx] JWT 검증 성공 (서명 미검증 — JWKS 미구현)"), { payload: t, valid: !0, signatureVerified: !1 }) : (g.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: t, valid: !1, signatureVerified: !1 });
3420
+ }), { payload: t, valid: !1, signatureVerified: !1 }) : t.sub ? (f.log("[CROSSx] JWT 검증 성공 (서명 미검증 — JWKS 미구현)"), { payload: t, valid: !0, signatureVerified: !1 }) : (f.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: t, valid: !1, signatureVerified: !1 });
3421
3421
  } catch (t) {
3422
- throw g.error("[CROSSx] JWT 검증 중 에러:", t), t;
3422
+ throw f.error("[CROSSx] JWT 검증 중 에러:", t), t;
3423
3423
  }
3424
3424
  }
3425
3425
  decodeJWT(e) {
@@ -3441,11 +3441,11 @@ ${t.length}`
3441
3441
  const i = Gt(o), a = s.startsWith("0x") ? s.slice(2) : s;
3442
3442
  if (a.length !== 130)
3443
3443
  throw new Error(`Invalid signature length: expected 130 hex chars, got ${a.length}`);
3444
- const c = sn(a), l = c.slice(0, 32), d = c.slice(32, 64), f = c[64], w = f >= 27 ? f - 27 : f, T = new jr.Signature(
3444
+ const c = sn(a), l = c.slice(0, 32), d = c.slice(32, 64), g = c[64], m = g >= 27 ? g - 27 : g, b = new jr.Signature(
3445
3445
  qt(l),
3446
3446
  qt(d)
3447
- ).addRecoveryBit(w).recoverPublicKey(i).toBytes(!1).slice(1), b = Gt(T);
3448
- return "0x" + ke(b.slice(12));
3447
+ ).addRecoveryBit(m).recoverPublicKey(i).toBytes(!1).slice(1), S = Gt(b);
3448
+ return "0x" + ke(S.slice(12));
3449
3449
  }
3450
3450
  }
3451
3451
  function sn(r) {
@@ -3498,38 +3498,38 @@ class pt {
3498
3498
  }
3499
3499
  openAuth(e) {
3500
3500
  return new Promise((s, t) => {
3501
- const n = e.width ?? 500, o = e.height ?? 600, i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c = pt.generateState(), l = e.authUrl.includes("?") ? "&" : "?", d = `${e.authUrl}${l}state=${c}`, f = window.open(
3501
+ const n = e.width ?? 500, o = e.height ?? 600, i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c = pt.generateState(), l = e.authUrl.includes("?") ? "&" : "?", d = `${e.authUrl}${l}state=${c}`, g = window.open(
3502
3502
  d,
3503
3503
  "CROSSx OAuth",
3504
3504
  `width=${n},height=${o},left=${i},top=${a}`
3505
3505
  );
3506
- if (!f) {
3506
+ if (!g) {
3507
3507
  t(new Error("팝업 창을 열 수 없습니다. 팝업 차단을 해제해 주세요."));
3508
3508
  return;
3509
3509
  }
3510
- const w = setTimeout(() => {
3511
- g.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), M(), t(new Error("Authentication timeout"));
3512
- }, 5 * 60 * 1e3), m = 10, _ = 30;
3513
- let T = 0, b = null;
3514
- const A = () => {
3515
- clearInterval(q), g.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + _ + "초간 대기합니다"), b = setTimeout(() => {
3510
+ const m = setTimeout(() => {
3511
+ f.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), M(), t(new Error("Authentication timeout"));
3512
+ }, 5 * 60 * 1e3), x = 10, w = 30;
3513
+ let b = 0, S = null;
3514
+ const E = () => {
3515
+ clearInterval(q), f.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + w + "초간 대기합니다"), S = setTimeout(() => {
3516
3516
  M(), t(new Error(
3517
3517
  "OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
3518
3518
  ));
3519
- }, _ * 1e3);
3519
+ }, w * 1e3);
3520
3520
  }, q = setInterval(() => {
3521
- T++;
3521
+ b++;
3522
3522
  try {
3523
- f.closed && (T <= m ? A() : (M(), t(new Error("로그인이 취소되었습니다"))));
3523
+ g.closed && (b <= x ? E() : (M(), t(new Error("로그인이 취소되었습니다"))));
3524
3524
  } catch {
3525
- A();
3525
+ E();
3526
3526
  }
3527
3527
  }, 1e3), M = () => {
3528
- clearTimeout(w), clearInterval(q), b && clearTimeout(b), window.removeEventListener("message", D);
3528
+ clearTimeout(m), clearInterval(q), S && clearTimeout(S), window.removeEventListener("message", D);
3529
3529
  }, D = (B) => {
3530
3530
  var ve, he, Z, xe, ne, L, P;
3531
3531
  if (B.origin !== e.expectedOrigin) return;
3532
- M(), g.log("[CROSSx] OAuth postMessage 수신 — status:", B.data.status);
3532
+ M(), f.log("[CROSSx] OAuth postMessage 수신 — status:", B.data.status);
3533
3533
  const Q = B.data.state ?? ((ve = B.data.data) == null ? void 0 : ve.state);
3534
3534
  if (!Q || Q !== c) {
3535
3535
  t(new Error("OAuth state mismatch — possible CSRF attack"));
@@ -3537,12 +3537,12 @@ class pt {
3537
3537
  }
3538
3538
  if (B.data.status === "success") {
3539
3539
  const u = ((he = B.data.data) == null ? void 0 : he.accessToken) || ((Z = B.data.data) == null ? void 0 : Z.idToken);
3540
- g.log("[CROSSx] OAuth 토큰 수신:", {
3540
+ f.log("[CROSSx] OAuth 토큰 수신:", {
3541
3541
  hasAccessToken: !!((xe = B.data.data) != null && xe.accessToken),
3542
3542
  hasIdToken: !!((ne = B.data.data) != null && ne.idToken)
3543
- }), u ? s(u) : (g.error("[CROSSx] 토큰을 찾을 수 없음:", B.data), t(new Error("Token not found in response")));
3543
+ }), u ? s(u) : (f.error("[CROSSx] 토큰을 찾을 수 없음:", B.data), t(new Error("Token not found in response")));
3544
3544
  } else
3545
- g.error("[CROSSx] OAuth 실패:", (L = B.data.data) == null ? void 0 : L.error), t(new Error(((P = B.data.data) == null ? void 0 : P.error) || "Authentication failed"));
3545
+ f.error("[CROSSx] OAuth 실패:", (L = B.data.data) == null ? void 0 : L.error), t(new Error(((P = B.data.data) == null ? void 0 : P.error) || "Authentication failed"));
3546
3546
  };
3547
3547
  window.addEventListener("message", D);
3548
3548
  });
@@ -3565,7 +3565,7 @@ class on {
3565
3565
  };
3566
3566
  return await this.storage.set(Oe, t), t;
3567
3567
  } catch (s) {
3568
- throw new x(p.WALLET_CREATION_FAILED, "Wallet creation failed", s);
3568
+ throw new _(p.WALLET_CREATION_FAILED, "Wallet creation failed", s);
3569
3569
  }
3570
3570
  }
3571
3571
  async getAddresses(e) {
@@ -3580,24 +3580,24 @@ class on {
3580
3580
  }
3581
3581
  async prepare(e, s) {
3582
3582
  const t = "mock-" + crypto.randomUUID();
3583
- return g.log(`[Mock] prepare action=${e} → uuid=${t}`), { uuid: t, expiresAt: new Date(Date.now() + 5 * 6e4).toISOString() };
3583
+ return f.log(`[Mock] prepare action=${e} → uuid=${t}`), { uuid: t, expiresAt: new Date(Date.now() + 5 * 6e4).toISOString() };
3584
3584
  }
3585
3585
  async signMessage(e, s, t, n = 0, o, i) {
3586
- return g.log(`[Mock] signMessage chainId=${s} index=${n} uuid=${o} from=${i}: "${t}"`), { chainId: s, signature: this.generateMockSignature(), format: "hex" };
3586
+ return f.log(`[Mock] signMessage chainId=${s} index=${n} uuid=${o} from=${i}: "${t}"`), { chainId: s, signature: this.generateMockSignature(), format: "hex" };
3587
3587
  }
3588
3588
  async signTypedData(e, s, t, n = 0, o, i) {
3589
- return g.log(`[Mock] signTypedData chainId=${s} index=${n} uuid=${o} from=${i}`), { chainId: s, signature: this.generateMockSignature(), format: "hex" };
3589
+ return f.log(`[Mock] signTypedData chainId=${s} index=${n} uuid=${o} from=${i}`), { chainId: s, signature: this.generateMockSignature(), format: "hex" };
3590
3590
  }
3591
3591
  async signTransaction(e, s, t, n = 0, o) {
3592
- g.log(`[Mock] signTransaction chainId=${s} index=${n} uuid=${o}:`, t);
3592
+ f.log(`[Mock] signTransaction chainId=${s} index=${n} uuid=${o}:`, t);
3593
3593
  const i = "0x" + Array(64).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join("");
3594
3594
  return { chainId: s, signature: this.generateMockSignature(), txHash: i, format: "hex" };
3595
3595
  }
3596
3596
  async sendTransaction(e, s, t, n) {
3597
- return g.log(`[Mock] sendTransaction chainId=${s} uuid=${n}:`, t), { txHash: "0x" + Array(64).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join("") };
3597
+ return f.log(`[Mock] sendTransaction chainId=${s} uuid=${n}:`, t), { txHash: "0x" + Array(64).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join("") };
3598
3598
  }
3599
3599
  async recoverWallet(e, s) {
3600
- g.log("[Mock] recoverWallet");
3600
+ f.log("[Mock] recoverWallet");
3601
3601
  const t = {
3602
3602
  id: e,
3603
3603
  address: this.generateMockEvmAddress(),
@@ -3607,7 +3607,7 @@ class on {
3607
3607
  return await this.storage.set(Oe, t), t;
3608
3608
  }
3609
3609
  async migrateWallet(e, s) {
3610
- g.log(`[Mock] migrateWallet pin=${e} sub=${s}`);
3610
+ f.log(`[Mock] migrateWallet pin=${e} sub=${s}`);
3611
3611
  const t = {
3612
3612
  id: s,
3613
3613
  address: this.generateMockEvmAddress(),
@@ -3637,7 +3637,7 @@ class qe {
3637
3637
  getAuthToken() {
3638
3638
  const e = this.tokenStore.get();
3639
3639
  if (!e)
3640
- throw new x(
3640
+ throw new _(
3641
3641
  p.AUTH_NOT_AUTHENTICATED,
3642
3642
  "No auth token found. Please sign in first."
3643
3643
  );
@@ -3659,33 +3659,33 @@ class qe {
3659
3659
  })).data;
3660
3660
  if (d && typeof d.code == "number") {
3661
3661
  if (d.code < 0 || d.code >= 400) {
3662
- const f = d.message || d.data || "API request failed";
3663
- g.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
3662
+ const g = d.message || d.data || "API request failed";
3663
+ f.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
3664
3664
  code: d.code,
3665
- message: f,
3665
+ message: g,
3666
3666
  url: o,
3667
3667
  method: e,
3668
3668
  fullResponse: d
3669
3669
  });
3670
- const w = qe.mapGatewayError(d.code), m = qe.getGatewayErrorMessage(d.code, f), _ = new x(w, m);
3671
- throw _.gatewayCode = d.code, _.gatewayMessage = f, _;
3670
+ const m = qe.mapGatewayError(d.code), x = qe.getGatewayErrorMessage(d.code, g), w = new _(m, x);
3671
+ throw w.gatewayCode = d.code, w.gatewayMessage = g, w;
3672
3672
  }
3673
- return g.log("[CROSSx] Wallet Gateway API 성공:", { code: d.code, url: o, method: e }), d.data ?? d;
3673
+ return f.log("[CROSSx] Wallet Gateway API 성공:", { code: d.code, url: o, method: e }), d.data ?? d;
3674
3674
  }
3675
3675
  return d;
3676
3676
  } catch (l) {
3677
- if (l instanceof x) throw l;
3677
+ if (l instanceof _) throw l;
3678
3678
  if ((a = l.response) != null && a.data) {
3679
- const d = l.response.data, f = d.message || d.data || "API request failed", w = d.code || "UNKNOWN";
3680
- throw g.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
3681
- code: w,
3682
- message: f,
3679
+ const d = l.response.data, g = d.message || d.data || "API request failed", m = d.code || "UNKNOWN";
3680
+ throw f.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
3681
+ code: m,
3682
+ message: g,
3683
3683
  url: o,
3684
3684
  method: e,
3685
3685
  status: (c = l.response) == null ? void 0 : c.status
3686
- }), new x(
3686
+ }), new _(
3687
3687
  p.UNKNOWN_ERROR,
3688
- `Wallet Gateway error (${w}): ${f}`
3688
+ `Wallet Gateway error (${m}): ${g}`
3689
3689
  );
3690
3690
  }
3691
3691
  throw l;
@@ -3693,12 +3693,12 @@ class qe {
3693
3693
  }
3694
3694
  async getOrCreateWallet(e) {
3695
3695
  var s;
3696
- g.log("[CROSSx][Migration Phase 2] GET /mnemonic/addresses — 기존 지갑 조회");
3696
+ f.log("[CROSSx][Migration Phase 2] GET /mnemonic/addresses — 기존 지갑 조회");
3697
3697
  try {
3698
3698
  const t = await this.request("GET", "/mnemonic/addresses");
3699
3699
  if (t.addresses && t.addresses.length > 0) {
3700
3700
  const { address: n } = t.addresses[0];
3701
- return g.log("[CROSSx][Migration Phase 2] 기존 지갑 발견 — address:", n), {
3701
+ return f.log("[CROSSx][Migration Phase 2] 기존 지갑 발견 — address:", n), {
3702
3702
  id: e,
3703
3703
  address: n,
3704
3704
  derivationPath: "m/44'/60'/0'/0/0",
@@ -3706,12 +3706,12 @@ class qe {
3706
3706
  };
3707
3707
  }
3708
3708
  } catch {
3709
- g.log("[CROSSx][Migration Phase 2] 기존 지갑 없음, POST /mnemonic/create 진행");
3709
+ f.log("[CROSSx][Migration Phase 2] 기존 지갑 없음, POST /mnemonic/create 진행");
3710
3710
  }
3711
- g.log("[CROSSx][Migration Phase 2] POST /mnemonic/create — ignoreBackup: false");
3711
+ f.log("[CROSSx][Migration Phase 2] POST /mnemonic/create — ignoreBackup: false");
3712
3712
  try {
3713
3713
  const t = { ignoreBackup: !1 }, n = await this.request("POST", "/mnemonic/create", t);
3714
- return g.log("[CROSSx][Migration Phase 2] /mnemonic/create 성공 — address:", n.address), {
3714
+ return f.log("[CROSSx][Migration Phase 2] /mnemonic/create 성공 — address:", n.address), {
3715
3715
  id: e,
3716
3716
  address: n.address,
3717
3717
  derivationPath: "m/44'/60'/0'/0/0",
@@ -3719,7 +3719,7 @@ class qe {
3719
3719
  };
3720
3720
  } catch (t) {
3721
3721
  if ((t == null ? void 0 : t.gatewayCode) === -10004 || (s = t == null ? void 0 : t.message) != null && s.includes("-10004")) {
3722
- g.log("[CROSSx][Migration Phase 2] 지갑 이미 존재 (-10004), 주소 재조회");
3722
+ f.log("[CROSSx][Migration Phase 2] 지갑 이미 존재 (-10004), 주소 재조회");
3723
3723
  const n = await this.request("GET", "/mnemonic/addresses");
3724
3724
  if (n.addresses && n.addresses.length > 0)
3725
3725
  return {
@@ -3729,7 +3729,7 @@ class qe {
3729
3729
  createdAt: Date.now()
3730
3730
  };
3731
3731
  }
3732
- throw (t == null ? void 0 : t.gatewayCode) === -10012 && g.log("[CROSSx][Migration Phase 2] Gateway -10012 수신 → MIGRATION_BACKUP_EXISTS throw"), t;
3732
+ throw (t == null ? void 0 : t.gatewayCode) === -10012 && f.log("[CROSSx][Migration Phase 2] Gateway -10012 수신 → MIGRATION_BACKUP_EXISTS throw"), t;
3733
3733
  }
3734
3734
  }
3735
3735
  async getAddresses(e) {
@@ -3742,8 +3742,8 @@ class qe {
3742
3742
  `/mnemonic/address?index=${s}`
3743
3743
  )).address, derivationPath: `m/44'/60'/0'/0/${s}` };
3744
3744
  } catch (t) {
3745
- if (t instanceof x && this.isAddressNotFoundError(t))
3746
- return g.log(`[CROSSx] index ${s} 주소 없음, 파생 중...`), { address: (await this.request(
3745
+ if (t instanceof _ && this.isAddressNotFoundError(t))
3746
+ return f.log(`[CROSSx] index ${s} 주소 없음, 파생 중...`), { address: (await this.request(
3747
3747
  "GET",
3748
3748
  `/mnemonic/address?index=${s}&derive=true`
3749
3749
  )).address, derivationPath: `m/44'/60'/0'/0/${s}` };
@@ -3759,15 +3759,15 @@ class qe {
3759
3759
  switch (e) {
3760
3760
  case "sign":
3761
3761
  case "send":
3762
- if (!s.tx) throw new x(p.TX_INVALID_PARAMS, "prepare: tx is required");
3762
+ if (!s.tx) throw new _(p.TX_INVALID_PARAMS, "prepare: tx is required");
3763
3763
  t = { unsignedTx: this.buildUnsignedTx(s.tx) };
3764
3764
  break;
3765
3765
  case "sign-message":
3766
- if (!s.message) throw new x(p.TX_INVALID_PARAMS, "prepare: message is required");
3766
+ if (!s.message) throw new _(p.TX_INVALID_PARAMS, "prepare: message is required");
3767
3767
  t = { message: s.message }, s.from && (t.from = s.from);
3768
3768
  break;
3769
3769
  case "sign-typed-data":
3770
- if (!s.typedData) throw new x(p.TX_INVALID_PARAMS, "prepare: typedData is required");
3770
+ if (!s.typedData) throw new _(p.TX_INVALID_PARAMS, "prepare: typedData is required");
3771
3771
  t = { typedData: s.typedData }, s.from && (t.from = s.from);
3772
3772
  break;
3773
3773
  }
@@ -3839,13 +3839,13 @@ class qe {
3839
3839
  };
3840
3840
  }
3841
3841
  async migrateWallet(e, s) {
3842
- g.log("[CROSSx][Migration Phase 4] POST /mnemonic/migrate 호출 — sub:", s);
3842
+ f.log("[CROSSx][Migration Phase 4] POST /mnemonic/migrate 호출 — sub:", s);
3843
3843
  const t = { pin: e, sub: s }, n = await this.request(
3844
3844
  "POST",
3845
3845
  "/mnemonic/migrate",
3846
3846
  t
3847
3847
  );
3848
- return g.log("[CROSSx][Migration Phase 4] /mnemonic/migrate 완료 — address:", n.address), {
3848
+ return f.log("[CROSSx][Migration Phase 4] /mnemonic/migrate 완료 — address:", n.address), {
3849
3849
  id: s,
3850
3850
  address: n.address,
3851
3851
  derivationPath: "m/44'/60'/0'/0/0",
@@ -3962,7 +3962,7 @@ class Ce {
3962
3962
  handleEnvelopeError(e) {
3963
3963
  if (e.code < 0) {
3964
3964
  const s = typeof e.data == "string" ? e.data : e.message ?? "Chain registry request failed";
3965
- throw new x(
3965
+ throw new _(
3966
3966
  Ce.mapErrorCode(e.code),
3967
3967
  s
3968
3968
  );
@@ -3973,7 +3973,7 @@ class Ce {
3973
3973
  (t) => t.chainId === e
3974
3974
  );
3975
3975
  if (s) return s;
3976
- throw new x(
3976
+ throw new _(
3977
3977
  p.CHAIN_NOT_SUPPORTED,
3978
3978
  `Unsupported chain: ${e}`
3979
3979
  );
@@ -4805,6 +4805,10 @@ const cn = `
4805
4805
  overflow-y: auto;
4806
4806
  animation: __crossx-slide-up-mobile 0.25s ease;
4807
4807
  }
4808
+ .__crossx-card--wallet-selector {
4809
+ overflow: hidden !important;
4810
+ }
4811
+ .__crossx-card--wallet-selector .__crossx-wallet-list { max-height: 203px; }
4808
4812
  .__crossx-login-btn-row {
4809
4813
  flex-direction: column;
4810
4814
  }
@@ -4838,7 +4842,7 @@ const cn = `
4838
4842
 
4839
4843
  /* ── Landscape for signing/transaction modals ──────────── */
4840
4844
  @media (orientation: landscape) and (max-height: 500px) {
4841
- #${te} { align-items: center !important; }
4845
+ #${te} { align-items: center !important; overflow: hidden; }
4842
4846
  .__crossx-card--send-tx,
4843
4847
  .__crossx-card--sign-tx,
4844
4848
  .__crossx-card--sign-msg,
@@ -4888,12 +4892,38 @@ const cn = `
4888
4892
  .__crossx-card--sign-msg .__crossx-msg-box { max-height: 130px; }
4889
4893
  .__crossx-card--sign-typed .__crossx-td-rows { max-height: 130px; overflow-y: auto; }
4890
4894
  .__crossx-col-left > .__crossx-divider { display: none; }
4891
- .__crossx-col-right-ws {
4895
+ .__crossx-card--wallet-selector {
4896
+ overflow: hidden !important;
4897
+ display: flex !important;
4898
+ flex-direction: column !important;
4899
+ }
4900
+ .__crossx-card--wallet-selector .__crossx-header { flex-shrink: 0; }
4901
+ .__crossx-card--wallet-selector > .__crossx-divider { flex-shrink: 0; }
4902
+ .__crossx-card--wallet-selector .__crossx-body {
4903
+ flex: 1;
4904
+ min-height: 0;
4905
+ overflow: hidden;
4906
+ display: flex;
4907
+ flex-direction: column;
4908
+ }
4909
+ .__crossx-card--wallet-selector .__crossx-body-cols {
4910
+ flex: 1;
4911
+ min-height: 0;
4912
+ align-items: stretch !important;
4913
+ }
4914
+ .__crossx-card--wallet-selector .__crossx-col-right-ws {
4892
4915
  display: flex;
4893
4916
  flex-direction: column;
4894
4917
  gap: 8px;
4918
+ min-height: 0;
4919
+ overflow: hidden;
4895
4920
  }
4896
- .__crossx-card--wallet-selector .__crossx-wallet-list { max-height: 140px; }
4921
+ .__crossx-card--wallet-selector .__crossx-wallet-list {
4922
+ max-height: none;
4923
+ flex: 1;
4924
+ min-height: 0;
4925
+ }
4926
+ .__crossx-card--wallet-selector .__crossx-wallet-add { flex-shrink: 0; }
4897
4927
  }
4898
4928
  `;
4899
4929
  function me() {
@@ -5194,19 +5224,19 @@ function yn(r, e) {
5194
5224
  function bn(r, e, s) {
5195
5225
  const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", o = r.querySelector("#__crossx-ttl"), i = r.querySelector(".__crossx-header");
5196
5226
  if (o) {
5197
- const _ = n ? gn : t ? "" : fn, T = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
5198
- _ ? (o.style.display = "flex", o.style.alignItems = "center", o.style.gap = "8px", o.innerHTML = `${_}<span>${T}</span>`) : o.textContent = T;
5227
+ const w = n ? gn : t ? "" : fn, b = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
5228
+ w ? (o.style.display = "flex", o.style.alignItems = "center", o.style.gap = "8px", o.innerHTML = `${w}<span>${b}</span>`) : o.textContent = b;
5199
5229
  }
5200
5230
  if (i && !r.querySelector("#__crossx-close-btn")) {
5201
- const _ = document.createElement("button");
5202
- _.className = "__crossx-close", _.id = "__crossx-close-btn", _.setAttribute("aria-label", "Close"), _.innerHTML = ie, i.appendChild(_);
5231
+ const w = document.createElement("button");
5232
+ w.className = "__crossx-close", w.id = "__crossx-close-btn", w.setAttribute("aria-label", "Close"), w.innerHTML = ie, i.appendChild(w);
5203
5233
  }
5204
5234
  const a = r.querySelector("#__crossx-progress-body");
5205
5235
  if (!a) return;
5206
5236
  const c = e.from ? G("From", `<span class="__crossx-addr-text">${Y(e.from)}</span>
5207
5237
  <button class="__crossx-copy-btn" data-copy="${$(e.from)}" title="Copy address">${de}</button>`) : "", l = e.to ? G("To", `<span class="__crossx-addr-text">${Y(e.to)}</span>
5208
- <button class="__crossx-copy-btn" data-copy="${$(e.to)}" title="Copy address">${de}</button>`) : "", d = e.amount ? G("Transfer", `<span>${$(e.amount)}</span>`) : "", f = e.fees ? G("Tx Fee", `<span>${$(e.fees)}</span>`) : "", w = e.txHash ? G("Tx Hash", `<span class="__crossx-addr-text">${Y(e.txHash)}</span>
5209
- <button class="__crossx-copy-btn" data-copy="${$(e.txHash)}" title="Copy hash">${de}</button>`) : "", m = e.total ? `<div class="__crossx-total-pill">
5238
+ <button class="__crossx-copy-btn" data-copy="${$(e.to)}" title="Copy address">${de}</button>`) : "", d = e.amount ? G("Transfer", `<span>${$(e.amount)}</span>`) : "", g = e.fees ? G("Tx Fee", `<span>${$(e.fees)}</span>`) : "", m = e.txHash ? G("Tx Hash", `<span class="__crossx-addr-text">${Y(e.txHash)}</span>
5239
+ <button class="__crossx-copy-btn" data-copy="${$(e.txHash)}" title="Copy hash">${de}</button>`) : "", x = e.total ? `<div class="__crossx-total-pill">
5210
5240
  <span class="__crossx-total-label">Total<br>(including fees)</span>
5211
5241
  <span class="__crossx-total-amount">${$(e.total)}</span>
5212
5242
  </div>` : "";
@@ -5215,17 +5245,17 @@ function bn(r, e, s) {
5215
5245
  ${c}
5216
5246
  ${l}
5217
5247
  ${d}
5218
- ${f}
5219
- ${w}
5248
+ ${g}
5249
+ ${m}
5220
5250
  </div>
5221
- ${m}
5251
+ ${x}
5222
5252
  <button class="__crossx-approve-btn" id="__crossx-done-btn">${t ? "All Done" : "Done"}</button>
5223
- `, a.querySelectorAll(".__crossx-copy-btn").forEach((_) => {
5224
- _.addEventListener("click", (T) => {
5225
- var A;
5226
- T.stopPropagation();
5227
- const b = _.dataset.copy;
5228
- b && ((A = navigator.clipboard) == null || A.writeText(b).catch(() => {
5253
+ `, a.querySelectorAll(".__crossx-copy-btn").forEach((w) => {
5254
+ w.addEventListener("click", (b) => {
5255
+ var E;
5256
+ b.stopPropagation();
5257
+ const S = w.dataset.copy;
5258
+ S && ((E = navigator.clipboard) == null || E.writeText(S).catch(() => {
5229
5259
  }));
5230
5260
  });
5231
5261
  });
@@ -5278,12 +5308,12 @@ function Sn(r, e) {
5278
5308
  <span class="__crossx-td-value">${$(o)}</span>
5279
5309
  </div>`;
5280
5310
  for (const [l, d] of Object.entries(i)) {
5281
- const f = mn(d), m = xn(d) ? `<span class="__crossx-addr-text">${Y(d)}</span>
5282
- <button class="__crossx-copy-btn" data-copy="${$(String(d))}" title="Copy">${de}</button>` : `<span>${f}</span>`;
5311
+ const g = mn(d), x = xn(d) ? `<span class="__crossx-addr-text">${Y(d)}</span>
5312
+ <button class="__crossx-copy-btn" data-copy="${$(String(d))}" title="Copy">${de}</button>` : `<span>${g}</span>`;
5283
5313
  a += `
5284
5314
  <div class="__crossx-td-row">
5285
5315
  <span class="__crossx-td-label">${$(l)}</span>
5286
- <div class="__crossx-td-value">${m}</div>
5316
+ <div class="__crossx-td-value">${x}</div>
5287
5317
  </div>`;
5288
5318
  }
5289
5319
  const c = document.createElement("div");
@@ -5464,8 +5494,8 @@ function kn(r, e, s) {
5464
5494
  a.preventDefault();
5465
5495
  const c = (((d = a.clipboardData) == null ? void 0 : d.getData("text")) ?? "").replace(/\D/g, "").slice(0, 4);
5466
5496
  if (!c) return;
5467
- c.split("").forEach((f, w) => {
5468
- t[w] && (t[w].value = f);
5497
+ c.split("").forEach((g, m) => {
5498
+ t[m] && (t[m].value = g);
5469
5499
  });
5470
5500
  const l = Math.min(c.length, 3);
5471
5501
  t[l].focus(), c.length === 4 && setTimeout(() => e(c), 200);
@@ -5489,48 +5519,48 @@ class Nn {
5489
5519
  */
5490
5520
  showWalletSelector(e, s) {
5491
5521
  return new Promise((t) => {
5492
- var m;
5522
+ var w;
5493
5523
  me();
5494
- const n = [...e], o = Tn(n, this.tokens);
5495
- document.body.appendChild(o);
5496
- let i = !1;
5497
- const a = () => {
5498
- i || (i = !0, o.remove());
5499
- }, c = (_) => {
5500
- a(), t(_);
5501
- }, l = () => {
5502
- a(), t(null);
5524
+ const n = [...e], o = Tn(n, this.tokens), i = document.body.style.overflow;
5525
+ document.body.style.overflow = "hidden", document.body.appendChild(o);
5526
+ let a = !1;
5527
+ const c = () => {
5528
+ a || (a = !0, o.remove(), document.body.style.overflow = i);
5529
+ }, l = (b) => {
5530
+ c(), t(b);
5531
+ }, d = () => {
5532
+ c(), t(null);
5503
5533
  };
5504
5534
  (() => {
5505
- o.querySelectorAll(".__crossx-wallet-item").forEach((_) => {
5506
- _.addEventListener("click", () => {
5507
- const T = _.dataset.walletAddress ?? "", b = parseInt(_.dataset.walletIndex ?? "0", 10);
5508
- c({ address: T, index: b });
5535
+ o.querySelectorAll(".__crossx-wallet-item").forEach((b) => {
5536
+ b.addEventListener("click", () => {
5537
+ const S = b.dataset.walletAddress ?? "", E = parseInt(b.dataset.walletIndex ?? "0", 10);
5538
+ l({ address: S, index: E });
5509
5539
  });
5510
5540
  });
5511
5541
  })();
5512
- const f = o.querySelector("#__crossx-add-wallet-btn");
5513
- f && f.addEventListener("click", async () => {
5514
- f.disabled = !0;
5542
+ const m = o.querySelector("#__crossx-add-wallet-btn");
5543
+ m && m.addEventListener("click", async () => {
5544
+ m.disabled = !0;
5515
5545
  try {
5516
- const _ = await s();
5517
- n.push(_);
5518
- const T = o.querySelector("#__crossx-wallet-list");
5519
- if (T) {
5520
- const b = document.createElement("button");
5521
- b.className = "__crossx-wallet-item", b.dataset.walletIndex = String(_.index), b.dataset.walletAddress = _.address, b.innerHTML = `<span class="__crossx-wallet-addr">${Y(_.address)}</span>`, b.addEventListener("click", () => c(_)), T.appendChild(b), b.scrollIntoView({ behavior: "smooth", block: "nearest" });
5546
+ const b = await s();
5547
+ n.push(b);
5548
+ const S = o.querySelector("#__crossx-wallet-list");
5549
+ if (S) {
5550
+ const E = document.createElement("button");
5551
+ E.className = "__crossx-wallet-item", E.dataset.walletIndex = String(b.index), E.dataset.walletAddress = b.address, E.innerHTML = `<span class="__crossx-wallet-addr">${Y(b.address)}</span>`, E.addEventListener("click", () => l(b)), S.appendChild(E), E.scrollIntoView({ behavior: "smooth", block: "nearest" });
5522
5552
  }
5523
5553
  } catch {
5524
5554
  } finally {
5525
- f.disabled = !1;
5555
+ m.disabled = !1;
5526
5556
  }
5527
- }), (m = o.querySelector("#__crossx-close-btn")) == null || m.addEventListener("click", l), o.addEventListener("click", (_) => {
5528
- _.target === o && l();
5557
+ }), (w = o.querySelector("#__crossx-close-btn")) == null || w.addEventListener("click", d), o.addEventListener("click", (b) => {
5558
+ b.target === o && d();
5529
5559
  });
5530
- const w = (_) => {
5531
- _.key === "Escape" && (document.removeEventListener("keydown", w), l());
5560
+ const x = (b) => {
5561
+ b.key === "Escape" && (document.removeEventListener("keydown", x), d());
5532
5562
  };
5533
- document.addEventListener("keydown", w);
5563
+ document.addEventListener("keydown", x);
5534
5564
  });
5535
5565
  }
5536
5566
  /**
@@ -5552,7 +5582,7 @@ class Nn {
5552
5582
  (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) => {
5553
5583
  d.target === s && o();
5554
5584
  }), s.querySelectorAll(".__crossx-login-terms-link").forEach((d) => {
5555
- d.addEventListener("click", (f) => f.stopPropagation());
5585
+ d.addEventListener("click", (g) => g.stopPropagation());
5556
5586
  });
5557
5587
  const i = (d) => {
5558
5588
  d.key === "Escape" && (document.removeEventListener("keydown", i), o());
@@ -5620,10 +5650,10 @@ class Nn {
5620
5650
  };
5621
5651
  (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) => {
5622
5652
  l.addEventListener("click", (d) => {
5623
- var w;
5653
+ var m;
5624
5654
  d.stopPropagation();
5625
- const f = l.dataset.copy;
5626
- f && ((w = navigator.clipboard) == null || w.writeText(f).catch(() => {
5655
+ const g = l.dataset.copy;
5656
+ g && ((m = navigator.clipboard) == null || m.writeText(g).catch(() => {
5627
5657
  }));
5628
5658
  });
5629
5659
  }), t.addEventListener("click", (l) => {
@@ -5649,12 +5679,12 @@ class Nn {
5649
5679
  const a = () => {
5650
5680
  i || (i = !0, o(), t());
5651
5681
  }, c = () => {
5652
- var d, f;
5653
- (d = n.querySelector("#__crossx-done-btn")) == null || d.addEventListener("click", a), (f = n.querySelector("#__crossx-close-btn")) == null || f.addEventListener("click", a), n.addEventListener("click", (w) => {
5654
- w.target === n && a();
5682
+ var d, g;
5683
+ (d = n.querySelector("#__crossx-done-btn")) == null || d.addEventListener("click", a), (g = n.querySelector("#__crossx-close-btn")) == null || g.addEventListener("click", a), n.addEventListener("click", (m) => {
5684
+ m.target === n && a();
5655
5685
  });
5656
- const l = (w) => {
5657
- w.key === "Escape" && (document.removeEventListener("keydown", l), a());
5686
+ const l = (m) => {
5687
+ m.key === "Escape" && (document.removeEventListener("keydown", l), a());
5658
5688
  };
5659
5689
  document.addEventListener("keydown", l);
5660
5690
  };
@@ -5674,19 +5704,19 @@ class Nn {
5674
5704
  }, i = () => {
5675
5705
  n(), s(!1);
5676
5706
  };
5677
- (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((f) => {
5678
- f.addEventListener("click", (w) => {
5679
- var _;
5680
- w.stopPropagation();
5681
- const m = f.dataset.copy;
5682
- m && ((_ = navigator.clipboard) == null || _.writeText(m).catch(() => {
5707
+ (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((g) => {
5708
+ g.addEventListener("click", (m) => {
5709
+ var w;
5710
+ m.stopPropagation();
5711
+ const x = g.dataset.copy;
5712
+ x && ((w = navigator.clipboard) == null || w.writeText(x).catch(() => {
5683
5713
  }));
5684
5714
  });
5685
- }), t.addEventListener("click", (f) => {
5686
- f.target === t && i();
5715
+ }), t.addEventListener("click", (g) => {
5716
+ g.target === t && i();
5687
5717
  });
5688
- const a = (f) => {
5689
- f.key === "Escape" && (document.removeEventListener("keydown", a), i());
5718
+ const a = (g) => {
5719
+ g.key === "Escape" && (document.removeEventListener("keydown", a), i());
5690
5720
  };
5691
5721
  document.addEventListener("keydown", a);
5692
5722
  });
@@ -5721,13 +5751,13 @@ function Bn(r) {
5721
5751
  projectId: r.projectId
5722
5752
  }, o = s.authMode !== "cookie" && At.isAvailable() ? new At() : new Ks(), i = new tn(), a = new nn(), c = new pt(), l = new Pn();
5723
5753
  let d;
5724
- r.useMockWallet ? (g.log("[CROSSx] Mock Wallet Provider 사용"), d = new on(o)) : (g.log("[CROSSx] Remote Wallet Provider 사용"), d = new qe(
5754
+ r.useMockWallet ? (f.log("[CROSSx] Mock Wallet Provider 사용"), d = new on(o)) : (f.log("[CROSSx] Remote Wallet Provider 사용"), d = new qe(
5725
5755
  t,
5726
5756
  o,
5727
5757
  a,
5728
5758
  l
5729
5759
  ));
5730
- const f = new Ce(t, a), w = new Nn(r.theme ?? "light", r.themeTokens);
5760
+ const g = new Ce(t, a), m = new Nn(r.theme ?? "light", r.themeTokens);
5731
5761
  return new st(
5732
5762
  s,
5733
5763
  t,
@@ -5737,12 +5767,12 @@ function Bn(r) {
5737
5767
  c,
5738
5768
  d,
5739
5769
  l,
5740
- w,
5741
- f
5770
+ m,
5771
+ g
5742
5772
  );
5743
5773
  }
5744
5774
  export {
5745
- x as CROSSxError,
5775
+ _ as CROSSxError,
5746
5776
  Cs as CROSSxEthereumProvider,
5747
5777
  st as CROSSxSDK,
5748
5778
  $n as ChainId,