@nexus-cross/connect-kit-react 1.1.3-beta.1 → 1.1.3-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.
Files changed (2) hide show
  1. package/README.md +73 -43
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -11,15 +11,20 @@ setup, use [`@nexus-cross/connect-kit-wagmi`](../wagmi) directly.
11
11
  ## Install
12
12
 
13
13
  ```sh
14
- pnpm add @nexus-cross/connect-kit-react @nexus-cross/connect-kit-wagmi \
14
+ pnpm add @nexus-cross/connect-kit-react \
15
15
  wagmi viem @tanstack/react-query react react-dom
16
16
  ```
17
17
 
18
- Optional peers (same as `@nexus-cross/connect-kit-wagmi`): `@to-nexus/sdk`,
19
- `@to-nexus/appkit-adapter-wagmi`, `@reown/appkit`,
20
- `@reown/appkit-adapter-wagmi`, `@nexus-cross/crossx-sdk-core`,
21
- `@nexus-cross/crossx-sdk-wagmi`. Install the ones matching the adapters you
22
- enable in your config.
18
+ `@nexus-cross/connect-kit-react` depends on
19
+ `@nexus-cross/connect-kit-wagmi` and `@nexus-cross/dapp-ui`, so most React
20
+ DApps install only the React package plus the peer dependencies above.
21
+
22
+ If your config uses `toNexusAdapter()`, add the private registry entry required
23
+ by the transitive `@to-nexus/*` packages:
24
+
25
+ ```ini
26
+ @to-nexus:registry=https://package.cross-nexus.com/repository/cross-sdk-js
27
+ ```
23
28
 
24
29
  ## Quick start
25
30
 
@@ -29,6 +34,16 @@ import { createCrossxConfig } from '@nexus-cross/connect-kit-wagmi';
29
34
  import { toNexusAdapter } from '@nexus-cross/connect-kit-wagmi/to-nexus';
30
35
  import { reownAdapter } from '@nexus-cross/connect-kit-wagmi/reown';
31
36
  import { embeddedConnectorFactory } from '@nexus-cross/connect-kit-wagmi/embedded';
37
+ import type { NetworkConfig } from '@nexus-cross/connect-kit-core';
38
+
39
+ const crossTestnet: NetworkConfig = {
40
+ id: 612044,
41
+ name: 'CROSS Testnet',
42
+ nativeCurrency: { name: 'tCROSS', symbol: 'tCROSS', decimals: 18 },
43
+ rpcUrl: 'https://testnet.crosstoken.io:22001',
44
+ blockExplorerUrl: 'https://testnet.crossscan.io',
45
+ testnet: true,
46
+ };
32
47
 
