@nexus-cross/connect-kit-wagmi 1.1.4 → 1.3.0

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 (93) hide show
  1. package/dist/chunk-33PCSJXD.js +1 -0
  2. package/dist/chunk-6BKDRLN2.js +1 -0
  3. package/dist/chunk-MB7252C7.js +1 -0
  4. package/dist/chunk-UVGOTXNW.js +1 -0
  5. package/dist/embedded.d.ts +38 -19
  6. package/dist/embedded.js +1 -18
  7. package/dist/index.d.ts +286 -23
  8. package/dist/index.js +1 -14
  9. package/dist/reown.d.ts +21 -3
  10. package/dist/reown.js +1 -2
  11. package/dist/{utils/theme.d.ts → theme-CjRKvIE1.d.ts} +6 -5
  12. package/dist/to-nexus.d.ts +16 -3
  13. package/dist/to-nexus.js +1 -2
  14. package/dist/{adapters/types.d.ts → types-DiRp3H2_.d.ts} +78 -12
  15. package/package.json +10 -6
  16. package/dist/adapters/crossySdkOAuthAdapter.d.ts +0 -12
  17. package/dist/adapters/crossySdkOAuthAdapter.d.ts.map +0 -1
  18. package/dist/adapters/crossySdkOAuthAdapter.js +0 -64
  19. package/dist/adapters/crossySdkOAuthAdapter.js.map +0 -1
  20. package/dist/adapters/helpers.d.ts +0 -46
  21. package/dist/adapters/helpers.d.ts.map +0 -1
  22. package/dist/adapters/helpers.js +0 -130
  23. package/dist/adapters/helpers.js.map +0 -1
  24. package/dist/adapters/reownAdapter.d.ts +0 -19
  25. package/dist/adapters/reownAdapter.d.ts.map +0 -1
  26. package/dist/adapters/reownAdapter.js +0 -257
  27. package/dist/adapters/reownAdapter.js.map +0 -1
  28. package/dist/adapters/toNexusAdapter.d.ts +0 -12
  29. package/dist/adapters/toNexusAdapter.d.ts.map +0 -1
  30. package/dist/adapters/toNexusAdapter.js +0 -252
  31. package/dist/adapters/toNexusAdapter.js.map +0 -1
  32. package/dist/adapters/types.d.ts.map +0 -1
  33. package/dist/adapters/types.js +0 -3
  34. package/dist/adapters/types.js.map +0 -1
  35. package/dist/config/createCrossxConfig.d.ts +0 -93
  36. package/dist/config/createCrossxConfig.d.ts.map +0 -1
  37. package/dist/config/createCrossxConfig.js +0 -104
  38. package/dist/config/createCrossxConfig.js.map +0 -1
  39. package/dist/config/networkPresets.d.ts +0 -43
  40. package/dist/config/networkPresets.d.ts.map +0 -1
  41. package/dist/config/networkPresets.js +0 -103
  42. package/dist/config/networkPresets.js.map +0 -1
  43. package/dist/connectors/embeddedConnector.d.ts +0 -36
  44. package/dist/connectors/embeddedConnector.d.ts.map +0 -1
  45. package/dist/connectors/embeddedConnector.js +0 -47
  46. package/dist/connectors/embeddedConnector.js.map +0 -1
  47. package/dist/connectors/extensionConnector.d.ts +0 -7
  48. package/dist/connectors/extensionConnector.d.ts.map +0 -1
  49. package/dist/connectors/extensionConnector.js +0 -60
  50. package/dist/connectors/extensionConnector.js.map +0 -1
  51. package/dist/connectors/walletConnectConnector.d.ts +0 -19
  52. package/dist/connectors/walletConnectConnector.d.ts.map +0 -1
  53. package/dist/connectors/walletConnectConnector.js +0 -33
  54. package/dist/connectors/walletConnectConnector.js.map +0 -1
  55. package/dist/embedded.d.ts.map +0 -1
  56. package/dist/embedded.js.map +0 -1
  57. package/dist/events.d.ts +0 -11
  58. package/dist/events.d.ts.map +0 -1
  59. package/dist/events.js +0 -17
  60. package/dist/events.js.map +0 -1
  61. package/dist/index.d.ts.map +0 -1
  62. package/dist/index.js.map +0 -1
  63. package/dist/registry/ConnectorRegistry.d.ts +0 -68
  64. package/dist/registry/ConnectorRegistry.d.ts.map +0 -1
  65. package/dist/registry/ConnectorRegistry.js +0 -52
  66. package/dist/registry/ConnectorRegistry.js.map +0 -1
  67. package/dist/reown.d.ts.map +0 -1
  68. package/dist/reown.js.map +0 -1
  69. package/dist/ssr.d.ts +0 -43
  70. package/dist/ssr.d.ts.map +0 -1
  71. package/dist/ssr.js +0 -50
  72. package/dist/ssr.js.map +0 -1
  73. package/dist/to-nexus.d.ts.map +0 -1
  74. package/dist/to-nexus.js.map +0 -1
  75. package/dist/utils/sessionStorage.d.ts +0 -21
  76. package/dist/utils/sessionStorage.d.ts.map +0 -1
  77. package/dist/utils/sessionStorage.js +0 -55
  78. package/dist/utils/sessionStorage.js.map +0 -1
  79. package/dist/utils/theme.d.ts.map +0 -1
  80. package/dist/utils/theme.js +0 -112
  81. package/dist/utils/theme.js.map +0 -1
  82. package/dist/wallets/detection.d.ts +0 -29
  83. package/dist/wallets/detection.d.ts.map +0 -1
  84. package/dist/wallets/detection.js +0 -190
  85. package/dist/wallets/detection.js.map +0 -1
  86. package/dist/wallets/icons.d.ts +0 -20
  87. package/dist/wallets/icons.d.ts.map +0 -1
  88. package/dist/wallets/icons.js +0 -33
  89. package/dist/wallets/icons.js.map +0 -1
  90. package/dist/wallets/registry.d.ts +0 -3
  91. package/dist/wallets/registry.d.ts.map +0 -1
  92. package/dist/wallets/registry.js +0 -33
  93. package/dist/wallets/registry.js.map +0 -1
