@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
@@ -0,0 +1 @@
1
+ var l='<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>',i='<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>',h='<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>',p='<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>',C='<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>',e='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><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>';function L(t){return`data:image/svg+xml,${encodeURIComponent(t)}`}var o=L(l),s=L(l),f=L(i),d=L(h),a=L(p),g=L(C),n=L(e);export{o as a,s as b,f as c,d,a as e,g as f,n as g};
@@ -0,0 +1 @@
1
+ var a={light:{bg:"#ffffff",surfaceDefault:"rgba(18,18,18,0.05)",surfaceSubtle:"rgba(18,18,18,0.1)",borderDefault:"rgba(18,18,18,0.05)",borderSubtle:"rgba(18,18,18,0.1)",textIconPrimary:"#121212",textIconSecondary:"rgba(18,18,18,0.7)",textIconTertiary:"rgba(18,18,18,0.5)",primary:"#019d92",secondary:"#e70077"},dark:{bg:"#121212",surfaceDefault:"rgba(255,255,255,0.05)",surfaceSubtle:"rgba(255,255,255,0.1)",borderDefault:"rgba(255,255,255,0.05)",borderSubtle:"rgba(255,255,255,0.1)",textIconPrimary:"#ffffff",textIconSecondary:"rgba(255,255,255,0.7)",textIconTertiary:"rgba(255,255,255,0.5)",primary:"#019d92",secondary:"#e70077"}},i={primary:"--wi-primary",secondary:"--wi-secondary",bg:"--wi-surface-bg",surfaceDefault:"--wi-surface-default",surfaceSubtle:"--wi-surface-subtle",borderDefault:"--wi-border-default",borderSubtle:"--wi-border-subtle",textIconPrimary:"--wi-texticon-primary",textIconSecondary:"--wi-texticon-secondary",textIconTertiary:"--wi-texticon-tertiary",onPrimary:"",error:""};function d(){if(typeof window>"u"||typeof document>"u")return;let t;try{t=getComputedStyle(document.documentElement)}catch{return}let e={};for(let[n,r]of Object.entries(i)){if(!r)continue;let o=t.getPropertyValue(r).trim();o&&(e[n]=o)}return Object.keys(e).length?e:void 0}function s(t="dark"){let e=a[t],n=d(),r=n?{...e,...n}:{...e};return{light:r,dark:r}}export{d as a,s as b};
@@ -0,0 +1 @@
1
+ import{a as c,b as l,c as u,d as f}from"./chunk-33PCSJXD.js";var r=[{id:"cross_embedded",name:"CROSSx",type:"embedded",iconUrl:c},{id:"cross_extension",name:"CROSSx Extension",type:"extension",iconUrl:l,rdns:"nexus.to.crosswallet.desktop",installUrl:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg"},{id:"metamask",name:"MetaMask",type:"external",iconUrl:u,rdns:"io.metamask",installUrl:"https://metamask.io/download/"},{id:"binance",name:"Binance Wallet",type:"external",iconUrl:f,rdns:"com.binance.wallet"}];async function w(e){try{let o=(await import("@to-nexus/appkit-core")).ConnectorController?.state?.connectors;return o?o.some(s=>(s.type==="ANNOUNCED"||s.type==="INJECTED")&&s.info?.rdns===e):void 0}catch{return}}var d,i=!1;function C(e){i||(i=!0,w(e).then(n=>{i=!1,n!==void 0&&(d=n)}))}var t=[],p=!1;function a(){p||typeof window>"u"||(p=!0,window.addEventListener("eip6963:announceProvider",(e=>{e.detail?.info&&(t.some(o=>o.info.rdns===e.detail.info.rdns)||t.push(e.detail))})),window.dispatchEvent(new Event("eip6963:requestProvider")))}function m(e){return a(),t.some(n=>n.info.rdns===e)}function E(e){return t.find(o=>o.info.rdns===e)?.info.icon}function b(){if(d===!0||m("nexus.to.crosswallet.desktop"))return!0;if(typeof window>"u")return!1;let e=window;if(e.cross||e.crossWallet)return!0;let n=e.ethereum;return n?!!(n.isCross||n.providers?.some(o=>o.isCross)):!1}function g(){if(typeof window>"u")return!1;let e=window.ethereum;return e?e.providers?.length?e.providers.some(n=>n.isMetaMask&&!n.isCross&&!n.isBinance):!!e.isMetaMask&&!e.isCross&&!e.isBinance:!1}function x(e=r){return a(),C("nexus.to.crosswallet.desktop"),e.map(n=>{let o=!1,s=n.rdns?E(n.rdns):void 0;return n.rdns&&m(n.rdns)?o=!0:n.id==="cross_extension"?o=b():n.id==="metamask"?o=g():n.id==="cross_embedded"&&(o=!0),{...n,installed:o,iconUrl:s||n.iconUrl}})}function k(){if(typeof window>"u")return;a();let e=window;console.group("[crossx-kit] debugDetect"),console.log("EIP-6963 announced:",t.map(n=>n.info)),console.log("window.crossWallet:",typeof e.crossWallet),console.log("window.cross:",typeof e.cross),console.log("window.ethereum:",{exists:!!e.ethereum,isMetaMask:e.ethereum?.isMetaMask,isCross:e.ethereum?.isCross,isBinance:e.ethereum?.isBinance,providers:e.ethereum?.providers?.map(n=>({isMetaMask:n.isMetaMask,isCross:n.isCross,isBinance:n.isBinance}))}),console.log("CROSSx SDK probe (ConnectorController.connectors):",d),console.log("Detected wallets:",x(r)),console.groupEnd()}typeof window<"u"&&(window.__crossxKit_debugDetect=k);export{r as a,m as b,x as c,k as d};
@@ -0,0 +1 @@
1
+ import{a as t,b as o,c as r,d as a}from"./chunk-33PCSJXD.js";import{walletConnect as i}from"wagmi/connectors";function s(e="CROSSx Wallet",n="walletConnect"){return{walletId:"cross_wallet",providerKind:"cross",type:"app",connectorId:n,name:e,iconUrl:t}}function d(){return{walletId:"cross_extension",providerKind:"cross",type:"extension",connectorId:"nexus.to.crosswallet.desktop",name:"CROSSx Extension",iconUrl:o,installUrl:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg"}}function C(e,n="walletConnect"){return{walletId:"metamask",providerKind:e,type:"external",connectorId:"io.metamask",aliasConnectorIds:["injected","metaMaskSDK"],name:"MetaMask",iconUrl:r,installUrl:"https://metamask.io/download/",fallbackConnectorId:n}}function m(e,n="walletConnect"){return{walletId:"binance",providerKind:e,type:"external",connectorId:"com.binance.wallet",aliasConnectorIds:["walletConnect"],name:"Binance Wallet",iconUrl:a,fallbackConnectorId:n}}export{s as a,d as b,C as c,m as d};
@@ -1,19 +1,38 @@
1
- /**
2
- * Opt-in entry point for the embedded CROSSx wallet connector.
3
- *
4
- * The underlying `@nexus-cross/crossx-sdk-wagmi` package touches
5
- * `indexedDB` at module load time, which throws under Next.js App Router
6
- * SSR. Importing it only from this subpath lets the core
7
- * `@nexus-cross/connect-kit-wagmi` entry stay server-safe — DApps that need the
8
- * embedded connector pull it in from a client boundary:
9
- *
10
- * ```ts
11
- * // providers.tsx ('use client')
12
- * import { embeddedConnectorFactory } from '@nexus-cross/connect-kit-wagmi/embedded';
13
- * ```
14
- *
15
- * Pass the factory to `createCrossxConfig({ embeddedConnectorFactory })`.
16
- */
17
- export { createEmbeddedConnector, createEmbeddedConnectorFromKitConfig as embeddedConnectorFactory, } from './connectors/embeddedConnector.js';
18
- export type { EmbeddedConnectorConfig } from './connectors/embeddedConnector.js';
19
- //# sourceMappingURL=embedded.d.ts.map
1
+ import { CreateConnectorFn } from 'wagmi';
2
+ import { ThemeMode, ThemeTokens, PinKeyboardOption, CrossConnectKitConfig } from '@nexus-cross/connect-kit-core';
3
+ import { S as SDKThemeTokensShape } from './theme-CjRKvIE1.js';
4
+
5
+ interface EmbeddedConnectorConfig {
6
+ projectId: string;
7
+ appName: string;
8
+ defaultChainId?: number;
9
+ openConnectOtherWallet?: () => void;
10
+ /** Forward to crossxConnector.theme ('light' | 'dark'). */
11
+ themeMode?: ThemeMode;
12
+ /**
13
+ * Explicit theme-token overrides for the embedded modal. When
14
+ * provided, wins over `inheritWalletInfoTheme`. Matches
15
+ * crossy-sdk's `SDKThemeTokens` shape 1:1.
16
+ */
17
+ themeTokens?: ThemeTokens | SDKThemeTokensShape;
18
+ /**
19
+ * When true (and `themeTokens` is not set), read `--wi-*` CSS
20
+ * variables on `:root` and forward matching values as `themeTokens`.
21
+ *
22
+ * Defaults to `false` when a kit-level theme is in play (the
23
+ * `CrossConnectKitProvider` already emits the `--cck-*` namespace the
24
+ * SDK's `themeTokens` will mirror). Set to `true` explicitly to
25
+ * opt-in on top of a DApp that only theme-overrides via `--wi-*`.
26
+ */
27
+ inheritWalletInfoTheme?: boolean;
28
+ /**
29
+ * Forwarded to crossy-sdk's `SDKConfig.pinKeyboard`. Controls whether
30
+ * the mobile PIN modal shows the SDK's virtual numpad or the OS's
31
+ * native numeric keyboard. See `PinKeyboardOption` for the full shape.
32
+ */
33
+ pinKeyboard?: PinKeyboardOption;
34
+ }
35
+ declare function createEmbeddedConnector(config: EmbeddedConnectorConfig): CreateConnectorFn;
36
+ declare function createEmbeddedConnectorFromKitConfig(kitConfig: CrossConnectKitConfig, openConnectOtherWallet?: () => void): CreateConnectorFn | null;
37
+
38
+ export { type EmbeddedConnectorConfig, createEmbeddedConnector, createEmbeddedConnectorFromKitConfig as embeddedConnectorFactory };
package/dist/embedded.js CHANGED
@@ -1,18 +1 @@
1
- /**
2
- * Opt-in entry point for the embedded CROSSx wallet connector.
3
- *
4
- * The underlying `@nexus-cross/crossx-sdk-wagmi` package touches
5
- * `indexedDB` at module load time, which throws under Next.js App Router
6
- * SSR. Importing it only from this subpath lets the core
7
- * `@nexus-cross/connect-kit-wagmi` entry stay server-safe — DApps that need the
8
- * embedded connector pull it in from a client boundary:
9
- *
10
- * ```ts
11
- * // providers.tsx ('use client')
12
- * import { embeddedConnectorFactory } from '@nexus-cross/connect-kit-wagmi/embedded';
13
- * ```
14
- *
15
- * Pass the factory to `createCrossxConfig({ embeddedConnectorFactory })`.
16
- */
17
- export { createEmbeddedConnector, createEmbeddedConnectorFromKitConfig as embeddedConnectorFactory, } from './connectors/embeddedConnector.js';
18
- //# sourceMappingURL=embedded.js.map
1
+ import{b as t}from"./chunk-6BKDRLN2.js";import{crossxConnector as a}from"@nexus-cross/crossx-sdk-wagmi";import{resolveThemeMode as m}from"@nexus-cross/connect-kit-core";function r(e){let o=e.themeTokens??(e.inheritWalletInfoTheme?t(e.themeMode??"dark"):void 0);return a({projectId:e.projectId,appName:e.appName,defaultChainId:e.defaultChainId,openConnectOtherWallet:e.openConnectOtherWallet,...e.themeMode?{theme:e.themeMode}:{},...o?{themeTokens:o}:{},...e.pinKeyboard!==void 0?{pinKeyboard:e.pinKeyboard}:{}})}function p(e,o){let n=e.embeddedProjectId??e.crossProjectId;if(!n||typeof window>"u"||typeof indexedDB>"u")return null;let d=m(e.theme,e.autoDetectTheme);return r({projectId:n,appName:e.appMetadata.name,defaultChainId:e.defaultNetwork?.id??e.networks[0]?.id,openConnectOtherWallet:o,themeMode:d,themeTokens:e.themeTokens,inheritWalletInfoTheme:!e.themeTokens,pinKeyboard:e.pinKeyboard})}export{r as createEmbeddedConnector,p as embeddedConnectorFactory};
package/dist/index.d.ts CHANGED
@@ -1,23 +1,286 @@
1
- export { createCrossxConfig } from './config/createCrossxConfig.js';
2
- export type { CrossxConfig, CreateCrossxConfigOptions, EmbeddedConnectorFactory, } from './config/createCrossxConfig.js';
3
- export { CROSS_MAINNET_CHAIN_ID, CROSS_TESTNET_CHAIN_ID, BSC_MAINNET_CHAIN_ID, BSC_TESTNET_CHAIN_ID, crossMainnetNetwork, crossTestnetNetwork, bscMainnetNetwork, bscTestnetNetwork, withRequiredBscPairs, } from './config/networkPresets.js';
4
- export type { ProviderKind } from './registry/ConnectorRegistry.js';
5
- export type { WalletConnectAdapter, WalletConnectAdapterContext, CrossWalletProviderKind, } from './adapters/types.js';
6
- export { clearWalletSessionStorage, DEFAULT_SESSION_STORAGE_PREFIXES, } from './utils/sessionStorage.js';
7
- export { cookieToCrossConnectKitState, pickInitialState } from './ssr.js';
8
- export type { CrossConnectKitInitialState } from './ssr.js';
9
- export { readWalletInfoTokens, deriveSDKThemeTokensFromWalletInfo, } from './utils/theme.js';
10
- export type { SDKThemeTokenOverrides, SDKThemeTokensShape, } from './utils/theme.js';
11
- export { createConnectorRegistry, resolveCurrentWallet, } from './registry/ConnectorRegistry.js';
12
- export type { ConnectorEntry, ConnectorRegistry, } from './registry/ConnectorRegistry.js';
13
- export { onOpenOtherWallets } from './events.js';
14
- export { DEFAULT_WALLET_REGISTRY } from './wallets/registry.js';
15
- export { detectWallets, debugDetect } from './wallets/detection.js';
16
- export { CROSSX_ICON, EXTENSION_ICON, METAMASK_ICON, BINANCE_ICON, WALLETCONNECT_ICON, GOOGLE_ICON, APPLE_ICON, } from './wallets/icons.js';
17
- export { crossExtensionConnector } from './connectors/extensionConnector.js';
18
- export { createWalletConnectConnector } from './connectors/walletConnectConnector.js';
19
- export type { WalletConnectConfig } from './connectors/walletConnectConnector.js';
20
- export type { CrossConnectKitConfig, AppMetadata, NetworkConfig } from '@nexus-cross/connect-kit-core';
21
- export type { ConnectorPort, ConnectorType, ConnectorResult, Account, WalletId, WalletDescriptor, OAuthPort, OAuthProvider, } from '@nexus-cross/connect-kit-core';
22
- export { createCrossySdkOAuthAdapter } from './adapters/crossySdkOAuthAdapter.js';
23
- //# sourceMappingURL=index.d.ts.map
1
+ import { CrossConnectKitConfig, WalletId, OAuthPort, NetworkConfig, WalletDescriptor } from '@nexus-cross/connect-kit-core';
2
+ export { Account, AppMetadata, ConnectorPort, ConnectorResult, ConnectorType, CrossConnectKitConfig, NetworkConfig, OAuthPort, OAuthProvider, WalletDescriptor, WalletId } from '@nexus-cross/connect-kit-core';
3
+ import { DesignSystem } from '@nexus-cross/crossx-design-system';
4
+ import { CreateConnectorFn, Config, State } from 'wagmi';
5
+ import { W as WalletConnectAdapter, P as ProviderKind, C as ConnectorRegistry } from './types-DiRp3H2_.js';
6
+ export { a as ConnectorEntry, b as CrossWalletProviderKind, c as WalletConnectAdapterContext, d as createConnectorRegistry, r as resolveCurrentWallet } from './types-DiRp3H2_.js';
7
+ export { a as SDKThemeTokenOverrides, S as SDKThemeTokensShape, d as deriveSDKThemeTokensFromWalletInfo, r as readWalletInfoTokens } from './theme-CjRKvIE1.js';
8
+
9
+ /**
10
+ * Signature of the embedded-connector factory. Imported from the subpath
11
+ * `@nexus-cross/connect-kit-wagmi/embedded` so the core entry stays SSR-safe (the
12
+ * underlying crossy-sdk-js touches indexedDB at module load).
13
+ */
14
+ type EmbeddedConnectorFactory = (kitConfig: CrossConnectKitConfig, openConnectOtherWallet?: () => void) => CreateConnectorFn | null;
15
+ interface CreateCrossxConfigOptions extends CrossConnectKitConfig {
16
+ /**
17
+ * CROSSx-side adapter. Produces the wagmi `Config` that hosts
18
+ * `cross_embedded`, `cross_wallet`, `cross_extension`. Required
19
+ * unless `reownProvider` is set (a reown-only DApp is permitted).
20
+ *
21
+ * Import via `@nexus-cross/connect-kit-wagmi/to-nexus`.
22
+ */
23
+ readonly crossProvider?: WalletConnectAdapter;
24
+ /**
25
+ * Reown-side adapter. Produces the wagmi `Config` that hosts
26
+ * `metamask`, `binance`. Optional — internal DApps that do not depend
27
+ * on Reown simply skip this and get a cross-only kit.
28
+ *
29
+ * Import via `@nexus-cross/connect-kit-wagmi/reown`.
30
+ */
31
+ readonly reownProvider?: WalletConnectAdapter;
32
+ /**
33
+ * Factory for the embedded CROSSx wallet connector. Opt-in — import
34
+ * from `@nexus-cross/connect-kit-wagmi/embedded` in a client-only boundary.
35
+ * Attached to the cross-side config. Omit for SSR-only flows or
36
+ * reown-only DApps.
37
+ */
38
+ readonly embeddedConnectorFactory?: EmbeddedConnectorFactory;
39
+ /**
40
+ * Per-wallet "Required Settings" guide URLs shown in the connect
41
+ * modal. Keys are walletIds, values are absolute or relative URLs.
42
+ */
43
+ readonly walletGuides?: Partial<Record<WalletId, {
44
+ url: string;
45
+ label?: string;
46
+ }>>;
47
+ /**
48
+ * Which side to show on first load when nothing is cached. Defaults
49
+ * to whichever side is configured; when both are, defaults to
50
+ * `'cross'`.
51
+ */
52
+ readonly defaultProvider?: ProviderKind;
53
+ /**
54
+ * Opt out of automatically registering the BSC chain that pairs with
55
+ * each CROSS chain in `networks`. CROSS tokens (e.g. `$CROSS`) are
56
+ * deployed on BSC, so the kit's Send screen needs BSC registered in
57
+ * wagmi to call `switchChain` / `sendTransaction`. The kit injects
58
+ * the BSC pair automatically; set this to `true` only if you have a
59
+ * deliberate reason to keep BSC off the wagmi config (e.g. a
60
+ * CROSS-only DApp that intentionally blocks BSC token sends).
61
+ *
62
+ * Default: `false` (BSC pairs auto-registered).
63
+ */
64
+ readonly disableBscAutoRegister?: boolean;
65
+ /**
66
+ * Design system that drives the published `--ds-*` CSS variables and
67
+ * `.ds-*` typography classes. Defaults to `defaultDesignSystem` from
68
+ * `@nexus-cross/crossx-design-system`. Pass your own `DesignSystem`-shaped
69
+ * object to theme every kit surface with a custom token set.
70
+ */
71
+ readonly designSystem?: DesignSystem;
72
+ }
73
+ /**
74
+ * Dual wagmi config produced by `createCrossxConfig`. The React
75
+ * provider mounts exactly one `<WagmiProvider>` at a time — swapping
76
+ * between `crossWagmiConfig` and `reownWagmiConfig` via the
77
+ * `providerKind` of the wallet the user picks. Posa's proven pattern;
78
+ * each side keeps its own session, and the remount drops stale state
79
+ * cleanly when the user jumps between ecosystems.
80
+ */
81
+ interface CrossxConfig {
82
+ readonly kitConfig: CrossConnectKitConfig;
83
+ readonly crossWagmiConfig: Config | null;
84
+ readonly reownWagmiConfig: Config | null;
85
+ readonly connectorRegistry: ConnectorRegistry;
86
+ readonly crossProvider: WalletConnectAdapter | null;
87
+ readonly reownProvider: WalletConnectAdapter | null;
88
+ /** Initial active side before any user interaction. */
89
+ readonly defaultProvider: ProviderKind;
90
+ /**
91
+ * Preferred localStorage key the React provider uses to persist the
92
+ * active provider across reloads. Exposed so DApps can clear it
93
+ * (e.g. during full sign-out flows).
94
+ */
95
+ readonly activeProviderStorageKey: string;
96
+ /**
97
+ * Headless OAuth entry point. Present only when the cross-side wagmi
98
+ * config (and therefore an embedded crossy-sdk connector) is registered.
99
+ * The React layer wires this into the connect modal's social buttons.
100
+ */
101
+ readonly oauth: OAuthPort | null;
102
+ /**
103
+ * Resolved design system (the option's value or `defaultDesignSystem`).
104
+ * The React provider reads this to publish `--ds-*` variables and
105
+ * `.ds-*` typography classes.
106
+ */
107
+ readonly designSystem: DesignSystem;
108
+ }
109
+ declare function createCrossxConfig(options: CreateCrossxConfigOptions): CrossxConfig;
110
+
111
+ /**
112
+ * Canonical CROSS / BSC network presets in `NetworkConfig` shape so DApps
113
+ * can register them via `createCrossxConfig({ networks })` without
114
+ * hand-typing chain IDs, RPCs, and explorers.
115
+ *
116
+ * RPC URLs intentionally match `@to-nexus/appkit/networks` (the upstream
117
+ * SDK preset). Keeping a single RPC across kit + SDK avoids two endpoints
118
+ * disagreeing on nonce / receipt state mid-flight.
119
+ *
120
+ * Numeric chain IDs (intentionally hard-coded, not imported, so the
121
+ * preset compiles even when `@to-nexus/sdk` is not installed):
122
+ * - CROSS Mainnet : 612055
123
+ * - CROSS Testnet : 612044
124
+ * - BSC Mainnet : 56
125
+ * - BSC Testnet : 97
126
+ */
127
+ declare const CROSS_MAINNET_CHAIN_ID: 612055;
128
+ declare const CROSS_TESTNET_CHAIN_ID: 612044;
129
+ declare const BSC_MAINNET_CHAIN_ID: 56;
130
+ declare const BSC_TESTNET_CHAIN_ID: 97;
131
+ declare const crossMainnetNetwork: NetworkConfig;
132
+ declare const crossTestnetNetwork: NetworkConfig;
133
+ declare const bscMainnetNetwork: NetworkConfig;
134
+ declare const bscTestnetNetwork: NetworkConfig;
135
+ /**
136
+ * Returns a new `networks` array augmented with the BSC counterpart of
137
+ * every CROSS chain present in `networks`. Existing entries are left
138
+ * untouched (no duplicate inject, no override). If the caller already
139
+ * registered BSC explicitly — possibly with a custom RPC — that entry
140
+ * wins.
141
+ *
142
+ * Pure / idempotent: passing the result back returns the same set.
143
+ */
144
+ declare function withRequiredBscPairs(networks: readonly NetworkConfig[]): readonly NetworkConfig[];
145
+
146
+ /**
147
+ * Prefixes used by the wallet SDKs crossx-kit integrates with. Disconnect
148
+ * flows must clear these so a stale WalletConnect session does not
149
+ * silently reconnect on the next page load.
150
+ *
151
+ * Derived from posa's manual cleanup (WalletProvider.tsx:207): `wc@`,
152
+ * `@w3m`, `wagmi`. Extended with `@walletconnect` and `@appkit` which some
153
+ * newer SDK versions write to.
154
+ */
155
+ declare const DEFAULT_SESSION_STORAGE_PREFIXES: readonly string[];
156
+ /**
157
+ * Remove every `localStorage` key starting with any of the given prefixes.
158
+ * No-op on server environments (SSR, Node) and on browsers where storage
159
+ * access is blocked (private mode, quota exceeded).
160
+ *
161
+ * Intended for disconnect flows where we need to evict cached
162
+ * WalletConnect pairings before the user attempts to connect to a
163
+ * different wallet — without resorting to `window.location.reload()`.
164
+ */
165
+ declare function clearWalletSessionStorage(prefixes?: readonly string[]): void;
166
+
167
+ /**
168
+ * Hydration state for one side of the dual wagmi config.
169
+ */
170
+ interface CrossConnectKitInitialState {
171
+ readonly cross?: State;
172
+ readonly reown?: State;
173
+ }
174
+ /**
175
+ * Extract wagmi's initialState for BOTH cross-side and reown-side
176
+ * wagmi configs from a cookie header. The React provider passes the
177
+ * correct slice into whichever `<WagmiProvider>` is currently active.
178
+ *
179
+ * ```tsx
180
+ * // app/layout.tsx (Server Component, Next.js App Router)
181
+ * import { headers } from 'next/headers';
182
+ * import { cookieToCrossConnectKitState } from '@nexus-cross/connect-kit-wagmi';
183
+ * import { config } from './config';
184
+ * import { Providers } from './providers';
185
+ *
186
+ * export default async function RootLayout({ children }) {
187
+ * const cookie = (await headers()).get('cookie');
188
+ * const initialState = cookieToCrossConnectKitState(config, cookie);
189
+ * return (
190
+ * <html><body>
191
+ * <Providers initialState={initialState}>{children}</Providers>
192
+ * </body></html>
193
+ * );
194
+ * }
195
+ * ```
196
+ *
197
+ * Returns `undefined` when no cookie is present. Requires
198
+ * `createCrossxConfig({ ssr: true })`.
199
+ */
200
+ declare function cookieToCrossConnectKitState(config: CrossxConfig, cookieHeader: string | null | undefined): CrossConnectKitInitialState | undefined;
201
+ /**
202
+ * Pick the active-provider slice from the dual hydration state.
203
+ * Internal helper used by CrossConnectKitProvider; exported for tests.
204
+ */
205
+ declare function pickInitialState(state: CrossConnectKitInitialState | undefined, providerKind: ProviderKind): State | undefined;
206
+
207
+ type Listener = () => void;
208
+ /**
209
+ * Subscribe to "open other wallets" events.
210
+ * Fired by the embedded connector when the SDK modal's
211
+ * "Connect with Other Wallets" button is clicked.
212
+ */
213
+ declare function onOpenOtherWallets(cb: Listener): () => void;
214
+
215
+ declare const DEFAULT_WALLET_REGISTRY: WalletDescriptor[];
216
+
217
+ /**
218
+ * Detect installed wallets using EIP-6963 and legacy probing.
219
+ * Returns the wallet registry with `installed` flags populated.
220
+ */
221
+ declare function detectWallets(registry?: WalletDescriptor[]): WalletDescriptor[];
222
+ /**
223
+ * Debug helper — dump what detectWallets sees right now. Call from the
224
+ * browser console when "CROSSx Extension / Not Installed" appears
225
+ * despite having the extension enabled:
226
+ *
227
+ * window.__crossxKit_debugDetect?.()
228
+ *
229
+ * Logs: EIP-6963 announcements, window globals, and per-wallet
230
+ * detection outcome.
231
+ */
232
+ declare function debugDetect(): void;
233
+
234
+ /**
235
+ * Wallet icons — ported from posa's `src/assets/icons/wallet-*.svg` and
236
+ * inlined as `data:image/svg+xml` URIs so `@nexus-cross/connect-kit-wagmi` stays a
237
+ * self-contained, bundler-agnostic module (no SVG loader required).
238
+ *
239
+ * Source references (read-only, posa repo):
240
+ * wallet-crossx.svg → CROSSX_ICON (cross_wallet, cross_embedded)
241
+ * wallet-crossx.svg → EXTENSION_ICON (cross_extension — shares art)
242
+ * wallet-metamask.svg → METAMASK_ICON
243
+ * wallet-binance.svg → BINANCE_ICON
244
+ * wallet-walletconnect.svg → WALLETCONNECT_ICON (generic WC fallback)
245
+ */
246
+ declare const CROSSX_ICON: string;
247
+ declare const EXTENSION_ICON: string;
248
+ declare const METAMASK_ICON: string;
249
+ declare const BINANCE_ICON: string;
250
+ declare const WALLETCONNECT_ICON: string;
251
+ declare const GOOGLE_ICON: string;
252
+ declare const APPLE_ICON: string;
253
+
254
+ /**
255
+ * wagmi connector for CROSSx browser extension.
256
+ * Uses the injected connector with a target that probes window.crossWallet.
257
+ */
258
+ declare function crossExtensionConnector(): CreateConnectorFn;
259
+
260
+ interface WalletConnectConfig {
261
+ projectId: string;
262
+ metadata?: {
263
+ name: string;
264
+ description?: string;
265
+ url: string;
266
+ icons?: string[];
267
+ };
268
+ showQrModal?: boolean;
269
+ }
270
+ /**
271
+ * Creates a WalletConnect connector for external wallets
272
+ * (MetaMask, Binance Wallet, etc. via QR/deep-link).
273
+ */
274
+ declare function createWalletConnectConnector(config: WalletConnectConfig): CreateConnectorFn;
275
+
276
+ /**
277
+ * Concrete {@link OAuthPort} implementation that delegates to crossy-sdk's
278
+ * `signInWithProvider`. Mounted on `CrossxConfig.oauth` by
279
+ * `createCrossxConfig` when an embedded connector is registered.
280
+ *
281
+ * The adapter does no UI work and does not surface progress / error
282
+ * state — the SDK owns the user-visible OAuth flow (see CLAUDE.md §6).
283
+ */
284
+ declare function createCrossySdkOAuthAdapter(crossWagmiConfig: Config): OAuthPort;
285
+
286
+ export { APPLE_ICON, BINANCE_ICON, BSC_MAINNET_CHAIN_ID, BSC_TESTNET_CHAIN_ID, CROSSX_ICON, CROSS_MAINNET_CHAIN_ID, CROSS_TESTNET_CHAIN_ID, ConnectorRegistry, type CreateCrossxConfigOptions, type CrossConnectKitInitialState, type CrossxConfig, DEFAULT_SESSION_STORAGE_PREFIXES, DEFAULT_WALLET_REGISTRY, EXTENSION_ICON, type EmbeddedConnectorFactory, GOOGLE_ICON, METAMASK_ICON, ProviderKind, WALLETCONNECT_ICON, WalletConnectAdapter, type WalletConnectConfig, bscMainnetNetwork, bscTestnetNetwork, clearWalletSessionStorage, cookieToCrossConnectKitState, createCrossxConfig, createCrossySdkOAuthAdapter, createWalletConnectConnector, crossExtensionConnector, crossMainnetNetwork, crossTestnetNetwork, debugDetect, detectWallets, onOpenOtherWallets, pickInitialState, withRequiredBscPairs };
package/dist/index.js CHANGED
@@ -1,14 +1 @@
1
- export { createCrossxConfig } from './config/createCrossxConfig.js';
2
- export { CROSS_MAINNET_CHAIN_ID, CROSS_TESTNET_CHAIN_ID, BSC_MAINNET_CHAIN_ID, BSC_TESTNET_CHAIN_ID, crossMainnetNetwork, crossTestnetNetwork, bscMainnetNetwork, bscTestnetNetwork, withRequiredBscPairs, } from './config/networkPresets.js';
3
- export { clearWalletSessionStorage, DEFAULT_SESSION_STORAGE_PREFIXES, } from './utils/sessionStorage.js';
4
- export { cookieToCrossConnectKitState, pickInitialState } from './ssr.js';
5
- export { readWalletInfoTokens, deriveSDKThemeTokensFromWalletInfo, } from './utils/theme.js';
6
- export { createConnectorRegistry, resolveCurrentWallet, } from './registry/ConnectorRegistry.js';
7
- export { onOpenOtherWallets } from './events.js';
8
- export { DEFAULT_WALLET_REGISTRY } from './wallets/registry.js';
9
- export { detectWallets, debugDetect } from './wallets/detection.js';
10
- export { CROSSX_ICON, EXTENSION_ICON, METAMASK_ICON, BINANCE_ICON, WALLETCONNECT_ICON, GOOGLE_ICON, APPLE_ICON, } from './wallets/icons.js';
11
- export { crossExtensionConnector } from './connectors/extensionConnector.js';
12
- export { createWalletConnectConnector } from './connectors/walletConnectConnector.js';
13
- export { createCrossySdkOAuthAdapter } from './adapters/crossySdkOAuthAdapter.js';
14
- //# sourceMappingURL=index.js.map
1
+ import{a as U,b as F}from"./chunk-6BKDRLN2.js";import{a as Q,c as $,d as V}from"./chunk-MB7252C7.js";import{a as m,b as L,c as H,d as q,e as G,f as X,g as Y}from"./chunk-33PCSJXD.js";import{defaultDesignSystem as ce,toSdkColorOverrides as P}from"@nexus-cross/crossx-design-system";var y=new Set;function z(e){return y.add(e),()=>{y.delete(e)}}function N(){y.forEach(e=>e())}function g(e){let o=new Map,n=new Map;for(let t of e){o.set(t.walletId,t);let r=[t.connectorId,...t.aliasConnectorIds??[]];for(let i of r){let d=n.get(i);d?d.push(t):n.set(i,[t])}}return{entries:e,getEntry:t=>o.get(t),getEntriesByConnectorId:t=>n.get(t)??[],getEntryByConnectorId:t=>n.get(t)?.[0],toWalletDescriptors:()=>e.map(t=>({id:t.walletId,name:t.name,type:t.type,iconUrl:t.iconUrl,installUrl:t.installUrl}))}}function J(e,o,n){if(!o)return null;let t=e.getEntriesByConnectorId(o);if(t.length===0)return null;if(t.length===1)return t[0].walletId;if(n){let r=t.find(i=>i.walletId===n);if(r)return r.walletId}return t[0].walletId}import{connect as Z}from"@wagmi/core";var _="crossx";function ee(e){return typeof e=="object"&&e!==null&&e.code==="ALREADY_AUTHENTICATED"}function w(e){async function o(){let n=e.connectors.find(t=>t.id===_);if(n)try{await Z(e,{connector:n})}catch{}}return{async signIn(n){let t=e.connectors.find(c=>c.id===_);if(!t)throw new Error("[crossx-kit] cross_embedded connector not configured. Pass `embeddedConnectorFactory` to createCrossxConfig.");if(typeof t.getProvider!="function")throw new Error("[crossx-kit] cross_embedded connector does not expose getProvider().");let i=(await t.getProvider())?.sdk,d=i?.signInWithCreate??i?.signIn;if(!i||typeof d!="function")throw new Error("[crossx-kit] crossy-sdk signIn/signInWithCreate is unavailable.");let l;try{l=await d.call(i,{provider:n})}catch(c){if(ee(c)){await o();return}throw c}if(l&&l.success===!1)throw new Error(`[crossx-kit] OAuth sign-in did not complete: ${l.error??"unknown reason"}`);await o()}}}var te=612055,oe=612044,ne=56,re=97,se={id:612055,name:"CROSS Mainnet",nativeCurrency:{name:"CROSS",symbol:"CROSS",decimals:18},rpcUrl:"https://mainnet.crosstoken.io:22001",blockExplorerUrl:"https://www.crossscan.io",testnet:!1},ie={id:612044,name:"CROSS Testnet",nativeCurrency:{name:"tCROSS",symbol:"tCROSS",decimals:18},rpcUrl:"https://testnet.crosstoken.io:22001",blockExplorerUrl:"https://testnet.crossscan.io",testnet:!0},O={id:56,name:"BSC Mainnet",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrl:"https://bsc-mainnet.crosstoken.io/2272489872e4f1475ff25d57ce93b51989f933c7",blockExplorerUrl:"https://bscscan.com",testnet:!1},T={id:97,name:"BSC Testnet",nativeCurrency:{name:"tBNB",symbol:"tBNB",decimals:18},rpcUrl:"https://bsc-testnet.crosstoken.io/110ea3628b77f244e5dbab16790d81bba874b962",blockExplorerUrl:"https://testnet.bscscan.com",testnet:!0},A={612055:O,612044:T};function x(e){let o=new Set(e.map(t=>t.id)),n=[];for(let t of e){let r=A[t.id];r&&!o.has(r.id)&&(n.push(r),o.add(r.id))}return n.length===0?e:[...e,...n]}function v(e){let o=new Set(e.map(t=>t.id)),n=[];for(let t of e){let r=A[t.id];r&&!o.has(r.id)&&(n.push(r),o.add(r.id))}return n}var ae="crossx-kit:active-provider";function de(e){let{crossProvider:o,reownProvider:n,embeddedConnectorFactory:t,walletGuides:r,defaultProvider:i,disableBscAutoRegister:d,designSystem:l=ce,...c}=e;if(!o&&!n)throw new Error("[crossx-kit] createCrossxConfig requires at least one of `crossProvider` (from @nexus-cross/connect-kit-wagmi/to-nexus) or `reownProvider` (from @nexus-cross/connect-kit-wagmi/reown).");let W={light:P(l,"light"),dark:P(l,"dark")},S=d?c:{...c,networks:x(c.networks)},f={...S,themeTokens:S.themeTokens??W};if(!d){let s=v(c.networks);s.length>0&&console.info("[crossx-kit] auto-registered BSC network(s) for CROSS token sends: "+s.map(a=>`${a.name}(${a.id})`).join(", ")+". Pass `disableBscAutoRegister: true` to opt out.")}let C=null,u=[];if(o){let s=[],a=t?t(f,N):null;a&&s.push({connector:a,registryEntry:{walletId:"cross_embedded",providerKind:"cross",type:"embedded",connectorId:"crossx",name:"CROSSx",iconUrl:m}});let h=o.buildWagmiConfig({kitConfig:f,extraConnectors:s});C=h.wagmiConfig,u.push(...h.registryEntries)}let I=null,E=[];if(n){let s=n.buildWagmiConfig({kitConfig:f,extraConnectors:[]});I=s.wagmiConfig,E.push(...s.registryEntries)}let k=[...u,...E],D=r?k.map(s=>{let a=r[s.walletId];return a?{...s,guideUrl:a.url,guideLabel:a.label}:s}):k,K=g(D),B=i??(C?"cross":"reown"),M=u.some(s=>s.walletId==="cross_embedded"),j=C&&M?w(C):null;return{kitConfig:f,crossWagmiConfig:C,reownWagmiConfig:I,connectorRegistry:K,crossProvider:o??null,reownProvider:n??null,defaultProvider:B,activeProviderStorageKey:ae,oauth:j,designSystem:l}}var R=["wc@","@w3m","@walletconnect","@appkit","wagmi"];function le(e=R){if(typeof window>"u")return;let o=(()=>{try{return window.localStorage}catch{return null}})();if(o)try{let n=[];for(let t=0;t<o.length;t+=1){let r=o.key(t);r&&e.some(i=>r.startsWith(i))&&n.push(r)}for(let t of n)o.removeItem(t)}catch{}}import{cookieToInitialState as b}from"wagmi";function Ce(e,o){if(!o)return;let n={cross:e.crossWagmiConfig?b(e.crossWagmiConfig,o):void 0,reown:e.reownWagmiConfig?b(e.reownWagmiConfig,o):void 0};return n.cross||n.reown?n:void 0}function fe(e,o){if(e)return o==="cross"?e.cross:e.reown}import{injected as pe}from"wagmi/connectors";function p(){if(typeof window>"u")return;let e=window.crossWallet??window.cross;if(!e?.request)return;let o=e.request.bind(e);return new Proxy(e,{get(n,t){return t==="request"?async r=>r.method==="wallet_requestPermissions"?[]:o(r):n[t]}})}function ue(){return pe({target(){let e=p();return e?{id:"nexus.to.crosswallet.desktop",name:"CROSSx Extension",provider:e}:{id:"nexus.to.crosswallet.desktop",name:"CROSSx Extension",provider:{request:async o=>{let n=p();if(!n)throw new Error("CROSSx Extension is not installed. Please install it and refresh.");return n.request(o)},on:(...o)=>{p()?.on?.(...o)},removeListener:(...o)=>{p()?.removeListener?.(...o)}}}}})}import{walletConnect as me}from"wagmi/connectors";function ye(e){return me({projectId:e.projectId,metadata:e.metadata?{name:e.metadata.name,description:e.metadata.description??"",url:e.metadata.url,icons:e.metadata.icons??[]}:void 0,showQrModal:e.showQrModal??!1})}export{Y as APPLE_ICON,q as BINANCE_ICON,ne as BSC_MAINNET_CHAIN_ID,re as BSC_TESTNET_CHAIN_ID,m as CROSSX_ICON,te as CROSS_MAINNET_CHAIN_ID,oe as CROSS_TESTNET_CHAIN_ID,R as DEFAULT_SESSION_STORAGE_PREFIXES,Q as DEFAULT_WALLET_REGISTRY,L as EXTENSION_ICON,X as GOOGLE_ICON,H as METAMASK_ICON,G as WALLETCONNECT_ICON,O as bscMainnetNetwork,T as bscTestnetNetwork,le as clearWalletSessionStorage,Ce as cookieToCrossConnectKitState,g as createConnectorRegistry,de as createCrossxConfig,w as createCrossySdkOAuthAdapter,ye as createWalletConnectConnector,ue as crossExtensionConnector,se as crossMainnetNetwork,ie as crossTestnetNetwork,V as debugDetect,F as deriveSDKThemeTokensFromWalletInfo,$ as detectWallets,z as onOpenOtherWallets,fe as pickInitialState,U as readWalletInfoTokens,J as resolveCurrentWallet,x as withRequiredBscPairs};
package/dist/reown.d.ts CHANGED
@@ -1,3 +1,21 @@
1
- export { reownAdapter } from './adapters/reownAdapter.js';
2
- export type { ReownAdapterOptions } from './adapters/reownAdapter.js';
3
- //# sourceMappingURL=reown.d.ts.map
1
+ import { W as WalletConnectAdapter } from './types-DiRp3H2_.js';
2
+ import 'wagmi';
3
+ import '@nexus-cross/connect-kit-core';
4
+
5
+ interface ReownAdapterOptions {
6
+ /**
7
+ * Override the AppKit theme mode. Falls back to `CrossConnectKitConfig.theme.mode`
8
+ * when omitted.
9
+ */
10
+ readonly themeMode?: 'light' | 'dark';
11
+ }
12
+ /**
13
+ * Reown-side adapter backed by `@reown/appkit-adapter-wagmi`. When the
14
+ * user picks MetaMask or Binance from crossx-kit's modal, `beforeConnect`
15
+ * prefers Reown wallet-button's direct handoff so mobile users go straight
16
+ * to the selected wallet app. If wallet-button metadata is unavailable,
17
+ * it falls back to Reown's trimmed Connect view.
18
+ */
19
+ declare function reownAdapter(_options?: ReownAdapterOptions): WalletConnectAdapter;
20
+
21
+ export { type ReownAdapterOptions, reownAdapter };
package/dist/reown.js CHANGED
@@ -1,2 +1 @@
1
- export { reownAdapter } from './adapters/reownAdapter.js';
2
- //# sourceMappingURL=reown.js.map
1
+ import{b as c}from"./chunk-MB7252C7.js";import{c as l,d as f}from"./chunk-UVGOTXNW.js";import"./chunk-33PCSJXD.js";import{createAppKit as k}from"@reown/appkit";import{WagmiAdapter as I}from"@reown/appkit-adapter-wagmi";import{mainnet as u,sepolia as m,bsc as w,bscTestnet as C}from"@reown/appkit/networks";import{resolveThemeMode as R}from"@nexus-cross/connect-kit-core";function K(r){return R(r,void 0)}var E=new Map([[u.id,u],[m.id,m],[w.id,w],[C.id,C]]),P="c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",B="8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",b=[P,B],j="eip155",M={binance:"binance",metamask:"metamask"},s=new Map;function N(r){return r.isReady()?Promise.resolve(!0):new Promise(e=>{let t=!1,o=setTimeout(()=>n(!1),2500),n=a=>{t||(t=!0,clearTimeout(o),e(a))};r.subscribeIsReady(({isReady:a})=>{a&&n(!0)})})}function y(r){r.appKit.open({view:"Connect"}).catch(e=>{typeof console<"u"&&console.warn("[crossx-kit] reownAdapter: appKit.open failed",e)})}async function _(r,e){let t=M[e];if(!t)return"defer";try{let{createAppKitWalletButton:o}=await import("@reown/appkit-wallet-button"),n=o({namespace:j});return await N(n)?(n.connect(t).catch(()=>{}),"handled"):(y(r),"handled")}catch{return y(r),"handled"}}function x(r){let e=[],t=[];for(let o of r){let n=E.get(o.id);n?e.push(n):t.push(o.id)}if(e.length===0)throw new Error(`[crossx-kit] reownAdapter: none of [${t.join(", ")}] match a Reown preset network. Currently supported: Ethereum mainnet/sepolia, BSC mainnet/testnet. CROSS chains are handled by toNexusAdapter \u2014 the reown side needs at least one chain that Reown knows about.`);return e}function O(r){let{kitConfig:e,extraConnectors:t}=r;if(!e.reownProjectId)throw new Error("[crossx-kit] reownAdapter requires CrossConnectKitConfig.reownProjectId \u2014 register a WalletConnect Cloud project at https://cloud.reown.com.");let o=e.reownProjectId,n=s.get(o);if(n)return n;let a=x(e.networks),i=t.map(W=>W.connector),p=new I({projectId:e.reownProjectId,networks:a,connectors:i,ssr:e.ssr}),g={adapters:[p],projectId:e.reownProjectId,networks:a,metadata:{name:e.appMetadata.name,description:e.appMetadata.description??"",url:e.appMetadata.url,icons:e.appMetadata.icons??[]},features:{email:!1,socials:!1,analytics:!1,onramp:!1,swaps:!1,send:!1,history:!1,receive:!1},allWallets:"HIDE",includeWalletIds:[...b],featuredWalletIds:[...b],enableNetworkSwitch:!1,enableCoinbase:!1,themeMode:K(e.theme)},h=k(g),A=p.wagmiConfig,d={appKit:h,wagmiConfig:A};return s.set(o,d),d}function T(r={}){return{providerKind:"reown",buildWagmiConfig(e){let{wagmiConfig:t}=O(e),o=[...e.extraConnectors.map(n=>n.registryEntry).filter(n=>n!==null),l("reown","walletConnect"),f("reown","walletConnect")];return{wagmiConfig:t,registryEntries:o}},async beforeConnect({kitConfig:e},t){if(!e.reownProjectId)return"defer";let o=s.get(e.reownProjectId);return!o||t==="metamask"&&c("io.metamask")||t==="binance"&&c("com.binance.wallet")?"defer":t==="metamask"||t==="binance"?_(o,t):"defer"},subscribeModalState({kitConfig:e},t){if(!e.reownProjectId)return()=>{};let o=s.get(e.reownProjectId);if(!o)return()=>{};let n;return o.appKit.subscribeState(a=>{let i=a.open===!0;i!==n&&(n=i,t(i))})},closeModal({kitConfig:e}){if(!e.reownProjectId)return;let t=s.get(e.reownProjectId);if(!t)return;let o=t.appKit.close;if(typeof o=="function")try{let n=o.call(t.appKit);n&&typeof n.then=="function"&&n.catch(()=>{})}catch{}}}}export{T as reownAdapter};
@@ -20,7 +20,7 @@
20
20
  * `SDKColorOverrides`. Kept local so `@nexus-cross/connect-kit-wagmi`'s public API
21
21
  * does not harden on external SDK internals.
22
22
  */
23
- export interface SDKThemeTokenOverrides {
23
+ interface SDKThemeTokenOverrides {
24
24
  primary?: string;
25
25
  secondary?: string;
26
26
  onPrimary?: string;
@@ -34,7 +34,7 @@ export interface SDKThemeTokenOverrides {
34
34
  bg?: string;
35
35
  error?: string;
36
36
  }
37
- export interface SDKThemeTokensShape {
37
+ interface SDKThemeTokensShape {
38
38
  light?: SDKThemeTokenOverrides;
39
39
  dark?: SDKThemeTokenOverrides;
40
40
  }
@@ -43,7 +43,7 @@ export interface SDKThemeTokensShape {
43
43
  * Empty/absent variables are skipped. Returns `undefined` when called
44
44
  * outside a browser environment.
45
45
  */
46
- export declare function readWalletInfoTokens(): SDKThemeTokenOverrides | undefined;
46
+ declare function readWalletInfoTokens(): SDKThemeTokenOverrides | undefined;
47
47
  /**
48
48
  * Build the `themeTokens` argument for `crossxConnector`. Merges
49
49
  * WalletInfo's built-in mode defaults with any `--wi-*` overrides on
@@ -54,5 +54,6 @@ export declare function readWalletInfoTokens(): SDKThemeTokenOverrides | undefin
54
54
  * entry to display; setting both prevents the SDK from flipping into a
55
55
  * mismatched palette if `autoDetectTheme` is enabled elsewhere.
56
56
  */
57
- export declare function deriveSDKThemeTokensFromWalletInfo(mode?: 'light' | 'dark'): SDKThemeTokensShape;
58
- //# sourceMappingURL=theme.d.ts.map
57
+ declare function deriveSDKThemeTokensFromWalletInfo(mode?: 'light' | 'dark'): SDKThemeTokensShape;
58
+
59
+ export { type SDKThemeTokensShape as S, type SDKThemeTokenOverrides as a, deriveSDKThemeTokensFromWalletInfo as d, readWalletInfoTokens as r };
@@ -1,3 +1,16 @@
1
- export { toNexusAdapter } from './adapters/toNexusAdapter.js';
2
- export type { ToNexusAdapterOptions } from './adapters/toNexusAdapter.js';
3
- //# sourceMappingURL=to-nexus.d.ts.map
1
+ import { W as WalletConnectAdapter } from './types-DiRp3H2_.js';
2
+ import 'wagmi';
3
+ import '@nexus-cross/connect-kit-core';
4
+
5
+ interface ToNexusAdapterOptions {
6
+ readonly displayName?: string;
7
+ }
8
+ /**
9
+ * Adapter backed by `@to-nexus/appkit-adapter-wagmi` — the CROSS-relay
10
+ * fork of Reown AppKit. Owns the wagmi `Config` so AppKit's native UI
11
+ * (QR modal, deep-link, Cross Extension approval flow) stays in sync
12
+ * with the kit's `useAccount` / `useConnect` state.
13
+ */
14
+ declare function toNexusAdapter(options?: ToNexusAdapterOptions): WalletConnectAdapter;
15
+
16
+ export { type ToNexusAdapterOptions, toNexusAdapter };
package/dist/to-nexus.js CHANGED
@@ -1,2 +1 @@
1
- export { toNexusAdapter } from './adapters/toNexusAdapter.js';
2
- //# sourceMappingURL=to-nexus.js.map
1
+ import{a as g,b as w}from"./chunk-UVGOTXNW.js";import"./chunk-33PCSJXD.js";import{WagmiAdapter as _}from"@to-nexus/appkit-adapter-wagmi";import{initCrossSdk as I,bscMainnet as h,bscTestnet as y,crossMainnet as b,crossTestnet as x,etherMainnet as k,etherTestnet as W,kaiaMainnet as M,kaiaTestnet as v,roninMainnet as A,roninTestnet as T}from"@to-nexus/sdk";import{ApiController as j,EventsController as K,ModalController as E,OptionsController as N,PublicStateController as B,RouterController as u}from"@to-nexus/appkit-core";import{resolveThemeMode as O}from"@nexus-cross/connect-kit-core";var R=new Map([[b.id,b],[x.id,x],[h.id,h],[y.id,y],[M.id,M],[v.id,v],[k.id,k],[W.id,W],[A.id,A],[T.id,T]]),f="cross_wallet",m="nexus.to.crosswallet.desktop";function D(){let s=N.state.customWallets?.find(t=>t.id===f||t.rdns===m);return s||{id:f,name:"CROSSx Wallet",image_url:"https://contents.crosstoken.io/wallet/token/images/CROSSx.svg",app_store:"https://apps.apple.com/us/app/crossx-games/id6741250674",play_store:"https://play.google.com/store/apps/details?id=com.nexus.crosswallet",chrome_store:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg",rdns:m,mobile_link:"crossx://",desktop_link:"",webapp_link:"",injected:[{injected_id:m}]}}var d=new Map;function L(s){let t=[],e=[];for(let o of s){let r=R.get(o.id);r?t.push(r):e.push(o.id)}if(e.length)throw new Error(`[crossx-kit] toNexusAdapter: chain IDs [${e.join(", ")}] are not supported by @to-nexus/sdk presets. Either remove them from CrossConnectKitConfig.networks or switch to reownAdapter().`);return t}function q(s){let{kitConfig:t,extraConnectors:e}=s,o=t.crossProjectId,r=d.get(o);if(r)return r;let n=L(t.networks),i=e.map(l=>l.connector),c=new _({projectId:o,networks:n,connectors:i,ssr:t.ssr}),a={name:t.appMetadata.name,description:t.appMetadata.description??"",url:t.appMetadata.url,icons:t.appMetadata.icons??[]},p=O(t.theme,t.autoDetectTheme),P=I(o,t.appMetadata.url,a,p,n[0],[c]);try{N.setEnableWallets(!0)}catch(l){console.warn("[crossx-kit] OptionsController.setEnableWallets failed",l)}let S=c.wagmiConfig,C={appKit:P,wagmiConfig:S,caipNetworks:n};return d.set(o,C),C}function H(s={}){let t=s.displayName??"CROSSx Wallet";return{providerKind:"to-nexus",buildWagmiConfig(e){if(!e.kitConfig.crossProjectId)throw new Error("[crossx-kit] toNexusAdapter requires CrossConnectKitConfig.crossProjectId");let{wagmiConfig:o}=q(e),r=[...e.extraConnectors.map(n=>n.registryEntry).filter(n=>n!==null),g(t,"walletConnect"),w()];return{wagmiConfig:o,registryEntries:r}},async teardown(){},subscribeModalState({kitConfig:e},o){if(!e.crossProjectId)return()=>{};let n=d.get(e.crossProjectId)?.appKit.subscribeState;if(!n)return()=>{};let i;return n(c=>{let a=c.open===!0;a!==i&&(i=a,o(a))})},closeModal({kitConfig:e}){if(!e.crossProjectId)return;let o=d.get(e.crossProjectId);if(!o)return;let r=o.appKit.close;if(typeof r=="function")try{let n=r.call(o.appKit);n&&typeof n.then=="function"&&n.catch(()=>{})}catch{}},async beforeConnect({kitConfig:e,themeMode:o},r){if(r!==f||!e.crossProjectId)return"defer";let n=d.get(e.crossProjectId);if(!n)return"defer";let i=o??O(e.theme,e.autoDetectTheme);try{n.appKit.setThemeMode?.(i)}catch(p){typeof console<"u"&&console.warn("[crossx-kit] toNexusAdapter: setThemeMode failed",p)}let c=D(),a=E.state.open;try{a||await j.prefetch(),u.state.view==="ConnectingWalletConnect"&&u.reset("Connect"),u.reset("ConnectingWalletConnect",{wallet:c}),a||(E.state.open=!0,B.set({open:!0}),K.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!1}}))}catch(p){typeof console<"u"&&console.warn("[crossx-kit] toNexusAdapter: appKit.open failed",p)}return"defer"}}}export{H as toNexusAdapter};