@nexus-cross/crossx-sdk-core 1.4.1 → 1.4.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -894,11 +894,11 @@ class Zs {
894
894
  this.listeners.clear();
895
895
  }
896
896
  }
897
- const Ke = {
897
+ const Oe = {
898
898
  production: {
899
- oauthServiceUrl: "https://stg-cross-wallet-oauth.crosstoken.io",
900
- authApiUrl: "https://stg-cross-auth.crosstoken.io",
901
- walletGatewayUrl: "https://stg-embedded-wallet-gateway.crosstoken.io/api/v1"
899
+ oauthServiceUrl: "https://cross-wallet-oauth.crosstoken.io",
900
+ authApiUrl: "https://cross-auth.crosstoken.io",
901
+ walletGatewayUrl: "https://embedded-wallet-gateway.crosstoken.io/api/v1"
902
902
  },
903
903
  staging: {
904
904
  oauthServiceUrl: "https://stg-cross-wallet-oauth.crosstoken.io",
@@ -913,7 +913,7 @@ const Ke = {
913
913
  };
914
914
  function Qs(r) {
915
915
  const e = r.environment;
916
- return e && e in Ke ? Ke[e] : null;
916
+ return e && e in Oe ? Oe[e] : null;
917
917
  }
918
918
  function er() {
919
919
  try {
@@ -923,10 +923,16 @@ function er() {
923
923
  }
924
924
  } catch {
925
925
  }
926
- return Ke.production;
926
+ try {
927
+ const r = process.env.NEXT_PUBLIC_CROSSX_ENVIRONMENT;
928
+ if (r && r in Oe)
929
+ return Oe[r];
930
+ } catch {
931
+ }
932
+ return Oe.production;
927
933
  }
928
934
  const tr = 2e3, Pt = 6e4, sr = 1e3, rr = 1e4, nr = "0x77359400", Ct = "0x3B9ACA00", Nt = 130, Lt = 6, Dt = 18, Mt = 3e4, ir = 5 * 60 * 1e3, or = 30 * 1e3;
929
- function Le(r) {
935
+ function De(r) {
930
936
  const e = r.indexOf("@");
931
937
  if (e < 0) return "***";
932
938
  const s = r.substring(0, e), t = r.substring(e);
@@ -2108,7 +2114,7 @@ const te = class te extends Zs {
2108
2114
  if (await this.confirmation.showSessionAlert({
2109
2115
  title: f.sessionAlert_title,
2110
2116
  message: f.alert_sessionExpired,
2111
- email: this.userEmail ? Le(this.userEmail) : void 0
2117
+ email: this.userEmail ? De(this.userEmail) : void 0
2112
2118
  }) === "signin-again" && (await this.signInAgain()).success) {
2113
2119
  d.log("[CROSSx][Migration Phase 4] 재로그인 성공 — PIN 입력 루프 계속"), i--;
2114
2120
  continue;
@@ -2139,7 +2145,7 @@ const te = class te extends Zs {
2139
2145
  if (await this.confirmation.showSessionAlert({
2140
2146
  title: _.sessionAlert_title,
2141
2147
  message: _.alert_sessionExpired,
2142
- email: this.userEmail ? Le(this.userEmail) : void 0
2148
+ email: this.userEmail ? De(this.userEmail) : void 0
2143
2149
  }) === "signin-again" && (await this.signInAgain()).success) {
2144
2150
  d.log("[CROSSx][Migration Phase 5] 재로그인 성공 — 마이그레이션 재시도 (검증된 PIN 유지)");
2145
2151
  try {
@@ -2331,7 +2337,7 @@ const te = class te extends Zs {
2331
2337
  return await this.confirmation.showSessionAlert({
2332
2338
  title: p.sessionAlert_title,
2333
2339
  message: p.alert_differentAccount,
2334
- email: this.userEmail ? Le(this.userEmail) : void 0
2340
+ email: this.userEmail ? De(this.userEmail) : void 0
2335
2341
  }) === "signin-again" ? (this._isRecoveringSession = !1, this.signInAgain()) : (this.clearAuthState(), { success: !1, error: "Different account signed in" });
2336
2342
  }
2337
2343
  this.applyAuthResult(a);
@@ -2355,7 +2361,7 @@ const te = class te extends Zs {
2355
2361
  try {
2356
2362
  return await e();
2357
2363
  } catch (s) {
2358
- const t = fe(this._config.locale ?? "en"), n = this.userEmail ? Le(this.userEmail) : void 0;
2364
+ const t = fe(this._config.locale ?? "en"), n = this.userEmail ? De(this.userEmail) : void 0;
2359
2365
  if (s instanceof g && s.code === h.WITHDRAW_FAILED) {
2360
2366
  if (d.warn("[CROSSx] WITHDRAW_FAILED — 로컬 인증 초기화"), await this.confirmation.showSessionAlert({
2361
2367
  title: t.sessionAlert_title,
@@ -2501,7 +2507,7 @@ const te = class te extends Zs {
2501
2507
  if (await this.confirmation.showSessionAlert({
2502
2508
  title: l.sessionAlert_title,
2503
2509
  message: l.alert_sessionExpired,
2504
- email: this.userEmail ? Le(this.userEmail) : void 0
2510
+ email: this.userEmail ? De(this.userEmail) : void 0
2505
2511
  }) === "signin-again" && (await this.signInAgain()).success)
2506
2512
  throw o(c), c;
2507
2513
  }
@@ -2695,7 +2701,7 @@ class ar {
2695
2701
  }
2696
2702
  }
2697
2703
  }
2698
- const tt = "crossx-sdk", cr = 1, he = "data", Ee = "keys", Ue = "aes-primary", lr = 12;
2704
+ const tt = "crossx-sdk", cr = 1, he = "data", Ee = "keys", He = "aes-primary", lr = 12;
2699
2705
  class $t {
2700
2706
  constructor(e) {
2701
2707
  this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
@@ -2738,7 +2744,7 @@ class $t {
2738
2744
  }
2739
2745
  async init() {
2740
2746
  this.db = await this.openDB();
2741
- const e = await this.idbGet(Ee, Ue);
2747
+ const e = await this.idbGet(Ee, He);
2742
2748
  if (e) {
2743
2749
  this.cryptoKey = e;
2744
2750
  return;
@@ -2752,7 +2758,7 @@ class $t {
2752
2758
  { name: "AES-GCM", length: 256 },
2753
2759
  !1,
2754
2760
  ["encrypt", "decrypt"]
2755
- ), await this.idbPut(Ee, Ue, this.cryptoKey);
2761
+ ), await this.idbPut(Ee, He, this.cryptoKey);
2756
2762
  }
2757
2763
  /**
2758
2764
  * 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
@@ -2761,7 +2767,7 @@ class $t {
2761
2767
  async migrateFromLegacyDB() {
2762
2768
  if (this.dbName === tt) return null;
2763
2769
  try {
2764
- const e = await this.openDB(tt), s = e.transaction([Ee, he], "readonly"), t = s.objectStore(Ee).get(Ue), n = await new Promise((l, u) => {
2770
+ const e = await this.openDB(tt), s = e.transaction([Ee, he], "readonly"), t = s.objectStore(Ee).get(He), n = await new Promise((l, u) => {
2765
2771
  t.onsuccess = () => l(t.result), t.onerror = () => u(t.error);
2766
2772
  });
2767
2773
  if (!n)
@@ -2774,7 +2780,7 @@ class $t {
2774
2780
  o.onsuccess = () => l(o.result), o.onerror = () => u(o.error);
2775
2781
  })
2776
2782
  ]);
2777
- e.close(), await this.idbPut(Ee, Ue, n);
2783
+ e.close(), await this.idbPut(Ee, He, n);
2778
2784
  for (let l = 0; l < c.length; l++)
2779
2785
  await this.idbPut(he, String(c[l]), a[l]);
2780
2786
  return indexedDB.deleteDatabase(tt), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
@@ -2864,7 +2870,7 @@ function os(r) {
2864
2870
  throw new Error("Hash must wrapped by utils.createHasher");
2865
2871
  we(r.outputLen), we(r.blockLen);
2866
2872
  }
2867
- function Pe(r, e = !0) {
2873
+ function Ce(r, e = !0) {
2868
2874
  if (r.destroyed)
2869
2875
  throw new Error("Hash instance has been destroyed");
2870
2876
  if (e && r.finished)
@@ -2879,7 +2885,7 @@ function as(r, e) {
2879
2885
  function dr(r) {
2880
2886
  return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
2881
2887
  }
2882
- function Ce(...r) {
2888
+ function Ne(...r) {
2883
2889
  for (let e = 0; e < r.length; e++)
2884
2890
  r[e].fill(0);
2885
2891
  }
@@ -2899,7 +2905,7 @@ function pr(r) {
2899
2905
  return r;
2900
2906
  }
2901
2907
  const Bt = ur ? (r) => r : pr, cs = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", fr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
2902
- function Be(r) {
2908
+ function Ue(r) {
2903
2909
  if (q(r), cs)
2904
2910
  return r.toHex();
2905
2911
  let e = "";
@@ -2983,7 +2989,7 @@ class mr {
2983
2989
  this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = st(this.buffer);
2984
2990
  }
2985
2991
  update(e) {
2986
- Pe(this), q(e);
2992
+ Ce(this), q(e);
2987
2993
  const { view: s, buffer: t, blockLen: n } = this, i = e.length;
2988
2994
  for (let o = 0; o < i; ) {
2989
2995
  const a = Math.min(n - this.pos, i - o);
@@ -2998,10 +3004,10 @@ class mr {
2998
3004
  return this.length += e.length, this.roundClean(), this;
2999
3005
  }
3000
3006
  digestInto(e) {
3001
- Pe(this), as(e, this), this.finished = !0;
3007
+ Ce(this), as(e, this), this.finished = !0;
3002
3008
  const { buffer: s, view: t, blockLen: n, isLE: i } = this;
3003
3009
  let { pos: o } = this;
3004
- s[o++] = 128, Ce(this.buffer.subarray(o)), this.padOffset > n - o && (this.process(t, 0), o = 0);
3010
+ s[o++] = 128, Ne(this.buffer.subarray(o)), this.padOffset > n - o && (this.process(t, 0), o = 0);
3005
3011
  for (let p = o; p < n; p++)
3006
3012
  s[p] = 0;
3007
3013
  t.setBigUint64(n - 8, BigInt(this.length * 8), i), this.process(t, 0);
@@ -3038,9 +3044,9 @@ const ye = /* @__PURE__ */ Uint32Array.from([
3038
3044
  2600822924,
3039
3045
  528734635,
3040
3046
  1541459225
3041
- ]), He = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ht = /* @__PURE__ */ BigInt(32);
3047
+ ]), Fe = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ht = /* @__PURE__ */ BigInt(32);
3042
3048
  function wr(r, e = !1) {
3043
- return e ? { h: Number(r & He), l: Number(r >> Ht & He) } : { h: Number(r >> Ht & He) | 0, l: Number(r & He) | 0 };
3049
+ return e ? { h: Number(r & Fe), l: Number(r >> Ht & Fe) } : { h: Number(r >> Ht & Fe) | 0, l: Number(r & Fe) | 0 };
3044
3050
  }
3045
3051
  function yr(r, e = !1) {
3046
3052
  const s = r.length;
@@ -3144,10 +3150,10 @@ class Ar extends mr {
3144
3150
  t = t + this.A | 0, n = n + this.B | 0, i = i + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, u = u + this.H | 0, this.set(t, n, i, o, a, c, l, u);
3145
3151
  }
3146
3152
  roundClean() {
3147
- Ce(be);
3153
+ Ne(be);
3148
3154
  }
3149
3155
  destroy() {
3150
- this.set(0, 0, 0, 0, 0, 0, 0, 0), Ce(this.buffer);
3156
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), Ne(this.buffer);
3151
3157
  }
3152
3158
  }
3153
3159
  class Tr extends Ar {
@@ -3180,13 +3186,13 @@ function ze(r, e = "") {
3180
3186
  }
3181
3187
  function us(r) {
3182
3188
  if (typeof r == "bigint") {
3183
- if (!qe(r))
3189
+ if (!Ke(r))
3184
3190
  throw new Error("positive bigint expected, got " + r);
3185
3191
  } else
3186
3192
  we(r);
3187
3193
  return r;
3188
3194
  }
3189
- function Fe(r) {
3195
+ function Ge(r) {
3190
3196
  const e = us(r).toString(16);
3191
3197
  return e.length & 1 ? "0" + e : e;
3192
3198
  }
@@ -3196,10 +3202,10 @@ function hs(r) {
3196
3202
  return r === "" ? gt : BigInt("0x" + r);
3197
3203
  }
3198
3204
  function Je(r) {
3199
- return hs(Be(r));
3205
+ return hs(Ue(r));
3200
3206
  }
3201
3207
  function ps(r) {
3202
- return hs(Be(kr(q(r)).reverse()));
3208
+ return hs(Ue(kr(q(r)).reverse()));
3203
3209
  }
3204
3210
  function mt(r, e) {
3205
3211
  we(e), r = us(r);
@@ -3214,9 +3220,9 @@ function fs(r, e) {
3214
3220
  function kr(r) {
3215
3221
  return Uint8Array.from(r);
3216
3222
  }
3217
- const qe = (r) => typeof r == "bigint" && gt <= r;
3223
+ const Ke = (r) => typeof r == "bigint" && gt <= r;
3218
3224
  function Or(r, e, s) {
3219
- return qe(r) && qe(e) && qe(s) && e <= r && r < s;
3225
+ return Ke(r) && Ke(e) && Ke(s) && e <= r && r < s;
3220
3226
  }
3221
3227
  function Pr(r, e, s, t) {
3222
3228
  if (!Or(e, s, t))
@@ -3555,7 +3561,7 @@ function qr(r, e, s = !1) {
3555
3561
  return s ? fs(a, n) : mt(a, n);
3556
3562
  }
3557
3563
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3558
- const Ne = /* @__PURE__ */ BigInt(0), Re = /* @__PURE__ */ BigInt(1);
3564
+ const Le = /* @__PURE__ */ BigInt(0), Re = /* @__PURE__ */ BigInt(1);
3559
3565
  function je(r, e) {
3560
3566
  const s = e.negate();
3561
3567
  return r ? s : e;
@@ -3585,7 +3591,7 @@ function it(r) {
3585
3591
  return As.get(r) || 1;
3586
3592
  }
3587
3593
  function Vt(r) {
3588
- if (r !== Ne)
3594
+ if (r !== Le)
3589
3595
  throw new Error("invalid wNAF");
3590
3596
  }
3591
3597
  class Kr {
@@ -3600,7 +3606,7 @@ class Kr {
3600
3606
  // non-const time multiplication ladder
3601
3607
  _unsafeLadder(e, s, t = this.ZERO) {
3602
3608
  let n = e;
3603
- for (; s > Ne; )
3609
+ for (; s > Le; )
3604
3610
  s & Re && (t = t.add(n)), n = n.double(), s >>= Re;
3605
3611
  return t;
3606
3612
  }
@@ -3651,7 +3657,7 @@ class Kr {
3651
3657
  */
3652
3658
  wNAFUnsafe(e, s, t, n = this.ZERO) {
3653
3659
  const i = rt(e, this.bits);
3654
- for (let o = 0; o < i.windows && t !== Ne; o++) {
3660
+ for (let o = 0; o < i.windows && t !== Le; o++) {
3655
3661
  const { nextN: a, offset: c, isZero: l, isNeg: u } = Kt(t, o, i);
3656
3662
  if (t = a, !l) {
3657
3663
  const p = s[c];
@@ -3684,7 +3690,7 @@ class Kr {
3684
3690
  }
3685
3691
  function Vr(r, e, s, t) {
3686
3692
  let n = e, i = r.ZERO, o = r.ZERO;
3687
- for (; s > Ne || t > Ne; )
3693
+ for (; s > Le || t > Le; )
3688
3694
  s & Re && (i = i.add(n)), t & Re && (o = o.add(n)), n = n.double(), s >>= Re, t >>= Re;
3689
3695
  return { p1: i, p2: o };
3690
3696
  }
@@ -3701,7 +3707,7 @@ function zr(r, e, s = {}, t) {
3701
3707
  throw new Error(`expected valid ${r} CURVE object`);
3702
3708
  for (const c of ["p", "n", "h"]) {
3703
3709
  const l = e[c];
3704
- if (!(typeof l == "bigint" && l > Ne))
3710
+ if (!(typeof l == "bigint" && l > Le))
3705
3711
  throw new Error(`CURVE.${c} must be positive bigint`);
3706
3712
  }
3707
3713
  const n = zt(e.p, s.Fp, t), i = zt(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
@@ -3734,13 +3740,13 @@ class Ts {
3734
3740
  this.iHash.update(n), this.oHash = e.create();
3735
3741
  for (let i = 0; i < n.length; i++)
3736
3742
  n[i] ^= 106;
3737
- this.oHash.update(n), Ce(n);
3743
+ this.oHash.update(n), Ne(n);
3738
3744
  }
3739
3745
  update(e) {
3740
- return Pe(this), this.iHash.update(e), this;
3746
+ return Ce(this), this.iHash.update(e), this;
3741
3747
  }
3742
3748
  digestInto(e) {
3743
- Pe(this), q(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
3749
+ Ce(this), q(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
3744
3750
  }
3745
3751
  digest() {
3746
3752
  const e = new Uint8Array(this.oHash.outputLen);
@@ -3767,7 +3773,7 @@ function Yr(r, e, s) {
3767
3773
  let l = r - a * t - c * i, u = -a * n - c * o;
3768
3774
  const p = l < ge, _ = u < ge;
3769
3775
  p && (l = -l), _ && (u = -u);
3770
- const f = wt(Math.ceil(Cr(s) / 2)) + Oe;
3776
+ const f = wt(Math.ceil(Cr(s) / 2)) + Pe;
3771
3777
  if (l < ge || l >= f || u < ge || u >= f)
3772
3778
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
3773
3779
  return { k1neg: p, k1: l, k2neg: _, k2: u };
@@ -3799,11 +3805,11 @@ const Se = {
3799
3805
  throw new s("tlv.encode: wrong tag");
3800
3806
  if (e.length & 1)
3801
3807
  throw new s("tlv.encode: unpadded data");
3802
- const t = e.length / 2, n = Fe(t);
3808
+ const t = e.length / 2, n = Ge(t);
3803
3809
  if (n.length / 2 & 128)
3804
3810
  throw new s("tlv.encode: long form length too big");
3805
- const i = t > 127 ? Fe(n.length / 2 | 128) : "";
3806
- return Fe(r) + i + n + e;
3811
+ const i = t > 127 ? Ge(n.length / 2 | 128) : "";
3812
+ return Ge(r) + i + n + e;
3807
3813
  },
3808
3814
  // v - value, l - left bytes (unparsed)
3809
3815
  decode(r, e) {
@@ -3848,7 +3854,7 @@ const Se = {
3848
3854
  const { Err: e } = Se;
3849
3855
  if (r < ge)
3850
3856
  throw new e("integer: negative integers are not allowed");
3851
- let s = Fe(r);
3857
+ let s = Ge(r);
3852
3858
  if (Number.parseInt(s[0], 16) & 8 && (s = "00" + s), s.length & 1)
3853
3859
  throw new e("unexpected DER parsing assertion: unpadded hex");
3854
3860
  return s;
@@ -3875,7 +3881,7 @@ const Se = {
3875
3881
  const { _tlv: e, _int: s } = Se, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), i = t + n;
3876
3882
  return e.encode(48, i);
3877
3883
  }
3878
- }, ge = BigInt(0), Oe = BigInt(1), ks = BigInt(2), Ge = BigInt(3), Jr = BigInt(4);
3884
+ }, ge = BigInt(0), Pe = BigInt(1), ks = BigInt(2), We = BigInt(3), Jr = BigInt(4);
3879
3885
  function Zr(r, e = {}) {
3880
3886
  const s = zr("weierstrass", r, e), { Fp: t, Fn: n } = s;
3881
3887
  let i = s.CURVE;
@@ -3942,7 +3948,7 @@ function Zr(r, e = {}) {
3942
3948
  }
3943
3949
  if (!y(i.Gx, i.Gy))
3944
3950
  throw new Error("bad curve params: generator point");
3945
- const I = t.mul(t.pow(i.a, Ge), Jr), P = t.mul(t.sqr(i.b), BigInt(27));
3951
+ const I = t.mul(t.pow(i.a, We), Jr), P = t.mul(t.sqr(i.b), BigInt(27));
3946
3952
  if (t.is0(t.add(I, P)))
3947
3953
  throw new Error("bad curve params: a or b");
3948
3954
  function H(T, x, m = !1) {
@@ -4029,7 +4035,7 @@ function Zr(r, e = {}) {
4029
4035
  * @returns
4030
4036
  */
4031
4037
  precompute(x = 8, m = !0) {
4032
- return v.createCache(this, x), m || this.multiply(Ge), this;
4038
+ return v.createCache(this, x), m || this.multiply(We), this;
4033
4039
  }
4034
4040
  // TODO: return `this`
4035
4041
  /** A point on curve is valid if it conforms to equation. */
@@ -4057,7 +4063,7 @@ function Zr(r, e = {}) {
4057
4063
  // https://eprint.iacr.org/2015/1060, algorithm 3
4058
4064
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
4059
4065
  double() {
4060
- const { a: x, b: m } = i, b = t.mul(m, Ge), { X: A, Y: N, Z: C } = this;
4066
+ const { a: x, b: m } = i, b = t.mul(m, We), { X: A, Y: N, Z: C } = this;
4061
4067
  let M = t.ZERO, O = t.ZERO, $ = t.ZERO, F = t.mul(A, A), Y = t.mul(N, N), W = t.mul(C, C), B = t.mul(A, N);
4062
4068
  return B = t.add(B, B), $ = t.mul(A, C), $ = t.add($, $), M = t.mul(x, $), O = t.mul(b, W), O = t.add(M, O), M = t.sub(Y, O), O = t.add(Y, O), O = t.mul(M, O), M = t.mul(B, M), $ = t.mul(b, $), W = t.mul(x, W), B = t.sub(F, W), B = t.mul(x, B), B = t.add(B, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, W), F = t.mul(F, B), O = t.add(O, F), W = t.mul(N, C), W = t.add(W, W), F = t.mul(W, B), M = t.sub(M, F), $ = t.mul(W, Y), $ = t.add($, $), $ = t.add($, $), new E(M, O, $);
4063
4069
  }
@@ -4069,7 +4075,7 @@ function Zr(r, e = {}) {
4069
4075
  D(x);
4070
4076
  const { X: m, Y: b, Z: A } = this, { X: N, Y: C, Z: M } = x;
4071
4077
  let O = t.ZERO, $ = t.ZERO, F = t.ZERO;
4072
- const Y = i.a, W = t.mul(i.b, Ge);
4078
+ const Y = i.a, W = t.mul(i.b, We);
4073
4079
  let B = t.mul(m, N), X = t.mul(b, C), Q = t.mul(A, M), oe = t.add(m, b), V = t.add(N, C);
4074
4080
  oe = t.mul(oe, V), V = t.add(B, X), oe = t.sub(oe, V), V = t.add(m, A);
4075
4081
  let ee = t.add(N, M);
@@ -4116,7 +4122,7 @@ function Zr(r, e = {}) {
4116
4122
  throw new Error("invalid scalar: out of range");
4117
4123
  if (x === ge || b.is0())
4118
4124
  return E.ZERO;
4119
- if (x === Oe)
4125
+ if (x === Pe)
4120
4126
  return b;
4121
4127
  if (v.hasCache(this))
4122
4128
  return this.multiply(x);
@@ -4139,11 +4145,11 @@ function Zr(r, e = {}) {
4139
4145
  */
4140
4146
  isTorsionFree() {
4141
4147
  const { isTorsionFree: x } = e;
4142
- return o === Oe ? !0 : x ? x(E, this) : v.unsafe(this, a).is0();
4148
+ return o === Pe ? !0 : x ? x(E, this) : v.unsafe(this, a).is0();
4143
4149
  }
4144
4150
  clearCofactor() {
4145
4151
  const { clearCofactor: x } = e;
4146
- return o === Oe ? this : x ? x(E, this) : this.multiplyUnsafe(o);
4152
+ return o === Pe ? this : x ? x(E, this) : this.multiplyUnsafe(o);
4147
4153
  }
4148
4154
  isSmallOrder() {
4149
4155
  return this.multiplyUnsafe(o).is0();
@@ -4152,7 +4158,7 @@ function Zr(r, e = {}) {
4152
4158
  return ze(x, "isCompressed"), this.assertValidity(), f(E, this, x);
4153
4159
  }
4154
4160
  toHex(x = !0) {
4155
- return Be(this.toBytes(x));
4161
+ return Ue(this.toBytes(x));
4156
4162
  }
4157
4163
  toString() {
4158
4164
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
@@ -4242,7 +4248,7 @@ function en(r, e, s = {}) {
4242
4248
  extraEntropy: !1
4243
4249
  }, S = a * ks < i.ORDER;
4244
4250
  function y(x) {
4245
- const m = a >> Oe;
4251
+ const m = a >> Pe;
4246
4252
  return x > m;
4247
4253
  }
4248
4254
  function I(x, m) {
@@ -4314,7 +4320,7 @@ function en(r, e, s = {}) {
4314
4320
  return m === "recovered" ? (P(), ve(Uint8Array.of(this.assertRecovery()), N, C)) : ve(N, C);
4315
4321
  }
4316
4322
  toHex(m) {
4317
- return Be(this.toBytes(m));
4323
+ return Ue(this.toBytes(m));
4318
4324
  }
4319
4325
  }
4320
4326
  const K = s.bits2int || function(m) {
@@ -4353,7 +4359,7 @@ function en(r, e, s = {}) {
4353
4359
  const ee = o.create(Q * o.create(Y + V * O));
4354
4360
  if (ee === ge)
4355
4361
  return;
4356
- let It = (oe.x === V ? 0 : 2) | Number(oe.y & Oe), At = ee;
4362
+ let It = (oe.x === V ? 0 : 2) | Number(oe.y & Pe), At = ee;
4357
4363
  return A && y(ee) && (At = o.neg(ee), It ^= 1), new D(V, At, S ? void 0 : It);
4358
4364
  }
4359
4365
  return { seed: F, k2sig: W };
@@ -4422,12 +4428,12 @@ function sn(r) {
4422
4428
  const ft = Ze(St.p, { sqrt: sn }), rn = /* @__PURE__ */ Zr(St, {
4423
4429
  Fp: ft,
4424
4430
  endo: tn
4425
- }), nn = /* @__PURE__ */ en(rn, Rr), on = BigInt(0), De = BigInt(1), an = BigInt(2), cn = BigInt(7), ln = BigInt(256), dn = BigInt(113), Cs = [], Ns = [], Ls = [];
4426
- for (let r = 0, e = De, s = 1, t = 0; r < 24; r++) {
4431
+ }), nn = /* @__PURE__ */ en(rn, Rr), on = BigInt(0), Me = BigInt(1), an = BigInt(2), cn = BigInt(7), ln = BigInt(256), dn = BigInt(113), Cs = [], Ns = [], Ls = [];
4432
+ for (let r = 0, e = Me, s = 1, t = 0; r < 24; r++) {
4427
4433
  [s, t] = [t, (2 * s + 3 * t) % 5], Cs.push(2 * (5 * t + s)), Ns.push((r + 1) * (r + 2) / 2 % 64);
4428
4434
  let n = on;
4429
4435
  for (let i = 0; i < 7; i++)
4430
- e = (e << De ^ (e >> cn) * dn) % ln, e & an && (n ^= De << (De << BigInt(i)) - De);
4436
+ e = (e << Me ^ (e >> cn) * dn) % ln, e & an && (n ^= Me << (Me << BigInt(i)) - Me);
4431
4437
  Ls.push(n);
4432
4438
  }
4433
4439
  const Ds = yr(Ls, !0), un = Ds[0], hn = Ds[1], Xt = (r, e, s) => s > 32 ? vr(r, e, s) : br(r, e, s), Jt = (r, e, s) => s > 32 ? Er(r, e, s) : Sr(r, e, s);
@@ -4454,7 +4460,7 @@ function pn(r, e = 24) {
4454
4460
  }
4455
4461
  r[0] ^= un[t], r[1] ^= hn[t];
4456
4462
  }
4457
- Ce(s);
4463
+ Ne(s);
4458
4464
  }
4459
4465
  class vt {
4460
4466
  // NOTE: we accept arguments in bytes instead of bits here.
@@ -4481,7 +4487,7 @@ class vt {
4481
4487
  Bt(this.state32), pn(this.state32, this.rounds), Bt(this.state32), this.posOut = 0, this.pos = 0;
4482
4488
  }
4483
4489
  update(e) {
4484
- Pe(this), q(e);
4490
+ Ce(this), q(e);
4485
4491
  const { blockLen: s, state: t } = this, n = e.length;
4486
4492
  for (let i = 0; i < n; ) {
4487
4493
  const o = Math.min(s - this.pos, n - i);
@@ -4499,7 +4505,7 @@ class vt {
4499
4505
  e[t] ^= s, s & 128 && t === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
4500
4506
  }
4501
4507
  writeInto(e) {
4502
- Pe(this, !1), q(e), this.finish();
4508
+ Ce(this, !1), q(e), this.finish();
4503
4509
  const s = this.state, { blockLen: t } = this;
4504
4510
  for (let n = 0, i = e.length; n < i; ) {
4505
4511
  this.posOut >= t && this.keccak();
@@ -4525,7 +4531,7 @@ class vt {
4525
4531
  return this.digestInto(new Uint8Array(this.outputLen));
4526
4532
  }
4527
4533
  destroy() {
4528
- this.destroyed = !0, Ce(this.state);
4534
+ this.destroyed = !0, Ne(this.state);
4529
4535
  }
4530
4536
  _cloneInto(e) {
4531
4537
  const { blockLen: s, suffix: t, outputLen: n, rounds: i, enableXOF: o } = this;
@@ -4604,7 +4610,7 @@ ${t.length}`
4604
4610
  Qt(l),
4605
4611
  Qt(u)
4606
4612
  ).addRecoveryBit(_).recoverPublicKey(o).toBytes(!1).slice(1), y = Zt(S);
4607
- return "0x" + Be(y.slice(12));
4613
+ return "0x" + Ue(y.slice(12));
4608
4614
  }
4609
4615
  }
4610
4616
  function gn(r) {
@@ -4815,7 +4821,7 @@ class Ie {
4815
4821
  });
4816
4822
  }
4817
4823
  }
4818
- const Me = "crossx_wallet_data", ke = "crossx_mock_pin_hash";
4824
+ const $e = "crossx_wallet_data", ke = "crossx_mock_pin_hash";
4819
4825
  class Sn {
4820
4826
  constructor(e, s) {
4821
4827
  this.storage = e, this.pinStore = s ?? null;
@@ -4829,13 +4835,13 @@ class Sn {
4829
4835
  async checkWallet() {
4830
4836
  if (this.migrateScenario !== void 0)
4831
4837
  return d.log("[Mock] checkWallet → migration_required"), "migration_required";
4832
- const s = await this.storage.get(Me) ? "exists" : "not_found";
4838
+ const s = await this.storage.get($e) ? "exists" : "not_found";
4833
4839
  return d.log(`[Mock] checkWallet → ${s}`), s;
4834
4840
  }
4835
4841
  async getOrCreateWallet(e) {
4836
4842
  var s;
4837
4843
  try {
4838
- const t = await this.storage.get(Me);
4844
+ const t = await this.storage.get($e);
4839
4845
  if (t) return t;
4840
4846
  const n = {
4841
4847
  id: e,
@@ -4843,7 +4849,7 @@ class Sn {
4843
4849
  derivationPath: "m/44'/60'/0'/0/0",
4844
4850
  createdAt: Date.now()
4845
4851
  };
4846
- await this.storage.set(Me, n);
4852
+ await this.storage.set($e, n);
4847
4853
  const i = (s = this.pinStore) == null ? void 0 : s.get();
4848
4854
  return i && (await this.storage.set(ke, i), d.log("[Mock] 지갑 생성 — PIN 저장됨")), n;
4849
4855
  } catch (t) {
@@ -4852,7 +4858,7 @@ class Sn {
4852
4858
  }
4853
4859
  /** GET /mnemonic/addresses 모킹 — PIN 불필요, 캐시된 주소 반환 */
4854
4860
  async getAddresses(e) {
4855
- const s = await this.storage.get(Me);
4861
+ const s = await this.storage.get($e);
4856
4862
  return s ? [{ address: s.address, index: 0 }] : [];
4857
4863
  }
4858
4864
  async getAddress(e, s) {
@@ -4932,7 +4938,7 @@ class Sn {
4932
4938
  derivationPath: "m/44'/60'/0'/0/0",
4933
4939
  createdAt: Date.now()
4934
4940
  };
4935
- await this.storage.set(Me, t);
4941
+ await this.storage.set($e, t);
4936
4942
  const n = (i = this.pinStore) == null ? void 0 : i.get();
4937
4943
  return n && (await this.storage.set(ke, n), d.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
4938
4944
  }
@@ -5418,7 +5424,7 @@ class Ae {
5418
5424
  }
5419
5425
  }
5420
5426
  }
5421
- class $e {
5427
+ class Be {
5422
5428
  constructor(e, s) {
5423
5429
  this.cache = /* @__PURE__ */ new Map(), this.loadedAt = 0, this.usingFallback = !1, this.adapterConfig = e, this.projectId = e.projectId, this.transport = s;
5424
5430
  }
@@ -5436,7 +5442,7 @@ class $e {
5436
5442
  const s = e.data.chains;
5437
5443
  return this.populateCache(s, !1), s;
5438
5444
  } catch {
5439
- const e = $e.fallbackChains();
5445
+ const e = Be.fallbackChains();
5440
5446
  return this.populateCache(e, !0), e;
5441
5447
  }
5442
5448
  }
@@ -5472,13 +5478,13 @@ class $e {
5472
5478
  if (e.code < 0) {
5473
5479
  const s = typeof e.data == "string" ? e.data : e.message ?? "체인 레지스트리 요청에 실패했습니다";
5474
5480
  throw new g(
5475
- $e.mapErrorCode(e.code),
5481
+ Be.mapErrorCode(e.code),
5476
5482
  s
5477
5483
  );
5478
5484
  }
5479
5485
  }
5480
5486
  fallbackOrThrow(e) {
5481
- const s = $e.fallbackChains().find(
5487
+ const s = Be.fallbackChains().find(
5482
5488
  (t) => t.chainId === e
5483
5489
  );
5484
5490
  if (s) return s;
@@ -7455,7 +7461,7 @@ function de(r) {
7455
7461
  }, { passive: !1 }), document.body.appendChild(r);
7456
7462
  }
7457
7463
  const In = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
7458
- function We() {
7464
+ function qe() {
7459
7465
  if (In()) {
7460
7466
  const e = window.scrollY;
7461
7467
  return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
@@ -8352,7 +8358,7 @@ class ri {
8352
8358
  return new Promise((n) => {
8353
8359
  var S;
8354
8360
  le();
8355
- const i = [...e], o = Gn(i, this.tokens, t), a = We();
8361
+ const i = [...e], o = Gn(i, this.tokens, t), a = qe();
8356
8362
  de(o);
8357
8363
  let c = !1;
8358
8364
  const l = () => {
@@ -8433,7 +8439,7 @@ class ri {
8433
8439
  accountLabel: (t == null ? void 0 : t.sessionAlert_accountLabel) ?? "Account",
8434
8440
  signOutLabel: (t == null ? void 0 : t.sessionAlert_signOutButton) ?? "Sign out",
8435
8441
  signInAgainLabel: (t == null ? void 0 : t.sessionAlert_signInAgainButton) ?? "Sign in again"
8436
- }), i = We();
8442
+ }), i = qe();
8437
8443
  de(n);
8438
8444
  let o = !1;
8439
8445
  const a = () => {
@@ -8502,7 +8508,7 @@ class ri {
8502
8508
  }, o = {
8503
8509
  title: (t == null ? void 0 : t.pinSetup_confirmTitle) ?? "Confirm PIN",
8504
8510
  headerSubtitle: (t == null ? void 0 : t.pinSetup_confirmSubtitle) ?? "Enter your PIN again to confirm."
8505
- }, a = rs(this.tokens, Jn(n)), c = We();
8511
+ }, a = rs(this.tokens, Jn(n)), c = qe();
8506
8512
  de(a);
8507
8513
  let l = !1;
8508
8514
  const u = () => {
@@ -8599,7 +8605,7 @@ class ri {
8599
8605
  attemptCount: e == null ? void 0 : e.attemptCount,
8600
8606
  maxAttempts: e == null ? void 0 : e.maxAttempts
8601
8607
  })
8602
- ), l = We();
8608
+ ), l = qe();
8603
8609
  de(c);
8604
8610
  let u = !1;
8605
8611
  const p = () => {
@@ -8782,7 +8788,7 @@ class ni {
8782
8788
  }
8783
8789
  function hi(r, e) {
8784
8790
  r.debug;
8785
- const s = Ke.production, t = {
8791
+ const s = Oe.production, t = {
8786
8792
  ...r,
8787
8793
  oauthServiceUrl: s.oauthServiceUrl,
8788
8794
  authApiUrl: s.authApiUrl,
@@ -8805,7 +8811,7 @@ function hi(r, e) {
8805
8811
  u,
8806
8812
  p
8807
8813
  ));
8808
- const f = new $e(n, c), w = new ri(r.theme ?? "light", r.themeTokens), S = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w, y = new ut(
8814
+ const f = new Be(n, c), w = new ri(r.theme ?? "light", r.themeTokens), S = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w, y = new ut(
8809
8815
  t,
8810
8816
  n,
8811
8817
  o,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cross/crossx-sdk-core",
3
- "version": "1.4.1",
3
+ "version": "1.4.2-beta.1",
4
4
  "description": "CROSSx Core SDK - Vanilla JavaScript Embedded Wallet SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",