@nexus-cross/crossx-sdk-core 3.0.0-beta.4 → 3.0.0-beta.6

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.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./factory-CN3vWWe6.cjs");function s(r){const t=i(r),a=S(t),o=JSON.parse(a);l(o);const{data:n}=o;return{status:o.status,state:o.state,firebaseToken:n.accessToken,provider:n.provider,email:n.email,providerSub:n.sub,tokenType:n.tokenType,expiresIn:n.expiresIn,raw:o}}function i(r){if(r.includes("://")&&r.includes("?")){const t=new URL(r),a=t.searchParams.get("crossx_oauth_result");if(a)return a;const o=t.searchParams.get("data");if(o)return o;throw new Error("Deeplink URL에 crossx_oauth_result 또는 data 파라미터가 없습니다")}return r}function S(r){if(r.startsWith("{"))return r;if(r.startsWith("%7B")||r.startsWith("%7b"))return decodeURIComponent(r);const t=E(r);return decodeURIComponent(t)}function E(r){if(typeof atob=="function")return atob(r);if(typeof Buffer<"u")return Buffer.from(r,"base64").toString("utf-8");throw new Error("Base64 디코딩을 지원하는 환경이 아닙니다")}function l(r){if(typeof r!="object"||r===null)throw new Error("Deeplink payload가 유효한 객체가 아닙니다");const t=r;if(typeof t.status!="string")throw new Error("Deeplink payload에 status 필드가 없습니다");if(typeof t.state!="string")throw new Error("Deeplink payload에 state 필드가 없습니다");if(typeof t.data!="object"||t.data===null)throw new Error("Deeplink payload에 data 필드가 없습니다");const a=t.data;if(typeof a.provider!="string")throw new Error("Deeplink data에 provider 필드가 없습니다");if(typeof a.accessToken!="string")throw new Error("Deeplink data에 accessToken 필드가 없습니다")}exports.CONNECT_OTHER_WALLET_DISPLAY_ORDER=e.CONNECT_OTHER_WALLET_DISPLAY_ORDER;exports.CROSSxError=e.CROSSxError;exports.CROSSxEthereumProvider=e.CROSSxEthereumProvider;exports.CROSSxSDK=e.CROSSxSDK;exports.ChainId=e.ChainId;exports.ConnectOtherWalletItem=e.ConnectOtherWalletItem;exports.ErrorCode=e.ErrorCode;exports.MESSAGES_EN=e.MESSAGES_EN;exports.MESSAGES_KO=e.MESSAGES_KO;exports.MNEMONIC_ADDRESS_LIMIT=e.MNEMONIC_ADDRESS_LIMIT;exports.ONEpocketError=e.CROSSxError;exports.ONEpocketEthereumProvider=e.CROSSxEthereumProvider;exports.ONEpocketSDK=e.CROSSxSDK;exports.PinMemoryStore=e.PinMemoryStore;exports.TokenMemoryStore=e.TokenMemoryStore;exports.WALLET_BRAND_NAME=e.WALLET_BRAND_NAME;exports.WEI_DISPLAY_DECIMALS=e.WEI_DISPLAY_DECIMALS;exports.createCROSSxSDK=e.createCROSSxSDK;exports.createONEpocketSDK=e.createONEpocketSDK;exports.getConnectOtherWalletLabel=e.getConnectOtherWalletLabel;exports.getWalletBrowserInfo=e.getWalletBrowserInfo;exports.isWalletInAppBrowser=e.isWalletInAppBrowser;exports.waitForWalletBrowser=e.waitForWalletBrowser;exports.parseOAuthDeeplink=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./factory-CzWM8S8d.cjs");function s(r){const t=i(r),a=S(t),o=JSON.parse(a);l(o);const{data:n}=o;return{status:o.status,state:o.state,firebaseToken:n.accessToken,provider:n.provider,email:n.email,providerSub:n.sub,tokenType:n.tokenType,expiresIn:n.expiresIn,raw:o}}function i(r){if(r.includes("://")&&r.includes("?")){const t=new URL(r),a=t.searchParams.get("crossx_oauth_result");if(a)return a;const o=t.searchParams.get("data");if(o)return o;throw new Error("Deeplink URL에 crossx_oauth_result 또는 data 파라미터가 없습니다")}return r}function S(r){if(r.startsWith("{"))return r;if(r.startsWith("%7B")||r.startsWith("%7b"))return decodeURIComponent(r);const t=E(r);return decodeURIComponent(t)}function E(r){if(typeof atob=="function")return atob(r);if(typeof Buffer<"u")return Buffer.from(r,"base64").toString("utf-8");throw new Error("Base64 디코딩을 지원하는 환경이 아닙니다")}function l(r){if(typeof r!="object"||r===null)throw new Error("Deeplink payload가 유효한 객체가 아닙니다");const t=r;if(typeof t.status!="string")throw new Error("Deeplink payload에 status 필드가 없습니다");if(typeof t.state!="string")throw new Error("Deeplink payload에 state 필드가 없습니다");if(typeof t.data!="object"||t.data===null)throw new Error("Deeplink payload에 data 필드가 없습니다");const a=t.data;if(typeof a.provider!="string")throw new Error("Deeplink data에 provider 필드가 없습니다");if(typeof a.accessToken!="string")throw new Error("Deeplink data에 accessToken 필드가 없습니다")}exports.CONNECT_OTHER_WALLET_DISPLAY_ORDER=e.CONNECT_OTHER_WALLET_DISPLAY_ORDER;exports.CROSSxError=e.CROSSxError;exports.CROSSxEthereumProvider=e.CROSSxEthereumProvider;exports.CROSSxSDK=e.CROSSxSDK;exports.ChainId=e.ChainId;exports.ConnectOtherWalletItem=e.ConnectOtherWalletItem;exports.ErrorCode=e.ErrorCode;exports.MESSAGES_EN=e.MESSAGES_EN;exports.MESSAGES_KO=e.MESSAGES_KO;exports.MNEMONIC_ADDRESS_LIMIT=e.MNEMONIC_ADDRESS_LIMIT;exports.ONEpocketError=e.CROSSxError;exports.ONEpocketEthereumProvider=e.CROSSxEthereumProvider;exports.ONEpocketSDK=e.CROSSxSDK;exports.PinMemoryStore=e.PinMemoryStore;exports.TokenMemoryStore=e.TokenMemoryStore;exports.WALLET_BRAND_NAME=e.WALLET_BRAND_NAME;exports.WEI_DISPLAY_DECIMALS=e.WEI_DISPLAY_DECIMALS;exports.createCROSSxSDK=e.createCROSSxSDK;exports.createONEpocketSDK=e.createONEpocketSDK;exports.getConnectOtherWalletLabel=e.getConnectOtherWalletLabel;exports.getWalletBrowserInfo=e.getWalletBrowserInfo;exports.isWalletInAppBrowser=e.isWalletInAppBrowser;exports.waitForWalletBrowser=e.waitForWalletBrowser;exports.parseOAuthDeeplink=s;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as u, a as d, b as E, d as S, e as h, f as w, E as D, M as k, h as O, i as m, a as y, b as _, d as C, P as I, T as b, W as R, j as T, k as x, l as A, m as N, n as W, o as L, w as P } from "./factory-ZntNsUG6.js";
1
+ import { C as u, a as d, b as E, d as S, e as h, f as w, E as D, M as k, h as O, i as m, a as y, b as _, d as C, P as I, T as b, W as R, j as T, k as x, l as A, m as N, n as W, o as L, w as P } from "./factory-Dq6PjlVu.js";
2
2
  function f(e) {
3
3
  const t = s(e), a = n(t), r = JSON.parse(a);
4
4
  c(r);
package/dist/internal.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./factory-CN3vWWe6.cjs");exports.DEFAULT_PIN_REUSE_TTL_MS=e.DEFAULT_PIN_REUSE_TTL_MS;exports.createCROSSxSDKWithOverrides=e.createCROSSxSDKWithOverrides;exports.getInternalContext=e.getInternalContext;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./factory-CzWM8S8d.cjs");exports.DEFAULT_PIN_REUSE_TTL_MS=e.DEFAULT_PIN_REUSE_TTL_MS;exports.createCROSSxSDKWithOverrides=e.createCROSSxSDKWithOverrides;exports.getInternalContext=e.getInternalContext;
package/dist/internal.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as r, c as a, g as S } from "./factory-ZntNsUG6.js";
1
+ import { D as r, c as a, g as S } from "./factory-Dq6PjlVu.js";
2
2
  export {
3
3
  r as DEFAULT_PIN_REUSE_TTL_MS,
4
4
  a as createCROSSxSDKWithOverrides,
@@ -325,6 +325,12 @@ export declare class CROSSxSDK extends TypedEventEmitter<SDKEventMap> {
325
325
  private restoreOneWalletSession;
326
326
  /** ONE ID 세션 → SDK 로그인 상태. 지갑이 있으면 주소를 싣고(PIN 불필요), 없으면 처음 쓸 때 만든다 */
327
327
  private applyOneIdSession;
328
+ /**
329
+ * one-wallet 로그인 · 복원 때 쓸 사용 지갑. 저장된 선호 지갑(`persistWalletPreference`)이 이 계정의 주소 목록에
330
+ * 있으면 그 지갑, 없거나 읽지 못하면 첫 지갑(index 0) — 2.x 와 같이 고른 지갑이 새로고침 · 재로그인 뒤에도 이어진다.
331
+ * 다른 계정으로 로그인하면 저장값이 목록에 없어 첫 지갑이 된다 (DEV2TF-2916).
332
+ */
333
+ private preferredOneWallet;
328
334
  private _oneIdSessions?;
329
335
  private oneIdContext;
330
336
  /** 초기화 중에도 쓰는 ONE ID 컨텍스트 (one-wallet 세션 복원) */
@@ -453,6 +459,19 @@ export declare class CROSSxSDK extends TypedEventEmitter<SDKEventMap> {
453
459
  index: number;
454
460
  name?: string;
455
461
  } | null>;
462
+ /**
463
+ * 지갑 목록에 있는 지갑으로 사용 지갑을 바꿉니다 (모달 없이). 서비스의 지갑 목록 화면에서 고른 지갑을 쓸 때 부릅니다.
464
+ * 바뀌면 `addressChanged` 이벤트가 나갑니다. 이미 사용 지갑이면 그대로 둡니다 (DEV2TF-2916).
465
+ *
466
+ * @param address 바꿀 지갑 주소 (대소문자 무시)
467
+ * @returns 바꾼 지갑 `{ address, index, name? }`
468
+ * @throws `WALLET_NOT_FOUND` 이 계정의 지갑 목록에 없는 주소
469
+ */
470
+ switchWallet(address: string): Promise<{
471
+ address: string;
472
+ index: number;
473
+ name?: string;
474
+ }>;
456
475
  /**
457
476
  * 지갑이 2개 이상이면 selectWallet()을 호출합니다.
458
477
  * selectWallet() 내부에서 this.address 설정 및 addressChanged 이벤트를 처리합니다.
@@ -8,6 +8,8 @@ export declare const ONEID_REFRESH_SKEW_MS: number;
8
8
  type SimpleStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
9
9
  /** ONE ID 세션이 끝났다는 오류인지 (`ONEID_SESSION_*`) */
10
10
  export declare function isOneIdSessionEnd(error: unknown): boolean;
11
+ /** 탭 사이 refresh 잠금 이름 — 같은 저장소를 쓰는 탭(보안 화면 iframe)들이 refresh 를 하나씩 보낸다 */
12
+ export declare const ONEID_REFRESH_LOCK = "crossx.oneid.refresh";
11
13
  export declare class OneIdSessionManager {
12
14
  private readonly port;
13
15
  private readonly config;
@@ -40,6 +42,11 @@ export declare class OneIdSessionManager {
40
42
  clear(): void;
41
43
  private read;
42
44
  private ensureFresh;
45
+ /**
46
+ * 잠금 안에서 저장소를 다시 읽는다. 기다리는 사이 다른 탭이 갱신했으면 그 토큰을 쓰고,
47
+ * 로그아웃했으면 null 이다. one-oauth 는 refresh token 을 돌려 쓰므로(rotation) 같은 값을 두 탭이 보내면
48
+ * 늦은 쪽이 세션 종료로 거부돼 두 탭 모두 로그아웃된다.
49
+ */
43
50
  private refresh;
44
51
  }
45
52
  /** 설정의 storage 값으로 브라우저 저장소를 고른다 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cross/crossx-sdk-core",
3
- "version": "3.0.0-beta.4",
3
+ "version": "3.0.0-beta.6",
4
4
  "description": "CROSSx Core SDK - Vanilla JavaScript Embedded Wallet SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",