33
48
  export const config = createCrossxConfig({
34
49
  crossProjectId: '...',
@@ -57,10 +72,11 @@ export function App() {
57
72
  }
58
73
  ```
59
74
 
60
- That's it. Clicking the button launches the CROSSx embedded wallet flow; the
61
- "Other wallets" link opens a modal listing `cross_wallet`, `cross_extension`,
62
- `metamask`, `binance` each of which routes through the correct provider
63
- automatically.
75
+ That's it. Clicking the button opens the kit's unified connect modal. The
76
+ social row routes through the embedded CROSSx OAuth adapter when
77
+ `embeddedConnectorFactory` is configured; the wallet list routes
78
+ `cross_wallet`, `cross_extension`, `metamask`, and `binance` through the
79
+ correct provider automatically.
64
80
 
65
81
  ## Components
66
82
 
@@ -123,6 +139,11 @@ export function Providers({ children, initialState }) {
123
139
 
124
140
  Requires `createCrossxConfig({ ssr: true })`.
125
141
 
142
+ `embeddedConnectorFactory` imports the browser-only CROSSx SDK. In Next.js App
143
+ Router, do not import `@nexus-cross/connect-kit-wagmi/embedded` from a module
144
+ that is also imported by a Server Component. Keep SSR configs server-safe, or
145
+ build the embedded-enabled config inside a `'use client'` boundary.
146
+
126
147
  ### `<ConnectButton>`
127
148
 
128
149
  ```tsx
@@ -137,8 +158,8 @@ Requires `createCrossxConfig({ ssr: true })`.
137
158
 
138
159
  Three visual states, driven by wagmi + the kit context:
139
160
 
140
- 1. **Disconnected** — solid pill with `label`, launches the embedded wallet
141
- flow on click.
161
+ 1. **Disconnected** — solid pill with `label`, opens the unified connect modal
162
+ on click.
142
163
  2. **Connecting / Reconnecting** — spinner + "Connecting…".
143
164
  3. **Connected** — pill showing a **platform icon** + shortened address.
144
165
  Clicking opens a popover powered by `@nexus-cross/dapp-ui`'s `WalletInfo`
@@ -154,30 +175,41 @@ For `cross_embedded`, the popover's **My Wallet** header is populated with
154
175
  the saved wallet name from crossy-sdk 2.0 (`sdk.getAddresses()`) when one
155
176
  exists.
156
177
 
157
- ### `<OtherWalletsModal>`
178
+ ### Unified connect modal
158
179
 
159
180
  ```tsx
160
- import { OtherWalletsModal, useCrossConnectKit } from '@nexus-cross/connect-kit-react';
181
+ import { useCrossConnectKit } from '@nexus-cross/connect-kit-react';
161
182
 
162
183
  function MyCustomButton() {
163
- const { connect, otherWalletsOpen, openOtherWallets, closeOtherWallets } =
164
- useCrossConnectKit();
184
+ const { openOtherWallets } = useCrossConnectKit();
165
185
 
166
- return (
167
- <>
168
- <button onClick={openOtherWallets}>Other wallets</button>
169
- <OtherWalletsModal
170
- open={otherWalletsOpen}
171
- onClose={closeOtherWallets}
172
- onSelect={connect}
173
- />
174
- </>
175
- );
186
+ return <button onClick={openOtherWallets}>Connect another wallet</button>;
176
187
  }
177
188
  ```
178
189
 
179
- Ported from posa's ConnectWalletModal themed via `--wi-*` CSS custom
180
- properties so it inherits the same palette as the WalletInfo popover.
190
+ `CrossConnectKitProvider` renders the modal for you. Calling
191
+ `openOtherWallets()` opens the same unified modal used by `<ConnectButton />`,
192
+ including the social row and wallet list. `CrossConnectModal` and
193
+ `OtherWalletsModal` are exported for low-level integrations, but most DApps
194
+ should not render them directly.
195
+
196
+ Filter the wallet list with provider props:
197
+
198
+ ```tsx
199
+ <CrossConnectKitProvider
200
+ config={config}
201
+ walletAllowlist={['cross_wallet', 'cross_extension']}
202
+ extraWallets={{
203
+ verse8: () => window.alert('Verse8 support is coming soon'),
204
+ }}
205
+ >
206
+ {children}
207
+ </CrossConnectKitProvider>
208
+ ```
209
+
210
+ `walletAllowlist={[]}` hides the wallet-list rows and leaves only the social row
211
+ when embedded OAuth is configured. Disable the social row separately by omitting
212
+ `embeddedConnectorFactory` from `createCrossxConfig`.
181
213
 
182
214
  ## Hooks
183
215
 
@@ -189,7 +221,7 @@ const {
189
221
  connectorRegistry,
190
222
  availableWallets, // registry entries with type !== 'embedded'
191
223
  connect, // (walletId: WalletId) => Promise<void>
192
- connectWallet, // () => Promise<void> — launches embedded flow
224
+ connectWallet, // () => Promise<void> — opens the unified connect modal
193
225
  disconnect, // () => Promise<void>
194
226
  selectWallet, // () => Promise<{ address, index } | null>
195
227
  currentWallet, // WalletId | null
@@ -230,27 +262,25 @@ import {
230
262
 
231
263
  ## Theming
232
264
 
233
- `WalletInfo` and `OtherWalletsModal` are styled through the `--wi-*` custom
234
- property set (surface, border, text, accent tokens). The kit reads these at
235
- runtime and forwards them to the crossy-sdk 2.0 login modal via
236
- `deriveSDKThemeTokensFromWalletInfo`, so a single CSS palette styles both
237
- the connect UI and the embedded login overlay.
265
+ `CrossConnectKitProvider` emits `--cck-*` CSS variables from
266
+ `config.themeTokens`. The dapp-ui surfaces (`WalletInfo`, `WalletPortfolio`,
267
+ `WalletConnectModal`, `AppLauncher`) read those variables, and the embedded SDK
268
+ receives the same theme tokens at runtime.
238
269
 
239
270
  ## Allowed dependencies
240
271
 
241
- This package may depend on: `react`, `react-dom` (peer), `wagmi` (peer, hooks
242
- only), `@tanstack/react-query` (peer), `@nexus-cross/connect-kit-core`,
243
- `@nexus-cross/connect-kit-wagmi`, `@nexus-cross/dapp-ui` (peer), `@to-nexus/sdk` (optional
244
- peer, for the hook that inspects the embedded session), radix-ui, vaul.
272
+ This package may depend on: `@nexus-cross/connect-kit-core`,
273
+ `@nexus-cross/connect-kit-wagmi`, and `@nexus-cross/dapp-ui`. React, wagmi, and
274
+ TanStack Query stay peer dependencies of the consuming app.
245
275
 
246
- It must **not** import `@nexus-cross/*` or `viem` directly domain types
247
- flow through `@nexus-cross/connect-kit-core`, and any external SDK access happens in the
248
- wagmi layer.
276
+ It must not own low-level wallet transport logic. External SDK access belongs in
277
+ the wagmi layer; this package composes providers, React context, hooks, and
278
+ dapp-ui components.
249
279
 
250
280
  ## Compatibility
251
281
 
252
- - `react@^18`, `react-dom@^18`
253
- - `wagmi@^2`, `viem@^2`
282
+ - `react@^19`, `react-dom@^19`
283
+ - `wagmi>=2 <4`, `viem@^2`
254
284
  - `@tanstack/react-query@^5`
255
285
 
256
286
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cross/connect-kit-react",
3
- "version": "1.1.3-beta.1",
3
+ "version": "1.1.3-beta.2",
4
4
  "description": "React components and hooks for @nexus-cross/connect-kit wallet connection",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,9 +19,9 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@nexus-cross/connect-kit-core": "1.1.3-beta.1",
23
- "@nexus-cross/connect-kit-wagmi": "1.1.3-beta.1",
24
- "@nexus-cross/dapp-ui": "1.1.3-beta.1"
22
+ "@nexus-cross/connect-kit-core": "1.1.3-beta.2",
23
+ "@nexus-cross/connect-kit-wagmi": "1.1.3-beta.2",
24
+ "@nexus-cross/dapp-ui": "1.1.3-beta.2"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@tanstack/react-query": "^5.60.0",