@nexus-cross/crossx-sdk-core 3.0.0-beta.2 → 3.0.0-beta.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.
@@ -16,7 +16,7 @@ class h extends Error {
16
16
  };
17
17
  }
18
18
  }
19
- const Ft = 2e3, Fe = 6e4, Bt = 1e3, Gt = 1e4, Kt = "0x77359400", Be = "0x3B9ACA00", Ge = 130, ut = 6, Ke = 18, He = 3e4, Ht = 300 * 1e3, Vt = 30 * 1e3, Ve = 100, $t = 300 * 1e3, $e = 60 * 1e3, le = "crossx-sdk-js/3.0.0-beta.2", Yt = "X-SDK-Version", qt = !1, jt = "x-sdk-deprecation", de = -10050, gt = "ONEpocket";
19
+ const Ft = 2e3, Fe = 6e4, Bt = 1e3, Gt = 1e4, Kt = "0x77359400", Be = "0x3B9ACA00", Ge = 130, ut = 6, Ke = 18, He = 3e4, Ht = 300 * 1e3, Vt = 30 * 1e3, Ve = 100, $t = 300 * 1e3, $e = 60 * 1e3, le = "crossx-sdk-js/3.0.0-beta.3", Yt = "X-SDK-Version", qt = !1, jt = "x-sdk-deprecation", de = -10050, gt = "ONEpocket";
20
20
  var Xt = /* @__PURE__ */ ((i) => (i.MetaMask = "io.metamask", i.Binance = "com.binance.wallet", i.CROSSx = "crossx", i))(Xt || {});
