@nexus-cross/connect-kit-wagmi 1.0.0-beta.1

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 (82) hide show
  1. package/README.md +195 -0
  2. package/dist/adapters/helpers.d.ts +46 -0
  3. package/dist/adapters/helpers.d.ts.map +1 -0
  4. package/dist/adapters/helpers.js +124 -0
  5. package/dist/adapters/helpers.js.map +1 -0
  6. package/dist/adapters/reownAdapter.d.ts +20 -0
  7. package/dist/adapters/reownAdapter.d.ts.map +1 -0
  8. package/dist/adapters/reownAdapter.js +213 -0
  9. package/dist/adapters/reownAdapter.js.map +1 -0
  10. package/dist/adapters/toNexusAdapter.d.ts +12 -0
  11. package/dist/adapters/toNexusAdapter.d.ts.map +1 -0
  12. package/dist/adapters/toNexusAdapter.js +167 -0
  13. package/dist/adapters/toNexusAdapter.js.map +1 -0
  14. package/dist/adapters/types.d.ts +101 -0
  15. package/dist/adapters/types.d.ts.map +1 -0
  16. package/dist/adapters/types.js +3 -0
  17. package/dist/adapters/types.js.map +1 -0
  18. package/dist/config/createCrossxConfig.d.ts +75 -0
  19. package/dist/config/createCrossxConfig.d.ts.map +1 -0
  20. package/dist/config/createCrossxConfig.js +77 -0
  21. package/dist/config/createCrossxConfig.js.map +1 -0
  22. package/dist/connectors/embeddedConnector.d.ts +30 -0
  23. package/dist/connectors/embeddedConnector.d.ts.map +1 -0
  24. package/dist/connectors/embeddedConnector.js +43 -0
  25. package/dist/connectors/embeddedConnector.js.map +1 -0
  26. package/dist/connectors/extensionConnector.d.ts +7 -0
  27. package/dist/connectors/extensionConnector.d.ts.map +1 -0
  28. package/dist/connectors/extensionConnector.js +60 -0
  29. package/dist/connectors/extensionConnector.js.map +1 -0
  30. package/dist/connectors/walletConnectConnector.d.ts +19 -0
  31. package/dist/connectors/walletConnectConnector.d.ts.map +1 -0
  32. package/dist/connectors/walletConnectConnector.js +33 -0
  33. package/dist/connectors/walletConnectConnector.js.map +1 -0
  34. package/dist/embedded.d.ts +19 -0
  35. package/dist/embedded.d.ts.map +1 -0
  36. package/dist/embedded.js +18 -0
  37. package/dist/embedded.js.map +1 -0
  38. package/dist/events.d.ts +11 -0
  39. package/dist/events.d.ts.map +1 -0
  40. package/dist/events.js +17 -0
  41. package/dist/events.js.map +1 -0
  42. package/dist/index.d.ts +21 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +12 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/registry/ConnectorRegistry.d.ts +68 -0
  47. package/dist/registry/ConnectorRegistry.d.ts.map +1 -0
  48. package/dist/registry/ConnectorRegistry.js +52 -0
  49. package/dist/registry/ConnectorRegistry.js.map +1 -0
  50. package/dist/reown.d.ts +3 -0
  51. package/dist/reown.d.ts.map +1 -0
  52. package/dist/reown.js +2 -0
  53. package/dist/reown.js.map +1 -0
  54. package/dist/ssr.d.ts +43 -0
  55. package/dist/ssr.d.ts.map +1 -0
  56. package/dist/ssr.js +50 -0
  57. package/dist/ssr.js.map +1 -0
  58. package/dist/to-nexus.d.ts +3 -0
  59. package/dist/to-nexus.d.ts.map +1 -0
  60. package/dist/to-nexus.js +2 -0
  61. package/dist/to-nexus.js.map +1 -0
  62. package/dist/utils/sessionStorage.d.ts +21 -0
  63. package/dist/utils/sessionStorage.d.ts.map +1 -0
  64. package/dist/utils/sessionStorage.js +55 -0
  65. package/dist/utils/sessionStorage.js.map +1 -0
  66. package/dist/utils/theme.d.ts +58 -0
  67. package/dist/utils/theme.d.ts.map +1 -0
  68. package/dist/utils/theme.js +112 -0
  69. package/dist/utils/theme.js.map +1 -0
  70. package/dist/wallets/detection.d.ts +28 -0
  71. package/dist/wallets/detection.d.ts.map +1 -0
  72. package/dist/wallets/detection.js +187 -0
  73. package/dist/wallets/detection.js.map +1 -0
  74. package/dist/wallets/icons.d.ts +20 -0
  75. package/dist/wallets/icons.d.ts.map +1 -0
  76. package/dist/wallets/icons.js +33 -0
  77. package/dist/wallets/icons.js.map +1 -0
  78. package/dist/wallets/registry.d.ts +3 -0
  79. package/dist/wallets/registry.d.ts.map +1 -0
  80. package/dist/wallets/registry.js +33 -0
  81. package/dist/wallets/registry.js.map +1 -0
  82. package/package.json +57 -0
