@nexus-cross/crossx-sdk-core 2.3.3-beta.3 → 2.3.3

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
@@ -184,34 +184,34 @@ class Ct {
184
184
  };
185
185
  }
186
186
  }
187
- let Y = null;
187
+ let X = null;
188
188
  function Ge(i) {
189
- Y = i;
189
+ X = i;
190
190
  }
191
191
  const c = {
192
192
  /** 빌드 모드와 무관하게 항상 출력되는 정보성 로그 (SDK 수명주기 등) */
193
193
  info(...i) {
194
- if (Y) {
195
- Y.log(...i);
194
+ if (X) {
195
+ X.log(...i);
196
196
  return;
197
197
  }
198
198
  console.log(...i);
199
199
  },
200
200
  log(...i) {
201
- if (Y) {
202
- Y.log(...i);
201
+ if (X) {
202
+ X.log(...i);
203
203
  return;
204
204
  }
205
205
  },
206
206
  warn(...i) {
207
- if (Y) {
208
- Y.warn(...i);
207
+ if (X) {
208
+ X.warn(...i);
209
209
  return;
210
210
  }
211
211
  },
212
212
  error(...i) {
213
- if (Y) {
214
- Y.error(...i);
213
+ if (X) {
214
+ X.error(...i);
215
215
  return;
216
216
  }
217
217
  }
@@ -1183,7 +1183,7 @@ function Ft() {
1183
1183
  }
1184
1184
  return require("crypto").randomBytes(16).toString("hex");
1185
1185
  }
1186
- class X {
1186
+ class Y {
1187
1187
  constructor(e) {
1188
1188
  this.config = e, this.context = null;
1189
1189
  }
@@ -1220,7 +1220,7 @@ class X {
1220
1220
  * Initialize and activate bridge
1221
1221
  */
1222
1222
  async initialize() {
1223
- if (await X.waitForBridgeReady(5e3) || c.warn("[RNBridge] Bridge did not become ready in time"), this.bridge = X.getBridge(), !this.bridge)
1223
+ if (await Y.waitForBridgeReady(5e3) || c.warn("[RNBridge] Bridge did not become ready in time"), this.bridge = Y.getBridge(), !this.bridge)
1224
1224
  throw new h(
1225
1225
  d.AUTH_NOT_INITIALIZED,
1226
1226
  "RN Bridge not available in this environment"
@@ -1449,7 +1449,7 @@ function at() {
1449
1449
  }
1450
1450
  return pe.production;
1451
1451
  }
1452
- const Wt = 2e3, Ve = 6e4, Ut = 1e3, Ht = 1e4, Gt = "0x77359400", je = "0x3B9ACA00", Ye = 130, Me = 6, Xe = 18, Je = 3e4, Kt = 5 * 60 * 1e3, zt = 30 * 1e3, Ne = 100, qt = "crossx-sdk-js/2.3.3-beta.3";
1452
+ const Wt = 2e3, Ve = 6e4, Ut = 1e3, Ht = 1e4, Gt = "0x77359400", je = "0x3B9ACA00", Ye = 130, Me = 6, Xe = 18, Je = 3e4, Kt = 5 * 60 * 1e3, zt = 30 * 1e3, Ne = 100, qt = "crossx-sdk-js/2.3.3";
1453
1453
  function ct(i) {
1454
1454
  let e = i.length;
1455
1455
  for (; e > 0 && i.charCodeAt(e - 1) === 48; ) e--;
@@ -2536,7 +2536,7 @@ const oe = class oe extends Mt {
2536
2536
  }
2537
2537
  async _doInitialize(e) {
2538
2538
  var r, t;
2539
- c.log("[CROSSx SDK] v2.3.3-beta.3 초기화 중..."), this.confirmation.setMessages(J(this._config.locale));
2539
+ c.log("[CROSSx SDK] v2.3.3 초기화 중..."), this.confirmation.setMessages(J(this._config.locale));
2540
2540
  try {
2541
2541
  const s = at();
2542
2542
  this.internalConfig.oauthServiceUrl = s.oauthServiceUrl, this.internalConfig.authApiUrl = s.authApiUrl, this.internalConfig.walletGatewayUrl = s.walletGatewayUrl, this.adapterConfig.gatewayUrl = s.walletGatewayUrl, (t = (r = this.crypto).setJWKSEndpoint) == null || t.call(r, `${s.authApiUrl}/.well-known/jwks.json`);
@@ -2572,7 +2572,7 @@ const oe = class oe extends Mt {
2572
2572
  throw u;
2573
2573
  }
2574
2574
  }
2575
- return this.initialized = !0, c.info("[CROSSx SDK] v2.3.3-beta.3 초기화 완료"), this.emit("initialized", { restored: !!(l != null && l.success) }), l ?? null;
2575
+ return this.initialized = !0, c.info("[CROSSx SDK] v2.3.3 초기화 완료"), this.emit("initialized", { restored: !!(l != null && l.success) }), l ?? null;
2576
2576
  } catch (s) {
2577
2577
  throw new h(d.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", s);
2578
2578
  }
@@ -2587,13 +2587,20 @@ const oe = class oe extends Mt {
2587
2587
  * → 사용자가 signIn() 을 호출할 때 bridge 로그인을 시도한다.
2588
2588
  */
2589
2589
  async tryRNBridgeBootstrap() {
2590
- if (!X.isAvailable()) return null;
2590
+ if (!Y.isAvailable()) return null;
2591
2591
  try {
2592
- c.log("[CROSSx] RN Bridge 감지 — Handshake 시도");
2593
- const e = new X({
2592
+ c.log("[CROSSx] RN Bridge 감지 — Handshake 시도"), c.info("[CROSSx][RNBridge trace] Bootstrap config", {
2594
2593
  appId: this._config.projectId,
2595
2594
  appVersion: "1.0.0",
2596
- sdkVersion: "2.3.3-beta.3",
2595
+ sdkVersion: "2.3.3",
2596
+ keyId: "key-id-1",
2597
+ userIdHash: "user-hash-placeholder",
2598
+ projectId: this._config.projectId
2599
+ });
2600
+ const e = new Y({
2601
+ appId: this._config.projectId,
2602
+ appVersion: "1.0.0",
2603
+ sdkVersion: "2.3.3",
2597
2604
  keyId: "key-id-1",
2598
2605
  userIdHash: "user-hash-placeholder",
2599
2606
  projectId: this._config.projectId
@@ -2611,7 +2618,12 @@ const oe = class oe extends Mt {
2611
2618
  }
2612
2619
  return c.log("[CROSSx] RN Bridge 준비 완료 — 사용자 로그인 대기"), null;
2613
2620
  } catch (e) {
2614
- return c.warn("[CROSSx] RN Bridge handshake 실패", e), null;
2621
+ return c.info("[CROSSx][RNBridge trace] Bootstrap failed detail", {
2622
+ name: e instanceof Error ? e.name : typeof e,
2623
+ message: e instanceof Error ? e.message : String(e),
2624
+ stack: e instanceof Error ? e.stack : void 0,
2625
+ cause: e instanceof Error ? e.cause : void 0
2626
+ }), c.warn("[CROSSx] RN Bridge handshake 실패", e), null;
2615
2627
  }
2616
2628
  }
2617
2629
  /**
@@ -2687,7 +2699,7 @@ const oe = class oe extends Mt {
2687
2699
  * @internal
2688
2700
  */
2689
2701
  getRNBridge() {
2690
- return X.getBridge();
2702
+ return Y.getBridge();
2691
2703
  }
2692
2704
  async signIn(e) {
2693
2705
  if (this.ensureInitialized(), this.authenticated)
@@ -2842,7 +2854,7 @@ const oe = class oe extends Mt {
2842
2854
  this.ensureInitialized();
2843
2855
  try {
2844
2856
  await this.signOutUseCase.execute(), this.clearAuthState();
2845
- const e = X.getBridge();
2857
+ const e = Y.getBridge();
2846
2858
  if (e != null && e.signOut)
2847
2859
  try {
2848
2860
  await e.signOut(), c.log("[CROSSx] RN Bridge signOut 통보 완료 — native trust cache 무효화");
@@ -3225,43 +3237,54 @@ const oe = class oe extends Mt {
3225
3237
  return this.withSessionRecovery(() => this._signMessage(e, r, t));
3226
3238
  }
3227
3239
  async _signMessage(e, r, t) {
3240
+ const s = Y.getBridge();
3241
+ if (s != null && s.signMessage) {
3242
+ const n = await s.signMessage({
3243
+ chainId: e,
3244
+ message: r,
3245
+ from: this.address ?? "",
3246
+ index: (t == null ? void 0 : t.index) ?? 0,
3247
+ dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName
3248
+ });
3249
+ return { chainId: e, signature: n.signature, message: r, address: this.address ?? "" };
3250
+ }
3228
3251
  if (this.ensureAuthenticated(), !this.userId)
3229
3252
  throw new h(d.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
3230
- const s = await this.resolveAddress(t == null ? void 0 : t.index);
3253
+ const o = await this.resolveAddress(t == null ? void 0 : t.index);
3231
3254
  try {
3232
- const o = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
3255
+ const n = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
3233
3256
  confirmation: {
3234
3257
  type: "sign-message",
3235
3258
  chainId: e,
3236
- from: s.address,
3259
+ from: o.address,
3237
3260
  message: r,
3238
3261
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
3239
3262
  accountName: t == null ? void 0 : t.accountName
3240
3263
  },
3241
3264
  rejectedMessage: "User rejected the message signing request",
3242
3265
  prepareAction: "sign-message",
3243
- prepareContext: { message: r, from: s.address },
3244
- execute: (n) => this.walletProvider.signMessage(
3266
+ prepareContext: { message: r, from: o.address },
3267
+ execute: (a) => this.walletProvider.signMessage(
3245
3268
  this.userId,
3246
3269
  e,
3247
3270
  r,
3248
3271
  t == null ? void 0 : t.index,
3249
- n,
3250
- s.address
3272
+ a,
3273
+ o.address
3251
3274
  )
3252
3275
  });
3253
3276
  return this.signatureVerifier.verifySignatureSigner(
3254
3277
  r,
3255
- o.signature,
3256
- s.address
3278
+ n.signature,
3279
+ o.address
3257
3280
  ), {
3258
3281
  chainId: e,
3259
- signature: o.signature,
3282
+ signature: n.signature,
3260
3283
  message: r,
3261
- address: s.address
3284
+ address: o.address
3262
3285
  };
3263
- } catch (o) {
3264
- throw o instanceof h ? o : new h(d.SIGNATURE_FAILED, `메시지 서명에 실패했습니다 (${e})`, o);
3286
+ } catch (n) {
3287
+ throw n instanceof h ? n : new h(d.SIGNATURE_FAILED, `메시지 서명에 실패했습니다 (${e})`, n);
3265
3288
  }
3266
3289
  }
3267
3290
  /**
@@ -3526,7 +3549,7 @@ const oe = class oe extends Mt {
3526
3549
  async sendTransactionWithWaitForReceipt(e, r, t = {}) {
3527
3550
  var m, y;
3528
3551
  if (this._isAuthenticatedViaRNBridge) {
3529
- const S = X.getBridge();
3552
+ const S = Y.getBridge();
3530
3553
  if (S != null && S.sendTransactionWithWaitForReceipt)
3531
3554
  return this.bridgeSendTransactionWithWaitForReceipt(S, e, r, t);
3532
3555
  }
@@ -3873,7 +3896,7 @@ const oe = class oe extends Mt {
3873
3896
  * 보안: bridge.isActivated() 가 false 이거나 payload sanitize 실패 시 이벤트 무시.
3874
3897
  */
3875
3898
  subscribeBridgeWalletChanged() {
3876
- const e = X.getBridge();
3899
+ const e = Y.getBridge();
3877
3900
  if (!(e != null && e.onEvent)) {
3878
3901
  c.warn("[CROSSx] bridge.onEvent 미지원 — walletChanged 구독 불가");
3879
3902
  return;
@@ -3896,7 +3919,7 @@ const oe = class oe extends Mt {
3896
3919
  c.warn("[walletChanged] invalid source — 이벤트 무시", t);
3897
3920
  return;
3898
3921
  }
3899
- if (!this.authenticated) {
3922
+ if (!this.authenticated && !this._isAuthenticatedViaRNBridge) {
3900
3923
  c.warn("[walletChanged] not authenticated — 이벤트 무시", t);
3901
3924
  return;
3902
3925
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cross/crossx-sdk-core",
3
- "version": "2.3.3-beta.3",
3
+ "version": "2.3.3",
4
4
  "description": "CROSSx Core SDK - Vanilla JavaScript Embedded Wallet SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",