@@ -1,19 +1,86 @@
1
- import type { Config, CreateConnectorFn } from 'wagmi';
2
- import type { CrossConnectKitConfig, ThemeMode, WalletId } from '@nexus-cross/connect-kit-core';
3
- import type { ConnectorEntry } from '../registry/ConnectorRegistry.js';
1
+ import { CreateConnectorFn, Config } from 'wagmi';
2
+ import { WalletId, ConnectorType, WalletDescriptor, CrossConnectKitConfig, ThemeMode } from '@nexus-cross/connect-kit-core';
3
+
4
+ /**
5
+ * Which wagmi `Config` a connector lives in.
6
+ *
7
+ * - `'cross'` — CROSSx 1.0 stack (`@to-nexus/*` WagmiAdapter + CROSS relay)
8
+ * - `'reown'` — standard Reown relay (optional side)
9
+ *
10
+ * crossx-kit keeps the two configs separate (posa-style dual config)
11
+ * so a DApp that cannot or will not depend on Reown still gets a working
12
+ * cross-only setup. `CrossConnectKitProvider` swaps the active `WagmiProvider`
13
+ * by remounting when the user picks a wallet from the other side.
14
+ */
15
+ type ProviderKind = 'cross' | 'reown';
16
+ interface ConnectorEntry {
17
+ readonly walletId: WalletId;
18
+ readonly providerKind: ProviderKind;
19
+ readonly type: ConnectorType;
20
+ readonly connectorId: string;
21
+ readonly name: string;
22
+ readonly iconUrl?: string;
23
+ readonly installUrl?: string;
24
+ readonly fallbackConnectorId?: string;
25
+ /**
26
+ * Alternative wagmi connector ids that resolve to the same walletId.
27
+ * Needed because wagmi's MIPD (multi-injected-provider-discovery)
28
+ * elevates `injected()` to the EIP-6963 `rdns` at runtime — e.g.
29
+ * MetaMask ends up as `io.metamask` even though we registered
30
+ * `'injected'`. Listing the known aliases here keeps
31
+ * `resolveCurrentWallet` from returning `null` in that case.
32
+ */
33
+ readonly aliasConnectorIds?: readonly string[];
34
+ /**
35
+ * Optional URL the modal renders as a "Required Settings" style notice
36
+ * below the wallet row (e.g. a Binance CROSS-network setup guide).
37
+ * Keep undefined to hide the notice.
38
+ */
39
+ readonly guideUrl?: string;
40
+ /** Override the default "Required Settings" CTA label. */
41
+ readonly guideLabel?: string;
42
+ }
43
+ interface ConnectorRegistry {
44
+ readonly entries: readonly ConnectorEntry[];
45
+ getEntry(walletId: WalletId): ConnectorEntry | undefined;
46
+ /**
47
+ * All entries that share a wagmi connectorId. Used when a single wagmi
48
+ * connector serves multiple walletIds (e.g. `cross_wallet` and `binance`
49
+ * both go through the shared `walletConnect` connector) — the caller
50
+ * disambiguates via the user's connect-intent hint.
51
+ */
52
+ getEntriesByConnectorId(connectorId: string): readonly ConnectorEntry[];
53
+ /**
54
+ * Convenience: returns the first entry for the given connectorId.
55
+ * Prefer {@link getEntriesByConnectorId} when collisions are expected.
56
+ */
57
+ getEntryByConnectorId(connectorId: string): ConnectorEntry | undefined;
58
+ toWalletDescriptors(): WalletDescriptor[];
59
+ }
60
+ declare function createConnectorRegistry(entries: ConnectorEntry[]): ConnectorRegistry;
61
+ /**
62
+ * Resolve the currently connected walletId from the active wagmi connector.
63
+ *
64
+ * When multiple walletIds share a single connector (e.g. `cross_wallet` and
65
+ * `binance` both go through `walletConnect`), pass the last recorded
66
+ * connect-intent as `preferredWalletId` to disambiguate. If the hint
67
+ * doesn't match any candidate, the first registered entry wins.
68
+ */
69
+ declare function resolveCurrentWallet(registry: ConnectorRegistry, activeConnectorId: string | undefined, preferredWalletId?: WalletId | null): WalletId | null;
70
+
4
71
  /**
5
72
  * Identifies which SDK stack provides the `cross_wallet` connection.
6
73
  *
7
74
  * - `'to-nexus'` — @to-nexus/appkit-adapter-wagmi (CROSS relay server)
8
75
  * - `'reown'` — standard wagmi walletConnect (Reown relay)
9
76
  */
