@nexus-cross/crossx-sdk-core 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- var Ts = Object.defineProperty;
2
- var Is = (r, e, s) => e in r ? Ts(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
- var v = (r, e, s) => Is(r, typeof e != "symbol" ? e + "" : e, s);
1
+ var Is = Object.defineProperty;
2
+ var Ts = (r, e, s) => e in r ? Is(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
+ var v = (r, e, s) => Ts(r, typeof e != "symbol" ? e + "" : e, s);
4
4
  import { decodeJwt as As } from "jose";
5
- var p = /* @__PURE__ */ ((r) => (r.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", r.AUTH_FAILED = "AUTH_FAILED", r.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", r.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", r.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", r.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 || {});
5
+ var g = /* @__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))(g || {});
6
6
  class _ extends Error {
7
7
  constructor(e, s, t) {
8
8
  super(s), this.code = e, this.details = t, this.name = "CROSSxError", Object.setPrototypeOf(this, _.prototype);
@@ -107,7 +107,7 @@ class Cs {
107
107
  case "personal_sign":
108
108
  case "eth_sign":
109
109
  throw new _(
110
- p.NOT_IMPLEMENTED,
110
+ g.NOT_IMPLEMENTED,
111
111
  `${e} is not yet supported. Use sdk.signMessage() directly.`
112
112
  );
113
113
  case "eth_signTypedData":
@@ -115,7 +115,7 @@ class Cs {
115
115
  case "eth_signTypedData_v3":
116
116
  case "eth_signTypedData_v4":
117
117
  throw new _(
118
- p.NOT_IMPLEMENTED,
118
+ g.NOT_IMPLEMENTED,
119
119
  `${e} is not yet supported. Use sdk.signTypedData() or sdk.signTypedDataOffchain() directly.`
120
120
  );
121
121
  default:
@@ -203,7 +203,7 @@ class ks {
203
203
  checkResponseError(e, s) {
204
204
  if (e != null && e.code && e.code !== 200 && e.code > 0)
205
205
  throw new _(
206
- p.AUTH_FAILED,
206
+ g.AUTH_FAILED,
207
207
  `${s} failed (code ${e.code}): ${e.message}`
208
208
  );
209
209
  const t = e == null ? void 0 : e.data;
@@ -211,7 +211,7 @@ class ks {
211
211
  const n = t;
212
212
  if (n.code && n.code !== 200 && n.code > 0)
213
213
  throw new _(
214
- p.AUTH_FAILED,
214
+ g.AUTH_FAILED,
215
215
  `${s} failed (code ${n.code}): ${n.message}`
216
216
  );
217
217
  }
@@ -223,14 +223,14 @@ 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: g } = this.config, m = `${d}${l}`;
226
+ const { oauthServiceUrl: d, authApiUrl: p } = this.config, m = `${d}${l}`;
227
227
  f.log(`[CROSSx] OAuth 팝업 열기 (${c || "일반"} 로그인):`, m);
228
228
  const x = await this.oauth.openAuth({
229
229
  authUrl: m,
230
230
  expectedOrigin: new URL(d).origin
231
231
  });
232
232
  f.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", x.length, ")");
233
- const { accessToken: w, refreshToken: b } = await this.exchangeFirebaseToken(x, g);
233
+ const { accessToken: w, refreshToken: b } = await this.exchangeFirebaseToken(x, p);
234
234
  let S, E;
235
235
  try {
236
236
  const B = this.crypto.decodeJWT(x);
@@ -296,7 +296,7 @@ class ks {
296
296
  return f.log("[CROSSx] Cookie 모드 — 로그인 성공 (JWT는 HttpOnly 쿠키)"), {};
297
297
  if (!a)
298
298
  throw new _(
299
- p.AUTH_FAILED,
299
+ g.AUTH_FAILED,
300
300
  "access_token not found in exchange response"
301
301
  );
302
302
  f.log("[CROSSx] access_token 교환 성공");
@@ -427,7 +427,7 @@ class ks {
427
427
  return;
428
428
  }
429
429
  if (!c)
430
- throw new _(p.AUTH_FAILED, "Silent refresh failed: no token in response");
430
+ throw new _(g.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);
@@ -440,10 +440,10 @@ class ks {
440
440
  try {
441
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 _ && o.code === p.MIGRATION_BACKUP_EXISTS)
443
+ if (o instanceof _ && o.code === g.MIGRATION_BACKUP_EXISTS)
444
444
  f.log("[CROSSx][Migration Phase 2] Gateway -10012 감지 → needsMigration = true"), n = !0;
445
445
  else {
446
- if (o instanceof _ && (o.code === p.PROJECT_NOT_REGISTERED || o.code === p.PROJECT_ID_MISSING || o.code === p.ORIGIN_NOT_ALLOWED))
446
+ if (o instanceof _ && (o.code === g.PROJECT_NOT_REGISTERED || o.code === g.PROJECT_ID_MISSING || o.code === g.ORIGIN_NOT_ALLOWED))
447
447
  throw f.error("[CROSSx][Migration Phase 2] 프로젝트 설정 에러:", o.message), o;
448
448
  f.warn("[CROSSx][Migration Phase 2] 지갑 로드 실패 (로그인은 유지):", o);
449
449
  }
@@ -467,7 +467,7 @@ class $s {
467
467
  async execute(e, s) {
468
468
  if (!this.walletProvider.migrateWallet)
469
469
  throw new _(
470
- p.NOT_IMPLEMENTED,
470
+ g.NOT_IMPLEMENTED,
471
471
  "Migration is not supported in the current environment"
472
472
  );
473
473
  f.log("[CROSSx][Migration Phase 4] MigrateWalletUseCase.execute() — pin 길이:", e.length, "sub:", s);
@@ -503,7 +503,7 @@ class Ms {
503
503
  })).data;
504
504
  if (a != null && a.error)
505
505
  throw new _(
506
- p.UNKNOWN_ERROR,
506
+ g.UNKNOWN_ERROR,
507
507
  `RPC error [${e}] (${t}): ${a.error.message} (code: ${a.error.code})`
508
508
  );
509
509
  return a == null ? void 0 : a.result;
@@ -571,7 +571,7 @@ async function Fs() {
571
571
  }
572
572
  return Ue.production;
573
573
  }
574
- const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA00", St = 130, Et = 6, Tt = 18, js = 0, Vs = 30 * 1e3, X = class X extends Bs {
574
+ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA00", St = 130, Et = 6, It = 18, js = 0, Vs = 30 * 1e3, X = class X extends Bs {
575
575
  constructor(e, s, t, n, o, i, a, c, l, d) {
576
576
  super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this.authenticated = !1, this.userId = null, this.address = null, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && wt(e.logger), this.confirmation = l, this.chainRegistry = d, this.jsonRpc = new Ms(d, o), this.signInUseCase = new ks(
577
577
  this.internalConfig,
@@ -602,14 +602,14 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
602
602
  */
603
603
  async initialize() {
604
604
  if (this.initialized) return this.authenticated ? { success: !0, address: this.address ?? void 0 } : null;
605
- console.log("[CROSSx SDK] v1.0.2 initializing...");
605
+ console.log("[CROSSx SDK] v1.0.5 initializing...");
606
606
  try {
607
607
  const e = await Fs();
608
608
  this.internalConfig.oauthServiceUrl = e.oauthServiceUrl, this.internalConfig.authApiUrl = e.authApiUrl, this.internalConfig.walletGatewayUrl = e.walletGatewayUrl, this.adapterConfig.gatewayUrl = e.walletGatewayUrl;
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 _(p.AUTH_NOT_INITIALIZED, "SDK initialization failed", e);
612
+ throw new _(g.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 _(p.AUTH_FAILED, "Sign in failed", t);
628
+ throw new _(g.AUTH_FAILED, "Sign in failed", t);
629
629
  }
630
630
  }
631
631
  /**
@@ -649,18 +649,18 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
649
649
  const s = await this.signIn(e);
650
650
  if (!s.success) return { ...s, addresses: [] };
651
651
  if (s.needsMigration || !s.address) {
652
- const { address: n } = await this.createWallet(), o = await this.getAddresses();
653
- return { ...s, address: n, needsMigration: !1, addresses: o };
652
+ const { address: o } = await this.createWallet(), i = await this.getAddresses(), a = await this.selectWalletIfMultiple(i);
653
+ return { ...s, address: (a == null ? void 0 : a.address) ?? o, needsMigration: !1, addresses: i };
654
654
  }
655
- const t = await this.getAddresses();
656
- return { ...s, addresses: t };
655
+ const t = await this.getAddresses(), n = await this.selectWalletIfMultiple(t);
656
+ return { ...s, address: (n == null ? void 0 : n.address) ?? s.address, addresses: t };
657
657
  }
658
658
  async signOut() {
659
659
  this.ensureInitialized();
660
660
  try {
661
661
  await this.signOutUseCase.execute(), this.clearAuthState();
662
662
  } catch (e) {
663
- throw new _(p.UNKNOWN_ERROR, "Sign out failed", e);
663
+ throw new _(g.UNKNOWN_ERROR, "Sign out failed", e);
664
664
  }
665
665
  }
666
666
  isAuthenticated() {
@@ -736,13 +736,13 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
736
736
  */
737
737
  async migrateWallet(e) {
738
738
  if (this.ensureAuthenticated(), !this.userId)
739
- throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
739
+ throw new _(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
740
740
  try {
741
741
  const s = await this.migrateWalletUseCase.execute(e, this.userId);
742
742
  return this.address = s.address, this.emit("addressChanged", { address: s.address, index: 0 }), f.log("[CROSSx] migrateWallet 완료 — address:", s.address), s;
743
743
  } catch (s) {
744
744
  throw s instanceof _ ? s : new _(
745
- p.MIGRATION_FAILED,
745
+ g.MIGRATION_FAILED,
746
746
  "Wallet migration failed",
747
747
  s
748
748
  );
@@ -763,7 +763,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
763
763
  async getAddress(e) {
764
764
  if (e !== void 0) {
765
765
  if (this.ensureAuthenticated(), !this.userId)
766
- throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
766
+ throw new _(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
767
767
  return { address: (await this.walletProvider.getAddress(this.userId, e)).address, index: e };
768
768
  }
769
769
  return !this.authenticated || !this.address ? null : { address: this.address, index: 0 };
@@ -797,7 +797,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
797
797
  */
798
798
  async selectWallet() {
799
799
  if (this.ensureAuthenticated(), !this.userId)
800
- throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
800
+ throw new _(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
801
801
  const e = await this.walletProvider.getAddresses(this.userId);
802
802
  return this.confirmation.showWalletSelector(
803
803
  e,
@@ -807,6 +807,15 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
807
807
  }
808
808
  );
809
809
  }
810
+ /**
811
+ * 지갑이 2개 이상이면 selectWallet()을 호출하고, 선택 결과를 내부 상태에 반영합니다.
812
+ * 지갑이 1개 이하이거나 사용자가 취소하면 null을 반환합니다.
813
+ */
814
+ async selectWalletIfMultiple(e) {
815
+ if (e.length < 2) return null;
816
+ const s = await this.selectWallet();
817
+ return s && (this.address = s.address, this.emit("addressChanged", { address: s.address, index: s.index })), s;
818
+ }
810
819
  // ============================================================================
811
820
  // 체인 조회
812
821
  // ============================================================================
@@ -827,7 +836,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
827
836
  try {
828
837
  return await this.chainRegistry.getChains();
829
838
  } catch (e) {
830
- throw e instanceof _ ? e : new _(p.UNKNOWN_ERROR, "Failed to fetch chains", e);
839
+ throw e instanceof _ ? e : new _(g.UNKNOWN_ERROR, "Failed to fetch chains", e);
831
840
  }
832
841
  }
833
842
  /**
@@ -846,7 +855,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
846
855
  try {
847
856
  return await this.chainRegistry.getChain(e);
848
857
  } catch (s) {
849
- throw s instanceof _ ? s : new _(p.CHAIN_NOT_SUPPORTED, `Failed to fetch chain: ${e}`, s);
858
+ throw s instanceof _ ? s : new _(g.CHAIN_NOT_SUPPORTED, `Failed to fetch chain: ${e}`, s);
850
859
  }
851
860
  }
852
861
  // ============================================================================
@@ -872,20 +881,20 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
872
881
  */
873
882
  async createWallet() {
874
883
  if (this.ensureAuthenticated(), !this.userId)
875
- throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
884
+ throw new _(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
876
885
  f.log("[CROSSx] 지갑 생성 시작");
877
886
  try {
878
887
  const e = await this.walletProvider.getOrCreateWallet(this.userId);
879
888
  return this.address = e.address, this.emit("addressChanged", { address: e.address, index: 0 }), f.log("[CROSSx] 지갑 생성 완료:", e.address), { address: e.address };
880
889
  } catch (e) {
881
- if (e instanceof _ && e.code === p.MIGRATION_BACKUP_EXISTS) {
890
+ if (e instanceof _ && e.code === g.MIGRATION_BACKUP_EXISTS) {
882
891
  const s = this.providerSub ?? this.userId;
883
892
  f.log("[CROSSx][Migration Phase 3] createWallet() — Gateway -10012 감지, 마이그레이션 UI 시작 — migrationSub:", s);
884
893
  const t = await this.handleMigrationFlow(s);
885
894
  if (t)
886
895
  return this.address = t.address, this.emit("addressChanged", { address: t.address, index: 0 }), { address: t.address };
887
896
  throw new _(
888
- p.MIGRATION_FAILED,
897
+ g.MIGRATION_FAILED,
889
898
  "Migration skipped by user"
890
899
  );
891
900
  }
@@ -904,7 +913,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
904
913
  */
905
914
  async signMessage(e, s, t) {
906
915
  if (this.ensureAuthenticated(), !this.userId)
907
- throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
916
+ throw new _(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
908
917
  const n = t == null ? void 0 : t.index, o = await this.walletProvider.getAddress(this.userId, n ?? 0);
909
918
  let i;
910
919
  if (this.walletProvider.prepare && (i = (await this.walletProvider.prepare("sign-message", { message: s, from: o.address })).uuid), !await this.confirmation.requestConfirmation({
@@ -915,7 +924,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
915
924
  dappName: t == null ? void 0 : t.dappName,
916
925
  accountName: t == null ? void 0 : t.accountName
917
926
  }))
918
- throw new _(p.USER_REJECTED, "User rejected message signing");
927
+ throw new _(g.USER_REJECTED, "User rejected message signing");
919
928
  try {
920
929
  const c = await this.walletProvider.signMessage(
921
930
  this.userId,
@@ -932,7 +941,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
932
941
  address: o.address
933
942
  };
934
943
  } catch (c) {
935
- throw c instanceof _ ? c : new _(p.SIGNATURE_FAILED, `Message signing failed (${e})`, c);
944
+ throw c instanceof _ ? c : new _(g.SIGNATURE_FAILED, `Message signing failed (${e})`, c);
936
945
  }
937
946
  }
938
947
  /**
@@ -958,9 +967,9 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
958
967
  */
959
968
  async signTypedData(e, s, t) {
960
969
  if (this.ensureAuthenticated(), !this.userId)
961
- throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
970
+ throw new _(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
962
971
  if (!this.walletProvider.signTypedData)
963
- throw new _(p.NOT_IMPLEMENTED, "signTypedData is not implemented");
972
+ throw new _(g.NOT_IMPLEMENTED, "signTypedData is not implemented");
964
973
  X.validateTypedDataChainId(e, s);
965
974
  const n = await this.walletProvider.getAddress(this.userId, (t == null ? void 0 : t.index) ?? 0);
966
975
  let o;
@@ -972,7 +981,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
972
981
  dappName: t == null ? void 0 : t.dappName,
973
982
  accountName: t == null ? void 0 : t.accountName
974
983
  }))
975
- throw new _(p.USER_REJECTED, "User rejected typed data signing");
984
+ throw new _(g.USER_REJECTED, "User rejected typed data signing");
976
985
  try {
977
986
  const a = await this.walletProvider.signTypedData(
978
987
  this.userId,
@@ -988,7 +997,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
988
997
  address: n.address
989
998
  };
990
999
  } catch (a) {
991
- throw a instanceof _ ? a : new _(p.SIGNATURE_FAILED, `Typed data signing failed (${e})`, a);
1000
+ throw a instanceof _ ? a : new _(g.SIGNATURE_FAILED, `Typed data signing failed (${e})`, a);
992
1001
  }
993
1002
  }
994
1003
  /**
@@ -1024,7 +1033,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1024
1033
  */
1025
1034
  async signTransaction(e, s, t) {
1026
1035
  if (this.ensureAuthenticated(), !this.userId)
1027
- throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
1036
+ throw new _(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
1028
1037
  const n = await this.withResolvedGasAndFee(s, e);
1029
1038
  let o;
1030
1039
  this.walletProvider.prepare && (o = (await this.walletProvider.prepare("sign", { tx: n })).uuid);
@@ -1045,7 +1054,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1045
1054
  dappName: t == null ? void 0 : t.dappName,
1046
1055
  accountName: t == null ? void 0 : t.accountName
1047
1056
  }))
1048
- throw new _(p.USER_REJECTED, "User rejected transaction signing");
1057
+ throw new _(g.USER_REJECTED, "User rejected transaction signing");
1049
1058
  try {
1050
1059
  const c = await this.walletProvider.signTransaction(
1051
1060
  this.userId,
@@ -1063,7 +1072,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1063
1072
  if (c instanceof _) throw c;
1064
1073
  const l = c instanceof Error ? c.message : String(c);
1065
1074
  throw new _(
1066
- p.SIGNATURE_FAILED,
1075
+ g.SIGNATURE_FAILED,
1067
1076
  `Transaction signing failed (${e}): ${l}`,
1068
1077
  c
1069
1078
  );
@@ -1077,7 +1086,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1077
1086
  */
1078
1087
  async sendTransaction(e, s, t) {
1079
1088
  if (this.ensureAuthenticated(), !this.userId)
1080
- throw new _(p.AUTH_NOT_AUTHENTICATED, "User ID not found");
1089
+ throw new _(g.AUTH_NOT_AUTHENTICATED, "User ID not found");
1081
1090
  const n = await this.withResolvedGasAndFee(s, e);
1082
1091
  let o;
1083
1092
  this.walletProvider.prepare && (o = (await this.walletProvider.prepare("send", { tx: n })).uuid);
@@ -1098,7 +1107,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1098
1107
  dappName: t == null ? void 0 : t.dappName,
1099
1108
  accountName: t == null ? void 0 : t.accountName
1100
1109
  }))
1101
- throw new _(p.USER_REJECTED, "User rejected transaction");
1110
+ throw new _(g.USER_REJECTED, "User rejected transaction");
1102
1111
  try {
1103
1112
  let c;
1104
1113
  if (this.walletProvider.sendTransaction)
@@ -1122,7 +1131,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1122
1131
  } catch (c) {
1123
1132
  const l = c instanceof Error ? c.message : String(c);
1124
1133
  throw new _(
1125
- p.TRANSACTION_FAILED,
1134
+ g.TRANSACTION_FAILED,
1126
1135
  `Transaction failed (${e}): ${l}`,
1127
1136
  c
1128
1137
  );
@@ -1155,7 +1164,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1155
1164
  await new Promise((d) => setTimeout(d, c)), c = Math.min(c * 2, o);
1156
1165
  }
1157
1166
  throw new _(
1158
- p.UNKNOWN_ERROR,
1167
+ g.UNKNOWN_ERROR,
1159
1168
  `Transaction receipt timeout (${e})`
1160
1169
  );
1161
1170
  }
@@ -1176,7 +1185,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1176
1185
  */
1177
1186
  async sendTransactionWithWaitForReceipt(e, s, t = {}) {
1178
1187
  var b, S;
1179
- 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 ?? "";
1188
+ 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), p = s.from ?? "";
1180
1189
  let m, x;
1181
1190
  const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((E) => {
1182
1191
  m = E;
@@ -1195,14 +1204,14 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1195
1204
  }).catch((E) => (x = E instanceof Error ? E : new Error(String(E)), {
1196
1205
  chainId: e,
1197
1206
  txHash: a,
1198
- from: g,
1207
+ from: p,
1199
1208
  to: s.to,
1200
1209
  amount: X.formatTxAmount(s.value, d.symbol, d.decimals),
1201
1210
  nativeSymbol: d.symbol,
1202
1211
  status: "timeout"
1203
1212
  }));
1204
1213
  if (await this.confirmation.showTransactionProgress(
1205
- { chainId: e, txHash: a, from: g, to: s.to },
1214
+ { chainId: e, txHash: a, from: p, to: s.to },
1206
1215
  w
1207
1216
  ), x) throw x;
1208
1217
  return { chainId: e, txHash: a, receipt: m };
@@ -1225,7 +1234,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1225
1234
  return await this.walletRpc("eth_gasPrice", [], e);
1226
1235
  } catch (s) {
1227
1236
  const t = s instanceof Error ? s.message : String(s);
1228
- throw new _(p.GAS_ESTIMATION_FAILED, `Failed to get gas price (${e}): ${t}`, s);
1237
+ throw new _(g.GAS_ESTIMATION_FAILED, `Failed to get gas price (${e}): ${t}`, s);
1229
1238
  }
1230
1239
  }
1231
1240
  /**
@@ -1246,7 +1255,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1246
1255
  return await this.walletRpc("eth_estimateGas", [t], s);
1247
1256
  } catch (n) {
1248
1257
  const o = n instanceof Error ? n.message : String(n);
1249
- throw new _(p.GAS_ESTIMATION_FAILED, `Failed to estimate gas (${s}): ${o}`, n);
1258
+ throw new _(g.GAS_ESTIMATION_FAILED, `Failed to estimate gas (${s}): ${o}`, n);
1250
1259
  }
1251
1260
  }
1252
1261
  /**
@@ -1267,7 +1276,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1267
1276
  return (s == null ? void 0 : s.baseFeePerGas) ?? null;
1268
1277
  } catch (s) {
1269
1278
  const t = s instanceof Error ? s.message : String(s);
1270
- throw new _(p.GAS_ESTIMATION_FAILED, `Failed to get baseFeePerGas (${e}): ${t}`, s);
1279
+ throw new _(g.GAS_ESTIMATION_FAILED, `Failed to get baseFeePerGas (${e}): ${t}`, s);
1271
1280
  }
1272
1281
  }
1273
1282
  /**
@@ -1286,7 +1295,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1286
1295
  return await this.walletRpc("eth_maxPriorityFeePerGas", [], e);
1287
1296
  } catch (s) {
1288
1297
  const t = s instanceof Error ? s.message : String(s);
1289
- throw new _(p.GAS_ESTIMATION_FAILED, `Failed to get maxPriorityFeePerGas (${e}): ${t}`, s);
1298
+ throw new _(g.GAS_ESTIMATION_FAILED, `Failed to get maxPriorityFeePerGas (${e}): ${t}`, s);
1290
1299
  }
1291
1300
  }
1292
1301
  // ============================================================================
@@ -1306,7 +1315,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1306
1315
  } catch (t) {
1307
1316
  if (t instanceof _) throw t;
1308
1317
  const n = t instanceof Error ? t.message : String(t);
1309
- throw new _(p.UNKNOWN_ERROR, `Failed to get nonce: ${n}`, t);
1318
+ throw new _(g.UNKNOWN_ERROR, `Failed to get nonce: ${n}`, t);
1310
1319
  }
1311
1320
  }
1312
1321
  /**
@@ -1325,7 +1334,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1325
1334
  } catch (t) {
1326
1335
  if (t instanceof _) throw t;
1327
1336
  const n = t instanceof Error ? t.message : String(t);
1328
- throw new _(p.UNKNOWN_ERROR, `Failed to get balance (${e}): ${n}`, t);
1337
+ throw new _(g.UNKNOWN_ERROR, `Failed to get balance (${e}): ${n}`, t);
1329
1338
  }
1330
1339
  }
1331
1340
  static formatWei(e) {
@@ -1333,7 +1342,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1333
1342
  try {
1334
1343
  const s = BigInt(e);
1335
1344
  if (s === 0n) return "0";
1336
- const t = 10n ** BigInt(Tt), n = s / t, i = (s % t).toString().padStart(Tt, "0").replace(/0+$/, "").slice(0, Et);
1345
+ const t = 10n ** BigInt(It), n = s / t, i = (s % t).toString().padStart(It, "0").replace(/0+$/, "").slice(0, Et);
1337
1346
  return i ? `${n}.${i}` : `${n}`;
1338
1347
  } catch {
1339
1348
  return "?";
@@ -1376,7 +1385,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1376
1385
  } catch (n) {
1377
1386
  if (n instanceof _) throw n;
1378
1387
  const o = n instanceof Error ? n.message : String(n);
1379
- throw new _(p.UNKNOWN_ERROR, `walletRpc failed [${e}] (${t}): ${o}`, n);
1388
+ throw new _(g.UNKNOWN_ERROR, `walletRpc failed [${e}] (${t}): ${o}`, n);
1380
1389
  }
1381
1390
  }
1382
1391
  // ============================================================================
@@ -1419,7 +1428,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1419
1428
  const i = await this.migrateWalletUseCase.execute(o, e);
1420
1429
  return f.log("[CROSSx][Migration Phase 5] 마이그레이션 성공 — address:", i.address), i;
1421
1430
  } catch (i) {
1422
- if (i instanceof _ && i.code === p.MIGRATION_FAILED) {
1431
+ if (i instanceof _ && i.code === g.MIGRATION_FAILED) {
1423
1432
  f.warn(`[CROSSx][Migration Phase 4] PIN 불일치 (시도 #${n}) — 재시도 요청`), t = "Incorrect PIN. Please try again.";
1424
1433
  continue;
1425
1434
  }
@@ -1443,7 +1452,15 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1443
1452
  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);
1444
1453
  if (!n && !o && !i && !a) return e;
1445
1454
  const c = { ...e };
1446
- 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) {
1455
+ if (n) {
1456
+ const l = c.from ?? this.address;
1457
+ if (l) {
1458
+ f.log("[CROSSx] nonce 비어있음 → eth_getTransactionCount 호출 (from:", l, ")");
1459
+ const d = await this.jsonRpc.call("eth_getTransactionCount", [l, "pending"], s);
1460
+ c.nonce = parseInt(d ?? "0x0", 16), f.log("[CROSSx] nonce 결과:", c.nonce);
1461
+ }
1462
+ }
1463
+ if (o && (f.log("[CROSSx] gasLimit 비어있음 → eth_estimateGas 호출"), c.gasLimit = await this.estimateGas(e, s), f.log("[CROSSx] estimateGas 결과:", c.gasLimit)), i) {
1447
1464
  f.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
1448
1465
  const l = await this.getBaseFeePerGas(s);
1449
1466
  if (l) {
@@ -1465,7 +1482,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1465
1482
  if (e === "0") {
1466
1483
  if (t !== void 0 && t !== 0)
1467
1484
  throw new _(
1468
- p.TYPED_DATA_CHAIN_ID_MISMATCH,
1485
+ g.TYPED_DATA_CHAIN_ID_MISMATCH,
1469
1486
  `Off-chain signing (chainId=0) requires typedData.domain.chainId to be absent or 0, got ${t}`
1470
1487
  );
1471
1488
  return;
@@ -1475,12 +1492,12 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1475
1492
  const o = Number(n[1]);
1476
1493
  if (t === void 0)
1477
1494
  throw new _(
1478
- p.TYPED_DATA_CHAIN_ID_MISMATCH,
1495
+ g.TYPED_DATA_CHAIN_ID_MISMATCH,
1479
1496
  `On-chain signing (${e}) requires typedData.domain.chainId to be present`
1480
1497
  );
1481
1498
  if (t !== o)
1482
1499
  throw new _(
1483
- p.TYPED_DATA_CHAIN_ID_MISMATCH,
1500
+ g.TYPED_DATA_CHAIN_ID_MISMATCH,
1484
1501
  `typedData.domain.chainId (${t}) does not match chainId (${e}, expected ${o})`
1485
1502
  );
1486
1503
  }
@@ -1498,10 +1515,10 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1498
1515
  static validateSignatureFormat(e) {
1499
1516
  const s = e.startsWith("0x") ? e.slice(2) : e;
1500
1517
  if (!/^[0-9a-fA-F]+$/.test(s))
1501
- throw new _(p.SIGNATURE_FAILED, "Invalid signature: not a valid hex string");
1518
+ throw new _(g.SIGNATURE_FAILED, "Invalid signature: not a valid hex string");
1502
1519
  if (s.length !== St)
1503
1520
  throw new _(
1504
- p.SIGNATURE_FAILED,
1521
+ g.SIGNATURE_FAILED,
1505
1522
  `Invalid signature length: expected ${St} hex chars (65 bytes), got ${s.length}`
1506
1523
  );
1507
1524
  }
@@ -1509,9 +1526,9 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1509
1526
  static validateSignedTxFormat(e) {
1510
1527
  const s = e.startsWith("0x") ? e.slice(2) : e;
1511
1528
  if (!/^[0-9a-fA-F]+$/.test(s))
1512
- throw new _(p.SIGNATURE_FAILED, "Invalid signedTx: not a valid hex string");
1529
+ throw new _(g.SIGNATURE_FAILED, "Invalid signedTx: not a valid hex string");
1513
1530
  if (s.length < 2)
1514
- throw new _(p.SIGNATURE_FAILED, "Invalid signedTx: too short");
1531
+ throw new _(g.SIGNATURE_FAILED, "Invalid signedTx: too short");
1515
1532
  }
1516
1533
  /**
1517
1534
  * Gateway 서명 응답의 ecrecover 검증 (XF-036)
@@ -1528,7 +1545,7 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1528
1545
  expected: t,
1529
1546
  recovered: n
1530
1547
  }), new _(
1531
- p.SIGNATURE_SIGNER_MISMATCH,
1548
+ g.SIGNATURE_SIGNER_MISMATCH,
1532
1549
  `Signature signer mismatch: expected ${t}, recovered ${n}`
1533
1550
  );
1534
1551
  f.log("[CROSSx] 서명 ecrecover 검증 성공");
@@ -1564,14 +1581,14 @@ const Hs = 2e3, bt = 6e4, Gs = 1e3, qs = 1e4, Ws = "0x77359400", vt = "0x3B9ACA0
1564
1581
  ensureInitialized() {
1565
1582
  if (!this.initialized)
1566
1583
  throw new _(
1567
- p.AUTH_NOT_INITIALIZED,
1584
+ g.AUTH_NOT_INITIALIZED,
1568
1585
  "SDK is not initialized. Call initialize() first."
1569
1586
  );
1570
1587
  }
1571
1588
  ensureAuthenticated() {
1572
1589
  if (this.ensureInitialized(), !this.authenticated)
1573
1590
  throw new _(
1574
- p.AUTH_NOT_AUTHENTICATED,
1591
+ g.AUTH_NOT_AUTHENTICATED,
1575
1592
  "Not authenticated. Call signIn() first."
1576
1593
  );
1577
1594
  }
@@ -1624,7 +1641,7 @@ class Ks {
1624
1641
  }
1625
1642
  }
1626
1643
  }
1627
- const zs = "crossx-sdk", Ys = 1, Se = "data", Le = "keys", It = "aes-primary", Zs = 12;
1644
+ const zs = "crossx-sdk", Ys = 1, Se = "data", Le = "keys", Tt = "aes-primary", Zs = 12;
1628
1645
  class At {
1629
1646
  constructor() {
1630
1647
  this.db = null, this.cryptoKey = null, this.initPromise = null;
@@ -1667,7 +1684,7 @@ class At {
1667
1684
  }
1668
1685
  async init() {
1669
1686
  this.db = await this.openDB();
1670
- const e = await this.idbGet(Le, It);
1687
+ const e = await this.idbGet(Le, Tt);
1671
1688
  if (e) {
1672
1689
  this.cryptoKey = e;
1673
1690
  return;
@@ -1676,7 +1693,7 @@ class At {
1676
1693
  { name: "AES-GCM", length: 256 },
1677
1694
  !1,
1678
1695
  ["encrypt", "decrypt"]
1679
- ), await this.idbPut(Le, It, this.cryptoKey);
1696
+ ), await this.idbPut(Le, Tt, this.cryptoKey);
1680
1697
  }
1681
1698
  async encrypt(e) {
1682
1699
  const s = new Uint8Array(Zs);
@@ -1760,7 +1777,7 @@ function Kt(r) {
1760
1777
  throw new Error("Hash must wrapped by utils.createHasher");
1761
1778
  ue(r.outputLen), ue(r.blockLen);
1762
1779
  }
1763
- function Te(r, e = !0) {
1780
+ function Ie(r, e = !0) {
1764
1781
  if (r.destroyed)
1765
1782
  throw new Error("Hash instance has been destroyed");
1766
1783
  if (e && r.finished)
@@ -1775,7 +1792,7 @@ function zt(r, e) {
1775
1792
  function Xs(r) {
1776
1793
  return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
1777
1794
  }
1778
- function Ie(...r) {
1795
+ function Te(...r) {
1779
1796
  for (let e = 0; e < r.length; e++)
1780
1797
  r[e].fill(0);
1781
1798
  }
@@ -1879,7 +1896,7 @@ class or {
1879
1896
  this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = Ze(this.buffer);
1880
1897
  }
1881
1898
  update(e) {
1882
- Te(this), F(e);
1899
+ Ie(this), F(e);
1883
1900
  const { view: s, buffer: t, blockLen: n } = this, o = e.length;
1884
1901
  for (let i = 0; i < o; ) {
1885
1902
  const a = Math.min(n - this.pos, o - i);
@@ -1894,12 +1911,12 @@ class or {
1894
1911
  return this.length += e.length, this.roundClean(), this;
1895
1912
  }
1896
1913
  digestInto(e) {
1897
- Te(this), zt(e, this), this.finished = !0;
1914
+ Ie(this), zt(e, this), this.finished = !0;
1898
1915
  const { buffer: s, view: t, blockLen: n, isLE: o } = this;
1899
1916
  let { pos: i } = this;
1900
- s[i++] = 128, Ie(this.buffer.subarray(i)), this.padOffset > n - i && (this.process(t, 0), i = 0);
1901
- for (let g = i; g < n; g++)
1902
- s[g] = 0;
1917
+ s[i++] = 128, Te(this.buffer.subarray(i)), this.padOffset > n - i && (this.process(t, 0), i = 0);
1918
+ for (let p = i; p < n; p++)
1919
+ s[p] = 0;
1903
1920
  t.setBigUint64(n - 8, BigInt(this.length * 8), o), this.process(t, 0);
1904
1921
  const a = Ze(e), c = this.outputLen;
1905
1922
  if (c % 4)
@@ -1907,8 +1924,8 @@ class or {
1907
1924
  const l = c / 4, d = this.get();
1908
1925
  if (l > d.length)
1909
1926
  throw new Error("_sha2: outputLen bigger than state");
1910
- for (let g = 0; g < l; g++)
1911
- a.setUint32(4 * g, d[g], o);
1927
+ for (let p = 0; p < l; p++)
1928
+ a.setUint32(4 * p, d[p], o);
1912
1929
  }
1913
1930
  digest() {
1914
1931
  const { buffer: e, outputLen: s } = this;
@@ -2012,7 +2029,7 @@ const cr = (r, e, s) => r << s | e >>> 32 - s, lr = (r, e, s) => e << s | r >>>
2012
2029
  2756734187,
2013
2030
  3204031479,
2014
2031
  3329325298
2015
- ]), ge = /* @__PURE__ */ new Uint32Array(64);
2032
+ ]), pe = /* @__PURE__ */ new Uint32Array(64);
2016
2033
  class fr extends or {
2017
2034
  constructor(e) {
2018
2035
  super(64, e, 8, !1);
@@ -2026,27 +2043,27 @@ class fr extends or {
2026
2043
  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;
2027
2044
  }
2028
2045
  process(e, s) {
2029
- for (let g = 0; g < 16; g++, s += 4)
2030
- ge[g] = e.getUint32(s, !1);
2031
- for (let g = 16; g < 64; g++) {
2032
- 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;
2033
- ge[g] = b + ge[g - 7] + w + ge[g - 16] | 0;
2046
+ for (let p = 0; p < 16; p++, s += 4)
2047
+ pe[p] = e.getUint32(s, !1);
2048
+ for (let p = 16; p < 64; p++) {
2049
+ const m = pe[p - 15], x = pe[p - 2], w = oe(m, 7) ^ oe(m, 18) ^ m >>> 3, b = oe(x, 17) ^ oe(x, 19) ^ x >>> 10;
2050
+ pe[p] = b + pe[p - 7] + w + pe[p - 16] | 0;
2034
2051
  }
2035
2052
  let { A: t, B: n, C: o, D: i, E: a, F: c, G: l, H: d } = this;
2036
- for (let g = 0; g < 64; g++) {
2037
- 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;
2053
+ for (let p = 0; p < 64; p++) {
2054
+ const m = oe(a, 6) ^ oe(a, 11) ^ oe(a, 25), x = d + m + rr(a, c, l) + hr[p] + pe[p] | 0, b = (oe(t, 2) ^ oe(t, 13) ^ oe(t, 22)) + nr(t, n, o) | 0;
2038
2055
  d = l, l = c, c = a, a = i + x | 0, i = o, o = n, n = t, t = x + b | 0;
2039
2056
  }
2040
2057
  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);
2041
2058
  }
2042
2059
  roundClean() {
2043
- Ie(ge);
2060
+ Te(pe);
2044
2061
  }
2045
2062
  destroy() {
2046
- this.set(0, 0, 0, 0, 0, 0, 0, 0), Ie(this.buffer);
2063
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), Te(this.buffer);
2047
2064
  }
2048
2065
  }
2049
- class gr extends fr {
2066
+ class pr extends fr {
2050
2067
  constructor() {
2051
2068
  super(32);
2052
2069
  // We cannot use array here since array allows indexing by variable
@@ -2061,8 +2078,8 @@ class gr extends fr {
2061
2078
  v(this, "H", fe[7] | 0);
2062
2079
  }
2063
2080
  }
2064
- const pr = /* @__PURE__ */ Zt(
2065
- () => new gr(),
2081
+ const gr = /* @__PURE__ */ Zt(
2082
+ () => new pr(),
2066
2083
  /* @__PURE__ */ sr(1)
2067
2084
  );
2068
2085
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
@@ -2130,7 +2147,7 @@ function yr(r, e, s) {
2130
2147
  throw new Error("hmacFn must be a function");
2131
2148
  const t = (S) => new Uint8Array(S), n = Uint8Array.of(), o = Uint8Array.of(0), i = Uint8Array.of(1), a = 1e3;
2132
2149
  let c = t(r), l = t(r), d = 0;
2133
- const g = () => {
2150
+ const p = () => {
2134
2151
  c.fill(1), l.fill(0), d = 0;
2135
2152
  }, m = (...S) => s(l, _e(c, ...S)), x = (S = n) => {
2136
2153
  l = m(o, S), c = m(), S.length !== 0 && (l = m(i, S), c = m());
@@ -2147,11 +2164,11 @@ function yr(r, e, s) {
2147
2164
  return _e(...E);
2148
2165
  };
2149
2166
  return (S, E) => {
2150
- g(), x(S);
2167
+ p(), x(S);
2151
2168
  let q;
2152
2169
  for (; !(q = E(w())); )
2153
2170
  x();
2154
- return g(), q;
2171
+ return p(), q;
2155
2172
  };
2156
2173
  }
2157
2174
  function ut(r, e = {}, s = {}) {
@@ -2220,8 +2237,8 @@ function Er(r) {
2220
2237
  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;
2221
2238
  return (a, c) => {
2222
2239
  let l = a.pow(c, i), d = a.mul(l, t);
2223
- 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);
2224
- l = a.cmov(l, d, x), d = a.cmov(m, g, w);
2240
+ const p = a.mul(l, n), m = a.mul(l, o), x = a.eql(a.sqr(d), c), w = a.eql(a.sqr(p), c);
2241
+ l = a.cmov(l, d, x), d = a.cmov(m, p, w);
2225
2242
  const b = a.eql(a.sqr(d), c), S = a.cmov(l, d, b);
2226
2243
  return ht(a, S, c), S;
2227
2244
  };
@@ -2246,7 +2263,7 @@ function cs(r) {
2246
2263
  return l;
2247
2264
  if (Pt(c, l) !== 1)
2248
2265
  throw new Error("Cannot find square root");
2249
- let d = s, g = c.mul(c.ONE, o), m = c.pow(l, e), x = c.pow(l, i);
2266
+ let d = s, p = c.mul(c.ONE, o), m = c.pow(l, e), x = c.pow(l, i);
2250
2267
  for (; !c.eql(m, c.ONE); ) {
2251
2268
  if (c.is0(m))
2252
2269
  return c.ZERO;
@@ -2254,16 +2271,16 @@ function cs(r) {
2254
2271
  for (; !c.eql(b, c.ONE); )
2255
2272
  if (w++, b = c.sqr(b), w === d)
2256
2273
  throw new Error("Cannot find square root");
2257
- const S = z << BigInt(d - w - 1), E = c.pow(g, S);
2258
- d = w, g = c.sqr(E), m = c.mul(m, g), x = c.mul(x, E);
2274
+ const S = z << BigInt(d - w - 1), E = c.pow(p, S);
2275
+ d = w, p = c.sqr(E), m = c.mul(m, p), x = c.mul(x, E);
2259
2276
  }
2260
2277
  return x;
2261
2278
  };
2262
2279
  }
2263
- function Tr(r) {
2280
+ function Ir(r) {
2264
2281
  return r % rs === ss ? as : r % os === ns ? Sr : r % is === vr ? Er(r) : cs(r);
2265
2282
  }
2266
- const Ir = [
2283
+ const Tr = [
2267
2284
  "create",
2268
2285
  "isValid",
2269
2286
  "is0",
@@ -2287,7 +2304,7 @@ function Ar(r) {
2287
2304
  ORDER: "bigint",
2288
2305
  BYTES: "number",
2289
2306
  BITS: "number"
2290
- }, s = Ir.reduce((t, n) => (t[n] = "function", t), e);
2307
+ }, s = Tr.reduce((t, n) => (t[n] = "function", t), e);
2291
2308
  return ut(r, s), r;
2292
2309
  }
2293
2310
  function Rr(r, e, s) {
@@ -2398,7 +2415,7 @@ class Cr {
2398
2415
  return Nt(e, this.ORDER);
2399
2416
  }
2400
2417
  sqrt(e) {
2401
- return this._sqrt || (this._sqrt = Tr(this.ORDER)), this._sqrt(this, e);
2418
+ return this._sqrt || (this._sqrt = Ir(this.ORDER)), this._sqrt(this, e);
2402
2419
  }
2403
2420
  toBytes(e) {
2404
2421
  return this.isLE ? ts(e, this.BYTES) : lt(e, this.BYTES);
@@ -2473,8 +2490,8 @@ function Dt(r, e, s) {
2473
2490
  const { windowSize: t, mask: n, maxNumber: o, shiftBy: i } = s;
2474
2491
  let a = Number(r & n), c = r >> i;
2475
2492
  a > t && (a -= o, c += be);
2476
- const l = e * t, d = l + Math.abs(a) - 1, g = a === 0, m = a < 0, x = e % 2 !== 0;
2477
- return { nextN: c, offset: d, isZero: g, isNeg: m, isNegF: x, offsetF: l };
2493
+ const l = e * t, d = l + Math.abs(a) - 1, p = a === 0, m = a < 0, x = e % 2 !== 0;
2494
+ return { nextN: c, offset: d, isZero: p, isNeg: m, isNegF: x, offsetF: l };
2478
2495
  }
2479
2496
  const Je = /* @__PURE__ */ new WeakMap(), fs = /* @__PURE__ */ new WeakMap();
2480
2497
  function Qe(r) {
@@ -2535,8 +2552,8 @@ class Nr {
2535
2552
  let n = this.ZERO, o = this.BASE;
2536
2553
  const i = Xe(e, this.bits);
2537
2554
  for (let a = 0; a < i.windows; a++) {
2538
- const { nextN: c, offset: l, isZero: d, isNeg: g, isNegF: m, offsetF: x } = Dt(t, a, i);
2539
- t = c, d ? o = o.add(Ge(m, s[x])) : n = n.add(Ge(g, s[l]));
2555
+ const { nextN: c, offset: l, isZero: d, isNeg: p, isNegF: m, offsetF: x } = Dt(t, a, i);
2556
+ t = c, d ? o = o.add(Ge(m, s[x])) : n = n.add(Ge(p, s[l]));
2540
2557
  }
2541
2558
  return $t(t), { p: n, f: o };
2542
2559
  }
@@ -2550,8 +2567,8 @@ class Nr {
2550
2567
  for (let i = 0; i < o.windows && t !== Ae; i++) {
2551
2568
  const { nextN: a, offset: c, isZero: l, isNeg: d } = Dt(t, i, o);
2552
2569
  if (t = a, !l) {
2553
- const g = s[c];
2554
- n = n.add(d ? g.negate() : g);
2570
+ const p = s[c];
2571
+ n = n.add(d ? p.negate() : p);
2555
2572
  }
2556
2573
  }
2557
2574
  return $t(t), n;
@@ -2612,7 +2629,7 @@ function Dr(r, e) {
2612
2629
  return { secretKey: n, publicKey: e(n) };
2613
2630
  };
2614
2631
  }
2615
- class gs {
2632
+ class ps {
2616
2633
  constructor(e, s) {
2617
2634
  v(this, "oHash");
2618
2635
  v(this, "iHash");
@@ -2630,13 +2647,13 @@ class gs {
2630
2647
  this.iHash.update(n), this.oHash = e.create();
2631
2648
  for (let o = 0; o < n.length; o++)
2632
2649
  n[o] ^= 106;
2633
- this.oHash.update(n), Ie(n);
2650
+ this.oHash.update(n), Te(n);
2634
2651
  }
2635
2652
  update(e) {
2636
- return Te(this), this.iHash.update(e), this;
2653
+ return Ie(this), this.iHash.update(e), this;
2637
2654
  }
2638
2655
  digestInto(e) {
2639
- Te(this), F(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
2656
+ Ie(this), F(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
2640
2657
  }
2641
2658
  digest() {
2642
2659
  const e = new Uint8Array(this.oHash.outputLen);
@@ -2654,19 +2671,19 @@ class gs {
2654
2671
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
2655
2672
  }
2656
2673
  }
2657
- const ps = (r, e, s) => new gs(r, e).update(s).digest();
2658
- ps.create = (r, e) => new gs(r, e);
2674
+ const gs = (r, e, s) => new ps(r, e).update(s).digest();
2675
+ gs.create = (r, e) => new ps(r, e);
2659
2676
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2660
2677
  const Bt = (r, e) => (r + (r >= 0 ? e : -e) / _s) / e;
2661
2678
  function $r(r, e, s) {
2662
2679
  const [[t, n], [o, i]] = e, a = Bt(i * r, s), c = Bt(-n * r, s);
2663
2680
  let l = r - a * t - c * o, d = -a * n - c * i;
2664
- const g = l < le, m = d < le;
2665
- g && (l = -l), m && (d = -d);
2681
+ const p = l < le, m = d < le;
2682
+ p && (l = -l), m && (d = -d);
2666
2683
  const x = dt(Math.ceil(wr(s) / 2)) + Ee;
2667
2684
  if (l < le || l >= x || d < le || d >= x)
2668
2685
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
2669
- return { k1neg: g, k1: l, k2neg: m, k2: d };
2686
+ return { k1neg: p, k1: l, k2neg: m, k2: d };
2670
2687
  }
2671
2688
  function nt(r) {
2672
2689
  if (!["compact", "recovered", "der"].includes(r))
@@ -2684,13 +2701,13 @@ class Mr extends Error {
2684
2701
  super(e);
2685
2702
  }
2686
2703
  }
2687
- const pe = {
2704
+ const ge = {
2688
2705
  // asn.1 DER encoding utils
2689
2706
  Err: Mr,
2690
2707
  // Basic building block is TLV (Tag-Length-Value)
2691
2708
  _tlv: {
2692
2709
  encode: (r, e) => {
2693
- const { Err: s } = pe;
2710
+ const { Err: s } = ge;
2694
2711
  if (r < 0 || r > 256)
2695
2712
  throw new s("tlv.encode: wrong tag");
2696
2713
  if (e.length & 1)
@@ -2703,7 +2720,7 @@ const pe = {
2703
2720
  },
2704
2721
  // v - value, l - left bytes (unparsed)
2705
2722
  decode(r, e) {
2706
- const { Err: s } = pe;
2723
+ const { Err: s } = ge;
2707
2724
  let t = 0;
2708
2725
  if (r < 0 || r > 256)
2709
2726
  throw new s("tlv.encode: wrong tag");
@@ -2741,7 +2758,7 @@ const pe = {
2741
2758
  // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
2742
2759
  _int: {
2743
2760
  encode(r) {
2744
- const { Err: e } = pe;
2761
+ const { Err: e } = ge;
2745
2762
  if (r < le)
2746
2763
  throw new e("integer: negative integers are not allowed");
2747
2764
  let s = $e(r);
@@ -2750,7 +2767,7 @@ const pe = {
2750
2767
  return s;
2751
2768
  },
2752
2769
  decode(r) {
2753
- const { Err: e } = pe;
2770
+ const { Err: e } = ge;
2754
2771
  if (r[0] & 128)
2755
2772
  throw new e("invalid signature integer: negative");
2756
2773
  if (r[0] === 0 && !(r[1] & 128))
@@ -2759,7 +2776,7 @@ const pe = {
2759
2776
  }
2760
2777
  },
2761
2778
  toSig(r) {
2762
- const { Err: e, _int: s, _tlv: t } = pe, n = F(r, void 0, "signature"), { v: o, l: i } = t.decode(48, n);
2779
+ const { Err: e, _int: s, _tlv: t } = ge, n = F(r, void 0, "signature"), { v: o, l: i } = t.decode(48, n);
2763
2780
  if (i.length)
2764
2781
  throw new e("invalid signature: left bytes after parsing");
2765
2782
  const { v: a, l: c } = t.decode(2, o), { v: l, l: d } = t.decode(2, c);
@@ -2768,7 +2785,7 @@ const pe = {
2768
2785
  return { r: s.decode(a), s: s.decode(l) };
2769
2786
  },
2770
2787
  hexFromSig(r) {
2771
- const { _tlv: e, _int: s } = pe, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), o = t + n;
2788
+ const { _tlv: e, _int: s } = ge, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), o = t + n;
2772
2789
  return e.encode(48, o);
2773
2790
  }
2774
2791
  }, le = BigInt(0), Ee = BigInt(1), _s = BigInt(2), Me = BigInt(3), Br = BigInt(4);
@@ -2792,42 +2809,42 @@ function Ur(r, e = {}) {
2792
2809
  if (!t.isOdd)
2793
2810
  throw new Error("compression is not supported: Field does not have .isOdd()");
2794
2811
  }
2795
- function g(P, u, h) {
2796
- const { x: y, y: I } = u.toAffine(), R = t.toBytes(y);
2812
+ function p(P, u, h) {
2813
+ const { x: y, y: T } = u.toAffine(), R = t.toBytes(y);
2797
2814
  if (He(h, "isCompressed"), h) {
2798
2815
  d();
2799
- const A = !t.isOdd(I);
2816
+ const A = !t.isOdd(T);
2800
2817
  return _e(xs(A), R);
2801
2818
  } else
2802
- return _e(Uint8Array.of(4), R, t.toBytes(I));
2819
+ return _e(Uint8Array.of(4), R, t.toBytes(T));
2803
2820
  }
2804
2821
  function m(P) {
2805
2822
  F(P, void 0, "Point");
2806
- const { publicKey: u, publicKeyUncompressed: h } = l, y = P.length, I = P[0], R = P.subarray(1);
2807
- if (y === u && (I === 2 || I === 3)) {
2823
+ const { publicKey: u, publicKeyUncompressed: h } = l, y = P.length, T = P[0], R = P.subarray(1);
2824
+ if (y === u && (T === 2 || T === 3)) {
2808
2825
  const A = t.fromBytes(R);
2809
2826
  if (!t.isValid(A))
2810
2827
  throw new Error("bad point: is not on curve, wrong x");
2811
2828
  const O = b(A);
2812
- let T;
2829
+ let I;
2813
2830
  try {
2814
- T = t.sqrt(O);
2831
+ I = t.sqrt(O);
2815
2832
  } catch (W) {
2816
2833
  const U = W instanceof Error ? ": " + W.message : "";
2817
2834
  throw new Error("bad point: is not on curve, sqrt error" + U);
2818
2835
  }
2819
2836
  d();
2820
- const C = t.isOdd(T);
2821
- return (I & 1) === 1 !== C && (T = t.neg(T)), { x: A, y: T };
2822
- } else if (y === h && I === 4) {
2823
- const A = t.BYTES, O = t.fromBytes(R.subarray(0, A)), T = t.fromBytes(R.subarray(A, A * 2));
2824
- if (!S(O, T))
2837
+ const C = t.isOdd(I);
2838
+ return (T & 1) === 1 !== C && (I = t.neg(I)), { x: A, y: I };
2839
+ } else if (y === h && T === 4) {
2840
+ const A = t.BYTES, O = t.fromBytes(R.subarray(0, A)), I = t.fromBytes(R.subarray(A, A * 2));
2841
+ if (!S(O, I))
2825
2842
  throw new Error("bad point: is not on curve");
2826
- return { x: O, y: T };
2843
+ return { x: O, y: I };
2827
2844
  } else
2828
2845
  throw new Error(`bad point: got length ${y}, expected compressed=${u} or uncompressed=${h}`);
2829
2846
  }
2830
- const x = e.toBytes || g, w = e.fromBytes || m;
2847
+ const x = e.toBytes || p, w = e.fromBytes || m;
2831
2848
  function b(P) {
2832
2849
  const u = t.sqr(P), h = t.mul(u, P);
2833
2850
  return t.add(t.add(h, t.mul(P, o.a)), o.b);
@@ -2856,15 +2873,15 @@ function Ur(r, e = {}) {
2856
2873
  return $r(P, c.basises, n.ORDER);
2857
2874
  }
2858
2875
  const Q = kt((P, u) => {
2859
- const { X: h, Y: y, Z: I } = P;
2860
- if (t.eql(I, t.ONE))
2876
+ const { X: h, Y: y, Z: T } = P;
2877
+ if (t.eql(T, t.ONE))
2861
2878
  return { x: h, y };
2862
2879
  const R = P.is0();
2863
- u == null && (u = R ? t.ONE : t.inv(I));
2864
- const A = t.mul(h, u), O = t.mul(y, u), T = t.mul(I, u);
2880
+ u == null && (u = R ? t.ONE : t.inv(T));
2881
+ const A = t.mul(h, u), O = t.mul(y, u), I = t.mul(T, u);
2865
2882
  if (R)
2866
2883
  return { x: t.ZERO, y: t.ZERO };
2867
- if (!t.eql(T, t.ONE))
2884
+ if (!t.eql(I, t.ONE))
2868
2885
  throw new Error("invZ was invalid");
2869
2886
  return { x: A, y: O };
2870
2887
  }), ve = kt((P) => {
@@ -2882,8 +2899,8 @@ function Ur(r, e = {}) {
2882
2899
  throw new Error("bad point: not in prime-order subgroup");
2883
2900
  return !0;
2884
2901
  });
2885
- function he(P, u, h, y, I) {
2886
- return h = new Z(t.mul(h.X, P), h.Y, h.Z), u = Ge(y, u), h = Ge(I, h), u.add(h);
2902
+ function he(P, u, h, y, T) {
2903
+ return h = new Z(t.mul(h.X, P), h.Y, h.Z), u = Ge(y, u), h = Ge(T, h), u.add(h);
2887
2904
  }
2888
2905
  const L = class L {
2889
2906
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
@@ -2941,8 +2958,8 @@ function Ur(r, e = {}) {
2941
2958
  /** Compare one point to another. */
2942
2959
  equals(u) {
2943
2960
  D(u);
2944
- 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));
2945
- return T && C;
2961
+ const { X: h, Y: y, Z: T } = this, { X: R, Y: A, Z: O } = u, I = t.eql(t.mul(h, O), t.mul(R, T)), C = t.eql(t.mul(y, O), t.mul(A, T));
2962
+ return I && C;
2946
2963
  }
2947
2964
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
2948
2965
  negate() {
@@ -2953,9 +2970,9 @@ function Ur(r, e = {}) {
2953
2970
  // https://eprint.iacr.org/2015/1060, algorithm 3
2954
2971
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
2955
2972
  double() {
2956
- const { a: u, b: h } = o, y = t.mul(h, Me), { X: I, Y: R, Z: A } = this;
2957
- 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);
2958
- 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);
2973
+ const { a: u, b: h } = o, y = t.mul(h, Me), { X: T, Y: R, Z: A } = this;
2974
+ let O = t.ZERO, I = t.ZERO, C = t.ZERO, N = t.mul(T, T), W = t.mul(R, R), U = t.mul(A, A), k = t.mul(T, R);
2975
+ return k = t.add(k, k), C = t.mul(T, A), C = t.add(C, C), O = t.mul(u, C), I = t.mul(y, U), I = t.add(O, I), O = t.sub(W, I), I = t.add(W, I), I = t.mul(O, I), 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), I = t.add(I, 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, I, C);
2959
2976
  }
2960
2977
  // Renes-Costello-Batina exception-free addition formula.
2961
2978
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -2963,13 +2980,13 @@ function Ur(r, e = {}) {
2963
2980
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
2964
2981
  add(u) {
2965
2982
  D(u);
2966
- const { X: h, Y: y, Z: I } = this, { X: R, Y: A, Z: O } = u;
2967
- let T = t.ZERO, C = t.ZERO, N = t.ZERO;
2983
+ const { X: h, Y: y, Z: T } = this, { X: R, Y: A, Z: O } = u;
2984
+ let I = t.ZERO, C = t.ZERO, N = t.ZERO;
2968
2985
  const W = o.a, U = t.mul(o.b, Me);
2969
- 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);
2970
- ee = t.mul(ee, H), H = t.add(k, j), ee = t.sub(ee, H), H = t.add(h, I);
2986
+ let k = t.mul(h, R), j = t.mul(y, A), V = t.mul(T, O), ee = t.add(h, y), H = t.add(R, A);
2987
+ ee = t.mul(ee, H), H = t.add(k, j), ee = t.sub(ee, H), H = t.add(h, T);
2971
2988
  let K = t.add(R, O);
2972
- 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);
2989
+ return H = t.mul(H, K), K = t.add(k, V), H = t.sub(H, K), K = t.add(y, T), I = t.add(A, O), K = t.mul(K, I), I = t.add(j, V), K = t.sub(K, I), N = t.mul(W, H), I = t.mul(U, V), N = t.add(I, N), I = t.sub(j, N), N = t.add(j, N), C = t.mul(I, 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), I = t.mul(ee, I), I = t.sub(I, k), k = t.mul(ee, j), N = t.mul(K, N), N = t.add(N, k), new L(I, C, N);
2973
2990
  }
2974
2991
  subtract(u) {
2975
2992
  return this.add(u.negate());
@@ -2990,16 +3007,16 @@ function Ur(r, e = {}) {
2990
3007
  const { endo: h } = e;
2991
3008
  if (!n.isValidNot0(u))
2992
3009
  throw new Error("invalid scalar: out of range");
2993
- let y, I;
3010
+ let y, T;
2994
3011
  const R = (A) => ne.cached(this, A, (O) => Lt(L, O));
2995
3012
  if (h) {
2996
- const { k1neg: A, k1: O, k2neg: T, k2: C } = M(u), { p: N, f: W } = R(O), { p: U, f: k } = R(C);
2997
- I = W.add(k), y = he(h.beta, N, U, A, T);
3013
+ const { k1neg: A, k1: O, k2neg: I, k2: C } = M(u), { p: N, f: W } = R(O), { p: U, f: k } = R(C);
3014
+ T = W.add(k), y = he(h.beta, N, U, A, I);
2998
3015
  } else {
2999
3016
  const { p: A, f: O } = R(u);
3000
- y = A, I = O;
3017
+ y = A, T = O;
3001
3018
  }
3002
- return Lt(L, [y, I])[0];
3019
+ return Lt(L, [y, T])[0];
3003
3020
  }
3004
3021
  /**
3005
3022
  * Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -3017,8 +3034,8 @@ function Ur(r, e = {}) {
3017
3034
  if (ne.hasCache(this))
3018
3035
  return this.multiply(u);
3019
3036
  if (h) {
3020
- const { k1neg: I, k1: R, k2neg: A, k2: O } = M(u), { p1: T, p2: C } = Pr(L, y, R, O);
3021
- return he(h.beta, T, C, I, A);
3037
+ const { k1neg: T, k1: R, k2neg: A, k2: O } = M(u), { p1: I, p2: C } = Pr(L, y, R, O);
3038
+ return he(h.beta, I, C, T, A);
3022
3039
  } else
3023
3040
  return ne.unsafe(y, u);
3024
3041
  }
@@ -3116,12 +3133,12 @@ function Fr(r, e = {}) {
3116
3133
  const S = s.fromBytes(x);
3117
3134
  return r.fromBytes(w).multiply(S).toBytes(b);
3118
3135
  }
3119
- const g = {
3136
+ const p = {
3120
3137
  isValidSecretKey: o,
3121
3138
  isValidPublicKey: i,
3122
3139
  randomSecretKey: a
3123
3140
  }, m = Dr(a, c);
3124
- return Object.freeze({ getPublicKey: c, getSharedSecret: d, keygen: m, Point: r, utils: g, lengths: n });
3141
+ return Object.freeze({ getPublicKey: c, getSharedSecret: d, keygen: m, Point: r, utils: p, lengths: n });
3125
3142
  }
3126
3143
  function Hr(r, e, s = {}) {
3127
3144
  Kt(e), ut(s, {}, {
@@ -3131,7 +3148,7 @@ function Hr(r, e, s = {}) {
3131
3148
  bits2int: "function",
3132
3149
  bits2int_modN: "function"
3133
3150
  }), s = Object.assign({}, s);
3134
- 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 = {
3151
+ const t = s.randomBytes || Xt, n = s.hmac || ((u, h) => gs(e, u, h)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: d, getSharedSecret: p, utils: m, lengths: x } = Fr(r, s), w = {
3135
3152
  prehash: !0,
3136
3153
  lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
3137
3154
  format: "compact",
@@ -3152,31 +3169,31 @@ function Hr(r, e, s = {}) {
3152
3169
  }
3153
3170
  function B(u, h) {
3154
3171
  nt(h);
3155
- const y = x.signature, I = h === "compact" ? y : h === "recovered" ? y + 1 : void 0;
3156
- return F(u, I);
3172
+ const y = x.signature, T = h === "compact" ? y : h === "recovered" ? y + 1 : void 0;
3173
+ return F(u, T);
3157
3174
  }
3158
3175
  class D {
3159
- constructor(h, y, I) {
3176
+ constructor(h, y, T) {
3160
3177
  v(this, "r");
3161
3178
  v(this, "s");
3162
3179
  v(this, "recovery");
3163
- if (this.r = E("r", h), this.s = E("s", y), I != null) {
3164
- if (q(), ![0, 1, 2, 3].includes(I))
3180
+ if (this.r = E("r", h), this.s = E("s", y), T != null) {
3181
+ if (q(), ![0, 1, 2, 3].includes(T))
3165
3182
  throw new Error("invalid recovery id");
3166
- this.recovery = I;
3183
+ this.recovery = T;
3167
3184
  }
3168
3185
  Object.freeze(this);
3169
3186
  }
3170
3187
  static fromBytes(h, y = w.format) {
3171
3188
  B(h, y);
3172
- let I;
3189
+ let T;
3173
3190
  if (y === "der") {
3174
- const { r: T, s: C } = pe.toSig(F(h));
3175
- return new D(T, C);
3191
+ const { r: I, s: C } = ge.toSig(F(h));
3192
+ return new D(I, C);
3176
3193
  }
3177
- y === "recovered" && (I = h[0], y = "compact", h = h.subarray(1));
3194
+ y === "recovered" && (T = h[0], y = "compact", h = h.subarray(1));
3178
3195
  const R = x.signature / 2, A = h.subarray(0, R), O = h.subarray(R, R * 2);
3179
- return new D(i.fromBytes(A), i.fromBytes(O), I);
3196
+ return new D(i.fromBytes(A), i.fromBytes(O), T);
3180
3197
  }
3181
3198
  static fromHex(h, y) {
3182
3199
  return this.fromBytes(Fe(h), y);
@@ -3191,10 +3208,10 @@ function Hr(r, e, s = {}) {
3191
3208
  return new D(this.r, this.s, h);
3192
3209
  }
3193
3210
  recoverPublicKey(h) {
3194
- const { r: y, s: I } = this, R = this.assertRecovery(), A = R === 2 || R === 3 ? y + a : y;
3211
+ const { r: y, s: T } = this, R = this.assertRecovery(), A = R === 2 || R === 3 ? y + a : y;
3195
3212
  if (!o.isValid(A))
3196
3213
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
3197
- 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));
3214
+ const O = o.toBytes(A), I = 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(T * C), k = r.BASE.multiplyUnsafe(W).add(I.multiplyUnsafe(U));
3198
3215
  if (k.is0())
3199
3216
  throw new Error("invalid recovery: point at infinify");
3200
3217
  return k.assertValidity(), k;
@@ -3205,8 +3222,8 @@ function Hr(r, e, s = {}) {
3205
3222
  }
3206
3223
  toBytes(h = w.format) {
3207
3224
  if (nt(h), h === "der")
3208
- return Fe(pe.hexFromSig(this));
3209
- const { r: y, s: I } = this, R = i.toBytes(y), A = i.toBytes(I);
3225
+ return Fe(ge.hexFromSig(this));
3226
+ const { r: y, s: T } = this, R = i.toBytes(y), A = i.toBytes(T);
3210
3227
  return h === "recovered" ? (q(), _e(Uint8Array.of(this.assertRecovery()), R, A)) : _e(R, A);
3211
3228
  }
3212
3229
  toHex(h) {
@@ -3216,8 +3233,8 @@ function Hr(r, e, s = {}) {
3216
3233
  const M = s.bits2int || function(h) {
3217
3234
  if (h.length > 8192)
3218
3235
  throw new Error("input is too large");
3219
- const y = je(h), I = h.length * 8 - c;
3220
- return I > 0 ? y >> BigInt(I) : y;
3236
+ const y = je(h), T = h.length * 8 - c;
3237
+ return T > 0 ? y >> BigInt(T) : y;
3221
3238
  }, Q = s.bits2int_modN || function(h) {
3222
3239
  return i.create(M(h));
3223
3240
  }, ve = dt(c);
@@ -3228,12 +3245,12 @@ function Hr(r, e, s = {}) {
3228
3245
  return F(u, void 0, "message"), h ? F(e(u), void 0, "prehashed message") : u;
3229
3246
  }
3230
3247
  function xe(u, h, y) {
3231
- const { lowS: I, prehash: R, extraEntropy: A } = et(y, w);
3248
+ const { lowS: T, prehash: R, extraEntropy: A } = et(y, w);
3232
3249
  u = Z(u, R);
3233
- const O = Q(u), T = i.fromBytes(h);
3234
- if (!i.isValidNot0(T))
3250
+ const O = Q(u), I = i.fromBytes(h);
3251
+ if (!i.isValidNot0(I))
3235
3252
  throw new Error("invalid private key");
3236
- const C = [he(T), he(O)];
3253
+ const C = [he(I), he(O)];
3237
3254
  if (A != null && A !== !1) {
3238
3255
  const k = A === !0 ? t(x.secretKey) : A;
3239
3256
  C.push(F(k, void 0, "extraEntropy"));
@@ -3246,43 +3263,43 @@ function Hr(r, e, s = {}) {
3246
3263
  const V = i.inv(j), ee = r.BASE.multiply(j).toAffine(), H = i.create(ee.x);
3247
3264
  if (H === le)
3248
3265
  return;
3249
- const K = i.create(V * i.create(W + H * T));
3266
+ const K = i.create(V * i.create(W + H * I));
3250
3267
  if (K === le)
3251
3268
  return;
3252
3269
  let xt = (ee.x === H ? 0 : 2) | Number(ee.y & Ee), mt = K;
3253
- return I && S(K) && (mt = i.neg(K), xt ^= 1), new D(H, mt, b ? void 0 : xt);
3270
+ return T && S(K) && (mt = i.neg(K), xt ^= 1), new D(H, mt, b ? void 0 : xt);
3254
3271
  }
3255
3272
  return { seed: N, k2sig: U };
3256
3273
  }
3257
3274
  function ne(u, h, y = {}) {
3258
- const { seed: I, k2sig: R } = xe(u, h, y);
3259
- return yr(e.outputLen, i.BYTES, n)(I, R).toBytes(y.format);
3275
+ const { seed: T, k2sig: R } = xe(u, h, y);
3276
+ return yr(e.outputLen, i.BYTES, n)(T, R).toBytes(y.format);
3260
3277
  }
3261
- function L(u, h, y, I = {}) {
3262
- const { lowS: R, prehash: A, format: O } = et(I, w);
3278
+ function L(u, h, y, T = {}) {
3279
+ const { lowS: R, prehash: A, format: O } = et(T, w);
3263
3280
  if (y = F(y, void 0, "publicKey"), h = Z(h, A), !at(u)) {
3264
- const T = u instanceof D ? ", use sig.toBytes()" : "";
3265
- throw new Error("verify expects Uint8Array signature" + T);
3281
+ const I = u instanceof D ? ", use sig.toBytes()" : "";
3282
+ throw new Error("verify expects Uint8Array signature" + I);
3266
3283
  }
3267
3284
  B(u, O);
3268
3285
  try {
3269
- const T = D.fromBytes(u, O), C = r.fromBytes(y);
3270
- if (R && T.hasHighS())
3286
+ const I = D.fromBytes(u, O), C = r.fromBytes(y);
3287
+ if (R && I.hasHighS())
3271
3288
  return !1;
3272
- 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));
3289
+ const { r: N, s: W } = I, 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));
3273
3290
  return ee.is0() ? !1 : i.create(ee.x) === N;
3274
3291
  } catch {
3275
3292
  return !1;
3276
3293
  }
3277
3294
  }
3278
3295
  function P(u, h, y = {}) {
3279
- const { prehash: I } = et(y, w);
3280
- return h = Z(h, I), D.fromBytes(u, "recovered").recoverPublicKey(h).toBytes();
3296
+ const { prehash: T } = et(y, w);
3297
+ return h = Z(h, T), D.fromBytes(u, "recovered").recoverPublicKey(h).toBytes();
3281
3298
  }
3282
3299
  return Object.freeze({
3283
3300
  keygen: l,
3284
3301
  getPublicKey: d,
3285
- getSharedSecret: g,
3302
+ getSharedSecret: p,
3286
3303
  utils: m,
3287
3304
  lengths: x,
3288
3305
  Point: r,
@@ -3310,7 +3327,7 @@ const ft = {
3310
3327
  ]
3311
3328
  }, Ut = /* @__PURE__ */ BigInt(2);
3312
3329
  function qr(r) {
3313
- 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, B = se(q, s, e) * d % e, D = se(B, i, e) * w % e, M = se(D, t, e) * l % e, Q = se(M, Ut, e);
3330
+ 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, p = se(d, s, e) * d % e, m = se(p, 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, B = se(q, s, e) * d % e, D = se(B, i, e) * w % e, M = se(D, t, e) * l % e, Q = se(M, Ut, e);
3314
3331
  if (!ot.eql(ot.sqr(Q), r))
3315
3332
  throw new Error("Cannot find square root");
3316
3333
  return Q;
@@ -3318,7 +3335,7 @@ function qr(r) {
3318
3335
  const ot = Ve(ft.p, { sqrt: qr }), Wr = /* @__PURE__ */ Ur(ft, {
3319
3336
  Fp: ot,
3320
3337
  endo: Gr
3321
- }), jr = /* @__PURE__ */ Hr(Wr, pr), Vr = BigInt(0), Re = BigInt(1), Kr = BigInt(2), zr = BigInt(7), Yr = BigInt(256), Zr = BigInt(113), ws = [], ys = [], bs = [];
3338
+ }), jr = /* @__PURE__ */ Hr(Wr, gr), Vr = BigInt(0), Re = BigInt(1), Kr = BigInt(2), zr = BigInt(7), Yr = BigInt(256), Zr = BigInt(113), ws = [], ys = [], bs = [];
3322
3339
  for (let r = 0, e = Re, s = 1, t = 0; r < 24; r++) {
3323
3340
  [s, t] = [t, (2 * s + 3 * t) % 5], ws.push(2 * (5 * t + s)), ys.push((r + 1) * (r + 2) / 2 % 64);
3324
3341
  let n = Vr;
@@ -3333,9 +3350,9 @@ function Qr(r, e = 24) {
3333
3350
  for (let i = 0; i < 10; i++)
3334
3351
  s[i] = r[i] ^ r[i + 10] ^ r[i + 20] ^ r[i + 30] ^ r[i + 40];
3335
3352
  for (let i = 0; i < 10; i += 2) {
3336
- 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];
3353
+ const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], d = s[c + 1], p = Ft(l, d, 1) ^ s[a], m = Ht(l, d, 1) ^ s[a + 1];
3337
3354
  for (let x = 0; x < 50; x += 10)
3338
- r[i + x] ^= g, r[i + x + 1] ^= m;
3355
+ r[i + x] ^= p, r[i + x + 1] ^= m;
3339
3356
  }
3340
3357
  let n = r[2], o = r[3];
3341
3358
  for (let i = 0; i < 24; i++) {
@@ -3350,9 +3367,9 @@ function Qr(r, e = 24) {
3350
3367
  }
3351
3368
  r[0] ^= Xr[t], r[1] ^= Jr[t];
3352
3369
  }
3353
- Ie(s);
3370
+ Te(s);
3354
3371
  }
3355
- class gt {
3372
+ class pt {
3356
3373
  // NOTE: we accept arguments in bytes instead of bits here.
3357
3374
  constructor(e, s, t, n = !1, o = 24) {
3358
3375
  v(this, "state");
@@ -3377,7 +3394,7 @@ class gt {
3377
3394
  Rt(this.state32), Qr(this.state32, this.rounds), Rt(this.state32), this.posOut = 0, this.pos = 0;
3378
3395
  }
3379
3396
  update(e) {
3380
- Te(this), F(e);
3397
+ Ie(this), F(e);
3381
3398
  const { blockLen: s, state: t } = this, n = e.length;
3382
3399
  for (let o = 0; o < n; ) {
3383
3400
  const i = Math.min(s - this.pos, n - o);
@@ -3395,7 +3412,7 @@ class gt {
3395
3412
  e[t] ^= s, s & 128 && t === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
3396
3413
  }
3397
3414
  writeInto(e) {
3398
- Te(this, !1), F(e), this.finish();
3415
+ Ie(this, !1), F(e), this.finish();
3399
3416
  const s = this.state, { blockLen: t } = this;
3400
3417
  for (let n = 0, o = e.length; n < o; ) {
3401
3418
  this.posOut >= t && this.keccak();
@@ -3421,14 +3438,14 @@ class gt {
3421
3438
  return this.digestInto(new Uint8Array(this.outputLen));
3422
3439
  }
3423
3440
  destroy() {
3424
- this.destroyed = !0, Ie(this.state);
3441
+ this.destroyed = !0, Te(this.state);
3425
3442
  }
3426
3443
  _cloneInto(e) {
3427
3444
  const { blockLen: s, suffix: t, outputLen: n, rounds: o, enableXOF: i } = this;
3428
- return e || (e = new gt(s, t, n, i, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = t, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
3445
+ return e || (e = new pt(s, t, n, i, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = t, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
3429
3446
  }
3430
3447
  }
3431
- const en = (r, e, s, t = {}) => Zt(() => new gt(e, r, s), t), Gt = /* @__PURE__ */ en(1, 136, 32);
3448
+ const en = (r, e, s, t = {}) => Zt(() => new pt(e, r, s), t), Gt = /* @__PURE__ */ en(1, 136, 32);
3432
3449
  class tn {
3433
3450
  async verifyJWT(e, s) {
3434
3451
  try {
@@ -3468,7 +3485,7 @@ ${t.length}`
3468
3485
  const i = Gt(o), a = s.startsWith("0x") ? s.slice(2) : s;
3469
3486
  if (a.length !== 130)
3470
3487
  throw new Error(`Invalid signature length: expected 130 hex chars, got ${a.length}`);
3471
- 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(
3488
+ const c = sn(a), l = c.slice(0, 32), d = c.slice(32, 64), p = c[64], m = p >= 27 ? p - 27 : p, b = new jr.Signature(
3472
3489
  qt(l),
3473
3490
  qt(d)
3474
3491
  ).addRecoveryBit(m).recoverPublicKey(i).toBytes(!1).slice(1), S = Gt(b);
@@ -3518,19 +3535,19 @@ class nn {
3518
3535
  }
3519
3536
  }
3520
3537
  }
3521
- class pt {
3538
+ class gt {
3522
3539
  static generateState() {
3523
3540
  const e = new Uint8Array(16);
3524
3541
  return crypto.getRandomValues(e), Array.from(e, (s) => s.toString(16).padStart(2, "0")).join("");
3525
3542
  }
3526
3543
  openAuth(e) {
3527
3544
  return new Promise((s, t) => {
3528
- 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(
3545
+ const n = e.width ?? 500, o = e.height ?? 600, i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c = gt.generateState(), l = e.authUrl.includes("?") ? "&" : "?", d = `${e.authUrl}${l}state=${c}`, p = window.open(
3529
3546
  d,
3530
3547
  "CROSSx OAuth",
3531
3548
  `width=${n},height=${o},left=${i},top=${a}`
3532
3549
  );
3533
- if (!g) {
3550
+ if (!p) {
3534
3551
  t(new Error("팝업 창을 열 수 없습니다. 팝업 차단을 해제해 주세요."));
3535
3552
  return;
3536
3553
  }
@@ -3547,7 +3564,7 @@ class pt {
3547
3564
  }, q = setInterval(() => {
3548
3565
  b++;
3549
3566
  try {
3550
- g.closed && (b <= x ? E() : (B(), t(new Error("로그인이 취소되었습니다"))));
3567
+ p.closed && (b <= x ? E() : (B(), t(new Error("로그인이 취소되었습니다"))));
3551
3568
  } catch {
3552
3569
  E();
3553
3570
  }
@@ -3592,7 +3609,7 @@ class on {
3592
3609
  };
3593
3610
  return await this.storage.set(Oe, t), t;
3594
3611
  } catch (s) {
3595
- throw new _(p.WALLET_CREATION_FAILED, "Wallet creation failed", s);
3612
+ throw new _(g.WALLET_CREATION_FAILED, "Wallet creation failed", s);
3596
3613
  }
3597
3614
  }
3598
3615
  async getAddresses(e) {
@@ -3665,7 +3682,7 @@ class qe {
3665
3682
  const e = this.tokenStore.get();
3666
3683
  if (!e)
3667
3684
  throw new _(
3668
- p.AUTH_NOT_AUTHENTICATED,
3685
+ g.AUTH_NOT_AUTHENTICATED,
3669
3686
  "No auth token found. Please sign in first."
3670
3687
  );
3671
3688
  return e;
@@ -3686,16 +3703,16 @@ class qe {
3686
3703
  })).data;
3687
3704
  if (d && typeof d.code == "number") {
3688
3705
  if (d.code < 0 || d.code >= 400) {
3689
- const g = d.message || d.data || "API request failed";
3706
+ const p = d.message || d.data || "API request failed";
3690
3707
  f.error("[CROSSx] Wallet Gateway API 에러 (HTTP 200):", {
3691
3708
  code: d.code,
3692
- message: g,
3709
+ message: p,
3693
3710
  url: o,
3694
3711
  method: e,
3695
3712
  fullResponse: d
3696
3713
  });
3697
- const m = qe.mapGatewayError(d.code), x = qe.getGatewayErrorMessage(d.code, g), w = new _(m, x);
3698
- throw w.gatewayCode = d.code, w.gatewayMessage = g, w;
3714
+ const m = qe.mapGatewayError(d.code), x = qe.getGatewayErrorMessage(d.code, p), w = new _(m, x);
3715
+ throw w.gatewayCode = d.code, w.gatewayMessage = p, w;
3699
3716
  }
3700
3717
  return f.log("[CROSSx] Wallet Gateway API 성공:", { code: d.code, url: o, method: e }), d.data ?? d;
3701
3718
  }
@@ -3703,16 +3720,16 @@ class qe {
3703
3720
  } catch (l) {
3704
3721
  if (l instanceof _) throw l;
3705
3722
  if ((a = l.response) != null && a.data) {
3706
- const d = l.response.data, g = d.message || d.data || "API request failed", m = d.code || "UNKNOWN";
3723
+ const d = l.response.data, p = d.message || d.data || "API request failed", m = d.code || "UNKNOWN";
3707
3724
  throw f.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
3708
3725
  code: m,
3709
- message: g,
3726
+ message: p,
3710
3727
  url: o,
3711
3728
  method: e,
3712
3729
  status: (c = l.response) == null ? void 0 : c.status
3713
3730
  }), new _(
3714
- p.UNKNOWN_ERROR,
3715
- `Wallet Gateway error (${m}): ${g}`
3731
+ g.UNKNOWN_ERROR,
3732
+ `Wallet Gateway error (${m}): ${p}`
3716
3733
  );
3717
3734
  }
3718
3735
  throw l;
@@ -3786,15 +3803,15 @@ class qe {
3786
3803
  switch (e) {
3787
3804
  case "sign":
3788
3805
  case "send":
3789
- if (!s.tx) throw new _(p.TX_INVALID_PARAMS, "prepare: tx is required");
3806
+ if (!s.tx) throw new _(g.TX_INVALID_PARAMS, "prepare: tx is required");
3790
3807
  t = { unsignedTx: this.buildUnsignedTx(s.tx) };
3791
3808
  break;
3792
3809
  case "sign-message":
3793
- if (!s.message) throw new _(p.TX_INVALID_PARAMS, "prepare: message is required");
3810
+ if (!s.message) throw new _(g.TX_INVALID_PARAMS, "prepare: message is required");
3794
3811
  t = { message: s.message }, s.from && (t.from = s.from);
3795
3812
  break;
3796
3813
  case "sign-typed-data":
3797
- if (!s.typedData) throw new _(p.TX_INVALID_PARAMS, "prepare: typedData is required");
3814
+ if (!s.typedData) throw new _(g.TX_INVALID_PARAMS, "prepare: typedData is required");
3798
3815
  t = { typedData: s.typedData }, s.from && (t.from = s.from);
3799
3816
  break;
3800
3817
  }
@@ -3882,37 +3899,37 @@ class qe {
3882
3899
  static mapGatewayError(e) {
3883
3900
  switch (e) {
3884
3901
  case -10002:
3885
- return p.AUTH_NOT_AUTHENTICATED;
3902
+ return g.AUTH_NOT_AUTHENTICATED;
3886
3903
  case -10001:
3887
3904
  case -10009:
3888
- return p.UNKNOWN_ERROR;
3905
+ return g.UNKNOWN_ERROR;
3889
3906
  case -10006:
3890
- return p.GATEWAY_INTERNAL_ERROR;
3907
+ return g.GATEWAY_INTERNAL_ERROR;
3891
3908
  case -10008:
3892
- return p.GATEWAY_LOCK_CONFLICT;
3909
+ return g.GATEWAY_LOCK_CONFLICT;
3893
3910
  case -10010:
3894
- return p.MIGRATION_FAILED;
3911
+ return g.MIGRATION_FAILED;
3895
3912
  case -10012:
3896
- return p.MIGRATION_BACKUP_EXISTS;
3913
+ return g.MIGRATION_BACKUP_EXISTS;
3897
3914
  case -10022:
3898
- return p.PROJECT_NOT_REGISTERED;
3915
+ return g.PROJECT_NOT_REGISTERED;
3899
3916
  case -10023:
3900
- return p.PROJECT_ID_MISSING;
3917
+ return g.PROJECT_ID_MISSING;
3901
3918
  case -10024:
3902
- return p.ORIGIN_NOT_ALLOWED;
3919
+ return g.ORIGIN_NOT_ALLOWED;
3903
3920
  case -10026:
3904
- return p.TYPED_DATA_CHAIN_ID_MISMATCH;
3921
+ return g.TYPED_DATA_CHAIN_ID_MISMATCH;
3905
3922
  case -10014:
3906
3923
  case -10015:
3907
3924
  case -10019:
3908
- return p.PREPARE_FAILED;
3925
+ return g.PREPARE_FAILED;
3909
3926
  case -10016:
3910
- return p.PREPARE_EXPIRED;
3927
+ return g.PREPARE_EXPIRED;
3911
3928
  case -10017:
3912
3929
  case -10018:
3913
- return p.PREPARE_MISMATCH;
3930
+ return g.PREPARE_MISMATCH;
3914
3931
  default:
3915
- return p.UNKNOWN_ERROR;
3932
+ return g.UNKNOWN_ERROR;
3916
3933
  }
3917
3934
  }
3918
3935
  static getGatewayErrorMessage(e, s) {
@@ -4001,7 +4018,7 @@ class Ce {
4001
4018
  );
4002
4019
  if (s) return s;
4003
4020
  throw new _(
4004
- p.CHAIN_NOT_SUPPORTED,
4021
+ g.CHAIN_NOT_SUPPORTED,
4005
4022
  `Unsupported chain: ${e}`
4006
4023
  );
4007
4024
  }
@@ -4014,19 +4031,19 @@ class Ce {
4014
4031
  static mapErrorCode(e) {
4015
4032
  switch (e) {
4016
4033
  case -10020:
4017
- return p.CHAIN_NOT_SUPPORTED;
4034
+ return g.CHAIN_NOT_SUPPORTED;
4018
4035
  case -10021:
4019
- return p.INVALID_CHAIN;
4036
+ return g.INVALID_CHAIN;
4020
4037
  case -10022:
4021
- return p.PROJECT_NOT_REGISTERED;
4038
+ return g.PROJECT_NOT_REGISTERED;
4022
4039
  case -10023:
4023
- return p.PROJECT_ID_MISSING;
4040
+ return g.PROJECT_ID_MISSING;
4024
4041
  case -10024:
4025
- return p.APP_IDENTIFIER_MISSING;
4042
+ return g.APP_IDENTIFIER_MISSING;
4026
4043
  case -10025:
4027
- return p.INVALID_APP_TYPE;
4044
+ return g.INVALID_APP_TYPE;
4028
4045
  default:
4029
- return p.UNKNOWN_ERROR;
4046
+ return g.UNKNOWN_ERROR;
4030
4047
  }
4031
4048
  }
4032
4049
  }
@@ -4181,12 +4198,14 @@ const cn = `
4181
4198
  outline: none;
4182
4199
  }
4183
4200
  .__crossx-close:hover,
4184
- .__crossx-close:focus {
4185
- background: none;
4186
- box-shadow: none;
4187
- outline: none;
4188
- filter: none;
4189
- transform: none;
4201
+ .__crossx-close:focus,
4202
+ .__crossx-close:active {
4203
+ background: none !important;
4204
+ box-shadow: none !important;
4205
+ outline: none !important;
4206
+ filter: none !important;
4207
+ transform: none !important;
4208
+ opacity: 1 !important;
4190
4209
  }
4191
4210
  .__crossx-close svg { display: block; }
4192
4211
 
@@ -4253,9 +4272,17 @@ const cn = `
4253
4272
  align-items: center;
4254
4273
  flex-shrink: 0;
4255
4274
  opacity: 0.7;
4256
- transition: opacity 0.12s;
4257
4275
  }
4258
- .__crossx-copy-btn:hover { opacity: 1; }
4276
+ .__crossx-copy-btn:hover,
4277
+ .__crossx-copy-btn:focus,
4278
+ .__crossx-copy-btn:active {
4279
+ opacity: 0.7 !important;
4280
+ box-shadow: none !important;
4281
+ outline: none !important;
4282
+ filter: none !important;
4283
+ transform: none !important;
4284
+ background: none !important;
4285
+ }
4259
4286
 
4260
4287
  /* Amount pill */
4261
4288
  .__crossx-pill {
@@ -4355,14 +4382,15 @@ const cn = `
4355
4382
  outline: none;
4356
4383
  }
4357
4384
  .__crossx-recover-btn:hover,
4358
- .__crossx-recover-btn:focus {
4359
- background: var(--cx-pill-bg);
4360
- border-color: var(--cx-pill-bg);
4361
- opacity: 1;
4362
- box-shadow: none;
4363
- outline: none;
4364
- filter: none;
4365
- transform: none;
4385
+ .__crossx-recover-btn:focus,
4386
+ .__crossx-recover-btn:active {
4387
+ background: var(--cx-pill-bg) !important;
4388
+ border-color: var(--cx-pill-bg) !important;
4389
+ opacity: 1 !important;
4390
+ box-shadow: none !important;
4391
+ outline: none !important;
4392
+ filter: none !important;
4393
+ transform: none !important;
4366
4394
  }
4367
4395
  .__crossx-recover-label {
4368
4396
  font-size: 18px;
@@ -4392,15 +4420,16 @@ const cn = `
4392
4420
  outline: none;
4393
4421
  }
4394
4422
  .__crossx-skip-btn:hover,
4395
- .__crossx-skip-btn:focus {
4396
- background: none;
4397
- color: var(--cx-subtitle);
4398
- opacity: 1;
4399
- box-shadow: none;
4400
- outline: none;
4401
- filter: none;
4402
- transform: none;
4403
- text-decoration: underline;
4423
+ .__crossx-skip-btn:focus,
4424
+ .__crossx-skip-btn:active {
4425
+ background: none !important;
4426
+ color: var(--cx-subtitle) !important;
4427
+ opacity: 1 !important;
4428
+ box-shadow: none !important;
4429
+ outline: none !important;
4430
+ filter: none !important;
4431
+ transform: none !important;
4432
+ text-decoration: underline !important;
4404
4433
  }
4405
4434
 
4406
4435
  /* ── PIN Input Modal ───────────────────────────────────────────── */
@@ -4571,10 +4600,18 @@ const cn = `
4571
4600
  font-weight: 700;
4572
4601
  line-height: 1.3;
4573
4602
  cursor: pointer;
4574
- transition: opacity 0.12s, transform 0.1s;
4575
4603
  }
4576
- .__crossx-approve-btn:hover { opacity: 0.9; }
4577
- .__crossx-approve-btn:active { transform: scale(0.98); }
4604
+ .__crossx-approve-btn:hover,
4605
+ .__crossx-approve-btn:focus,
4606
+ .__crossx-approve-btn:active {
4607
+ opacity: 1 !important;
4608
+ box-shadow: none !important;
4609
+ outline: none !important;
4610
+ filter: none !important;
4611
+ transform: none !important;
4612
+ background: var(--cx-primary) !important;
4613
+ color: var(--cx-on-primary) !important;
4614
+ }
4578
4615
  .__crossx-btn-row {
4579
4616
  display: flex;
4580
4617
  gap: 8px;
@@ -4592,9 +4629,18 @@ const cn = `
4592
4629
  font-weight: 700;
4593
4630
  line-height: 1.3;
4594
4631
  cursor: pointer;
4595
- transition: opacity 0.12s;
4596
4632
  }
4597
- .__crossx-cancel-btn:hover { opacity: 0.8; }
4633
+ .__crossx-cancel-btn:hover,
4634
+ .__crossx-cancel-btn:focus,
4635
+ .__crossx-cancel-btn:active {
4636
+ opacity: 1 !important;
4637
+ box-shadow: none !important;
4638
+ outline: none !important;
4639
+ filter: none !important;
4640
+ transform: none !important;
4641
+ background: none !important;
4642
+ color: var(--cx-primary) !important;
4643
+ }
4598
4644
  .__crossx-confirm-btn {
4599
4645
  flex: 1;
4600
4646
  padding: 16px;
@@ -4607,10 +4653,18 @@ const cn = `
4607
4653
  font-weight: 700;
4608
4654
  line-height: 1.3;
4609
4655
  cursor: pointer;
4610
- transition: opacity 0.12s, transform 0.1s;
4611
4656
  }
4612
- .__crossx-confirm-btn:hover { opacity: 0.9; }
4613
- .__crossx-confirm-btn:active { transform: scale(0.98); }
4657
+ .__crossx-confirm-btn:hover,
4658
+ .__crossx-confirm-btn:focus,
4659
+ .__crossx-confirm-btn:active {
4660
+ opacity: 1 !important;
4661
+ box-shadow: none !important;
4662
+ outline: none !important;
4663
+ filter: none !important;
4664
+ transform: none !important;
4665
+ background: var(--cx-primary) !important;
4666
+ color: var(--cx-on-primary) !important;
4667
+ }
4614
4668
 
4615
4669
  /* ── Transaction Progress / Complete Modal ─────────────────── */
4616
4670
  @keyframes __crossx-spinner {
@@ -4691,13 +4745,17 @@ const cn = `
4691
4745
  -webkit-tap-highlight-color: transparent;
4692
4746
  box-shadow: none;
4693
4747
  outline: none;
4694
- transition: opacity 0.12s;
4695
4748
  min-width: 0;
4696
4749
  }
4697
- .__crossx-login-btn:hover { opacity: 0.8; }
4698
- .__crossx-login-btn:focus {
4699
- outline: none;
4700
- box-shadow: none;
4750
+ .__crossx-login-btn:hover,
4751
+ .__crossx-login-btn:focus,
4752
+ .__crossx-login-btn:active {
4753
+ opacity: 1 !important;
4754
+ box-shadow: none !important;
4755
+ outline: none !important;
4756
+ filter: none !important;
4757
+ transform: none !important;
4758
+ background: var(--cx-pill-bg) !important;
4701
4759
  }
4702
4760
  .__crossx-login-btn-label {
4703
4761
  font-size: 18px;
@@ -4731,14 +4789,16 @@ const cn = `
4731
4789
  text-decoration: none;
4732
4790
  }
4733
4791
  .__crossx-login-terms-link:hover,
4734
- .__crossx-login-terms-link:focus {
4735
- color: var(--cx-primary);
4736
- text-decoration: none;
4737
- opacity: 1;
4738
- background: none;
4739
- box-shadow: none;
4740
- outline: none;
4741
- filter: none;
4792
+ .__crossx-login-terms-link:focus,
4793
+ .__crossx-login-terms-link:active {
4794
+ color: var(--cx-primary) !important;
4795
+ text-decoration: none !important;
4796
+ opacity: 1 !important;
4797
+ background: none !important;
4798
+ box-shadow: none !important;
4799
+ outline: none !important;
4800
+ filter: none !important;
4801
+ transform: none !important;
4742
4802
  }
4743
4803
 
4744
4804
  /* ── Wallet Selector Modal ─────────────────────────────────── */
@@ -4773,11 +4833,18 @@ const cn = `
4773
4833
  box-shadow: none;
4774
4834
  outline: none;
4775
4835
  width: 100%;
4776
- transition: opacity 0.12s;
4777
4836
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
4778
4837
  }
4779
- .__crossx-wallet-item:hover { opacity: 0.8; }
4780
- .__crossx-wallet-item:focus { outline: none; box-shadow: none; }
4838
+ .__crossx-wallet-item:hover,
4839
+ .__crossx-wallet-item:focus,
4840
+ .__crossx-wallet-item:active {
4841
+ opacity: 1 !important;
4842
+ box-shadow: none !important;
4843
+ outline: none !important;
4844
+ filter: none !important;
4845
+ transform: none !important;
4846
+ background: var(--cx-pill-bg) !important;
4847
+ }
4781
4848
  .__crossx-wallet-addr {
4782
4849
  font-size: 16px;
4783
4850
  font-weight: 600;
@@ -4801,12 +4868,19 @@ const cn = `
4801
4868
  outline: none;
4802
4869
  background: none;
4803
4870
  width: 100%;
4804
- transition: opacity 0.12s;
4805
4871
  flex-shrink: 0;
4806
4872
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
4807
4873
  }
4808
- .__crossx-wallet-add:hover { opacity: 0.8; }
4809
- .__crossx-wallet-add:focus { outline: none; box-shadow: none; }
4874
+ .__crossx-wallet-add:hover,
4875
+ .__crossx-wallet-add:focus,
4876
+ .__crossx-wallet-add:active {
4877
+ opacity: 1 !important;
4878
+ box-shadow: none !important;
4879
+ outline: none !important;
4880
+ filter: none !important;
4881
+ transform: none !important;
4882
+ background: none !important;
4883
+ }
4810
4884
  .__crossx-wallet-add:disabled { opacity: 0.5; cursor: not-allowed; }
4811
4885
  .__crossx-wallet-add-icon {
4812
4886
  width: 24px;
@@ -5072,7 +5146,7 @@ const _t = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
5072
5146
  <rect x="12.5" y="11.5" width="3.5" height="2.5" rx="0.75" fill="currentColor"/>
5073
5147
  </svg>`, fn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
5074
5148
  <path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="var(--cx-secondary)"/>
5075
- </svg>`, gn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
5149
+ </svg>`, pn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
5076
5150
  <circle cx="12" cy="12" r="12" fill="var(--cx-secondary)"/>
5077
5151
  <circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
5078
5152
  <path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
@@ -5108,7 +5182,7 @@ function G(r, e) {
5108
5182
  <div class="__crossx-row-value">${e}</div>
5109
5183
  </div>`;
5110
5184
  }
5111
- function pn(r, e) {
5185
+ function gn(r, e) {
5112
5186
  const s = e, t = Ke(), n = r.to ? `<span class="__crossx-addr-text">${Y(r.to)}</span>
5113
5187
  <button class="__crossx-copy-btn" data-copy="${$(r.to)}" title="Copy address">${de}</button>` : "<span>—</span>", o = Es(r), i = r.data && r.data !== "0x" ? r.data : "0x", a = document.createElement("div");
5114
5188
  return a.id = te, a.innerHTML = `
@@ -5251,7 +5325,7 @@ function yn(r, e) {
5251
5325
  function bn(r, e, s) {
5252
5326
  const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", o = r.querySelector("#__crossx-ttl"), i = r.querySelector(".__crossx-header");
5253
5327
  if (o) {
5254
- const w = n ? gn : t ? "" : fn, b = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
5328
+ const w = n ? pn : t ? "" : fn, b = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
5255
5329
  w ? (o.style.display = "flex", o.style.alignItems = "center", o.style.gap = "8px", o.innerHTML = `${w}<span>${b}</span>`) : o.textContent = b;
5256
5330
  }
5257
5331
  if (i && !r.querySelector("#__crossx-close-btn")) {
@@ -5262,7 +5336,7 @@ function bn(r, e, s) {
5262
5336
  if (!a) return;
5263
5337
  const c = e.from ? G("From", `<span class="__crossx-addr-text">${Y(e.from)}</span>
5264
5338
  <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>
5265
- <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>
5339
+ <button class="__crossx-copy-btn" data-copy="${$(e.to)}" title="Copy address">${de}</button>`) : "", d = e.amount ? G("Transfer", `<span>${$(e.amount)}</span>`) : "", p = e.fees ? G("Tx Fee", `<span>${$(e.fees)}</span>`) : "", m = e.txHash ? G("Tx Hash", `<span class="__crossx-addr-text">${Y(e.txHash)}</span>
5266
5340
  <button class="__crossx-copy-btn" data-copy="${$(e.txHash)}" title="Copy hash">${de}</button>`) : "", x = e.total ? `<div class="__crossx-total-pill">
5267
5341
  <span class="__crossx-total-label">Total<br>(including fees)</span>
5268
5342
  <span class="__crossx-total-amount">${$(e.total)}</span>
@@ -5272,7 +5346,7 @@ function bn(r, e, s) {
5272
5346
  ${c}
5273
5347
  ${l}
5274
5348
  ${d}
5275
- ${g}
5349
+ ${p}
5276
5350
  ${m}
5277
5351
  </div>
5278
5352
  ${x}
@@ -5335,8 +5409,8 @@ function Sn(r, e) {
5335
5409
  <span class="__crossx-td-value">${$(o)}</span>
5336
5410
  </div>`;
5337
5411
  for (const [l, d] of Object.entries(i)) {
5338
- const g = mn(d), x = xn(d) ? `<span class="__crossx-addr-text">${Y(d)}</span>
5339
- <button class="__crossx-copy-btn" data-copy="${$(String(d))}" title="Copy">${de}</button>` : `<span>${g}</span>`;
5412
+ const p = mn(d), x = xn(d) ? `<span class="__crossx-addr-text">${Y(d)}</span>
5413
+ <button class="__crossx-copy-btn" data-copy="${$(String(d))}" title="Copy">${de}</button>` : `<span>${p}</span>`;
5340
5414
  a += `
5341
5415
  <div class="__crossx-td-row">
5342
5416
  <span class="__crossx-td-label">${$(l)}</span>
@@ -5378,7 +5452,7 @@ const En = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="
5378
5452
  <line x1="12" y1="5" x2="12" y2="19"/>
5379
5453
  <line x1="5" y1="12" x2="19" y2="12"/>
5380
5454
  </svg>`;
5381
- function Tn(r, e) {
5455
+ function In(r, e) {
5382
5456
  const s = r.map(
5383
5457
  (n) => `<button class="__crossx-wallet-item" data-wallet-index="${n.index}" data-wallet-address="${$(n.address)}">
5384
5458
  <span class="__crossx-wallet-addr">${Y(n.address)}</span>
@@ -5417,7 +5491,7 @@ function Tn(r, e) {
5417
5491
  </div>
5418
5492
  `, t;
5419
5493
  }
5420
- const In = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
5494
+ const Tn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
5421
5495
  <path d="M26.693 21.193c-.028-3.168 2.587-4.712 2.706-4.786-1.477-2.16-3.77-2.454-4.58-2.484-1.944-.197-3.804 1.148-4.793 1.148-.992 0-2.52-1.12-4.147-1.09-2.13.032-4.1 1.239-5.198 3.133-2.222 3.855-.569 9.562 1.593 12.69 1.061 1.535 2.318 3.258 3.975 3.196 1.6-.064 2.2-1.03 4.133-1.03 1.928 0 2.48 1.03 4.172.997 1.72-.03 2.806-1.56 3.862-3.1 1.211-1.779 1.713-3.495 1.74-3.583-.037-.017-3.427-1.316-3.463-5.09z" fill="currentColor"/>
5422
5496
  <path d="M23.527 11.876c.877-1.065 1.471-2.545 1.31-4.024-1.266.053-2.807.845-3.718 1.907-.813.946-1.53 2.468-1.34 3.915 1.41.107 2.852-.716 3.748-1.798z" fill="currentColor"/>
5423
5497
  </svg>`, An = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -5441,7 +5515,7 @@ function Rn(r) {
5441
5515
  <div class="__crossx-body">
5442
5516
  <div class="__crossx-login-btn-row">
5443
5517
  <button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
5444
- <span class="__crossx-login-icon" style="color:var(--cx-value);">${In}</span>
5518
+ <span class="__crossx-login-icon" style="color:var(--cx-value);">${Tn}</span>
5445
5519
  <span class="__crossx-login-btn-label">Sign in with&nbsp;&nbsp;Apple</span>
5446
5520
  </button>
5447
5521
  <button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
@@ -5521,8 +5595,8 @@ function kn(r, e, s) {
5521
5595
  a.preventDefault();
5522
5596
  const c = (((d = a.clipboardData) == null ? void 0 : d.getData("text")) ?? "").replace(/\D/g, "").slice(0, 4);
5523
5597
  if (!c) return;
5524
- c.split("").forEach((g, m) => {
5525
- t[m] && (t[m].value = g);
5598
+ c.split("").forEach((p, m) => {
5599
+ t[m] && (t[m].value = p);
5526
5600
  });
5527
5601
  const l = Math.min(c.length, 3);
5528
5602
  t[l].focus(), c.length === 4 && setTimeout(() => e(c), 200);
@@ -5548,7 +5622,7 @@ class Nn {
5548
5622
  return new Promise((t) => {
5549
5623
  var w;
5550
5624
  me();
5551
- const n = [...e], o = Tn(n, this.tokens), i = document.body.style.overflow;
5625
+ const n = [...e], o = In(n, this.tokens), i = document.body.style.overflow;
5552
5626
  document.body.style.overflow = "hidden", document.body.appendChild(o);
5553
5627
  let a = !1;
5554
5628
  const c = () => {
@@ -5609,7 +5683,7 @@ class Nn {
5609
5683
  (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) => {
5610
5684
  d.target === s && o();
5611
5685
  }), s.querySelectorAll(".__crossx-login-terms-link").forEach((d) => {
5612
- d.addEventListener("click", (g) => g.stopPropagation());
5686
+ d.addEventListener("click", (p) => p.stopPropagation());
5613
5687
  });
5614
5688
  const i = (d) => {
5615
5689
  d.key === "Escape" && (document.removeEventListener("keydown", i), o());
@@ -5679,8 +5753,8 @@ class Nn {
5679
5753
  l.addEventListener("click", (d) => {
5680
5754
  var m;
5681
5755
  d.stopPropagation();
5682
- const g = l.dataset.copy;
5683
- g && ((m = navigator.clipboard) == null || m.writeText(g).catch(() => {
5756
+ const p = l.dataset.copy;
5757
+ p && ((m = navigator.clipboard) == null || m.writeText(p).catch(() => {
5684
5758
  }));
5685
5759
  });
5686
5760
  }), t.addEventListener("click", (l) => {
@@ -5706,8 +5780,8 @@ class Nn {
5706
5780
  const a = () => {
5707
5781
  i || (i = !0, o(), t());
5708
5782
  }, c = () => {
5709
- var d, g;
5710
- (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) => {
5783
+ var d, p;
5784
+ (d = n.querySelector("#__crossx-done-btn")) == null || d.addEventListener("click", a), (p = n.querySelector("#__crossx-close-btn")) == null || p.addEventListener("click", a), n.addEventListener("click", (m) => {
5711
5785
  m.target === n && a();
5712
5786
  });
5713
5787
  const l = (m) => {
@@ -5725,25 +5799,25 @@ class Nn {
5725
5799
  var c, l, d;
5726
5800
  me();
5727
5801
  let t;
5728
- e.type === "sign-message" ? t = vn(e, this.tokens) : e.type === "sign-typed-data" ? t = Sn(e, this.tokens) : e.type === "sign" ? t = pn(e, this.tokens) : t = _n(e, this.tokens), document.body.appendChild(t);
5802
+ e.type === "sign-message" ? t = vn(e, this.tokens) : e.type === "sign-typed-data" ? t = Sn(e, this.tokens) : e.type === "sign" ? t = gn(e, this.tokens) : t = _n(e, this.tokens), document.body.appendChild(t);
5729
5803
  const n = () => t.remove(), o = () => {
5730
5804
  n(), s(!0);
5731
5805
  }, i = () => {
5732
5806
  n(), s(!1);
5733
5807
  };
5734
- (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) => {
5735
- g.addEventListener("click", (m) => {
5808
+ (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((p) => {
5809
+ p.addEventListener("click", (m) => {
5736
5810
  var w;
5737
5811
  m.stopPropagation();
5738
- const x = g.dataset.copy;
5812
+ const x = p.dataset.copy;
5739
5813
  x && ((w = navigator.clipboard) == null || w.writeText(x).catch(() => {
5740
5814
  }));
5741
5815
  });
5742
- }), t.addEventListener("click", (g) => {
5743
- g.target === t && i();
5816
+ }), t.addEventListener("click", (p) => {
5817
+ p.target === t && i();
5744
5818
  });
5745
- const a = (g) => {
5746
- g.key === "Escape" && (document.removeEventListener("keydown", a), i());
5819
+ const a = (p) => {
5820
+ p.key === "Escape" && (document.removeEventListener("keydown", a), i());
5747
5821
  };
5748
5822
  document.addEventListener("keydown", a);
5749
5823
  });
@@ -5776,7 +5850,7 @@ function Mn(r) {
5776
5850
  }, t = {
5777
5851
  gatewayUrl: e.walletGatewayUrl,
5778
5852
  projectId: r.projectId
5779
- }, o = s.authMode !== "cookie" && At.isAvailable() ? new At() : new Ks(), i = new tn(), a = new nn(), c = new pt(), l = new Pn();
5853
+ }, o = s.authMode !== "cookie" && At.isAvailable() ? new At() : new Ks(), i = new tn(), a = new nn(), c = new gt(), l = new Pn();
5780
5854
  let d;
5781
5855
  r.useMockWallet ? (f.log("[CROSSx] Mock Wallet Provider 사용"), d = new on(o)) : (f.log("[CROSSx] Remote Wallet Provider 사용"), d = new qe(
5782
5856
  t,
@@ -5784,7 +5858,7 @@ function Mn(r) {
5784
5858
  a,
5785
5859
  l
5786
5860
  ));
5787
- const g = new Ce(t, a), m = new Nn(r.theme ?? "light", r.themeTokens);
5861
+ const p = new Ce(t, a), m = new Nn(r.theme ?? "light", r.themeTokens);
5788
5862
  return new st(
5789
5863
  s,
5790
5864
  t,
@@ -5795,7 +5869,7 @@ function Mn(r) {
5795
5869
  d,
5796
5870
  l,
5797
5871
  m,
5798
- g
5872
+ p
5799
5873
  );
5800
5874
  }
5801
5875
  export {
@@ -5803,6 +5877,6 @@ export {
5803
5877
  Cs as CROSSxEthereumProvider,
5804
5878
  st as CROSSxSDK,
5805
5879
  $n as ChainId,
5806
- p as ErrorCode,
5880
+ g as ErrorCode,
5807
5881
  Mn as createCROSSxSDK
5808
5882
  };