21
21
  const zt = {
22
22
  "io.metamask": "MetaMask",
@@ -297,6 +297,8 @@ const c = {
297
297
  login_selector_subtitle: "소셜 계정으로 간편하게 로그인하세요",
298
298
  login_selector_google: "Google로 로그인",
299
299
  login_selector_apple: "Apple로 로그인",
300
+ login_selector_oneid: "원아이디로 로그인",
301
+ login_selector_subtitle_oneid: "원아이디 계정으로 로그인하세요",
300
302
  login_selector_or: "또는",
301
303
  login_selector_terms_template: "계속 진행하면 NEXUS {tos}에 동의하고 {pp}에 동의하게 됩니다.",
302
304
  login_selector_terms_tos: "이용약관",
@@ -423,6 +425,8 @@ const c = {
423
425
  login_selector_subtitle: "Sign in instantly with your social account",
424
426
  login_selector_google: "Sign in with Google",
425
427
  login_selector_apple: "Sign in with Apple",
428
+ login_selector_oneid: "Sign in with ONE ID",
429
+ login_selector_subtitle_oneid: "Sign in with your ONE ID account",
426
430
  login_selector_or: "or",
427
431
  login_selector_terms_template: "By continuing, you agree to NEXUS {tos} and consent to its {pp}",
428
432
  login_selector_terms_tos: "Terms of Service",
@@ -3850,12 +3854,12 @@ const W = class W extends or {
3850
3854
  }
3851
3855
  async _doInitialize(e) {
3852
3856
  var t, s;
3853
- c.log("[CROSSx SDK] v3.0.0-beta.2 초기화 중..."), this.confirmation.setMessages(M(this._config.locale));
3857
+ c.log("[CROSSx SDK] v3.0.0-beta.3 초기화 중..."), this.confirmation.setMessages(M(this._config.locale));
3854
3858
  try {
3855
3859
  const r = ue();
3856
3860
  if (this.internalConfig.oauthServiceUrl = r.oauthServiceUrl, this.internalConfig.legacyOauthServiceUrl = r.legacyOauthServiceUrl, this.internalConfig.authApiUrl = r.authApiUrl, this.internalConfig.walletGatewayUrl = r.walletGatewayUrl, this.adapterConfig.gatewayUrl = r.walletGatewayUrl, (s = (t = this.crypto).setJWKSEndpoint) == null || s.call(t, `${r.authApiUrl}/.well-known/jwks.json`), this.usesOneWallet) {
3857
3861
  const g = await this.restoreOneWalletSession();
3858
- return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.2 초기화 완료 (one-wallet)"), this.emit("initialized", { restored: !!(g != null && g.success) }), g;
3862
+ return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.3 초기화 완료 (one-wallet)"), this.emit("initialized", { restored: !!(g != null && g.success) }), g;
3859
3863
  }
3860
3864
  const n = this._config.persistWalletPreference !== !1 ? await this.storage.get(
3861
3865
  W.WALLET_PREF_KEY
@@ -3889,7 +3893,7 @@ const W = class W extends or {
3889
3893
  throw _;
3890
3894
  }
3891
3895
  }
3892
- return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.2 초기화 완료"), this.emit("initialized", { restored: !!(d != null && d.success) }), d ?? null;
3896
+ return this.initialized = !0, c.info("[CROSSx SDK] v3.0.0-beta.3 초기화 완료"), this.emit("initialized", { restored: !!(d != null && d.success) }), d ?? null;
3893
3897
  } catch (r) {
3894
3898
  throw new h(o.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", r);
3895
3899
  }
@@ -3909,7 +3913,7 @@ const W = class W extends or {
3909
3913
  c.log("[CROSSx] RN Bridge 감지 — Handshake 시도"), c.info("[CROSSx][RNBridge trace] Bootstrap config", {
3910
3914
  appId: this._config.projectId,
3911
3915
  appVersion: "1.0.0",
3912
- sdkVersion: "3.0.0-beta.2",
3916
+ sdkVersion: "3.0.0-beta.3",
3913
3917
  keyId: "key-id-1",
3914
3918
  userIdHash: "user-hash-placeholder",
3915
3919
  projectId: this._config.projectId
@@ -3917,7 +3921,7 @@ const W = class W extends or {
3917
3921
  const e = new b({
3918
3922
  appId: this._config.projectId,
3919
3923
  appVersion: "1.0.0",
3920
- sdkVersion: "3.0.0-beta.2",
3924
+ sdkVersion: "3.0.0-beta.3",
3921
3925
  keyId: "key-id-1",
3922
3926
  userIdHash: "user-hash-placeholder",
3923
3927
  projectId: this._config.projectId
@@ -4045,11 +4049,12 @@ const W = class W extends or {
4045
4049
  return b.getBridge();
4046
4050
  }
4047
4051
  async signIn(e) {
4048
- if (this.ensureInitialized(), this.ensureNotOneWallet("signIn"), this.authenticated)
4052
+ if (this.ensureInitialized(), this.authenticated)
4049
4053
  throw new h(
4050
4054
  o.ALREADY_AUTHENTICATED,
4051
4055
  "이미 로그인된 상태입니다. signOut()을 먼저 호출하세요."
4052
4056
  );
4057
+ if (this.usesOneWallet) return this.signInWithOneIdSelector();
4053
4058
  const t = !!(e != null && e.provider) && !!this._rnBridgeWalletProvider && e.provider !== this._rnBridgeWalletProvider;
4054
4059
  if (t && c.log(
4055
4060
  `[CROSSx] 선택한 provider(${e == null ? void 0 : e.provider})가 bridge 연결 provider(${this._rnBridgeWalletProvider})와 불일치 — bridge 건너뛰고 OAuth 진행`
@@ -4071,6 +4076,8 @@ const W = class W extends or {
4071
4076
  o.EXTERNAL_WALLET_REQUESTED,
4072
4077
  "User requested external wallet connection"
4073
4078
  );
4079
+ if (r.type === "oneid")
4080
+ throw new h(o.NOT_IMPLEMENTED, "원아이디 로그인은 walletServer 'one-wallet' 에서만 지원합니다");
4074
4081
  s = { ...e, provider: r.provider };
4075
4082
  }
4076
4083
  try {
@@ -4100,6 +4107,14 @@ const W = class W extends or {
4100
4107
  async signInWithCreate(e) {
4101
4108
  const { preferredWalletAddress: t, ...s } = e ?? {}, r = await this.signIn(s);
4102
4109
  if (!r.success) return { ...r, addresses: [] };
4110
+ if (this.usesOneWallet) {
4111
+ if (!r.address) return { ...r, addresses: [] };
4112
+ try {
4113
+ return { ...r, addresses: await this.getAddresses() };
4114
+ } catch (n) {
4115
+ return c.warn("[CROSSx] one-wallet signInWithCreate: 주소 목록 조회 실패 — 지갑 주소로 대신", n), { ...r, addresses: [{ address: r.address, index: 0 }] };
4116
+ }
4117
+ }
4103
4118
  try {
4104
4119
  if (r.needsMigration || !r.address) {
4105
4120
  const { address: l } = await this.createWallet(), d = await this.getAddresses(), g = await this.selectWalletIfMultiple(d, t);
@@ -4285,6 +4300,19 @@ const W = class W extends or {
4285
4300
  this.usesOneWallet && this.clearAuthState();
4286
4301
  }
4287
4302
  }
4303
+ /**
4304
+ * one-wallet 의 `signIn()`: 로그인 선택 화면(원아이디만)을 띄우고, 사용자가 누르면 그 클릭의 사용자 활성화 안에서
4305
+ * 원아이디 팝업을 연다. 보안 화면 iframe 은 서비스 페이지 클릭을 넘겨받지 못하므로 이 화면의 클릭이 필요하다.
4306
+ * 같은 창 이동은 iframe 을 옮겨 버리므로 쓰지 않는다 (DEV2TF-2771).
4307
+ */
4308
+ async signInWithOneIdSelector() {
4309
+ const e = await this.confirmation.showLoginSelector({ methods: ["oneid"] });
4310
+ if (e === null) throw new h(o.USER_REJECTED, "User cancelled login");
4311
+ if (e.type !== "oneid")
4312
+ throw new h(o.NOT_IMPLEMENTED, "walletServer 'one-wallet' 은 원아이디 로그인만 지원합니다");
4313
+ const t = await this.signInWithOneId({ mode: "popup" });
4314
+ return t.status !== "signed-in" ? { success: !1, error: "ONE ID sign-in did not complete" } : { success: !0, address: this.address ?? void 0, user: { id: t.session.subject } };
4315
+ }
4288
4316
  /** one-wallet 은 ONE ID 세션만 쓴다 — 2.x 로그인 진입점은 막는다 (DEV2TF-2755) */
4289
4317
  ensureNotOneWallet(e) {
4290
4318
  if (this.usesOneWallet)
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./factory-CzX-ZcrQ.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-D3fGiPFz.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.d.ts CHANGED
@@ -10,7 +10,7 @@ export type { EIP1193Provider, EIP1193RequestArguments } from './sdk/EthereumPro
10
10
  export { CROSSxSDK as ONEpocketSDK } from './sdk/CROSSxSDK';
11
11
  export { CROSSxEthereumProvider as ONEpocketEthereumProvider } from './sdk/EthereumProvider';
12
12
  export { CROSSxError as ONEpocketError } from './core/types/errors';
13
- export type { SDKConfig, SDKThemeTokens, SDKColorOverrides, SDKUserInfo, AuthResult, SignInWithCreateResult, UserInfo, SignMessageResp, SignTxResp, SignTypedDataResp, SignInOptions, SignInWithCreateOptions, SignInWithOneIdOptions, OneIdConfig, OneIdSession, OneIdSignInResult, SelectWalletOptions, SignOptions, SendTxResp, TransactionWithReceipt, MigrateResult, AddressInfo, EvmTransactionRequest, TransactionReceipt, ChainInfo, ChainIdValue, PrepareAction, PrepareContext, PrepareResult, SDKEventMap, AuthChangedEvent, AddressChangedEvent, InitializedEvent, ConnectExternalWalletEvent, VersionDeprecatedEvent, LoginSelectorResult, TokenHistoryItem, GetTokenHistoryResponse, RegisterTokenHistoryRequest, } from './core/types';
13
+ export type { SDKConfig, SDKThemeTokens, SDKColorOverrides, SDKUserInfo, AuthResult, SignInWithCreateResult, UserInfo, SignMessageResp, SignTxResp, SignTypedDataResp, SignInOptions, SignInWithCreateOptions, SignInWithOneIdOptions, OneIdConfig, OneIdSession, OneIdSignInResult, SelectWalletOptions, SignOptions, SendTxResp, TransactionWithReceipt, MigrateResult, AddressInfo, EvmTransactionRequest, TransactionReceipt, ChainInfo, ChainIdValue, PrepareAction, PrepareContext, PrepareResult, SDKEventMap, AuthChangedEvent, AddressChangedEvent, InitializedEvent, ConnectExternalWalletEvent, VersionDeprecatedEvent, LoginSelectorResult, LoginSelectorMethod, TokenHistoryItem, GetTokenHistoryResponse, RegisterTokenHistoryRequest, } from './core/types';
14
14
  export { ConnectOtherWalletItem, CONNECT_OTHER_WALLET_DISPLAY_ORDER, getConnectOtherWalletLabel, } from './core/types/connectOtherWallet';
15
15
  export { ChainId } from './core/types';
16
16
  export { CROSSxError, ErrorCode } from './core/types/errors';
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-CB7q7IqU.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-DT5DsVMr.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-CzX-ZcrQ.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-D3fGiPFz.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-CB7q7IqU.js";
1
+ import { D as r, c as a, g as S } from "./factory-DT5DsVMr.js";
2
2
  export {
3
3
  r as DEFAULT_PIN_REUSE_TTL_MS,
4
4
  a as createCROSSxSDKWithOverrides,
@@ -308,6 +308,12 @@ export declare class CROSSxSDK extends TypedEventEmitter<SDKEventMap> {
308
308
  * ONE ID 세션을 끝냅니다 (`POST {issuer}/logout`). 서버 호출이 실패해도 보관 토큰은 지웁니다.
309
309
  */
310
310
  signOutOneId(): Promise<void>;
311
+ /**
312
+ * one-wallet 의 `signIn()`: 로그인 선택 화면(원아이디만)을 띄우고, 사용자가 누르면 그 클릭의 사용자 활성화 안에서
313
+ * 원아이디 팝업을 연다. 보안 화면 iframe 은 서비스 페이지 클릭을 넘겨받지 못하므로 이 화면의 클릭이 필요하다.
314
+ * 같은 창 이동은 iframe 을 옮겨 버리므로 쓰지 않는다 (DEV2TF-2771).
315
+ */
316
+ private signInWithOneIdSelector;
311
317
  /** one-wallet 은 ONE ID 세션만 쓴다 — 2.x 로그인 진입점은 막는다 (DEV2TF-2755) */
312
318
  private ensureNotOneWallet;
313
319
  /** `SDKConfig.walletServer === 'one-wallet'` (DEV2TF-2755) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cross/crossx-sdk-core",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.3",
4
4
  "description": "CROSSx Core SDK - Vanilla JavaScript Embedded Wallet SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",