@wheelx-widget/widget 0.1.18 → 0.1.19

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 CHANGED
@@ -8,7 +8,7 @@ An open-source, framework-agnostic React widget for cross-chain token swaps and
8
8
  - 👛 **Built-in Wallet Connection** — Dynamic SDK + Wagmi v2 supporting EVM (MetaMask, OKX, etc.) and Solana (Phantom)
9
9
  - 🎨 **Configurable Theme** — 14 color tokens for custom skinning
10
10
  - ⚛️ **Framework Agnostic** — Works with any React framework (Next.js, Vite, Create React App, etc.)
11
- - 📦 **Tree-shakeable** — ESM + CJS builds with TypeScript declarations
11
+ - 📦 **ESM + CJS** — Dual-format builds with full TypeScript declarations
12
12
  - 🔌 **Configurable Default Tokens** — Set default from/to chains and tokens
13
13
  - 📱 **Deep Link Support** — Wallet app launch support in WebView (React Native) — see [Deep Link Guide](./DEEP_LINK_GUIDE.md)
14
14
 
@@ -22,6 +22,19 @@ Note: `@chakra-ui/react` and `@emotion/react` are required peer dependencies.
22
22
 
23
23
  ## Quick Start
24
24
 
25
+ If you don't have a project yet, scaffold one first:
26
+
27
+ ```bash
28
+ npm create vite@latest my-swap-page -- --template react-ts
29
+ cd my-swap-page
30
+ ```
31
+
32
+ Then install the widget and required peer dependencies:
33
+
34
+ ```bash
35
+ npm install @wheelx-widget/widget @chakra-ui/react @emotion/react
36
+ ```
37
+
25
38
  ```tsx
26
39
  // main.tsx — wrap with ChakraProvider
27
40
  import { ChakraProvider, defaultSystem } from '@chakra-ui/react'
@@ -38,7 +51,7 @@ createRoot(document.getElementById('root')!).render(
38
51
  ```tsx
39
52
  // App.tsx
40
53
  // Import the CSS for animations (required!)
41
- import '@wheelx-widget/widget/dist/index.css'
54
+ import '@wheelx-widget/widget/styles.css'
42
55
  import { WheelXProvider, WheelXWidget } from '@wheelx-widget/widget'
43
56
 
44
57
  function App() {
@@ -106,18 +119,6 @@ Customize 14 visual tokens:
106
119
  </WheelXProvider>
107
120
  ```
108
121
 
109
- ### API Base URL
110
-
111
- Override the default WheelX API endpoint. Useful for testing against a staging or development environment.
112
-
113
- ```tsx
114
- <WheelXProvider config={{
115
- apiBaseUrl: 'https://dev-api.wheelx.fi' // Default: 'https://api.wheelx.fi'
116
- }}>
117
- <WheelXWidget />
118
- </WheelXProvider>
119
- ```
120
-
121
122
  ### Fixed Recipient Address (Different Address)
122
123
 
123
124
  Configure fixed recipient addresses for EVM or Solana chains. When set, the widget will:
@@ -170,9 +171,6 @@ The main trading widget component.
170
171
  interface WidgetConfig {
171
172
  theme?: Partial<WidgetTheme>
172
173
 
173
- /** API base URL. Default 'https://api.wheelx.fi' */
174
- apiBaseUrl?: string
175
-
176
174
  from?: {
177
175
  chains?: number[]
178
176
  defaultChainId?: number
@@ -242,6 +240,16 @@ In short, three things are required:
242
240
  2. Configure `<queries>` declaration in Android's `AndroidManifest.xml`
243
241
  3. Configure `LSApplicationQueriesSchemes` in iOS's `Info.plist`
244
242
 
243
+ ## Troubleshooting
244
+
245
+ | Problem | Symptom | Solution |
246
+ |----------|---------|----------|
247
+ | **Missing ChakraProvider** | White screen or unstyled component | Wrap your app in `<ChakraProvider value={defaultSystem}>` — the widget depends on Chakra's context |
248
+ | **Forgot to import CSS** | Component works but has no styling/animations | Add `import '@wheelx-widget/widget/styles.css'` in your entry file |
249
+ | **Vite dev server starts slow** | `vite dev` takes 30+ seconds | Normal — Vite pre-bundles large wallet dependencies (wagmi, viem, ethers, etc.). Subsequent starts with cache are faster |
250
+ | **Build output is large** | dist/ folder tens of MB, main bundle ~7.5MB (1.9MB gzipped) | Expected — the widget bundles all wallet SDKs. Use code-splitting or lazy-loading in your host app if needed |
251
+ | **React hooks errors** | "Invalid hook call" or context mismatch | You may have duplicate React instances. Ensure `react` and `react-dom` are peer dependencies in your project, and use a single version (18 or 19) |
252
+
245
253
  ## License
246
254
 
247
255
  MIT
package/dist/index.d.mts CHANGED
@@ -36,8 +36,6 @@ interface WidgetTheme {
36
36
  }
37
37
  interface WidgetConfig {
38
38
  theme?: Partial<WidgetTheme>;
39
- /** API base URL. Default 'https://api.wheelx.fi' */
40
- apiBaseUrl?: string;
41
39
  from?: {
42
40
  chains?: number[];
43
41
  defaultChainId?: number;
package/dist/index.d.ts CHANGED
@@ -36,8 +36,6 @@ interface WidgetTheme {
36
36
  }
37
37
  interface WidgetConfig {
38
38
  theme?: Partial<WidgetTheme>;
39
- /** API base URL. Default 'https://api.wheelx.fi' */
40
- apiBaseUrl?: string;
41
39
  from?: {
42
40
  chains?: number[];
43
41
  defaultChainId?: number;
package/dist/index.js CHANGED
@@ -43737,12 +43737,9 @@ var WidgetThemeProvider = ({
43737
43737
  };
43738
43738
 
43739
43739
  // src/api/consts.ts
43740
- var _baseApiUrl = "https://api.wheelx.fi";
43740
+ var BASE_API_URL = "https://api.wheelx.fi";
43741
43741
  function getBaseApiUrl() {
43742
- return _baseApiUrl;
43743
- }
43744
- function setBaseApiUrl(url) {
43745
- _baseApiUrl = url;
43742
+ return BASE_API_URL;
43746
43743
  }
43747
43744
  async function getChainsAndTokens() {
43748
43745
  const url = `${getBaseApiUrl()}/v1/chain-info`;
@@ -44787,9 +44784,6 @@ function ChainsAndTokensLoader({ children, config }) {
44787
44784
  var DEFAULT_ENVIRONMENT_ID = "f217660e-2cec-470b-a8f4-ac655b16f802";
44788
44785
  var solanaRpcUrl = "https://mainnet.helius-rpc.com/?api-key=7337bed2-6c3a-472f-b06f-9b2be0e1392f";
44789
44786
  var WheelXProvider = ({ config, children }) => {
44790
- if (config?.apiBaseUrl) {
44791
- setBaseApiUrl(config.apiBaseUrl);
44792
- }
44793
44787
  const queryClient = React5.useMemo(() => new reactQuery.QueryClient(), []);
44794
44788
  const evmNetworks = React5.useMemo(() => supportedChains.map((chain) => ({
44795
44789
  chainId: chain.id,