@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.
- package/README.md +195 -0
- package/dist/adapters/helpers.d.ts +46 -0
- package/dist/adapters/helpers.d.ts.map +1 -0
- package/dist/adapters/helpers.js +124 -0
- package/dist/adapters/helpers.js.map +1 -0
- package/dist/adapters/reownAdapter.d.ts +20 -0
- package/dist/adapters/reownAdapter.d.ts.map +1 -0
- package/dist/adapters/reownAdapter.js +213 -0
- package/dist/adapters/reownAdapter.js.map +1 -0
- package/dist/adapters/toNexusAdapter.d.ts +12 -0
- package/dist/adapters/toNexusAdapter.d.ts.map +1 -0
- package/dist/adapters/toNexusAdapter.js +167 -0
- package/dist/adapters/toNexusAdapter.js.map +1 -0
- package/dist/adapters/types.d.ts +101 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +3 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/config/createCrossxConfig.d.ts +75 -0
- package/dist/config/createCrossxConfig.d.ts.map +1 -0
- package/dist/config/createCrossxConfig.js +77 -0
- package/dist/config/createCrossxConfig.js.map +1 -0
- package/dist/connectors/embeddedConnector.d.ts +30 -0
- package/dist/connectors/embeddedConnector.d.ts.map +1 -0
- package/dist/connectors/embeddedConnector.js +43 -0
- package/dist/connectors/embeddedConnector.js.map +1 -0
- package/dist/connectors/extensionConnector.d.ts +7 -0
- package/dist/connectors/extensionConnector.d.ts.map +1 -0
- package/dist/connectors/extensionConnector.js +60 -0
- package/dist/connectors/extensionConnector.js.map +1 -0
- package/dist/connectors/walletConnectConnector.d.ts +19 -0
- package/dist/connectors/walletConnectConnector.d.ts.map +1 -0
- package/dist/connectors/walletConnectConnector.js +33 -0
- package/dist/connectors/walletConnectConnector.js.map +1 -0
- package/dist/embedded.d.ts +19 -0
- package/dist/embedded.d.ts.map +1 -0
- package/dist/embedded.js +18 -0
- package/dist/embedded.js.map +1 -0
- package/dist/events.d.ts +11 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +17 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/registry/ConnectorRegistry.d.ts +68 -0
- package/dist/registry/ConnectorRegistry.d.ts.map +1 -0
- package/dist/registry/ConnectorRegistry.js +52 -0
- package/dist/registry/ConnectorRegistry.js.map +1 -0
- package/dist/reown.d.ts +3 -0
- package/dist/reown.d.ts.map +1 -0
- package/dist/reown.js +2 -0
- package/dist/reown.js.map +1 -0
- package/dist/ssr.d.ts +43 -0
- package/dist/ssr.d.ts.map +1 -0
- package/dist/ssr.js +50 -0
- package/dist/ssr.js.map +1 -0
- package/dist/to-nexus.d.ts +3 -0
- package/dist/to-nexus.d.ts.map +1 -0
- package/dist/to-nexus.js +2 -0
- package/dist/to-nexus.js.map +1 -0
- package/dist/utils/sessionStorage.d.ts +21 -0
- package/dist/utils/sessionStorage.d.ts.map +1 -0
- package/dist/utils/sessionStorage.js +55 -0
- package/dist/utils/sessionStorage.js.map +1 -0
- package/dist/utils/theme.d.ts +58 -0
- package/dist/utils/theme.d.ts.map +1 -0
- package/dist/utils/theme.js +112 -0
- package/dist/utils/theme.js.map +1 -0
- package/dist/wallets/detection.d.ts +28 -0
- package/dist/wallets/detection.d.ts.map +1 -0
- package/dist/wallets/detection.js +187 -0
- package/dist/wallets/detection.js.map +1 -0
- package/dist/wallets/icons.d.ts +20 -0
- package/dist/wallets/icons.d.ts.map +1 -0
- package/dist/wallets/icons.js +33 -0
- package/dist/wallets/icons.js.map +1 -0
- package/dist/wallets/registry.d.ts +3 -0
- package/dist/wallets/registry.d.ts.map +1 -0
- package/dist/wallets/registry.js +33 -0
- package/dist/wallets/registry.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge between the `--wi-*` CSS variables exposed by
|
|
3
|
+
* `@nexus-cross/dapp-ui`'s `WalletInfo` and `SDKThemeTokens` consumed by
|
|
4
|
+
* `crossy-sdk-js`'s embedded login modal.
|
|
5
|
+
*
|
|
6
|
+
* DApps typically theme their shell once (either by overriding `--wi-*`
|
|
7
|
+
* on `:root` or by relying on WalletInfo's built-in light/dark
|
|
8
|
+
* defaults). This helper reads that state at connector-creation time and
|
|
9
|
+
* forwards it into the embedded SDK so its modal renders with the same
|
|
10
|
+
* palette as WalletInfo — and by extension `OtherWalletsModal`, which
|
|
11
|
+
* also consumes `--wi-*`.
|
|
12
|
+
*
|
|
13
|
+
* Resolution order per token:
|
|
14
|
+
* 1. `--wi-*` CSS variable on `document.documentElement` (DApp override)
|
|
15
|
+
* 2. WalletInfo's built-in default for the requested mode
|
|
16
|
+
* 3. (embedded SDK's own default — we omit the key entirely)
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* WalletInfo's built-in default palette. Sourced from
|
|
20
|
+
* `cross-app-launcher/dist/index.js` inline CSS — kept in sync so the
|
|
21
|
+
* embedded SDK matches even when the DApp has not overridden `--wi-*`.
|
|
22
|
+
*/
|
|
23
|
+
const WALLET_INFO_DEFAULTS = {
|
|
24
|
+
light: {
|
|
25
|
+
bg: '#ffffff',
|
|
26
|
+
surfaceDefault: 'rgba(18,18,18,0.05)',
|
|
27
|
+
surfaceSubtle: 'rgba(18,18,18,0.1)',
|
|
28
|
+
borderDefault: 'rgba(18,18,18,0.05)',
|
|
29
|
+
borderSubtle: 'rgba(18,18,18,0.1)',
|
|
30
|
+
textIconPrimary: '#121212',
|
|
31
|
+
textIconSecondary: 'rgba(18,18,18,0.7)',
|
|
32
|
+
textIconTertiary: 'rgba(18,18,18,0.5)',
|
|
33
|
+
primary: '#019d92',
|
|
34
|
+
secondary: '#e70077',
|
|
35
|
+
},
|
|
36
|
+
dark: {
|
|
37
|
+
bg: '#121212',
|
|
38
|
+
surfaceDefault: 'rgba(255,255,255,0.05)',
|
|
39
|
+
surfaceSubtle: 'rgba(255,255,255,0.1)',
|
|
40
|
+
borderDefault: 'rgba(255,255,255,0.05)',
|
|
41
|
+
borderSubtle: 'rgba(255,255,255,0.1)',
|
|
42
|
+
textIconPrimary: '#ffffff',
|
|
43
|
+
textIconSecondary: 'rgba(255,255,255,0.7)',
|
|
44
|
+
textIconTertiary: 'rgba(255,255,255,0.5)',
|
|
45
|
+
primary: '#019d92',
|
|
46
|
+
secondary: '#e70077',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* WalletInfo CSS variable → SDK override key. Keep in sync with
|
|
51
|
+
* `packages/react/src/components/OtherWalletsModal.tsx`.
|
|
52
|
+
*/
|
|
53
|
+
const WI_VARS = {
|
|
54
|
+
primary: '--wi-primary',
|
|
55
|
+
secondary: '--wi-secondary',
|
|
56
|
+
bg: '--wi-surface-bg',
|
|
57
|
+
surfaceDefault: '--wi-surface-default',
|
|
58
|
+
surfaceSubtle: '--wi-surface-subtle',
|
|
59
|
+
borderDefault: '--wi-border-default',
|
|
60
|
+
borderSubtle: '--wi-border-subtle',
|
|
61
|
+
textIconPrimary: '--wi-texticon-primary',
|
|
62
|
+
textIconSecondary: '--wi-texticon-secondary',
|
|
63
|
+
textIconTertiary: '--wi-texticon-tertiary',
|
|
64
|
+
// Not exposed by WalletInfo — omit (SDK falls back to its own default).
|
|
65
|
+
onPrimary: '',
|
|
66
|
+
error: '',
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Read overridden `--wi-*` values from `document.documentElement`.
|
|
70
|
+
* Empty/absent variables are skipped. Returns `undefined` when called
|
|
71
|
+
* outside a browser environment.
|
|
72
|
+
*/
|
|
73
|
+
export function readWalletInfoTokens() {
|
|
74
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
let cs;
|
|
78
|
+
try {
|
|
79
|
+
cs = getComputedStyle(document.documentElement);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
const out = {};
|
|
85
|
+
for (const [key, cssName] of Object.entries(WI_VARS)) {
|
|
86
|
+
if (!cssName)
|
|
87
|
+
continue;
|
|
88
|
+
const value = cs.getPropertyValue(cssName).trim();
|
|
89
|
+
if (value)
|
|
90
|
+
out[key] = value;
|
|
91
|
+
}
|
|
92
|
+
return Object.keys(out).length ? out : undefined;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Build the `themeTokens` argument for `crossxConnector`. Merges
|
|
96
|
+
* WalletInfo's built-in mode defaults with any `--wi-*` overrides on
|
|
97
|
+
* `:root` — the latter takes precedence per CSS cascade.
|
|
98
|
+
*
|
|
99
|
+
* The same resolved palette is applied to both `light` and `dark`
|
|
100
|
+
* entries. `crossxConnector`'s own `theme` prop then selects which
|
|
101
|
+
* entry to display; setting both prevents the SDK from flipping into a
|
|
102
|
+
* mismatched palette if `autoDetectTheme` is enabled elsewhere.
|
|
103
|
+
*/
|
|
104
|
+
export function deriveSDKThemeTokensFromWalletInfo(mode = 'dark') {
|
|
105
|
+
const defaults = WALLET_INFO_DEFAULTS[mode];
|
|
106
|
+
const overrides = readWalletInfoTokens();
|
|
107
|
+
const merged = overrides
|
|
108
|
+
? { ...defaults, ...overrides }
|
|
109
|
+
: { ...defaults };
|
|
110
|
+
return { light: merged, dark: merged };
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA2BH;;;;GAIG;AACH,MAAM,oBAAoB,GAAoE;IAC5F,KAAK,EAAE;QACL,EAAE,EAAE,SAAS;QACb,cAAc,EAAE,qBAAqB;QACrC,aAAa,EAAE,oBAAoB;QACnC,aAAa,EAAE,qBAAqB;QACpC,YAAY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AO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAElD,EAAE,CAAC;QACF,IAAI,CAAC,OAAO;YAAE,SAAS;QACvB,MAAM,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QAClD,IAAI,KAAK;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC9B,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kCAAkC,CAChD,OAAyB,MAAM;IAE/B,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,oBAAoB,EAAE,CAAC;IACzC,MAAM,MAAM,GAA2B,SAAS;QAC9C,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,GAAG,SAAS,EAAE;QAC/B,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC;IACpB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { WalletDescriptor } from '@nexus-cross/connect-kit-core';
|
|
2
|
+
interface EIP6963Detail {
|
|
3
|
+
info: {
|
|
4
|
+
rdns?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
};
|
|
8
|
+
provider: unknown;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Detect installed wallets using EIP-6963 and legacy probing.
|
|
12
|
+
* Returns the wallet registry with `installed` flags populated.
|
|
13
|
+
*/
|
|
14
|
+
export declare function detectWallets(registry?: WalletDescriptor[]): WalletDescriptor[];
|
|
15
|
+
export declare function getAnnouncedProviders(): EIP6963Detail[];
|
|
16
|
+
/**
|
|
17
|
+
* Debug helper — dump what detectWallets sees right now. Call from the
|
|
18
|
+
* browser console when "CROSSx Extension / Not Installed" appears
|
|
19
|
+
* despite having the extension enabled:
|
|
20
|
+
*
|
|
21
|
+
* window.__crossxKit_debugDetect?.()
|
|
22
|
+
*
|
|
23
|
+
* Logs: EIP-6963 announcements, window globals, and per-wallet
|
|
24
|
+
* detection outcome.
|
|
25
|
+
*/
|
|
26
|
+
export declare function debugDetect(): void;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../src/wallets/detection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAsDtE,UAAU,aAAa;IACrB,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAuED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,GAAE,gBAAgB,EAA4B,GACrD,gBAAgB,EAAE,CA2BpB;AAED,wBAAgB,qBAAqB,IAAI,aAAa,EAAE,CAGvD;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,IAAI,CA8BlC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { DEFAULT_WALLET_REGISTRY } from './registry.js';
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
/**
|
|
4
|
+
* CROSSx 1.0 SDK (`@to-nexus/*`) detection helpers. Mirrors
|
|
5
|
+
* `ConnectorUtil.isInstalledCrossExtensionWallet()` at
|
|
6
|
+
* `cross-sdk-js/packages/wallet-button/src/utils/ConnectorUtil.ts` —
|
|
7
|
+
* but called directly via `@to-nexus/appkit-core` so we don't pull in
|
|
8
|
+
* the full wallet-button package (which contains UI widgets we don't
|
|
9
|
+
* need).
|
|
10
|
+
*
|
|
11
|
+
* Only effective when `initCrossSdk()` has run (i.e. the DApp uses
|
|
12
|
+
* `toNexusAdapter`). Under `reownAdapter` or before init, these helpers
|
|
13
|
+
* return `undefined` and we fall back to EIP-6963 + window probing.
|
|
14
|
+
*/
|
|
15
|
+
async function probeCrossSdkExtensionInstalled(rdns) {
|
|
16
|
+
try {
|
|
17
|
+
// Plain dynamic import — @to-nexus/appkit-core is a direct dep of
|
|
18
|
+
// @nexus-cross/connect-kit-wagmi so Vite / Rollup resolves it at build time.
|
|
19
|
+
// Must NOT be marked @vite-ignore (dev server cannot resolve bare
|
|
20
|
+
// specifiers that the bundler hasn't pre-processed).
|
|
21
|
+
const mod = (await import('@to-nexus/appkit-core'));
|
|
22
|
+
const connectors = mod.ConnectorController?.state?.connectors;
|
|
23
|
+
if (!connectors)
|
|
24
|
+
return undefined;
|
|
25
|
+
return connectors.some((c) => (c.type === 'ANNOUNCED' || c.type === 'INJECTED') &&
|
|
26
|
+
c.info?.rdns === rdns);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Kept in-memory; populated asynchronously on first detectWallets() call
|
|
33
|
+
// so subsequent synchronous renders can reflect the SDK's answer.
|
|
34
|
+
let crossExtensionInstalledFromSdk;
|
|
35
|
+
let crossExtensionProbeInFlight = false;
|
|
36
|
+
function refreshSdkProbe(rdns) {
|
|
37
|
+
if (crossExtensionProbeInFlight)
|
|
38
|
+
return;
|
|
39
|
+
crossExtensionProbeInFlight = true;
|
|
40
|
+
void probeCrossSdkExtensionInstalled(rdns).then((installed) => {
|
|
41
|
+
crossExtensionProbeInFlight = false;
|
|
42
|
+
if (installed !== undefined) {
|
|
43
|
+
crossExtensionInstalledFromSdk = installed;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
let announcedProviders = [];
|
|
48
|
+
let listenerAttached = false;
|
|
49
|
+
function ensureEIP6963Listener() {
|
|
50
|
+
if (listenerAttached || typeof window === 'undefined')
|
|
51
|
+
return;
|
|
52
|
+
listenerAttached = true;
|
|
53
|
+
window.addEventListener('eip6963:announceProvider', ((e) => {
|
|
54
|
+
if (e.detail?.info) {
|
|
55
|
+
const exists = announcedProviders.some((p) => p.info.rdns === e.detail.info.rdns);
|
|
56
|
+
if (!exists)
|
|
57
|
+
announcedProviders.push(e.detail);
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
window.dispatchEvent(new Event('eip6963:requestProvider'));
|
|
61
|
+
}
|
|
62
|
+
function isRdnsDetected(rdns) {
|
|
63
|
+
return announcedProviders.some((p) => p.info.rdns === rdns);
|
|
64
|
+
}
|
|
65
|
+
function getEIP6963Icon(rdns) {
|
|
66
|
+
const provider = announcedProviders.find((p) => p.info.rdns === rdns);
|
|
67
|
+
return provider?.info.icon;
|
|
68
|
+
}
|
|
69
|
+
function isCrossExtensionDetected() {
|
|
70
|
+
// Primary signal — CROSSx 1.0 SDK's own view of announced/injected
|
|
71
|
+
// connectors. Authoritative when AppKit is initialized.
|
|
72
|
+
if (crossExtensionInstalledFromSdk === true)
|
|
73
|
+
return true;
|
|
74
|
+
// EIP-6963 announcements captured by our own listener — authoritative
|
|
75
|
+
// regardless of AppKit presence.
|
|
76
|
+
if (isRdnsDetected('nexus.to.crosswallet.desktop'))
|
|
77
|
+
return true;
|
|
78
|
+
// Legacy fallbacks for builds that inject before EIP-6963 announce.
|
|
79
|
+
if (typeof window === 'undefined')
|
|
80
|
+
return false;
|
|
81
|
+
const w = window;
|
|
82
|
+
if (w.cross || w.crossWallet)
|
|
83
|
+
return true;
|
|
84
|
+
const eth = w.ethereum;
|
|
85
|
+
if (!eth)
|
|
86
|
+
return false;
|
|
87
|
+
if (eth.isCross)
|
|
88
|
+
return true;
|
|
89
|
+
if (eth.providers?.some((p) => p.isCross))
|
|
90
|
+
return true;
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
function isMetaMaskDetected() {
|
|
94
|
+
if (typeof window === 'undefined')
|
|
95
|
+
return false;
|
|
96
|
+
const eth = window.ethereum;
|
|
97
|
+
if (!eth)
|
|
98
|
+
return false;
|
|
99
|
+
if (eth.providers?.length) {
|
|
100
|
+
return eth.providers.some((p) => p.isMetaMask && !p.isCross && !p.isBinance);
|
|
101
|
+
}
|
|
102
|
+
return !!eth.isMetaMask && !eth.isCross && !eth.isBinance;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Detect installed wallets using EIP-6963 and legacy probing.
|
|
106
|
+
* Returns the wallet registry with `installed` flags populated.
|
|
107
|
+
*/
|
|
108
|
+
export function detectWallets(registry = DEFAULT_WALLET_REGISTRY) {
|
|
109
|
+
ensureEIP6963Listener();
|
|
110
|
+
// Fire-and-forget: the next call to detectWallets() will observe the
|
|
111
|
+
// cached result. Matches how posa's async detection re-checks after
|
|
112
|
+
// ~1000ms and how OtherWalletsModal re-runs detectWallets on a timer.
|
|
113
|
+
refreshSdkProbe('nexus.to.crosswallet.desktop');
|
|
114
|
+
return registry.map((wallet) => {
|
|
115
|
+
let installed = false;
|
|
116
|
+
const eip6963Icon = wallet.rdns ? getEIP6963Icon(wallet.rdns) : undefined;
|
|
117
|
+
if (wallet.rdns && isRdnsDetected(wallet.rdns)) {
|
|
118
|
+
installed = true;
|
|
119
|
+
}
|
|
120
|
+
else if (wallet.id === 'cross_extension') {
|
|
121
|
+
installed = isCrossExtensionDetected();
|
|
122
|
+
}
|
|
123
|
+
else if (wallet.id === 'metamask') {
|
|
124
|
+
installed = isMetaMaskDetected();
|
|
125
|
+
}
|
|
126
|
+
else if (wallet.id === 'cross_embedded') {
|
|
127
|
+
installed = true;
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
...wallet,
|
|
131
|
+
installed,
|
|
132
|
+
iconUrl: eip6963Icon || wallet.iconUrl,
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
export function getAnnouncedProviders() {
|
|
137
|
+
ensureEIP6963Listener();
|
|
138
|
+
return [...announcedProviders];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Debug helper — dump what detectWallets sees right now. Call from the
|
|
142
|
+
* browser console when "CROSSx Extension / Not Installed" appears
|
|
143
|
+
* despite having the extension enabled:
|
|
144
|
+
*
|
|
145
|
+
* window.__crossxKit_debugDetect?.()
|
|
146
|
+
*
|
|
147
|
+
* Logs: EIP-6963 announcements, window globals, and per-wallet
|
|
148
|
+
* detection outcome.
|
|
149
|
+
*/
|
|
150
|
+
export function debugDetect() {
|
|
151
|
+
if (typeof window === 'undefined')
|
|
152
|
+
return;
|
|
153
|
+
ensureEIP6963Listener();
|
|
154
|
+
const w = window;
|
|
155
|
+
// eslint-disable-next-line no-console
|
|
156
|
+
console.group('[crossx-kit] debugDetect');
|
|
157
|
+
// eslint-disable-next-line no-console
|
|
158
|
+
console.log('EIP-6963 announced:', announcedProviders.map((p) => p.info));
|
|
159
|
+
// eslint-disable-next-line no-console
|
|
160
|
+
console.log('window.crossWallet:', typeof w.crossWallet);
|
|
161
|
+
// eslint-disable-next-line no-console
|
|
162
|
+
console.log('window.cross:', typeof w.cross);
|
|
163
|
+
// eslint-disable-next-line no-console
|
|
164
|
+
console.log('window.ethereum:', {
|
|
165
|
+
exists: !!w.ethereum,
|
|
166
|
+
isMetaMask: w.ethereum?.isMetaMask,
|
|
167
|
+
isCross: w.ethereum?.isCross,
|
|
168
|
+
isBinance: w.ethereum?.isBinance,
|
|
169
|
+
providers: w.ethereum?.providers?.map((p) => ({
|
|
170
|
+
isMetaMask: p.isMetaMask,
|
|
171
|
+
isCross: p.isCross,
|
|
172
|
+
isBinance: p.isBinance,
|
|
173
|
+
})),
|
|
174
|
+
});
|
|
175
|
+
// eslint-disable-next-line no-console
|
|
176
|
+
console.log('CROSSx SDK probe (ConnectorController.connectors):', crossExtensionInstalledFromSdk);
|
|
177
|
+
// eslint-disable-next-line no-console
|
|
178
|
+
console.log('Detected wallets:', detectWallets(DEFAULT_WALLET_REGISTRY));
|
|
179
|
+
// eslint-disable-next-line no-console
|
|
180
|
+
console.groupEnd();
|
|
181
|
+
}
|
|
182
|
+
// Expose the debugger globally so users can invoke it from devtools
|
|
183
|
+
// without importing anything.
|
|
184
|
+
if (typeof window !== 'undefined') {
|
|
185
|
+
window.__crossxKit_debugDetect = debugDetect;
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.js","sourceRoot":"","sources":["../../src/wallets/detection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,uDAAuD;AAEvD;;;;;;;;;;;GAWG;AACH,KAAK,UAAU,+BAA+B,CAAC,IAAY;IACzD,IAAI,CAAC;QACH,kEAAkE;QAClE,6EAA6E;QAC7E,kEAAkE;QAClE,qDAAqD;QACrD,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAEjD,CAAC;QACF,MAAM,UAAU,GAAG,GAAG,CAAC,mBAAmB,EAAE,KAAK,EAAE,UAAU,CAAC;QAC9D,IAAI,CAAC,UAAU;YAAE,OAAO,SAAS,CAAC;QAClC,OAAO,UAAU,CAAC,IAAI,CACpB,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC;YACjD,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CACxB,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,kEAAkE;AAClE,IAAI,8BAAmD,CAAC;AACxD,IAAI,2BAA2B,GAAG,KA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C,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC,CAAC;IACzE,sCAAsC;IACtC,OAAO,CAAC,QAAQ,EAAE,CAAC;AACrB,CAAC;AAED,oEAAoE;AACpE,8BAA8B;AAC9B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACjC,MAAc,CAAC,uBAAuB,GAAG,WAAW,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet icons — ported from posa's `src/assets/icons/wallet-*.svg` and
|
|
3
|
+
* inlined as `data:image/svg+xml` URIs so `@nexus-cross/connect-kit-wagmi` stays a
|
|
4
|
+
* self-contained, bundler-agnostic module (no SVG loader required).
|
|
5
|
+
*
|
|
6
|
+
* Source references (read-only, posa repo):
|
|
7
|
+
* wallet-crossx.svg → CROSSX_ICON (cross_wallet, cross_embedded)
|
|
8
|
+
* wallet-crossx.svg → EXTENSION_ICON (cross_extension — shares art)
|
|
9
|
+
* wallet-metamask.svg → METAMASK_ICON
|
|
10
|
+
* wallet-binance.svg → BINANCE_ICON
|
|
11
|
+
* wallet-walletconnect.svg → WALLETCONNECT_ICON (generic WC fallback)
|
|
12
|
+
*/
|
|
13
|
+
export declare const CROSSX_ICON: string;
|
|
14
|
+
export declare const EXTENSION_ICON: string;
|
|
15
|
+
export declare const METAMASK_ICON: string;
|
|
16
|
+
export declare const BINANCE_ICON: string;
|
|
17
|
+
export declare const WALLETCONNECT_ICON: string;
|
|
18
|
+
export declare const GOOGLE_ICON: string;
|
|
19
|
+
export declare const APPLE_ICON: string;
|
|
20
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/wallets/icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAsBH,eAAO,MAAM,WAAW,QAAwB,CAAC;AACjD,eAAO,MAAM,cAAc,QAAwB,CAAC;AACpD,eAAO,MAAM,aAAa,QAA0B,CAAC;AACrD,eAAO,MAAM,YAAY,QAAyB,CAAC;AACnD,eAAO,MAAM,kBAAkB,QAA+B,CAAC;AAC/D,eAAO,MAAM,WAAW,QAAwB,CAAC;AACjD,eAAO,MAAM,UAAU,QAAuB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet icons — ported from posa's `src/assets/icons/wallet-*.svg` and
|
|
3
|
+
* inlined as `data:image/svg+xml` URIs so `@nexus-cross/connect-kit-wagmi` stays a
|
|
4
|
+
* self-contained, bundler-agnostic module (no SVG loader required).
|
|
5
|
+
*
|
|
6
|
+
* Source references (read-only, posa repo):
|
|
7
|
+
* wallet-crossx.svg → CROSSX_ICON (cross_wallet, cross_embedded)
|
|
8
|
+
* wallet-crossx.svg → EXTENSION_ICON (cross_extension — shares art)
|
|
9
|
+
* wallet-metamask.svg → METAMASK_ICON
|
|
10
|
+
* wallet-binance.svg → BINANCE_ICON
|
|
11
|
+
* wallet-walletconnect.svg → WALLETCONNECT_ICON (generic WC fallback)
|
|
12
|
+
*/
|
|
13
|
+
const CROSSX_SVG = `<svg preserveAspectRatio="none" width="100%" height="100%" overflow="visible" style="display: block;" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#c0)"><path d="M18 36C27.9411 36 36 27.9411 36 18C36 8.05887 27.9411 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36Z" fill="#00D5AA"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18.2903 2.57169L21.3525 5.63385V10.6471L25.3058 6.69381L29.6364 11.0244L25.7226 14.9381H18.2903C16.5992 14.9381 15.2283 16.309 15.2283 18.0003C15.2283 19.6915 16.5992 21.0624 18.2903 21.0624H25.6836L29.6365 25.0154L25.3059 29.3459L21.3525 25.3925V30.3666L18.2903 33.4288L15.2283 30.3666V25.4326L11.3148 29.3459L6.98426 25.0154L10.9372 21.0624H5.92394L2.86178 18.0003L5.92394 14.9381H10.8981L6.98437 11.0244L11.3149 6.69383L15.2283 10.6071V5.63385L18.2903 2.57169Z" fill="#000"/></g><defs><clipPath id="c0"><rect width="36" height="36" fill="#fff"/></clipPath></defs></svg>`;
|
|
14
|
+
const METAMASK_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 28 28" fill="none"><g clip-path="url(#m0)"><path d="M26.07 26.93L20.06 25.07L15.53 27.88L12.37 27.88L7.83 25.07L1.83 26.93L0 20.53L1.83 13.44L0 7.44L1.83 0L11.21 5.81H16.69L26.07 0L27.9 7.44L26.07 13.44L27.9 20.53Z" fill="#FF5C16"/><path d="M7.83 20.54L11.96 23.8L7.83 25.07V20.54Z" fill="#FF5C16"/><path d="M20.06 20.54L15.93 23.8L20.06 25.07L20.06 20.54Z" fill="#FF5C16"/><path d="M11.63 15.14L12.78 22.85L11.19 18.56L5.77 17.17L7.83 15.14H11.63Z" fill="#E34807"/><path d="M16.27 15.14L15.12 22.85L16.71 18.56L22.13 17.17L20.07 15.14H16.27Z" fill="#E34807"/><path d="M0 20.53L1.83 13.44H5.76L5.77 17.17L11.19 18.56L12.78 22.85L11.96 23.79L7.83 20.53H0Z" fill="#FF8D5D"/><path d="M27.9 20.53L26.07 13.44H22.14L22.13 17.17L16.71 18.56L15.12 22.85L15.94 23.79L20.07 20.53H27.9Z" fill="#FF8D5D"/><path d="M16.69 5.81H11.21L10.84 9.81L12.78 22.85H15.12L17.06 9.81L16.69 5.81Z" fill="#FF8D5D"/><path d="M15.53 25.34V27.88H12.37V25.34H15.53Z" fill="#C0C4CD"/><path d="M7.83 25.07L12.37 27.88V25.34L11.96 23.79L7.83 25.07Z" fill="#E7EBF6"/><path d="M20.07 25.07L15.53 27.88V25.34L15.94 23.79L20.07 25.07Z" fill="#E7EBF6"/></g><defs><clipPath id="m0"><rect width="28" height="28" fill="#fff"/></clipPath></defs></svg>`;
|
|
15
|
+
const BINANCE_SVG = `<svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z" fill="#F3BA2F"/><path d="M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z" fill="#F3BA2F"/><path d="M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z" fill="#F3BA2F"/><path d="M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z" fill="#F3BA2F"/><path d="M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z" fill="#F3BA2F"/></svg>`;
|
|
16
|
+
const WALLETCONNECT_SVG = `<svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="40" height="40" rx="8" fill="#3B99FC" fill-opacity="0.1"/><path d="M14.5 17C17.5 14 22.5 14 25.5 17L25.9 17.4C26.1 17.6 26.1 17.9 25.9 18.1L24.7 19.3C24.6 19.4 24.4 19.4 24.3 19.3L23.8 18.8C21.7 16.7 18.3 16.7 16.2 18.8L15.6 19.4C15.5 19.5 15.3 19.5 15.2 19.4L14 18.2C13.8 18 13.8 17.7 14 17.5L14.5 17Z" fill="#3B99FC"/><path d="M28 19.5L29 20.5C29.2 20.7 29.2 21 29 21.2L23.5 26.7C23.3 26.9 23 26.9 22.8 26.7L19.2 23.1C19.15 23.05 19.05 23.05 19 23.1L15.4 26.7C15.2 26.9 14.9 26.9 14.7 26.7L9.2 21.2C9 21 9 20.7 9.2 20.5L10.2 19.5C10.4 19.3 10.7 19.3 10.9 19.5L14.5 23.1C14.55 23.15 14.65 23.15 14.7 23.1L18.3 19.5C18.5 19.3 18.8 19.3 19 19.5L22.6 23.1C22.65 23.15 22.75 23.15 22.8 23.1L26.4 19.5C26.6 19.3 26.9 19.3 27.1 19.5L28 19.5Z" fill="#3B99FC"/></svg>`;
|
|
17
|
+
// Google "G" — four-color official logo. Used for the connected-button
|
|
18
|
+
// icon when the user signed into crossy-sdk 2.0 via Google OAuth.
|
|
19
|
+
const GOOGLE_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path fill="#FFC107" d="M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"/><path fill="#FF3D00" d="M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"/><path fill="#4CAF50" d="M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"/><path fill="#1976D2" d="M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"/></svg>`;
|
|
20
|
+
// Apple logomark — solid. Colour lands on `currentColor` so the button
|
|
21
|
+
// foreground picks it up (white on dark, black on light).
|
|
22
|
+
const APPLE_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/></svg>`;
|
|
23
|
+
function toDataUri(svg) {
|
|
24
|
+
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
25
|
+
}
|
|
26
|
+
export const CROSSX_ICON = toDataUri(CROSSX_SVG);
|
|
27
|
+
export const EXTENSION_ICON = toDataUri(CROSSX_SVG);
|
|
28
|
+
export const METAMASK_ICON = toDataUri(METAMASK_SVG);
|
|
29
|
+
export const BINANCE_ICON = toDataUri(BINANCE_SVG);
|
|
30
|
+
export const WALLETCONNECT_ICON = toDataUri(WALLETCONNECT_SVG);
|
|
31
|
+
export const GOOGLE_ICON = toDataUri(GOOGLE_SVG);
|
|
32
|
+
export const APPLE_ICON = toDataUri(APPLE_SVG);
|
|
33
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/wallets/icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,UAAU,GAAG,67BAA67B,CAAC;AAEj9B,MAAM,YAAY,GAAG,4wCAA4wC,CAAC;AAElyC,MAAM,WAAW,GAAG,ujBAAujB,CAAC;AAE5kB,MAAM,iBAAiB,GAAG,02BAA02B,CAAC;AAEr4B,uEAAuE;AACvE,kEAAkE;AAClE,MAAM,UAAU,GAAG,kiBAAkiB,CAAC;AAEtjB,uEAAuE;AACvE,0DAA0D;AAC1D,MAAM,SAAS,GAAG,+ZAA+Z,CAAC;AAElb,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,sBAAsB,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;AACzD,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/wallets/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,EA8BrD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CROSSX_ICON, EXTENSION_ICON, METAMASK_ICON, BINANCE_ICON } from './icons.js';
|
|
2
|
+
export const DEFAULT_WALLET_REGISTRY = [
|
|
3
|
+
{
|
|
4
|
+
id: 'cross_embedded',
|
|
5
|
+
name: 'CROSSx',
|
|
6
|
+
type: 'embedded',
|
|
7
|
+
iconUrl: CROSSX_ICON,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
id: 'cross_extension',
|
|
11
|
+
name: 'CROSSx Extension',
|
|
12
|
+
type: 'extension',
|
|
13
|
+
iconUrl: EXTENSION_ICON,
|
|
14
|
+
rdns: 'nexus.to.crosswallet.desktop',
|
|
15
|
+
installUrl: 'https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: 'metamask',
|
|
19
|
+
name: 'MetaMask',
|
|
20
|
+
type: 'external',
|
|
21
|
+
iconUrl: METAMASK_ICON,
|
|
22
|
+
rdns: 'io.metamask',
|
|
23
|
+
installUrl: 'https://metamask.io/download/',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'binance',
|
|
27
|
+
name: 'Binance Wallet',
|
|
28
|
+
type: 'external',
|
|
29
|
+
iconUrl: BINANCE_ICON,
|
|
30
|
+
rdns: 'com.binance.wallet',
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/wallets/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEtF,MAAM,CAAC,MAAM,uBAAuB,GAAuB;IACzD;QACE,EAAE,EAAE,gBAAgB;QACpB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,WAAW;KACrB;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,cAAc;QACvB,IAAI,EAAE,8BAA8B;QACpC,UAAU,EAAE,kFAAkF;KAC/F;IACD;QACE,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,aAAa;QACtB,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,+BAA+B;KAC5C;IACD;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,oBAAoB;KAC3B;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nexus-cross/connect-kit-wagmi",
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
|
+
"description": "wagmi connector adapters for @nexus-cross/connect-kit — embedded wallet, WalletConnect",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./to-nexus": {
|
|
14
|
+
"types": "./dist/to-nexus.d.ts",
|
|
15
|
+
"import": "./dist/to-nexus.js"
|
|
16
|
+
},
|
|
17
|
+
"./reown": {
|
|
18
|
+
"types": "./dist/reown.d.ts",
|
|
19
|
+
"import": "./dist/reown.js"
|
|
20
|
+
},
|
|
21
|
+
"./embedded": {
|
|
22
|
+
"types": "./dist/embedded.d.ts",
|
|
23
|
+
"import": "./dist/embedded.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"registry": "https://registry.npmjs.org",
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@nexus-cross/crossx-sdk-core": "2.1.0-beta.2",
|
|
35
|
+
"@nexus-cross/crossx-sdk-wagmi": "2.1.0-beta.2",
|
|
36
|
+
"@reown/appkit": "^1.8.0",
|
|
37
|
+
"@reown/appkit-adapter-wagmi": "^1.8.0",
|
|
38
|
+
"@to-nexus/appkit-adapter-wagmi": "^1.19.1",
|
|
39
|
+
"@to-nexus/appkit-common": "^1.19.1",
|
|
40
|
+
"@to-nexus/appkit-core": "^1.19.1",
|
|
41
|
+
"@to-nexus/sdk": "^1.19.1",
|
|
42
|
+
"@nexus-cross/connect-kit-core": "1.0.0-beta.1"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@wagmi/core": "^2.0.0",
|
|
46
|
+
"viem": "^2.0.0",
|
|
47
|
+
"wagmi": "^2.0.0"
|
|
48
|
+
},
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc",
|
|
52
|
+
"dev": "tsc --watch",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"test:watch": "vitest",
|
|
55
|
+
"typecheck": "tsc --noEmit"
|
|
56
|
+
}
|
|
57
|
+
}
|