package/README.md ADDED
@@ -0,0 +1,195 @@
1
+ # @nexus-cross/connect-kit-wagmi
2
+
3
+ wagmi connector adapters, connector registry, and the `createCrossxConfig`
4
+ factory that produces a **dual wagmi config** — one side for CROSSx wallets
5
+ (embedded, CROSSx Wallet, CROSSx Extension) and one side for third-party
6
+ wallets routed through Reown (MetaMask, Binance). Use this package when you
7
+ want the wallet plumbing without the built-in React UI.
8
+
9
+ - With React UI: install [`@nexus-cross/connect-kit-react`](../react) instead — it already
10
+ depends on this package.
11
+ - Headless: install this package directly and build your own button / modal.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ pnpm add @nexus-cross/connect-kit-wagmi wagmi viem @wagmi/core
17
+ ```
18
+
19
+ **Optional peers** — install only the ones your DApp actually uses:
20
+
21
+ | Peer | When to install |
22
+ |------|-----------------|
23
+ | `@to-nexus/sdk`, `@to-nexus/appkit-adapter-wagmi` | You want `cross_wallet` / `cross_extension` over the CROSS relay. |
24
+ | `@reown/appkit`, `@reown/appkit-adapter-wagmi` | You want `metamask` / `binance` (or any third-party WalletConnect wallet). |
25
+ | `@nexus-cross/crossx-sdk-core`, `@nexus-cross/crossx-sdk-wagmi` | You want the in-app `cross_embedded` (social-login) wallet. |
26
+
27
+ ## Quick start
28
+
29
+ ### Dual-side config (cross + reown)
30
+
31
+ ```ts
32
+ import { createCrossxConfig } from '@nexus-cross/connect-kit-wagmi';
33
+ import { toNexusAdapter } from '@nexus-cross/connect-kit-wagmi/to-nexus';
34
+ import { reownAdapter } from '@nexus-cross/connect-kit-wagmi/reown';
35
+ import { embeddedConnectorFactory } from '@nexus-cross/connect-kit-wagmi/embedded';
36
+
37
+ export const config = createCrossxConfig({
38
+ crossProjectId: '...',
39
+ reownProjectId: '...',
40
+ appMetadata: { name: 'My DApp', url: 'https://example.com' },
41
+ networks: [crossTestnet, bscTestnet],
42
+ defaultNetwork: crossTestnet,
43
+ ssr: true, // Next.js App Router
44
+ crossProvider: toNexusAdapter(), // hosts cross_*
45
+ reownProvider: reownAdapter(), // hosts metamask / binance
46
+ embeddedConnectorFactory, // enables cross_embedded
47
+ });
48
+
49
+ // config.crossWagmiConfig — wagmi Config for cross side (nullable)
50
+ // config.reownWagmiConfig — wagmi Config for reown side (nullable)
51
+ // config.connectorRegistry — unified wallet list for your UI
52
+ ```
53
+
54
+ ### Single-side config
55
+
56
+ Drop either adapter when your DApp only needs one ecosystem — the unused side
57
+ becomes `null` and the registry only exposes wallets from the side you wired.
58
+
59
+ ```ts
60
+ // CROSSx-only
61
+ createCrossxConfig({
62
+ /* ... */
63
+ crossProvider: toNexusAdapter(),
64
+ });
65
+
66
+ // Reown-only
67
+ createCrossxConfig({
68
+ /* ... */
69
+ reownProvider: reownAdapter(),
70
+ });
71
+ ```
72
+
73
+ ### Mounting the wagmi config manually
74
+
75
+ If you use `@nexus-cross/connect-kit-react`, the provider handles this for you. When using
76
+ this package alone, remount `<WagmiProvider>` when the active side swaps so
77
+ session state from the other side never leaks:
78
+
79
+ ```tsx
80
+ <WagmiProvider key={activeProvider} config={activeWagmiConfig}>
81
+ {/* ... */}
82
+ </WagmiProvider>
83
+ ```
84
+
85
+ ## Entrypoints
86
+
87
+ | Import | Purpose |
88
+ |--------|---------|
89
+ | `@nexus-cross/connect-kit-wagmi` | Core API: `createCrossxConfig`, connector registry, SSR helpers, icons, utilities. |
90
+ | `@nexus-cross/connect-kit-wagmi/to-nexus` | `toNexusAdapter()` — CROSS relay via `@to-nexus/appkit-adapter-wagmi`. |
91
+ | `@nexus-cross/connect-kit-wagmi/reown` | `reownAdapter()` — standard WalletConnect relay via `@reown/appkit-adapter-wagmi`. |
92
+ | `@nexus-cross/connect-kit-wagmi/embedded` | `embeddedConnectorFactory` — in-app CROSSx wallet (social login). Client-only; don't import from server code. |
93
+
94
+ ## Main API
95
+
96
+ ### `createCrossxConfig(options)`
97
+
98
+ Produces a `CrossxConfig` bundle with:
99
+
100
+ - `crossWagmiConfig` / `reownWagmiConfig` — per-side wagmi `Config`, or `null`
101
+ when that side isn't wired.
102
+ - `connectorRegistry` — ordered list of `ConnectorEntry` with `walletId`,
103
+ `providerKind` (`'cross' | 'reown'`), `connectorId`, icons, and optional
104
+ `guideUrl` / `fallbackConnectorId`.
105
+ - `crossProvider` / `reownProvider` — the adapter instances (exposes
106
+ `beforeConnect`, `closeModal`, `subscribeModalState`, `teardown`).
107
+ - `defaultProvider` — which side to mount first (`'cross'` when both sides
108
+ are wired, unless overridden via `defaultProvider` option).
109
+ - `activeProviderStorageKey` — localStorage key for persisting the active side
110
+ across reloads. Clear this during full sign-out flows.
111
+
112
+ ### Connector registry
113
+
114
+ ```ts
115
+ import { resolveCurrentWallet } from '@nexus-cross/connect-kit-wagmi';
116
+
117
+ // Map a live wagmi connectorId (+ last user intent) back to a WalletId.
118
+ const walletId = resolveCurrentWallet(
119
+ config.connectorRegistry,
120
+ activeConnector.id,
121
+ lastIntent,
122
+ );
123
+ ```
124
+
125
+ `ConnectorEntry.aliasConnectorIds` handles EIP-6963 promotion (e.g.
126
+ `io.metamask` elevating over wagmi's default `metaMask` id).
127
+
128
+ ### SSR helpers
129
+
130
+ ```tsx
131
+ // app/layout.tsx (Next.js App Router)
132
+ import { headers } from 'next/headers';
133
+ import { cookieToCrossConnectKitState } from '@nexus-cross/connect-kit-wagmi';
134
+
135
+ export default async function RootLayout({ children }) {
136
+ const cookie = (await headers()).get('cookie');
137
+ const initialState = cookieToCrossConnectKitState(config, cookie);
138
+ return (
139
+ <html><body>
140
+ <Providers initialState={initialState}>{children}</Providers>
141
+ </body></html>
142
+ );
143
+ }
144
+ ```
145
+
146
+ Requires `createCrossxConfig({ ssr: true })`.
147
+
148
+ ### Utilities
149
+
150
+ ```ts
151
+ import {
152
+ clearWalletSessionStorage, // nukes WC / appkit / wagmi localStorage keys
153
+ DEFAULT_SESSION_STORAGE_PREFIXES,
154
+ detectWallets, debugDetect, // EIP-6963 + window globals + SDK probe
155
+ DEFAULT_WALLET_REGISTRY, // canonical wallet descriptors
156
+ readWalletInfoTokens, // read --wi-* CSS custom properties
157
+ deriveSDKThemeTokensFromWalletInfo, // map --wi-* → SDKThemeTokens
158
+ } from '@nexus-cross/connect-kit-wagmi';
159
+ ```
160
+
161
+ ### Icons
162
+
163
+ Bundler-agnostic `data:image/svg+xml` URIs. Safe to use as `<img src>`:
164
+
165
+ ```ts
166
+ import {
167
+ CROSSX_ICON, EXTENSION_ICON,
168
+ METAMASK_ICON, BINANCE_ICON, WALLETCONNECT_ICON,
169
+ GOOGLE_ICON, APPLE_ICON,
170
+ } from '@nexus-cross/connect-kit-wagmi';
171
+ ```
172
+
173
+ ## Headless example
174
+
175
+ Using this package without `@nexus-cross/connect-kit-react` to build a custom UI is
176
+ demonstrated in
177
+ [`examples/next-wagmi-only`](../../examples/next-wagmi-only).
178
+
179
+ ## Allowed dependencies
180
+
181
+ This package may depend on: `@nexus-cross/connect-kit-core` (ports / types), `wagmi`,
182
+ `viem`, `@wagmi/core`, `@nexus-cross/*` (optional), `@to-nexus/*` (optional),
183
+ `@reown/appkit*` (optional).
184
+
185
+ It must **not** depend on React or `@nexus-cross/connect-kit-react` — the dependency
186
+ direction is `react → core ← wagmi`.
187
+
188
+ ## Compatibility
189
+
190
+ - `wagmi@^2`, `viem@^2`, `@wagmi/core@^2`
191
+ - Node 18+ / modern browsers
192
+
193
+ ## License
194
+
195
+ MIT
@@ -0,0 +1,46 @@
1
+ import type { CrossConnectKitConfig } from '@nexus-cross/connect-kit-core';
2
+ import type { Chain } from 'viem';
3
+ import type { CreateConnectorFn } from 'wagmi';
4
+ import type { ConnectorEntry } from '../registry/ConnectorRegistry.js';
5
+ /**
6
+ * Connector id used for the standard Reown-relay WalletConnect
7
+ * connector in `toNexusAdapter` mode. Coexists with WagmiAdapter's
8
+ * internal 'walletConnect' (CROSS relay) so Binance and mobile
9
+ * MetaMask (which only speak the official WC relay) can still pair.
10
+ */
11
+ export declare const REOWN_WC_CONNECTOR_ID = "walletConnectReown";
12
+ /**
13
+ * Registry entries shared by both built-in adapters. Keeping them in one
14
+ * place ensures wallet order and metadata match regardless of which
15
+ * relay transport the DApp picks.
16
+ */
17
+ export declare function crossWalletEntry(name?: string, connectorId?: string): ConnectorEntry;
18
+ export declare function crossExtensionEntry(): ConnectorEntry;
19
+ export declare function metamaskEntry(providerKind: 'cross' | 'reown', fallbackConnectorId?: string | undefined): ConnectorEntry;
20
+ export declare function binanceEntry(providerKind: 'cross' | 'reown', connectorId?: string): ConnectorEntry;
21
+ /**
22
+ * Factory for a standard-relay WalletConnect connector that coexists
23
+ * with WagmiAdapter's CROSS-relay walletConnect. Used only in
24
+ * `toNexusAdapter` mode where the 'walletConnect' id is already taken;
25
+ * `reownAdapter` mode just uses the built-in id directly.
26
+ *
27
+ * `showQrModal: true` delegates QR rendering to `@walletconnect/modal`
28
+ * (pulled in by the provider) so users without an extension can still
29
+ * complete the flow without crossx-kit having to ship its own QR UI.
30
+ */
31
+ export declare function createReownWalletConnectConnector(params: {
32
+ projectId: string;
33
+ metadata?: {
34
+ name: string;
35
+ description?: string;
36
+ url: string;
37
+ icons?: string[];
38
+ };
39
+ }): CreateConnectorFn;
40
+ /**
41
+ * Convert our env-agnostic `NetworkConfig[]` into viem `Chain[]` for
42
+ * wagmi's `createConfig`. Only used by the reown path; `toNexusAdapter`
43
+ * uses CAIP-formatted preset networks from `@to-nexus/sdk` instead.
44
+ */
45
+ export declare function toViemChain(network: CrossConnectKitConfig['networks'][number]): Chain;
46
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/adapters/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAQvE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D;;;;GAIG;AAEH,wBAAgB,gBAAgB,CAC9B,IAAI,SAAkB,EACtB,WAAW,SAAkB,GAC5B,cAAc,CAShB;AAED,wBAAgB,mBAAmB,IAAI,cAAc,CAWpD;AAED,wBAAgB,aAAa,CAC3B,YAAY,EAAE,OAAO,GAAG,OAAO,EAC/B,mBAAmB,GAAE,MAAM,GAAG,SAA2B,GACxD,cAAc,CAehB;AAED,wBAAgB,YAAY,CAC1B,YAAY,EAAE,OAAO,GAAG,OAAO,EAC/B,WAAW,SAAkB,GAC5B,cAAc,CAYhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;CACH,GAAG,iBAAiB,CA6BpB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CAarF"}
@@ -0,0 +1,124 @@
1
+ import { walletConnect } from 'wagmi/connectors';
2
+ import { BINANCE_ICON, CROSSX_ICON, EXTENSION_ICON, METAMASK_ICON, } from '../wallets/icons.js';
3
+ /**
4
+ * Connector id used for the standard Reown-relay WalletConnect
5
+ * connector in `toNexusAdapter` mode. Coexists with WagmiAdapter's
6
+ * internal 'walletConnect' (CROSS relay) so Binance and mobile
7
+ * MetaMask (which only speak the official WC relay) can still pair.
8
+ */
9
+ export const REOWN_WC_CONNECTOR_ID = 'walletConnectReown';
10
+ /**
11
+ * Registry entries shared by both built-in adapters. Keeping them in one
12
+ * place ensures wallet order and metadata match regardless of which
13
+ * relay transport the DApp picks.
14
+ */
15
+ export function crossWalletEntry(name = 'CROSSx Wallet', connectorId = 'walletConnect') {
16
+ return {
17
+ walletId: 'cross_wallet',
18
+ providerKind: 'cross',
19
+ type: 'app',
20
+ connectorId,
21
+ name,
22
+ iconUrl: CROSSX_ICON,
23
+ };
24
+ }
25
+ export function crossExtensionEntry() {
26
+ return {
27
+ walletId: 'cross_extension',
28
+ providerKind: 'cross',
29
+ type: 'extension',
30
+ connectorId: 'nexus.to.crosswallet.desktop',
31
+ name: 'CROSSx Extension',
32
+ iconUrl: EXTENSION_ICON,
33
+ installUrl: 'https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg',
34
+ };
35
+ }
36
+ export function metamaskEntry(providerKind, fallbackConnectorId = 'walletConnect') {
37
+ return {
38
+ walletId: 'metamask',
39
+ providerKind,
40
+ type: 'external',
41
+ connectorId: 'injected',
42
+ // wagmi's MIPD elevates `injected` to the EIP-6963 rdns once the
43
+ // MetaMask extension announces itself; register both forms so
44
+ // `resolveCurrentWallet` maps correctly after connect.
45
+ aliasConnectorIds: ['io.metamask', 'metaMaskSDK'],
46
+ name: 'MetaMask',
47
+ iconUrl: METAMASK_ICON,
48
+ installUrl: 'https://metamask.io/download/',
49
+ fallbackConnectorId,
50
+ };
51
+ }
52
+ export function binanceEntry(providerKind, connectorId = 'walletConnect') {
53
+ return {
54
+ walletId: 'binance',
55
+ providerKind,
56
+ type: 'external',
57
+ connectorId,
58
+ // Same MIPD-aliasing case as MetaMask — Binance Wallet extension
59
+ // announces `com.binance.wallet` via EIP-6963 on desktop.
60
+ aliasConnectorIds: ['com.binance.wallet'],
61
+ name: 'Binance Wallet',
62
+ iconUrl: BINANCE_ICON,
63
+ };
64
+ }
65
+ /**
66
+ * Factory for a standard-relay WalletConnect connector that coexists
67
+ * with WagmiAdapter's CROSS-relay walletConnect. Used only in
68
+ * `toNexusAdapter` mode where the 'walletConnect' id is already taken;
69
+ * `reownAdapter` mode just uses the built-in id directly.
70
+ *
71
+ * `showQrModal: true` delegates QR rendering to `@walletconnect/modal`
72
+ * (pulled in by the provider) so users without an extension can still
73
+ * complete the flow without crossx-kit having to ship its own QR UI.
74
+ */
75
+ export function createReownWalletConnectConnector(params) {
76
+ const factory = walletConnect({
77
+ projectId: params.projectId,
78
+ metadata: params.metadata
79
+ ? {
80
+ name: params.metadata.name,
81
+ description: params.metadata.description ?? '',
82
+ url: params.metadata.url,
83
+ icons: params.metadata.icons ?? [],
84
+ }
85
+ : undefined,
86
+ showQrModal: true,
87
+ });
88
+ return ((config) => {
89
+ const connector = factory(config);
90
+ // Override id so wagmi sees it as a distinct connector from
91
+ // WagmiAdapter's CROSS-relay 'walletConnect'.
92
+ Object.defineProperty(connector, 'id', {
93
+ value: REOWN_WC_CONNECTOR_ID,
94
+ configurable: true,
95
+ writable: false,
96
+ });
97
+ Object.defineProperty(connector, 'name', {
98
+ value: 'WalletConnect',
99
+ configurable: true,
100
+ writable: true,
101
+ });
102
+ return connector;
103
+ });
104
+ }
105
+ /**
106
+ * Convert our env-agnostic `NetworkConfig[]` into viem `Chain[]` for
107
+ * wagmi's `createConfig`. Only used by the reown path; `toNexusAdapter`
108
+ * uses CAIP-formatted preset networks from `@to-nexus/sdk` instead.
109
+ */
110
+ export function toViemChain(network) {
111
+ return {
112
+ id: network.id,
113
+ name: network.name,
114
+ nativeCurrency: network.nativeCurrency,
115
+ rpcUrls: {
116
+ default: { http: [network.rpcUrl] },
117
+ },
118
+ blockExplorers: network.blockExplorerUrl
119
+ ? { default: { name: 'Explorer', url: network.blockExplorerUrl } }
120
+ : undefined,
121
+ testnet: network.testnet,
122
+ };
123
+ }
124
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","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d,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,OAAO,EAAE;YACP,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;SACpC;QACD,cAAc,EAAE,OAAO,CAAC,gBAAgB;YACtC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,gBAAgB,EAAE,EAAE;YAClE,CAAC,CAAC,SAAS;QACb,OAAO,EAAE,OAAO,CAAC,OAAO;KAChB,CAAC;AACb,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { CreateConnectorFn } from 'wagmi';
2
+ import { type WalletConnectAdapter } from './types.js';
3
+ export interface ReownAdapterOptions {
4
+ /**
5
+ * Override the AppKit theme mode. Falls back to `CrossConnectKitConfig.theme.mode`
6
+ * when omitted.
7
+ */
8
+ readonly themeMode?: 'light' | 'dark';
9
+ }
10
+ /**
11
+ * Reown-side adapter backed by `@reown/appkit-adapter-wagmi` + the
12
+ * Reown Connect / ConnectingWalletConnect views. When the user picks
13
+ * MetaMask or Binance from crossx-kit's modal, `beforeConnect` opens
14
+ * Reown's native AppKit modal — the QR code rendered there shows the
15
+ * wallet's own logo (MetaMask fox, Binance diamond) instead of the
16
+ * generic WalletConnect glyph.
17
+ */
18
+ export declare function reownAdapter(_options?: ReownAdapterOptions): WalletConnectAdapter;
19
+ export type { CreateConnectorFn };
20
+ //# sourceMappingURL=reownAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reownAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/reownAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,iBAAiB,EAAE,MAAM,OAAO,CAAC;AA6BvD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AA6IpB,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACvC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,GAAE,mBAAwB,GACjC,oBAAoB,CAkFtB;AAID,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,213 @@
1
+ import { createAppKit } from '@reown/appkit';
2
+ import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
3
+ import { resolveThemeMode } from '@nexus-cross/connect-kit-core';
4
+ /**
5
+ * `kitConfig.theme` accepts both the literal string form (`'dark'`) and
6
+ * the legacy `Partial<Theme>` object (`{ mode: 'dark' }`). Normalize
7
+ * both to a plain `ThemeMode` for Reown's AppKit options.
8
+ */
9
+ function resolveKitThemeMode(theme) {
10
+ return resolveThemeMode(theme, undefined);
11
+ }
12
+ import { mainnet, sepolia, bsc, bscTestnet, } from '@reown/appkit/networks';
13
+ import { binanceEntry, metamaskEntry, } from './helpers.js';
14
+ /**
15
+ * Map of EIP-155 chain IDs → Reown preset `AppKitNetwork`. Reown's
16
+ * `createAppKit` / `WagmiAdapter` require these typed objects (not raw
17
+ * `NetworkConfig`). DApps that use chains outside this set should limit
18
+ * their reown side to the supported networks or open an upstream issue
19
+ * to get the preset added.
20
+ */
21
+ const REOWN_PRESET_NETWORKS_BY_ID = new Map([
22
+ [mainnet.id, mainnet],
23
+ [sepolia.id, sepolia],
24
+ [bsc.id, bsc],
25
+ [bscTestnet.id, bscTestnet],
26
+ ]);
27
+ /**
28
+ * Canonical WalletConnect Cloud wallet IDs for the wallets we surface
29
+ * via Reown's Connect view. Generic IDs — stable across projects —
30
+ * not DApp-scoped. Same values posa uses in its Reown AppKit config.
31
+ */
32
+ const METAMASK_WC_ID = 'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96';
33
+ const BINANCE_WC_ID = '8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4';
34
+ const WALLET_ID_ALLOWLIST = [METAMASK_WC_ID, BINANCE_WC_ID];
35
+ /** Mirrors posa's `isMetaMaskInstalled` — non-Cross, non-Binance injected. */
36
+ function isMetaMaskExtensionInstalled() {
37
+ if (typeof window === 'undefined')
38
+ return false;
39
+ const eth = window.ethereum;
40
+ if (!eth)
41
+ return false;
42
+ if (eth.providers?.length) {
43
+ return eth.providers.some((p) => p.isMetaMask && !p.isCross && !p.isBinance);
44
+ }
45
+ return !!eth.isMetaMask && !eth.isCross && !eth.isBinance;
46
+ }
47
+ const bootstrapCache = new Map();
48
+ function resolveReownNetworks(kitNetworks) {
49
+ const result = [];
50
+ const unsupported = [];
51
+ for (const net of kitNetworks) {
52
+ const preset = REOWN_PRESET_NETWORKS_BY_ID.get(net.id);
53
+ if (preset)
54
+ result.push(preset);
55
+ else
56
+ unsupported.push(net.id);
57
+ }
58
+ if (result.length === 0) {
59
+ throw new Error(`[crossx-kit] reownAdapter: none of [${unsupported.join(', ')}] match a ` +
60
+ 'Reown preset network. Currently supported: Ethereum mainnet/sepolia, ' +
61
+ 'BSC mainnet/testnet. CROSS chains are handled by toNexusAdapter — ' +
62
+ 'the reown side needs at least one chain that Reown knows about.');
63
+ }
64
+ return result;
65
+ }
66
+ function bootstrapReown(input) {
67
+ const { kitConfig, extraConnectors } = input;
68
+ if (!kitConfig.reownProjectId) {
69
+ throw new Error('[crossx-kit] reownAdapter requires CrossConnectKitConfig.reownProjectId — ' +
70
+ 'register a WalletConnect Cloud project at https://cloud.reown.com.');
71
+ }
72
+ const key = kitConfig.reownProjectId;
73
+ const existing = bootstrapCache.get(key);
74
+ if (existing)
75
+ return existing;
76
+ const networks = resolveReownNetworks(kitConfig.networks);
77
+ const connectors = extraConnectors.map((e) => e.connector);
78
+ const wagmiAdapter = new WagmiAdapter({
79
+ projectId: kitConfig.reownProjectId,
80
+ networks,
81
+ connectors,
82
+ ssr: kitConfig.ssr,
83
+ });
84
+ // Match posa's `getReownAppKitConfig` (wallet-support.ts:91-121) so
85
+ // the modal stays focused on the two wallets we actually surface
86
+ // (MetaMask / Binance) and never auto-prompts a chain switch —
87
+ // posa's users are used to handling chain mismatches themselves via
88
+ // the connected wallet's own UI.
89
+ const options = {
90
+ adapters: [wagmiAdapter],
91
+ projectId: kitConfig.reownProjectId,
92
+ networks: networks,
93
+ metadata: {
94
+ name: kitConfig.appMetadata.name,
95
+ description: kitConfig.appMetadata.description ?? '',
96
+ url: kitConfig.appMetadata.url,
97
+ icons: kitConfig.appMetadata.icons ?? [],
98
+ },
99
+ features: {
100
+ email: false,
101
+ socials: false,
102
+ analytics: false,
103
+ onramp: false,
104
+ swaps: false,
105
+ send: false,
106
+ history: false,
107
+ receive: false,
108
+ },
109
+ allWallets: 'HIDE',
110
+ includeWalletIds: [...WALLET_ID_ALLOWLIST],
111
+ featuredWalletIds: [...WALLET_ID_ALLOWLIST],
112
+ enableNetworkSwitch: false,
113
+ enableCoinbase: false,
114
+ themeMode: resolveKitThemeMode(kitConfig.theme),
115
+ };
116
+ const appKit = createAppKit(options);
117
+ const wagmiConfig = wagmiAdapter
118
+ .wagmiConfig;
119
+ const entry = { appKit, wagmiConfig };
120
+ bootstrapCache.set(key, entry);
121
+ return entry;
122
+ }
123
+ /**
124
+ * Reown-side adapter backed by `@reown/appkit-adapter-wagmi` + the
125
+ * Reown Connect / ConnectingWalletConnect views. When the user picks
126
+ * MetaMask or Binance from crossx-kit's modal, `beforeConnect` opens
127
+ * Reown's native AppKit modal — the QR code rendered there shows the
128
+ * wallet's own logo (MetaMask fox, Binance diamond) instead of the
129
+ * generic WalletConnect glyph.
130
+ */
131
+ export function reownAdapter(_options = {}) {
132
+ return {
133
+ providerKind: 'reown',
134
+ buildWagmiConfig(input) {
135
+ const { wagmiConfig } = bootstrapReown(input);
136
+ const registryEntries = [
137
+ ...input.extraConnectors
138
+ .map((e) => e.registryEntry)
139
+ .filter((e) => e !== null),
140
+ // Extension MetaMask path: wagmi's injected auto-added by
141
+ // WagmiAdapter. Mobile fallback: AppKit's Connect view (opened
142
+ // via beforeConnect).
143
+ metamaskEntry('reown', 'walletConnect'),
144
+ binanceEntry('reown', 'walletConnect'),
145
+ ];
146
+ return { wagmiConfig, registryEntries };
147
+ },
148
+ beforeConnect({ kitConfig }, walletId) {
149
+ if (!kitConfig.reownProjectId)
150
+ return 'defer';
151
+ const entry = bootstrapCache.get(kitConfig.reownProjectId);
152
+ if (!entry)
153
+ return 'defer';
154
+ // MetaMask + extension installed: let wagmi's `injected` connector
155
+ // fire directly so the user sees only the extension's native
156
+ // approval popup — no AppKit wallet picker in between. Matches
157
+ // posa's `connectMetaMask` fast path (WalletProvider.tsx:310-334).
158
+ if (walletId === 'metamask' && isMetaMaskExtensionInstalled()) {
159
+ return 'defer';
160
+ }
161
+ // Every other external wallet (Binance, MetaMask mobile) goes
162
+ // through the Reown Connect modal. `allWallets: 'HIDE'` +
163
+ // `includeWalletIds` trims the list so only the supported two
164
+ // wallets appear; clicking one routes to the QR view with its
165
+ // own logo.
166
+ if (walletId === 'metamask' || walletId === 'binance') {
167
+ entry.appKit.open({ view: 'Connect' }).catch((err) => {
168
+ if (typeof console !== 'undefined') {
169
+ console.warn('[crossx-kit] reownAdapter: appKit.open failed', err);
170
+ }
171
+ });
172
+ return 'handled';
173
+ }
174
+ return 'defer';
175
+ },
176
+ subscribeModalState({ kitConfig }, callback) {
177
+ if (!kitConfig.reownProjectId)
178
+ return () => { };
179
+ const entry = bootstrapCache.get(kitConfig.reownProjectId);
180
+ if (!entry)
181
+ return () => { };
182
+ let lastOpen;
183
+ return entry.appKit.subscribeState((state) => {
184
+ const next = state.open === true;
185
+ if (next !== lastOpen) {
186
+ lastOpen = next;
187
+ callback(next);
188
+ }
189
+ });
190
+ },
191
+ closeModal({ kitConfig }) {
192
+ if (!kitConfig.reownProjectId)
193
+ return;
194
+ const entry = bootstrapCache.get(kitConfig.reownProjectId);
195
+ if (!entry)
196
+ return;
197
+ const close = entry.appKit
198
+ .close;
199
+ if (typeof close !== 'function')
200
+ return;
201
+ try {
202
+ const result = close.call(entry.appKit);
203
+ if (result && typeof result.then === 'function') {
204
+ result.catch(() => { });
205
+ }
206
+ }
207
+ catch {
208
+ /* best-effort */
209
+ }
210
+ },
211
+ };
212
+ }
213
+ //# sourceMappingURL=reownAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reownAdapter.js","sourceRoot":"","sources":["../../src/adapters/reownAdapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAmC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMjE;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,KAAqC;IAChE,OAAO,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC;AACD,OAAO,EACL,OAAO,EACP,OAAO,EACP,GAAG,EACH,UAAU,GAEX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,YAAY,EACZ,aAAa,GACd,MAAM,cAAc,CAAC;AAOtB;;;;;;GAMG;AACH,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAwB;IACjE,CAAC,OAAO,CAAC,EAAY,EAAE,OAAO,CAAC;IAC/B,CAAC,OAAO,CAAC,EAAY,EAAE,OAAO,CAAC;IAC/B,CAAC,GAAG,CAAC,EAAY,EAAE,GAAG,CAAC;IACvB,CAAC,UAAU,CAAC,EAAY,EAAE,UAAU,CAAC;CACtC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,cAAc,GAClB,kEAAkE,CAAC;AACrE,MAAM,aAAa,GACjB,kEAAkE,CAAC;AACrE,MAAM,mBAAmB,GAAG,CAAC,cAAc,EAAE,aAAa,CAAU,CAAC;AAErE,8EAA8E;AAC9E,SAAS,4BAA4B;IACnC,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IAChD,MAAM,GAAG,GAAI,MAST,CAAC,QAAQ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,QAAQ,GAAG,IAAI,CAAC;oBAChB,QAAQ,CAAC,IAAI,CAAC,CAAC;gBACjB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,UAAU,CAAC,EAAE,SAAS,EAAE;YACtB,IAAI,CAAC,SAAS,CAAC,cAAc;gBAAE,OAAO;YACtC,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;YAC3D,IAAI,CAAC,KAAK;gBAAE,OAAO;YACnB,MAAM,KAAK,GAAI,KAAK,CAAC,MAA+C;iBACjE,KAAK,CAAC;YACT,IAAI,OAAO,KAAK,KAAK,UAAU;gBAAE,OAAO;YACxC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBACxC,IAAI,MAAM,IAAI,OAAQ,MAAwB,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;oBAClE,MAAwB,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,iBAAiB;YACnB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type WalletConnectAdapter } from './types.js';
2
+ export interface ToNexusAdapterOptions {
3
+ readonly displayName?: string;
4
+ }
5
+ /**
6
+ * Adapter backed by `@to-nexus/appkit-adapter-wagmi` — the CROSS-relay
7
+ * fork of Reown AppKit. Owns the wagmi `Config` so AppKit's native UI
8
+ * (QR modal, deep-link, Cross Extension approval flow) stays in sync
9
+ * with the kit's `useAccount` / `useConnect` state.
10
+ */
11
+ export declare function toNexusAdapter(options?: ToNexusAdapterOptions): WalletConnectAdapter;
12
+ //# sourceMappingURL=toNexusAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toNexusAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/toNexusAdapter.ts"],"names":[],"mappings":"AAoBA,OAAO,EAGL,KAAK,oBAAoB,EAE1B,MAAM,YAAY,CAAC;AAuGpB,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CAyFtB"}