@wheelx/widget 0.0.5 → 0.0.6
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 +256 -392
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/internal/SelectTokenModal/DesktopContent.d.ts.map +1 -1
- package/dist/internal/SelectTokenModal/DesktopContent.js +2 -1
- package/dist/internal/SelectTokenModal/DesktopContent.js.map +1 -1
- package/dist/internal/SelectTokenModal/MobileContent.d.ts.map +1 -1
- package/dist/internal/SelectTokenModal/MobileContent.js +2 -1
- package/dist/internal/SelectTokenModal/MobileContent.js.map +1 -1
- package/dist/internal/SelectTokenModal/TokenAndAddress.d.ts.map +1 -1
- package/dist/internal/SelectTokenModal/TokenAndAddress.js +1 -1
- package/dist/internal/SelectTokenModal/TokenAndAddress.js.map +1 -1
- package/dist/internal/SwapAndBridge/DifferentAddressDialog.d.ts.map +1 -1
- package/dist/internal/SwapAndBridge/DifferentAddressDialog.js +42 -11
- package/dist/internal/SwapAndBridge/DifferentAddressDialog.js.map +1 -1
- package/dist/internal/SwapAndBridge/MainForm.d.ts.map +1 -1
- package/dist/internal/SwapAndBridge/MainForm.js +1 -2
- package/dist/internal/SwapAndBridge/MainForm.js.map +1 -1
- package/dist/internal/SwapAndBridge/TipsContent.d.ts.map +1 -1
- package/dist/internal/SwapAndBridge/TipsContent.js +19 -14
- package/dist/internal/SwapAndBridge/TipsContent.js.map +1 -1
- package/dist/internal/SwapAndBridge/TxInfo.d.ts.map +1 -1
- package/dist/internal/SwapAndBridge/TxInfo.js +6 -6
- package/dist/internal/SwapAndBridge/TxInfo.js.map +1 -1
- package/dist/internal/SwapAndBridge/animations/Success.d.ts.map +1 -1
- package/dist/internal/SwapAndBridge/animations/Success.js +69 -2
- package/dist/internal/SwapAndBridge/animations/Success.js.map +1 -1
- package/dist/internal/SwapAndBridge/animations/Wheel.d.ts.map +1 -1
- package/dist/internal/SwapAndBridge/animations/Wheel.js +43 -3
- package/dist/internal/SwapAndBridge/animations/Wheel.js.map +1 -1
- package/dist/internal/WidgetDataBootstrap.d.ts.map +1 -1
- package/dist/internal/WidgetDataBootstrap.js +10 -1
- package/dist/internal/WidgetDataBootstrap.js.map +1 -1
- package/dist/internal/assets/icons/ai.svg +1 -2
- package/dist/internal/commons/TokenIconWithNetworkLogo.d.ts.map +1 -1
- package/dist/internal/commons/TokenIconWithNetworkLogo.js +3 -1
- package/dist/internal/commons/TokenIconWithNetworkLogo.js.map +1 -1
- package/dist/internal/ui/tooltip.js +1 -1
- package/dist/internal/ui/tooltip.js.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -1,143 +1,110 @@
|
|
|
1
1
|
# `@wheelx/widget`
|
|
2
2
|
|
|
3
|
-
WheelX
|
|
3
|
+
Embeddable WheelX bridge and swap widget for Next.js applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It packages the full widget flow behind a small integration surface:
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
- bridge and swap UI
|
|
8
|
+
- wallet-ready provider wrapper
|
|
9
|
+
- network and token restrictions
|
|
10
|
+
- theme and style overrides
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
- default selected tokens
|
|
12
|
-
- token restrictions per chain
|
|
13
|
-
- visual styles and typography
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
12
|
+
## Quick Start
|
|
16
13
|
|
|
17
|
-
Install
|
|
14
|
+
### 1. Install From npm
|
|
18
15
|
|
|
19
16
|
```bash
|
|
20
|
-
pnpm add @wheelx/widget
|
|
17
|
+
pnpm add @wheelx/widget @rainbow-me/rainbowkit
|
|
21
18
|
```
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
If your app does not already load RainbowKit styles, add this once in your app entry:
|
|
24
21
|
|
|
25
|
-
```
|
|
26
|
-
|
|
22
|
+
```tsx
|
|
23
|
+
import '@rainbow-me/rainbowkit/styles.css'
|
|
27
24
|
```
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
Minimal usage:
|
|
30
27
|
|
|
31
|
-
```
|
|
32
|
-
|
|
28
|
+
```tsx
|
|
29
|
+
'use client'
|
|
30
|
+
|
|
31
|
+
import {
|
|
32
|
+
WheelxBridgeSwapWidget,
|
|
33
|
+
WheelxWidgetProvider
|
|
34
|
+
} from '@wheelx/widget'
|
|
35
|
+
|
|
36
|
+
export default function Page() {
|
|
37
|
+
return (
|
|
38
|
+
<WheelxWidgetProvider>
|
|
39
|
+
<WheelxBridgeSwapWidget />
|
|
40
|
+
</WheelxWidgetProvider>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
33
43
|
```
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
Requirements:
|
|
36
46
|
|
|
37
|
-
|
|
47
|
+
- `Next.js >= 15`
|
|
48
|
+
- `React 19`
|
|
49
|
+
- `react-dom 19`
|
|
50
|
+
|
|
51
|
+
The widget currently depends on Next.js runtime APIs, so the host app should be Next.js-based.
|
|
38
52
|
|
|
39
|
-
|
|
53
|
+
### 2. Run From Source
|
|
54
|
+
|
|
55
|
+
Clone the repository and install dependencies from the root:
|
|
40
56
|
|
|
41
57
|
```bash
|
|
42
58
|
pnpm install
|
|
43
59
|
```
|
|
44
60
|
|
|
45
|
-
|
|
46
|
-
clone does not require a separate manual build before starting the demo.
|
|
47
|
-
|
|
48
|
-
Run the demo:
|
|
61
|
+
Start the local demo:
|
|
49
62
|
|
|
50
63
|
```bash
|
|
51
64
|
pnpm demo:dev
|
|
52
65
|
```
|
|
53
66
|
|
|
54
|
-
`pnpm demo:dev` also rebuilds the package first to keep `dist/` in sync with the
|
|
55
|
-
current source tree.
|
|
56
|
-
|
|
57
67
|
Build the demo:
|
|
58
68
|
|
|
59
69
|
```bash
|
|
60
70
|
pnpm demo:build
|
|
61
71
|
```
|
|
62
72
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
The package defaults to production endpoints:
|
|
73
|
+
`pnpm demo:dev` rebuilds the package first, so the demo stays aligned with the current source tree.
|
|
66
74
|
|
|
67
|
-
|
|
68
|
-
NEXT_PUBLIC_API_URL=https://api.wheelx.fi
|
|
69
|
-
NEXT_PUBLIC_APP_DOMAIN=https://wheelx.fi
|
|
70
|
-
```
|
|
75
|
+
## Theme Page
|
|
71
76
|
|
|
72
|
-
|
|
77
|
+
The repository includes a theme playground at:
|
|
73
78
|
|
|
74
79
|
```text
|
|
75
|
-
|
|
80
|
+
/theme
|
|
76
81
|
```
|
|
77
82
|
|
|
78
|
-
|
|
83
|
+
It lets you:
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
## Requirements
|
|
85
|
+
- preview the live widget
|
|
86
|
+
- switch between presets
|
|
87
|
+
- edit theme values
|
|
88
|
+
- copy the generated config block
|
|
85
89
|
|
|
86
|
-
|
|
87
|
-
- `React 19`
|
|
88
|
-
- `react-dom 19`
|
|
90
|
+
This page is intended for visual review and handoff, not just internal testing.
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
should be Next.js-based.
|
|
92
|
+
## Configuration
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
your root layout or global entry:
|
|
94
|
+
The main config type is `WheelxWidgetConfig`.
|
|
95
95
|
|
|
96
96
|
```tsx
|
|
97
|
-
import '@
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
`WheelxWidgetProvider` already includes the wallet-related providers required by
|
|
101
|
-
the widget. If your host application wants a wallet connect button, render your
|
|
102
|
-
own UI in the host app, for example with RainbowKit's `ConnectButton`.
|
|
103
|
-
|
|
104
|
-
## Quick Start
|
|
105
|
-
|
|
106
|
-
The smallest working integration is:
|
|
107
|
-
|
|
108
|
-
```tsx
|
|
109
|
-
'use client'
|
|
110
|
-
|
|
111
|
-
import {
|
|
112
|
-
WheelxBridgeSwapWidget,
|
|
113
|
-
WheelxWidgetProvider
|
|
114
|
-
} from '@wheelx/widget'
|
|
115
|
-
|
|
116
|
-
export default function Page() {
|
|
117
|
-
return (
|
|
118
|
-
<WheelxWidgetProvider>
|
|
119
|
-
<WheelxBridgeSwapWidget />
|
|
120
|
-
</WheelxWidgetProvider>
|
|
121
|
-
)
|
|
122
|
-
}
|
|
97
|
+
import type { WheelxWidgetConfig } from '@wheelx/widget'
|
|
123
98
|
```
|
|
124
99
|
|
|
125
|
-
|
|
100
|
+
Example:
|
|
126
101
|
|
|
127
102
|
```tsx
|
|
128
|
-
'use client'
|
|
129
|
-
|
|
130
|
-
import {
|
|
131
|
-
WheelxBridgeSwapWidget,
|
|
132
|
-
WheelxWidgetProvider,
|
|
133
|
-
type WheelxWidgetConfig
|
|
134
|
-
} from '@wheelx/widget'
|
|
135
|
-
|
|
136
103
|
const config: WheelxWidgetConfig = {
|
|
137
104
|
mode: 'bridge-and-swap',
|
|
138
105
|
networks: {
|
|
139
|
-
from: [1, 8453
|
|
140
|
-
to: [8453,
|
|
106
|
+
from: [1, 8453],
|
|
107
|
+
to: [8453, 137]
|
|
141
108
|
},
|
|
142
109
|
defaultTokens: {
|
|
143
110
|
from: {
|
|
@@ -150,391 +117,288 @@ const config: WheelxWidgetConfig = {
|
|
|
150
117
|
address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
151
118
|
symbol: 'USDC'
|
|
152
119
|
}
|
|
120
|
+
},
|
|
121
|
+
allowedTokens: {
|
|
122
|
+
from: [
|
|
123
|
+
{
|
|
124
|
+
chainId: 8453,
|
|
125
|
+
tokens: [
|
|
126
|
+
'0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2'
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
styles: {
|
|
132
|
+
formContainer: {
|
|
133
|
+
backgroundColor: '#0f172a'
|
|
134
|
+
}
|
|
153
135
|
}
|
|
154
136
|
}
|
|
155
|
-
|
|
156
|
-
export default function Page() {
|
|
157
|
-
return (
|
|
158
|
-
<WheelxWidgetProvider>
|
|
159
|
-
<WheelxBridgeSwapWidget config={config} />
|
|
160
|
-
</WheelxWidgetProvider>
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
137
|
```
|
|
164
138
|
|
|
165
|
-
|
|
139
|
+
### Supported Options
|
|
166
140
|
|
|
167
|
-
|
|
141
|
+
#### `mode`
|
|
168
142
|
|
|
169
|
-
|
|
143
|
+
Controls the widget flow.
|
|
170
144
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
145
|
+
- `bridge-and-swap`
|
|
146
|
+
Enables same-chain swaps, bridging, and cross-chain swaps.
|
|
147
|
+
- `swap`
|
|
148
|
+
Restricts the widget to same-chain swaps.
|
|
174
149
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
- same-chain swap
|
|
178
|
-
- cross-chain bridge
|
|
179
|
-
- cross-chain swap
|
|
180
|
-
|
|
181
|
-
### 2. Swap-Only Mode
|
|
182
|
-
|
|
183
|
-
```ts
|
|
184
|
-
mode: 'swap'
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
Behavior:
|
|
150
|
+
Notes:
|
|
188
151
|
|
|
189
|
-
-
|
|
190
|
-
- the
|
|
191
|
-
- clicking `From` or `To` only shows tokens for the currently selected chain
|
|
192
|
-
- initial token rendering is aligned to the configured chain before token data
|
|
193
|
-
finishes loading, so the widget does not flash the built-in Soneium/Base
|
|
194
|
-
defaults first
|
|
152
|
+
- `bridge-and-swap` is the default.
|
|
153
|
+
- In `swap` mode, the widget normalizes `networks.from` and `networks.to` to the shared chain set when both are provided.
|
|
195
154
|
|
|
196
|
-
|
|
155
|
+
#### `networks`
|
|
197
156
|
|
|
198
|
-
|
|
157
|
+
Restricts the available chains for each side.
|
|
199
158
|
|
|
200
159
|
```ts
|
|
201
|
-
networks
|
|
202
|
-
from
|
|
203
|
-
to
|
|
160
|
+
networks?: {
|
|
161
|
+
from?: 'all' | number | number[]
|
|
162
|
+
to?: 'all' | number | number[]
|
|
204
163
|
}
|
|
205
164
|
```
|
|
206
165
|
|
|
207
|
-
|
|
166
|
+
Rules:
|
|
208
167
|
|
|
209
|
-
- `'all'`
|
|
210
|
-
-
|
|
211
|
-
-
|
|
168
|
+
- Omit a side or use `'all'` to allow every chain returned by the backend.
|
|
169
|
+
- Use a single number to allow one chain.
|
|
170
|
+
- Use an array to allow a subset of chains.
|
|
212
171
|
|
|
213
|
-
|
|
172
|
+
#### `defaultTokens`
|
|
214
173
|
|
|
215
|
-
|
|
174
|
+
Sets the initial token selection.
|
|
216
175
|
|
|
217
176
|
```ts
|
|
218
|
-
defaultTokens
|
|
219
|
-
from
|
|
220
|
-
chainId:
|
|
221
|
-
address:
|
|
222
|
-
symbol
|
|
223
|
-
}
|
|
224
|
-
to
|
|
225
|
-
chainId:
|
|
226
|
-
address:
|
|
227
|
-
symbol
|
|
177
|
+
defaultTokens?: {
|
|
178
|
+
from?: {
|
|
179
|
+
chainId: number
|
|
180
|
+
address: string
|
|
181
|
+
symbol?: string
|
|
182
|
+
}
|
|
183
|
+
to?: {
|
|
184
|
+
chainId: number
|
|
185
|
+
address: string
|
|
186
|
+
symbol?: string
|
|
228
187
|
}
|
|
229
188
|
}
|
|
230
189
|
```
|
|
231
190
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
- defaults are applied once during widget initialization
|
|
235
|
-
- URL presets take precedence over `defaultTokens`
|
|
236
|
-
- in swap-only mode, same-chain behavior is still enforced after defaults apply
|
|
237
|
-
- if a default token falls outside `networks` or `allowedTokens`, the widget will
|
|
238
|
-
fall back to the nearest valid option
|
|
239
|
-
|
|
240
|
-
### 5. Token Restriction Per Chain
|
|
191
|
+
Rules:
|
|
241
192
|
|
|
242
|
-
|
|
193
|
+
- `chainId` and `address` identify the token.
|
|
194
|
+
- `symbol` is optional and can help disambiguate token lookup.
|
|
195
|
+
- Defaults are applied during widget initialization.
|
|
196
|
+
- If a configured default is not valid under `networks` or `allowedTokens`, the widget falls back to the nearest valid option.
|
|
243
197
|
|
|
244
|
-
|
|
198
|
+
#### `allowedTokens`
|
|
245
199
|
|
|
246
|
-
|
|
247
|
-
- tokens declared in `allowedTokens`
|
|
248
|
-
|
|
249
|
-
If you configure a token address that does not exist in the API response, it is
|
|
250
|
-
silently ignored.
|
|
200
|
+
Restricts selectable tokens by chain.
|
|
251
201
|
|
|
252
202
|
```ts
|
|
253
|
-
allowedTokens
|
|
254
|
-
from
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
],
|
|
263
|
-
to: [
|
|
264
|
-
{
|
|
265
|
-
chainId: 8453,
|
|
266
|
-
tokens: ['0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913']
|
|
267
|
-
}
|
|
268
|
-
]
|
|
203
|
+
allowedTokens?: {
|
|
204
|
+
from?: Array<{
|
|
205
|
+
chainId: number
|
|
206
|
+
tokens: string[]
|
|
207
|
+
}>
|
|
208
|
+
to?: Array<{
|
|
209
|
+
chainId: number
|
|
210
|
+
tokens: string[]
|
|
211
|
+
}>
|
|
269
212
|
}
|
|
270
213
|
```
|
|
271
214
|
|
|
272
|
-
|
|
215
|
+
Rules:
|
|
273
216
|
|
|
274
|
-
-
|
|
275
|
-
-
|
|
276
|
-
-
|
|
217
|
+
- Restrictions are chain-scoped.
|
|
218
|
+
- Only chains explicitly listed in `allowedTokens` are restricted.
|
|
219
|
+
- Chains that are not listed remain unrestricted.
|
|
220
|
+
- Token addresses are normalized to lowercase internally.
|
|
221
|
+
- Invalid or empty addresses are ignored.
|
|
277
222
|
|
|
278
|
-
|
|
223
|
+
#### `styles`
|
|
279
224
|
|
|
280
|
-
|
|
225
|
+
Overrides widget appearance with style objects.
|
|
281
226
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
## Customization
|
|
286
|
-
|
|
287
|
-
The widget does not currently support render overrides for internal components.
|
|
288
|
-
Customization is done through the `styles` field using Chakra-style props.
|
|
289
|
-
|
|
290
|
-
```tsx
|
|
291
|
-
const config: WheelxWidgetConfig = {
|
|
292
|
-
styles: {
|
|
293
|
-
formContainer: {
|
|
294
|
-
bg: '#FFFFFF',
|
|
295
|
-
borderRadius: '24px',
|
|
296
|
-
boxShadow: '0 12px 36px rgba(0, 0, 0, 0.12)'
|
|
297
|
-
},
|
|
298
|
-
primaryButton: {
|
|
299
|
-
borderRadius: '999px'
|
|
300
|
-
},
|
|
301
|
-
formTitleText: {
|
|
302
|
-
color: '#7C2D12',
|
|
303
|
-
fontFamily: 'Georgia, serif',
|
|
304
|
-
fontWeight: 900
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
227
|
+
```ts
|
|
228
|
+
styles?: WidgetStyleOverrides
|
|
308
229
|
```
|
|
309
230
|
|
|
310
|
-
|
|
231
|
+
All supported style keys are listed below.
|
|
311
232
|
|
|
312
|
-
|
|
233
|
+
##### Form
|
|
313
234
|
|
|
314
235
|
- `formContainer`
|
|
315
|
-
|
|
316
|
-
- `tokenSelector`
|
|
317
|
-
- `recipientBadge`
|
|
318
|
-
- `amountInputContainer`
|
|
319
|
-
- `tokenModalContent`
|
|
320
|
-
- `tokenModalChainPanel`
|
|
321
|
-
- `tokenModalTokenPanel`
|
|
322
|
-
- `quoteInfoContainer`
|
|
323
|
-
- `quoteTooltipContent`
|
|
324
|
-
- `quoteInfoCard`
|
|
325
|
-
- `txStateCard`
|
|
326
|
-
- `txStateRouteContainer`
|
|
327
|
-
- `txStateSummaryContainer`
|
|
328
|
-
- `txStateTokenCard`
|
|
329
|
-
|
|
330
|
-
### Typography Slots
|
|
331
|
-
|
|
236
|
+
Main widget shell.
|
|
332
237
|
- `formTitleText`
|
|
238
|
+
Main title text.
|
|
239
|
+
- `formFooterText`
|
|
240
|
+
Footer text such as `Powered by WheelX.fi`.
|
|
241
|
+
- `sectionContainer`
|
|
242
|
+
Form sections such as `From` and `To`.
|
|
333
243
|
- `sectionLabelText`
|
|
244
|
+
Section labels.
|
|
245
|
+
- `tokenSelector`
|
|
246
|
+
Token selector surface.
|
|
334
247
|
- `tokenPrimaryText`
|
|
248
|
+
Token symbol and main token text.
|
|
335
249
|
- `tokenSecondaryText`
|
|
250
|
+
Chain name and secondary token text.
|
|
251
|
+
- `tokenIconBadge`
|
|
252
|
+
Small network badge attached to token icons.
|
|
336
253
|
- `balanceText`
|
|
254
|
+
Balance text near token inputs.
|
|
255
|
+
- `recipientBadge`
|
|
256
|
+
Recipient address badge on the `To` side.
|
|
257
|
+
- `amountInputContainer`
|
|
258
|
+
Numeric input shell.
|
|
337
259
|
- `amountInputText`
|
|
260
|
+
Numeric input text.
|
|
338
261
|
- `amountUsdText`
|
|
339
|
-
|
|
340
|
-
- `tokenModalTitleText`
|
|
341
|
-
- `tokenModalSectionLabelText`
|
|
342
|
-
- `tokenModalChainText`
|
|
343
|
-
- `tokenModalTokenPrimaryText`
|
|
344
|
-
- `tokenModalTokenSecondaryText`
|
|
345
|
-
- `tokenModalCategoryTabText`
|
|
346
|
-
- `slippageTitleText`
|
|
347
|
-
- `slippageDescriptionText`
|
|
348
|
-
- `slippageButtonText`
|
|
349
|
-
- `quoteInfoLabel`
|
|
350
|
-
- `quoteInfoValue`
|
|
351
|
-
- `txStateLabel`
|
|
352
|
-
- `txStateValue`
|
|
353
|
-
|
|
354
|
-
### Button / State Slots
|
|
355
|
-
|
|
262
|
+
USD amount text below or beside token inputs.
|
|
356
263
|
- `primaryButton`
|
|
264
|
+
Main action button surface.
|
|
357
265
|
- `primaryButtonLoading`
|
|
266
|
+
Main action button while loading.
|
|
358
267
|
- `primaryButtonWarning`
|
|
268
|
+
Main action button in warning state.
|
|
269
|
+
- `primaryButtonText`
|
|
270
|
+
Main action button text.
|
|
359
271
|
- `quickHalfButton`
|
|
272
|
+
`50%` quick action button.
|
|
360
273
|
- `quickMaxButton`
|
|
361
|
-
|
|
362
|
-
- `slippageAutoButton`
|
|
363
|
-
- `slippageCustomInput`
|
|
364
|
-
- `txStatePrimaryButton`
|
|
365
|
-
- `quoteInfoFreeBadge`
|
|
274
|
+
`Max` quick action button.
|
|
366
275
|
|
|
367
|
-
|
|
276
|
+
##### Token Modal
|
|
368
277
|
|
|
278
|
+
- `tokenModalContent`
|
|
279
|
+
Modal container.
|
|
280
|
+
- `tokenModalTitleText`
|
|
281
|
+
Modal title.
|
|
369
282
|
- `tokenModalSearchInput`
|
|
283
|
+
Search input.
|
|
284
|
+
- `tokenModalChainPanel`
|
|
285
|
+
Left chain list panel.
|
|
286
|
+
- `tokenModalTokenPanel`
|
|
287
|
+
Right token list panel.
|
|
288
|
+
- `tokenModalSectionLabelText`
|
|
289
|
+
Section labels such as `Popular` or `Prediction`.
|
|
370
290
|
- `tokenModalChainRow`
|
|
291
|
+
Chain row base style.
|
|
371
292
|
- `tokenModalChainRowHover`
|
|
293
|
+
Chain row hover state.
|
|
372
294
|
- `tokenModalChainRowActive`
|
|
295
|
+
Chain row active state.
|
|
296
|
+
- `tokenModalChainText`
|
|
297
|
+
Chain row text.
|
|
373
298
|
- `tokenModalChainsWithAssetsRow`
|
|
299
|
+
`Chains with assets` row.
|
|
374
300
|
- `tokenModalChainsWithAssetsRowActive`
|
|
301
|
+
Active state for `Chains with assets`.
|
|
375
302
|
- `tokenModalTokenRow`
|
|
303
|
+
Token row base style.
|
|
376
304
|
- `tokenModalTokenRowHover`
|
|
305
|
+
Token row hover state.
|
|
306
|
+
- `tokenModalTokenPrimaryText`
|
|
307
|
+
Token row main text.
|
|
308
|
+
- `tokenModalTokenSecondaryText`
|
|
309
|
+
Token row secondary text.
|
|
377
310
|
- `tokenModalCategoryTab`
|
|
311
|
+
Category tabs such as `All`, `AI`, `Liked`, `Searched`.
|
|
378
312
|
- `tokenModalCategoryTabActive`
|
|
313
|
+
Active category tab.
|
|
314
|
+
- `tokenModalCategoryTabText`
|
|
315
|
+
Category tab text.
|
|
379
316
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
- `txStateStatusLink`
|
|
383
|
-
- `txStateStatusError`
|
|
384
|
-
- `txStateStatusWarning`
|
|
385
|
-
- `txStateStatusProgress`
|
|
386
|
-
|
|
387
|
-
## Common Integration Examples
|
|
388
|
-
|
|
389
|
-
### Swap Only On Base
|
|
390
|
-
|
|
391
|
-
```ts
|
|
392
|
-
const config: WheelxWidgetConfig = {
|
|
393
|
-
mode: 'swap',
|
|
394
|
-
networks: {
|
|
395
|
-
from: 8453,
|
|
396
|
-
to: 8453
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
### Restrict From/To To Different Network Sets
|
|
402
|
-
|
|
403
|
-
```ts
|
|
404
|
-
const config: WheelxWidgetConfig = {
|
|
405
|
-
networks: {
|
|
406
|
-
from: [1, 8453],
|
|
407
|
-
to: [10, 137, 8453]
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
### Restrict Only One Chain's Tokens
|
|
413
|
-
|
|
414
|
-
```ts
|
|
415
|
-
const config: WheelxWidgetConfig = {
|
|
416
|
-
networks: {
|
|
417
|
-
from: [1, 8453],
|
|
418
|
-
to: [1, 8453]
|
|
419
|
-
},
|
|
420
|
-
allowedTokens: {
|
|
421
|
-
from: [
|
|
422
|
-
{
|
|
423
|
-
chainId: 8453,
|
|
424
|
-
tokens: [
|
|
425
|
-
'0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2'
|
|
426
|
-
]
|
|
427
|
-
}
|
|
428
|
-
]
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
Behavior:
|
|
434
|
-
|
|
435
|
-
- Base `from` tokens are restricted to the configured list
|
|
436
|
-
- Ethereum `from` tokens remain available
|
|
437
|
-
|
|
438
|
-
### Visual Theming
|
|
439
|
-
|
|
440
|
-
```ts
|
|
441
|
-
const config: WheelxWidgetConfig = {
|
|
442
|
-
styles: {
|
|
443
|
-
formContainer: {
|
|
444
|
-
bg: '#FFF7ED',
|
|
445
|
-
border: '3px solid',
|
|
446
|
-
borderColor: '#EA580C'
|
|
447
|
-
},
|
|
448
|
-
tokenSelector: {
|
|
449
|
-
bg: '#DCFCE7',
|
|
450
|
-
border: '2px solid',
|
|
451
|
-
borderColor: '#16A34A'
|
|
452
|
-
},
|
|
453
|
-
primaryButton: {
|
|
454
|
-
bg: 'linear-gradient(90deg, #111827 0%, #1E3A8A 100%)',
|
|
455
|
-
color: '#FFFFFF'
|
|
456
|
-
},
|
|
457
|
-
tokenModalTokenRowHover: {
|
|
458
|
-
bg: '#DBEAFE'
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
## API Reference
|
|
465
|
-
|
|
466
|
-
### `WheelxWidgetProvider`
|
|
317
|
+
##### Different Address Dialog
|
|
467
318
|
|
|
468
|
-
|
|
319
|
+
- `differentAddressDialogContent`
|
|
320
|
+
Dialog container.
|
|
321
|
+
- `differentAddressDialogTitleText`
|
|
322
|
+
Dialog title.
|
|
323
|
+
- `differentAddressDialogInput`
|
|
324
|
+
Address input.
|
|
325
|
+
- `differentAddressDialogCancelButton`
|
|
326
|
+
Cancel button.
|
|
327
|
+
- `differentAddressDialogSaveButton`
|
|
328
|
+
Save button.
|
|
329
|
+
- `differentAddressDialogCloseButton`
|
|
330
|
+
Close button in the top-right corner.
|
|
469
331
|
|
|
470
|
-
|
|
471
|
-
<WheelxWidgetProvider>
|
|
472
|
-
<WheelxBridgeSwapWidget />
|
|
473
|
-
</WheelxWidgetProvider>
|
|
474
|
-
```
|
|
332
|
+
##### Slippage
|
|
475
333
|
|
|
476
|
-
|
|
334
|
+
- `slippageSettingsTrigger`
|
|
335
|
+
Trigger button in the form header.
|
|
336
|
+
- `slippagePopoverContent`
|
|
337
|
+
Slippage popover container.
|
|
338
|
+
- `slippageAutoButton`
|
|
339
|
+
`Auto` slippage button.
|
|
340
|
+
- `slippageCustomInput`
|
|
341
|
+
Custom slippage input.
|
|
342
|
+
- `slippageTitleText`
|
|
343
|
+
Popover title.
|
|
344
|
+
- `slippageDescriptionText`
|
|
345
|
+
Popover helper text.
|
|
346
|
+
- `slippageButtonText`
|
|
347
|
+
Text inside slippage buttons.
|
|
477
348
|
|
|
478
|
-
|
|
349
|
+
##### Quote And Tooltip
|
|
479
350
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
351
|
+
- `quoteInfoContainer`
|
|
352
|
+
Quote summary wrapper.
|
|
353
|
+
- `quoteTooltipContent`
|
|
354
|
+
Tooltip container for quote details.
|
|
355
|
+
- `quoteInfoCard`
|
|
356
|
+
Quote detail cards.
|
|
357
|
+
- `quoteInfoLabel`
|
|
358
|
+
Quote labels such as `Price Impact` or `Slippage`.
|
|
359
|
+
- `quoteInfoValue`
|
|
360
|
+
Quote values.
|
|
361
|
+
- `quoteInfoFreeBadge`
|
|
362
|
+
`Free` badge styling.
|
|
485
363
|
|
|
486
|
-
|
|
364
|
+
##### Transaction State
|
|
487
365
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
tokens: string[]
|
|
511
|
-
}>
|
|
512
|
-
to?: Array<{
|
|
513
|
-
chainId: number
|
|
514
|
-
tokens: string[]
|
|
515
|
-
}>
|
|
516
|
-
}
|
|
517
|
-
styles?: WidgetStyleOverrides
|
|
518
|
-
}
|
|
519
|
-
```
|
|
366
|
+
- `txStateCard`
|
|
367
|
+
Shared base style for transaction state cards.
|
|
368
|
+
- `txStateRouteContainer`
|
|
369
|
+
Route summary card.
|
|
370
|
+
- `txStateSummaryContainer`
|
|
371
|
+
Date, time, and recipient summary card.
|
|
372
|
+
- `txStateTokenCard`
|
|
373
|
+
Token amount cards.
|
|
374
|
+
- `txStateLabel`
|
|
375
|
+
Labels in the transaction state view.
|
|
376
|
+
- `txStateValue`
|
|
377
|
+
Values in the transaction state view.
|
|
378
|
+
- `txStatePrimaryButton`
|
|
379
|
+
Main action button in the transaction state view.
|
|
380
|
+
- `txStateStatusLink`
|
|
381
|
+
Success link text.
|
|
382
|
+
- `txStateStatusError`
|
|
383
|
+
Error status text.
|
|
384
|
+
- `txStateStatusWarning`
|
|
385
|
+
Warning status text.
|
|
386
|
+
- `txStateStatusProgress`
|
|
387
|
+
In-progress status text.
|
|
520
388
|
|
|
521
|
-
##
|
|
389
|
+
## Environment
|
|
522
390
|
|
|
523
|
-
|
|
391
|
+
By default, the widget uses the production API.
|
|
524
392
|
|
|
525
|
-
```
|
|
526
|
-
|
|
393
|
+
```bash
|
|
394
|
+
NEXT_PUBLIC_API_URL=https://api.wheelx.fi
|
|
395
|
+
NEXT_PUBLIC_APP_DOMAIN=https://wheelx.fi
|
|
527
396
|
```
|
|
528
397
|
|
|
529
|
-
|
|
398
|
+
For wallet connections, set:
|
|
530
399
|
|
|
531
400
|
```bash
|
|
532
|
-
|
|
533
|
-
pnpm --dir demo dev
|
|
401
|
+
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=...
|
|
534
402
|
```
|
|
535
403
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
```text
|
|
539
|
-
@wheelx/widget -> file:..
|
|
540
|
-
```
|
|
404
|
+
If you are running locally, place overrides in `.env.local`.
|