10
- export type CrossWalletProviderKind = 'to-nexus' | 'reown';
77
+ type CrossWalletProviderKind = 'to-nexus' | 'reown';
11
78
  /**
12
79
  * Optional connector + registry entry pair passed into the adapter.
13
80
  * Used by `createCrossxConfig` to contribute app-level connectors the
14
81
  * adapter cannot produce itself — notably the embedded wallet.
15
82
  */
16
- export interface ExtraConnector {
83
+ interface ExtraConnector {
17
84
  readonly connector: CreateConnectorFn;
18
85
  /**
19
86
  * Registry entry for this connector, or `null` when the connector is
@@ -23,11 +90,11 @@ export interface ExtraConnector {
23
90
  */
24
91
  readonly registryEntry: ConnectorEntry | null;
25
92
  }
26
- export interface BuildWagmiConfigInput {
93
+ interface BuildWagmiConfigInput {
27
94
  readonly kitConfig: CrossConnectKitConfig;
28
95
  readonly extraConnectors: readonly ExtraConnector[];
29
96
  }
30
- export interface BuildWagmiConfigOutput {
97
+ interface BuildWagmiConfigOutput {
31
98
  readonly wagmiConfig: Config;
32
99
  /**
33
100
  * Registry entries covering every wallet the DApp should be able to
@@ -37,7 +104,7 @@ export interface BuildWagmiConfigOutput {
37
104
  */
38
105
  readonly registryEntries: readonly ConnectorEntry[];
39
106
  }
40
- export interface WalletConnectAdapterContext {
107
+ interface WalletConnectAdapterContext {
41
108
  readonly kitConfig: CrossConnectKitConfig;
42
109
  /**
43
110
  * Currently active theme as resolved by `CrossConnectKitProvider`
@@ -61,7 +128,7 @@ export interface WalletConnectAdapterContext {
61
128
  * `@nexus-cross/connect-kit-wagmi/to-nexus` — default, posa-compatible
62
129
  * `@nexus-cross/connect-kit-wagmi/reown` — fallback, no @to-nexus/* dependency
63
130
  */
64
- export interface WalletConnectAdapter {
131
+ interface WalletConnectAdapter {
65
132
  readonly providerKind: CrossWalletProviderKind;
66
133
  /**
67
134
  * Construct the wagmi config for this adapter. Called once by
@@ -105,6 +172,5 @@ export interface WalletConnectAdapter {
105
172
  */
106
173
  closeModal?(ctx: WalletConnectAdapterContext): void;
107
174
  }
108
- /** WalletId handled by the walletConnect transport. */
109
- export declare const ADAPTER_WALLET_ID: WalletId;
110
- //# sourceMappingURL=types.d.ts.map
175
+
176
+ export { type ConnectorRegistry as C, type ProviderKind as P, type WalletConnectAdapter as W, type ConnectorEntry as a, type CrossWalletProviderKind as b, type WalletConnectAdapterContext as c, createConnectorRegistry as d, resolveCurrentWallet as r };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cross/connect-kit-wagmi",
3
- "version": "1.1.4",
3
+ "version": "1.3.0",
4
4
  "description": "wagmi connector adapters for @nexus-cross/connect-kit — embedded wallet, WalletConnect",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,13 +26,14 @@
26
26
  "files": [
27
27
  "dist"
28
28
  ],
29
+ "sideEffects": false,
29
30
  "publishConfig": {
30
31
  "registry": "https://registry.npmjs.org",
31
32
  "access": "public"
32
33
  },
33
34
  "dependencies": {
34
- "@nexus-cross/crossx-sdk-core": "2.2.4-beta.2",
35
- "@nexus-cross/crossx-sdk-wagmi": "2.2.4-beta.2",
35
+ "@nexus-cross/crossx-sdk-core": "2.3.0",
36
+ "@nexus-cross/crossx-sdk-wagmi": "2.3.0",
36
37
  "@reown/appkit": "1.8.19",
37
38
  "@reown/appkit-adapter-wagmi": "1.8.19",
38
39
  "@reown/appkit-wallet-button": "1.8.19",
@@ -40,7 +41,8 @@
40
41
  "@to-nexus/appkit-common": "1.19.4",
41
42
  "@to-nexus/appkit-core": "1.19.4",
42
43
  "@to-nexus/sdk": "1.19.4",
43
- "@nexus-cross/connect-kit-core": "1.1.4"
44
+ "@nexus-cross/connect-kit-core": "1.3.0",
45
+ "@nexus-cross/crossx-design-system": "0.1.0"
44
46
  },
45
47
  "peerDependencies": {
46
48
  "@wagmi/core": ">=2.0.0 <4",
@@ -49,13 +51,15 @@
49
51
  },
50
52
  "devDependencies": {
51
53
  "@wagmi/core": "^3.4.0",
54
+ "tsup": "^8.4.0",
55
+ "typescript": "^5.7.0",
52
56
  "viem": "^2.21.0",
53
57
  "wagmi": "^3.6.0"
54
58
  },
55
59
  "license": "MIT",
56
60
  "scripts": {
57
- "build": "tsc",
58
- "dev": "tsc --watch",
61
+ "build": "tsup",
62
+ "dev": "tsup --watch",
59
63
  "test": "vitest run",
60
64
  "test:watch": "vitest",
61
65
  "typecheck": "tsc --noEmit"
@@ -1,12 +0,0 @@
1
- import type { Config } from 'wagmi';
2
- import type { OAuthPort } from '@nexus-cross/connect-kit-core';
3
- /**
4
- * Concrete {@link OAuthPort} implementation that delegates to crossy-sdk's
5
- * `signInWithProvider`. Mounted on `CrossxConfig.oauth` by
6
- * `createCrossxConfig` when an embedded connector is registered.
7
- *
8
- * The adapter does no UI work and does not surface progress / error
9
- * state — the SDK owns the user-visible OAuth flow (see CLAUDE.md §6).
10
- */
11
- export declare function createCrossySdkOAuthAdapter(crossWagmiConfig: Config): OAuthPort;
12
- //# sourceMappingURL=crossySdkOAuthAdapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crossySdkOAuthAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/crossySdkOAuthAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EACV,SAAS,EAEV,MAAM,+BAA+B,CAAC;AA2CvC;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,gBAAgB,EAAE,MAAM,GACvB,SAAS,CAmDX"}
@@ -1,64 +0,0 @@
1
- const EMBEDDED_CONNECTOR_ID = 'crossx';
2
- /**
3
- * crossy-sdk throws `CROSSxError` with `code: 'ALREADY_AUTHENTICATED'`
4
- * when `signIn` / `signInWithCreate` is called while the embedded session
5
- * is already signed in (e.g. a session restored on reconnect, or a
6
- * double-tap on the social button). Duck-typed by `code` so we don't have
7
- * to import the SDK's error enum into the wagmi package.
8
- */
9
- function isAlreadyAuthenticatedError(err) {
10
- return (typeof err === 'object' &&
11
- err !== null &&
12
- err.code === 'ALREADY_AUTHENTICATED');
13
- }
14
- /**
15
- * Concrete {@link OAuthPort} implementation that delegates to crossy-sdk's
16
- * `signInWithProvider`. Mounted on `CrossxConfig.oauth` by
17
- * `createCrossxConfig` when an embedded connector is registered.
18
- *
19
- * The adapter does no UI work and does not surface progress / error
20
- * state — the SDK owns the user-visible OAuth flow (see CLAUDE.md §6).
21
- */
22
- export function createCrossySdkOAuthAdapter(crossWagmiConfig) {
23
- return {
24
- async signIn(provider) {
25
- const connector = crossWagmiConfig.connectors.find((c) => c.id === EMBEDDED_CONNECTOR_ID);
26
- if (!connector) {
27
- throw new Error('[crossx-kit] cross_embedded connector not configured. ' +
28
- 'Pass `embeddedConnectorFactory` to createCrossxConfig.');
29
- }
30
- if (typeof connector.getProvider !== 'function') {
31
- throw new Error('[crossx-kit] cross_embedded connector does not expose getProvider().');
32
- }
33
- const ext = (await connector.getProvider());
34
- const sdk = ext?.sdk;
35
- const fn = sdk?.signInWithCreate ?? sdk?.signIn;
36
- if (!sdk || typeof fn !== 'function') {
37
- throw new Error('[crossx-kit] crossy-sdk signIn/signInWithCreate is unavailable.');
38
- }
39
- // crossy-sdk signals cancellation in two ways: a thrown CROSSxError
40
- // (e.g. OAuth popup closed / auth failed) OR a resolved
41
- // `{ success: false }` result (e.g. bridge auth timed out without a
42
- // user decision). The OAuthPort contract is "resolve on success,
43
- // reject otherwise" — so surface the latter as a rejection too,
44
- // otherwise the kit's connecting state never releases.
45
- let result;
46
- try {
47
- result = await fn.call(sdk, { provider });
48
- }
49
- catch (err) {
50
- // Already signed in → the user is already in the desired state and
51
- // the cross_embedded connector reconnects on its own. Treat as a
52
- // successful no-op instead of letting the kit's wrapped
53
- // `oauth.signIn` surface an uncaught rejection.
54
- if (isAlreadyAuthenticatedError(err))
55
- return;
56
- throw err;
57
- }
58
- if (result && result.success === false) {
59
- throw new Error(`[crossx-kit] OAuth sign-in did not complete: ${result.error ?? 'unknown reason'}`);
60
- }
61
- },
62
- };
63
- }
64
- //# sourceMappingURL=crossySdkOAuthAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crossySdkOAuthAdapter.js","sourceRoot":"","sources":["../../src/adapters/crossySdkOAuthAdapter.ts"],"names":[],"mappings":"AA8BA,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AAEvC;;;;;;GAMG;AACH,SAAS,2BAA2B,CAAC,GAAY;IAC/C,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACX,GAA0B,CAAC,IAAI,KAAK,uBAAuB,CAC7D,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CACzC,gBAAwB;IAExB,OAAO;QACL,KAAK,CAAC,MAAM,CAAC,QAAuB;YAClC,MAAM,SAAS,GAAG,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAChD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,qBAAqB,CACtC,CAAC;YACF,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CACb,wDAAwD;oBACtD,wDAAwD,CAC3D,CAAC;YACJ,CAAC;YACD,IAAI,OAAO,SAAS,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;gBAChD,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAC;YACJ,CAAC;YACD,MAAM,GAAG,GAAG,CAAC,MAAM,SAAS,CAAC,WAAW,EAAE,CAEzC,CAAC;YACF,MAAM,GAAG,GAAG,GAAG,EAAE,GAAG,CAAC;YACrB,MAAM,EAAE,GAAG,GAAG,EAAE,gBAAgB,IAAI,GAAG,EAAE,MAAM,CAAC;YAChD,IAAI,CAAC,GAAG,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;gBACrC,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;YACJ,CAAC;YACD,oEAAoE;YACpE,wDAAwD;YACxD,oEAAoE;YACpE,iEAAiE;YACjE,gEAAgE;YAChE,uDAAuD;YACvD,IAAI,MAAuB,CAAC;YAC5B,IAAI,CAAC;gBACH,MAAM,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,mEAAmE;gBACnE,iEAAiE;gBACjE,wDAAwD;gBACxD,gDAAgD;gBAChD,IAAI,2BAA2B,CAAC,GAAG,CAAC;oBAAE,OAAO;gBAC7C,MAAM,GAAG,CAAC;YACZ,CAAC;YACD,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;gBACvC,MAAM,IAAI,KAAK,CACb,gDAAgD,MAAM,CAAC,KAAK,IAAI,gBAAgB,EAAE,CACnF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,46 +0,0 @@
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', fallbackConnectorId?: string | undefined): 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
@@ -1 +0,0 @@
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,CAkBhB;AAED,wBAAgB,YAAY,CAC1B,YAAY,EAAE,OAAO,GAAG,OAAO,EAC/B,mBAAmB,GAAE,MAAM,GAAG,SAA2B,GACxD,cAAc,CAehB;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"}
@@ -1,130 +0,0 @@
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
- // Connect via the EIP-6963 rdns connector so we bind to MetaMask's
42
- // own provider object — immune to whoever occupies window.ethereum.
43
- // wagmi's MIPD creates this connector when MetaMask announces itself;
44
- // when absent, runConnect falls back to `fallbackConnectorId` (QR).
45
- connectorId: 'io.metamask',
46
- // Keep the generic ids as aliases so `resolveCurrentWallet` still
47
- // maps a session back to MetaMask if it connected via injected/SDK.
48
- aliasConnectorIds: ['injected', 'metaMaskSDK'],
49
- name: 'MetaMask',
50
- iconUrl: METAMASK_ICON,
51
- installUrl: 'https://metamask.io/download/',
52
- fallbackConnectorId,
53
- };
54
- }
55
- export function binanceEntry(providerKind, fallbackConnectorId = 'walletConnect') {
56
- return {
57
- walletId: 'binance',
58
- providerKind,
59
- type: 'external',
60
- // EIP-6963 rdns connector — Binance Wallet extension announces
61
- // `com.binance.wallet`. Binding to its own provider object avoids the
62
- // window.ethereum ambiguity (Binance may set isMetaMask:true). Falls
63
- // back to WalletConnect QR when the extension isn't installed.
64
- connectorId: 'com.binance.wallet',
65
- aliasConnectorIds: ['walletConnect'],
66
- name: 'Binance Wallet',
67
- iconUrl: BINANCE_ICON,
68
- fallbackConnectorId,
69
- };
70
- }
71
- /**
72
- * Factory for a standard-relay WalletConnect connector that coexists
73
- * with WagmiAdapter's CROSS-relay walletConnect. Used only in
74
- * `toNexusAdapter` mode where the 'walletConnect' id is already taken;
75
- * `reownAdapter` mode just uses the built-in id directly.
76
- *
77
- * `showQrModal: true` delegates QR rendering to `@walletconnect/modal`
78
- * (pulled in by the provider) so users without an extension can still
79
- * complete the flow without crossx-kit having to ship its own QR UI.
80
- */
81
- export function createReownWalletConnectConnector(params) {
82
- const factory = walletConnect({
83
- projectId: params.projectId,
84
- metadata: params.metadata
85
- ? {
86
- name: params.metadata.name,
87
- description: params.metadata.description ?? '',
88
- url: params.metadata.url,
89
- icons: params.metadata.icons ?? [],
90
- }
91
- : undefined,
92
- showQrModal: true,
93
- });
94
- return ((config) => {
95
- const connector = factory(config);
96
- // Override id so wagmi sees it as a distinct connector from
97
- // WagmiAdapter's CROSS-relay 'walletConnect'.
98
- Object.defineProperty(connector, 'id', {
99
- value: REOWN_WC_CONNECTOR_ID,
100
- configurable: true,
101
- writable: false,
102
- });
103
- Object.defineProperty(connector, 'name', {
104
- value: 'WalletConnect',
105
- configurable: true,
106
- writable: true,
107
- });
108
- return connector;
109
- });
110
- }
111
- /**
112
- * Convert our env-agnostic `NetworkConfig[]` into viem `Chain[]` for
113
- * wagmi's `createConfig`. Only used by the reown path; `toNexusAdapter`
114
- * uses CAIP-formatted preset networks from `@to-nexus/sdk` instead.
115
- */
116
- export function toViemChain(network) {
117
- return {
118
- id: network.id,
119
- name: network.name,
120
- nativeCurrency: network.nativeCurrency,
121
- rpcUrls: {
122
- default: { http: [network.rpcUrl] },
123
- },
124
- blockExplorers: network.blockExplorerUrl
125
- ? { default: { name: 'Explorer', url: network.blockExplorerUrl } }
126
- : undefined,
127
- testnet: network.testnet,
128
- };
129
- }
130
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/adapters/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAA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O,CAAC,EAAE;QACd,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"}
@@ -1,19 +0,0 @@
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`. When the
12
- * user picks MetaMask or Binance from crossx-kit's modal, `beforeConnect`
13
- * prefers Reown wallet-button's direct handoff so mobile users go straight
14
- * to the selected wallet app. If wallet-button metadata is unavailable,
15
- * it falls back to Reown's trimmed Connect view.
16
- */
17
- export declare function reownAdapter(_options?: ReownAdapterOptions): WalletConnectAdapter;
18
- export type { CreateConnectorFn };
19
- //# sourceMappingURL=reownAdapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reownAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/reownAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAoBvD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AAmNpB,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACvC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,GAAE,mBAAwB,GACjC,oBAAoB,CAiFtB;AAID,YAAY,EAAE,iBAAiB,EAAE,CAAC"}