@nexus-cross/connect-kit-core 2.3.4-beta.1 → 2.4.0-beta.2
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.d.ts +124 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -222,6 +222,25 @@ interface CrossConnectKitConfig {
|
|
|
222
222
|
* `embeddedProjectId`(미설정 시 `crossProjectId` fallback)를 사용한다.
|
|
223
223
|
*/
|
|
224
224
|
kycEnabled?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* ONEpop(소셜 핸들 드롭) 마스터 토글. default false.
|
|
227
|
+
*
|
|
228
|
+
* true이면 이 토글 **하나로** ONEpop이 특별한 추가 설정 없이 동작한다:
|
|
229
|
+
* - `ConnectButton`이 WalletInfo에 `showOnePop`을 켜서 액션 행 ONEpop
|
|
230
|
+
* 카드와 진입 화면을 노출한다 (prop으로 `showOnePop`을 명시하면 우선).
|
|
231
|
+
* - ONEpop 화면에 표시할 `onePopSummary`(수령 대기 수/합계, X 연결 여부,
|
|
232
|
+
* 최근 활동)를 `@nexus-cross/pop`으로 조회해 자동 주입한다(fallback).
|
|
233
|
+
* one-pop-api `/drops`·`/histories`는 cross-auth SIWE JWT를 요구하므로
|
|
234
|
+
* **사용자가 ONEpop 화면을 실제로 열 때** 서명을 한 번 요청하고, 발급된
|
|
235
|
+
* 토큰은 세션 동안 주소별로 재사용한다. DApp이 `onePopSummary`를 직접
|
|
236
|
+
* 주입하면 조회를 건너뛴다.
|
|
237
|
+
* - 화면의 액션(Send POP / Claim POPs / Activity / 배너)은 ONEpop 서비스
|
|
238
|
+
* 웹 딥링크가 기본 동작이고, `onOnePopSend` 등 콜백 주입 시 그것이
|
|
239
|
+
* 우선한다.
|
|
240
|
+
*
|
|
241
|
+
* false(기본)면 ONEpop 카드/화면이 렌더되지 않고 조회도 하지 않는다.
|
|
242
|
+
*/
|
|
243
|
+
onePopEnabled?: boolean;
|
|
225
244
|
/**
|
|
226
245
|
* When `true`, the kit switches the wallet to {@link defaultNetwork}
|
|
227
246
|
* exactly once right after a connection is established. External
|
|
@@ -242,6 +261,35 @@ interface CrossConnectKitConfig {
|
|
|
242
261
|
* Requires `defaultNetwork` to be set. Default: `false`.
|
|
243
262
|
*/
|
|
244
263
|
enforceDefaultNetworkOnConnect?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* When `true` (default), any wallet chain switch the kit performs *for
|
|
266
|
+
* an operation* is undone once that operation completes — the wallet is
|
|
267
|
+
* restored to the chain it was on before. This covers the bridge/swap
|
|
268
|
+
* flow (which switches to the source chain to submit the tx) and the
|
|
269
|
+
* Send screen (which switches to the token's chain to send).
|
|
270
|
+
*
|
|
271
|
+
* Rationale: the temporary switch is an implementation detail of the
|
|
272
|
+
* operation. Leaving the DApp's wallet stranded on, say, BSC after a
|
|
273
|
+
* BSC→CROSS bridge makes the rest of the app (and the developer's own
|
|
274
|
+
* flows) behave unexpectedly. app-launcher is a DApp-integration tool,
|
|
275
|
+
* so the friendly default is to hand the chain back.
|
|
276
|
+
*
|
|
277
|
+
* Semantics:
|
|
278
|
+
* - Best-effort: restore is fire-and-forget. A rejected switch-back
|
|
279
|
+
* (or an unconfigured chain) never turns a successful bridge/send
|
|
280
|
+
* into a failure.
|
|
281
|
+
* - Only after success. A failed/cancelled operation leaves the
|
|
282
|
+
* wallet on the operation chain so the user can retry without an
|
|
283
|
+
* extra switch round-trip.
|
|
284
|
+
* - No-op when no switch happened (e.g. already on the target chain,
|
|
285
|
+
* or the gasless permit bridge path that never switches).
|
|
286
|
+
*
|
|
287
|
+
* Unlike {@link enforceDefaultNetworkOnConnect} — which pins to a fixed
|
|
288
|
+
* canonical chain once at connect — this restores to whatever chain the
|
|
289
|
+
* user actually had before the operation. Set `false` to leave the
|
|
290
|
+
* wallet on the operation chain. Default: `true`.
|
|
291
|
+
*/
|
|
292
|
+
restoreChainAfterSwitch?: boolean;
|
|
245
293
|
}
|
|
246
294
|
interface AppMetadata {
|
|
247
295
|
name: string;
|
|
@@ -273,6 +321,65 @@ interface NetworkConfig {
|
|
|
273
321
|
blockExplorerUrl?: string;
|
|
274
322
|
testnet?: boolean;
|
|
275
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* The user-flow lifecycle events the kit EMITS. connect-kit is an SDK: it
|
|
326
|
+
* never stores, batches, or ships telemetry — it only surfaces these
|
|
327
|
+
* events through {@link AnalyticsPort} (react: `useConnectKitAnalytics`),
|
|
328
|
+
* and the DApp is the collection owner.
|
|
329
|
+
*
|
|
330
|
+
* See `docs/connect-kit/09-analytics-events.md`.
|
|
331
|
+
*/
|
|
332
|
+
type ConnectKitEventName = 'connect_modal_opened' | 'connect_modal_closed' | 'wallet_selected' | 'connect_started' | 'connect_succeeded' | 'connect_failed' | 'connect_cancelled' | 'wallet_switched' | 'disconnected';
|
|
333
|
+
/** Why a connect attempt terminally failed. */
|
|
334
|
+
type ConnectFailReason = 'connector_error' | 'connector_not_found' | 'fallback_failed' | 'unknown';
|
|
335
|
+
/** Where in the flow the user abandoned a connect attempt. */
|
|
336
|
+
type ConnectCancelStage = 'modal' | 'popup' | 'stalled';
|
|
337
|
+
/**
|
|
338
|
+
* A single user-flow event. Discriminated on {@link ConnectKitEventName}.
|
|
339
|
+
*
|
|
340
|
+
* PRIVACY: payloads carry only categorical/structural values — walletId,
|
|
341
|
+
* walletType, chainId, reason, stage. Never an address, PIN, token, email,
|
|
342
|
+
* balance, or signature. `timestamp` (ms epoch) is stamped by the react
|
|
343
|
+
* adapter, not core (core has no clock).
|
|
344
|
+
*/
|
|
345
|
+
interface ConnectKitEventBase {
|
|
346
|
+
name: ConnectKitEventName;
|
|
347
|
+
/** ms epoch, stamped by the react adapter (core has no side effects). */
|
|
348
|
+
timestamp: number;
|
|
349
|
+
}
|
|
350
|
+
type ConnectKitEvent = (ConnectKitEventBase & {
|
|
351
|
+
name: 'connect_modal_opened';
|
|
352
|
+
}) | (ConnectKitEventBase & {
|
|
353
|
+
name: 'connect_modal_closed';
|
|
354
|
+
completed: boolean;
|
|
355
|
+
}) | (ConnectKitEventBase & {
|
|
356
|
+
name: 'wallet_selected';
|
|
357
|
+
walletId: WalletId;
|
|
358
|
+
walletType: ConnectorType;
|
|
359
|
+
}) | (ConnectKitEventBase & {
|
|
360
|
+
name: 'connect_started';
|
|
361
|
+
walletId: WalletId;
|
|
362
|
+
walletType: ConnectorType;
|
|
363
|
+
}) | (ConnectKitEventBase & {
|
|
364
|
+
name: 'connect_succeeded';
|
|
365
|
+
walletId: WalletId;
|
|
366
|
+
walletType: ConnectorType;
|
|
367
|
+
chainId: number;
|
|
368
|
+
}) | (ConnectKitEventBase & {
|
|
369
|
+
name: 'connect_failed';
|
|
370
|
+
walletId: WalletId;
|
|
371
|
+
reason: ConnectFailReason;
|
|
372
|
+
}) | (ConnectKitEventBase & {
|
|
373
|
+
name: 'connect_cancelled';
|
|
374
|
+
walletId: WalletId;
|
|
375
|
+
stage: ConnectCancelStage;
|
|
376
|
+
}) | (ConnectKitEventBase & {
|
|
377
|
+
name: 'wallet_switched';
|
|
378
|
+
index: number;
|
|
379
|
+
}) | (ConnectKitEventBase & {
|
|
380
|
+
name: 'disconnected';
|
|
381
|
+
walletId: WalletId | null;
|
|
382
|
+
});
|
|
276
383
|
type Unsubscribe = () => void;
|
|
277
384
|
|
|
278
385
|
/**
|
|
@@ -362,6 +469,22 @@ interface OAuthPort {
|
|
|
362
469
|
signIn(provider: OAuthProvider): Promise<void>;
|
|
363
470
|
}
|
|
364
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Outbound analytics sink. The kit EMITS user-flow events; it never
|
|
474
|
+
* stores, batches, or ships them. The DApp implements this port (in the
|
|
475
|
+
* react layer, via the `useConnectKitAnalytics` hook) to route events into
|
|
476
|
+
* its own analytics (GA, Amplitude, backend, …).
|
|
477
|
+
*
|
|
478
|
+
* Sync + fire-and-forget (like {@link ModalControlPort}): a slow or
|
|
479
|
+
* throwing handler must never block or break the connect flow — the react
|
|
480
|
+
* adapter swallows handler errors.
|
|
481
|
+
*
|
|
482
|
+
* See `docs/connect-kit/09-analytics-events.md`.
|
|
483
|
+
*/
|
|
484
|
+
interface AnalyticsPort {
|
|
485
|
+
track(event: ConnectKitEvent): void;
|
|
486
|
+
}
|
|
487
|
+
|
|
365
488
|
/**
|
|
366
489
|
* Theme-mode resolution.
|
|
367
490
|
*
|
|
@@ -413,4 +536,4 @@ declare function formatBalance(value: bigint, decimals: number, displayDecimals?
|
|
|
413
536
|
*/
|
|
414
537
|
declare function formatWei(wei: bigint, displayDecimals?: number): string;
|
|
415
538
|
|
|
416
|
-
export { type Account, type AppMetadata, type BalancePort, type ChainBalance, type ColorOverrides, ConnectionStatus, type ConnectorPort, type ConnectorResult, type ConnectorType, type CrossConnectKitConfig, type LegalLinks, type ModalControlPort, type ModalView, type NetworkConfig, type OAuthPort, type OAuthProvider, type PinKeyboardMode, type PinKeyboardOption, type StoragePort, type Theme, type ThemeMode, type ThemePort, type ThemeTokens, type Unsubscribe, type WalletDescriptor, type WalletDetectionPort, type WalletId, type WalletState, formatBalance, formatWei, resolveThemeMode };
|
|
539
|
+
export { type Account, type AnalyticsPort, type AppMetadata, type BalancePort, type ChainBalance, type ColorOverrides, type ConnectCancelStage, type ConnectFailReason, type ConnectKitEvent, type ConnectKitEventName, ConnectionStatus, type ConnectorPort, type ConnectorResult, type ConnectorType, type CrossConnectKitConfig, type LegalLinks, type ModalControlPort, type ModalView, type NetworkConfig, type OAuthPort, type OAuthProvider, type PinKeyboardMode, type PinKeyboardOption, type StoragePort, type Theme, type ThemeMode, type ThemePort, type ThemeTokens, type Unsubscribe, type WalletDescriptor, type WalletDetectionPort, type WalletId, type WalletState, formatBalance, formatWei, resolveThemeMode };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var f={CONNECTED:"connected",DISCONNECTED:"disconnected",CONNECTING:"connecting",RECONNECTING:"reconnecting"};function u(e,t){if(t&&typeof window<"u"&&window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{}return typeof e=="string"?e:e&&typeof e=="object"&&"mode"in e?e.mode??"dark":"dark"}function m(e,t,
|
|
1
|
+
var f={CONNECTED:"connected",DISCONNECTED:"disconnected",CONNECTING:"connecting",RECONNECTING:"reconnecting"};function u(e,t){if(t&&typeof window<"u"&&window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{}return typeof e=="string"?e:e&&typeof e=="object"&&"mode"in e?e.mode??"dark":"dark"}function m(e,t,n=4){if(t<0||!Number.isInteger(t))throw new RangeError(`formatBalance: decimals must be a non-negative integer, got ${t}`);if(n<0||!Number.isInteger(n))throw new RangeError(`formatBalance: displayDecimals must be a non-negative integer, got ${n}`);let r=e<0n,c=r?-e:e;if(t===0){let o=c.toString();return r?`-${o}`:o}let s=10n**BigInt(t),i=c/s,g=c%s;if(n===0){let o=i.toString();return r?`-${o}`:o}let l=g.toString().padStart(t,"0").slice(0,n),a=l.length;for(;a>0&&l.charCodeAt(a-1)===48;)a--;let d=l.slice(0,a),p=d?`${i}.${d}`:i.toString();return r?`-${p}`:p}function C(e,t=4){return m(e,18,t)}import{OnRampError as E,normalizeDisallowReason as O}from"@nexus-cross/onramp";export{f as ConnectionStatus,E as OnRampError,m as formatBalance,C as formatWei,O as normalizeDisallowReason,u as resolveThemeMode};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-cross/connect-kit-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0-beta.2",
|
|
4
4
|
"description": "Core domain logic for @nexus-cross/connect-kit — types, ports, utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@nexus-cross/onramp": "2.
|
|
23
|
+
"@nexus-cross/onramp": "2.4.0-beta.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"tsup": "^8.4.0",
|