@wheelx-widget/widget 0.1.11 → 0.1.13
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 +63 -0
- package/dist/index.d.mts +76 -13
- package/dist/index.d.ts +76 -13
- package/dist/index.js +45298 -443
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45305 -458
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ An open-source, framework-agnostic React widget for cross-chain token swaps and
|
|
|
10
10
|
- ⚛️ **Framework Agnostic** — Works with any React framework (Next.js, Vite, Create React App, etc.)
|
|
11
11
|
- 📦 **Tree-shakeable** — ESM + CJS builds with TypeScript declarations
|
|
12
12
|
- 🔌 **Configurable Default Tokens** — Set default from/to chains and tokens
|
|
13
|
+
- 📱 **Deep Link Support** — Wallet app launch support in WebView (React Native) — see [Deep Link Guide](./DEEP_LINK_GUIDE.md)
|
|
13
14
|
|
|
14
15
|
## Installation
|
|
15
16
|
|
|
@@ -105,6 +106,45 @@ Customize 14 visual tokens:
|
|
|
105
106
|
</WheelXProvider>
|
|
106
107
|
```
|
|
107
108
|
|
|
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
|
+
### Fixed Recipient Address (Different Address)
|
|
122
|
+
|
|
123
|
+
Configure fixed recipient addresses for EVM or Solana chains. When set, the widget will:
|
|
124
|
+
|
|
125
|
+
- **Display the configured address** in the To field instead of showing "Connect Wallet"
|
|
126
|
+
- **Query the token balance** of the configured address
|
|
127
|
+
- **Skip wallet connection** for the target chain (only the source chain wallet is required for signing)
|
|
128
|
+
- **Show GetGas** when the configured address has insufficient native token balance
|
|
129
|
+
|
|
130
|
+
This is useful for exchange or merchant scenarios where funds should always be sent to a specific address regardless of which wallet the user connects.
|
|
131
|
+
|
|
132
|
+
**Priority order for recipient address:**
|
|
133
|
+
1. Configured fixed address (`evmDifferentAddress` / `solanaDifferentAddress`)
|
|
134
|
+
2. User manually entered different address (via Different Address dialog)
|
|
135
|
+
3. Connected wallet address
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
<WheelXProvider config={{
|
|
139
|
+
evmDifferentAddress: '0xAbCdEf1234567890...', // Fixed recipient for EVM chains (0x format)
|
|
140
|
+
solanaDifferentAddress: '9zQX...' // Fixed recipient for Solana chains (base58 format)
|
|
141
|
+
}}>
|
|
142
|
+
<WheelXWidget />
|
|
143
|
+
</WheelXProvider>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
> **Note:** You can configure one, both, or neither. The widget will only use the relevant one based on the selected To chain.
|
|
147
|
+
|
|
108
148
|
## API Reference
|
|
109
149
|
|
|
110
150
|
### `<WheelXProvider>`
|
|
@@ -129,6 +169,10 @@ The main trading widget component.
|
|
|
129
169
|
```typescript
|
|
130
170
|
interface WidgetConfig {
|
|
131
171
|
theme?: Partial<WidgetTheme>
|
|
172
|
+
|
|
173
|
+
/** API base URL. Default 'https://api.wheelx.fi' */
|
|
174
|
+
apiBaseUrl?: string
|
|
175
|
+
|
|
132
176
|
from?: {
|
|
133
177
|
chains?: number[]
|
|
134
178
|
defaultChainId?: number
|
|
@@ -147,6 +191,12 @@ interface WidgetConfig {
|
|
|
147
191
|
getCurrentPathname?: () => string
|
|
148
192
|
}
|
|
149
193
|
dynamicEnvironmentId?: string
|
|
194
|
+
onDeepLink?: (url: string) => void // See Deep Link Guide for WebView environments
|
|
195
|
+
|
|
196
|
+
/** Fixed recipient address for EVM chains (0x format). Takes priority over wallet address and manual different address */
|
|
197
|
+
evmDifferentAddress?: string
|
|
198
|
+
/** Fixed recipient address for Solana chains (base58 format). Takes priority over wallet address and manual different address */
|
|
199
|
+
solanaDifferentAddress?: string
|
|
150
200
|
}
|
|
151
201
|
```
|
|
152
202
|
|
|
@@ -168,6 +218,8 @@ interface WidgetTheme {
|
|
|
168
218
|
normalButtonText: string
|
|
169
219
|
disabledButtonBg: string
|
|
170
220
|
disabledButtonText: string
|
|
221
|
+
/** Color palette for the GetGas switch component. e.g. 'purple', 'blue', 'green'. Default: 'purple' */
|
|
222
|
+
getGasSwitchColorPalette?: string
|
|
171
223
|
}
|
|
172
224
|
```
|
|
173
225
|
|
|
@@ -179,6 +231,17 @@ A demo `https://widget.wheelx.fi`
|
|
|
179
231
|
|
|
180
232
|
This widget connects to the WheelX API at `https://api.wheelx.fi`. The API domain is not configurable.
|
|
181
233
|
|
|
234
|
+
## React Native / WebView Integration
|
|
235
|
+
|
|
236
|
+
If you embed the Widget into a React Native WebView, additional configuration is required to properly launch wallet apps.
|
|
237
|
+
|
|
238
|
+
Please refer to: **[Mobile Wallet Launch Guide (DEEP_LINK_GUIDE.md)](./DEEP_LINK_GUIDE.md)**
|
|
239
|
+
|
|
240
|
+
In short, three things are required:
|
|
241
|
+
1. Add `onMessage` listener in the WebView
|
|
242
|
+
2. Configure `<queries>` declaration in Android's `AndroidManifest.xml`
|
|
243
|
+
3. Configure `LSApplicationQueriesSchemes` in iOS's `Info.plist`
|
|
244
|
+
|
|
182
245
|
## License
|
|
183
246
|
|
|
184
247
|
MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -27,9 +27,17 @@ interface WidgetTheme {
|
|
|
27
27
|
normalButtonText: string;
|
|
28
28
|
disabledButtonBg: string;
|
|
29
29
|
disabledButtonText: string;
|
|
30
|
+
/**
|
|
31
|
+
* GetGas Switch colorPalette — accepts Chakra UI color palette names
|
|
32
|
+
* e.g. 'gray', 'red', 'orange', 'yellow', 'green', 'teal', 'cyan', 'blue', 'purple', 'pink'
|
|
33
|
+
* @default 'purple'
|
|
34
|
+
*/
|
|
35
|
+
getGasSwitchColorPalette?: string;
|
|
30
36
|
}
|
|
31
37
|
interface WidgetConfig {
|
|
32
38
|
theme?: Partial<WidgetTheme>;
|
|
39
|
+
/** API base URL. Default 'https://api.wheelx.fi' */
|
|
40
|
+
apiBaseUrl?: string;
|
|
33
41
|
from?: {
|
|
34
42
|
chains?: number[];
|
|
35
43
|
defaultChainId?: number;
|
|
@@ -54,6 +62,18 @@ interface WidgetConfig {
|
|
|
54
62
|
getCurrentPathname?: () => string;
|
|
55
63
|
};
|
|
56
64
|
dynamicEnvironmentId?: string;
|
|
65
|
+
/**
|
|
66
|
+
* 深度链接处理器。当 widget 在 WebView 中运行时,用于将钱包的 deep link URL
|
|
67
|
+
* 传递给宿主 App 处理(如通过 Linking.openURL 打开钱包 App)。
|
|
68
|
+
*
|
|
69
|
+
* 如果不提供此回调,widget 会自动尝试通过 ReactNativeWebView.postMessage
|
|
70
|
+
* 或自定义 DOM 事件进行通信。
|
|
71
|
+
*/
|
|
72
|
+
onDeepLink?: (url: string) => void;
|
|
73
|
+
/** EVM链固定收款异地址(0x格式)。配置后,to网络为EVM链时优先使用此地址 */
|
|
74
|
+
evmDifferentAddress?: string;
|
|
75
|
+
/** Solana链固定收款异地址(base58格式)。配置后,to网络为Solana链时优先使用此地址 */
|
|
76
|
+
solanaDifferentAddress?: string;
|
|
57
77
|
}
|
|
58
78
|
|
|
59
79
|
interface WheelXProviderProps {
|
|
@@ -101,6 +121,7 @@ interface QuoteRequest {
|
|
|
101
121
|
amount: string;
|
|
102
122
|
slippage?: number;
|
|
103
123
|
to_platform_id: number;
|
|
124
|
+
sponsor_gas?: boolean;
|
|
104
125
|
}
|
|
105
126
|
type QuoteErrorType = 'business_error' | 'http_error' | 'network_error' | 'timeout' | 'unknown_error';
|
|
106
127
|
interface QuoteMutationError extends Error {
|
|
@@ -147,6 +168,7 @@ type ChainInfo = {
|
|
|
147
168
|
inbound: boolean;
|
|
148
169
|
is_testnet?: boolean;
|
|
149
170
|
platform_id?: number;
|
|
171
|
+
support_sponsor_gas?: boolean;
|
|
150
172
|
};
|
|
151
173
|
interface Prediction {
|
|
152
174
|
chains: ChainInfo[];
|
|
@@ -160,6 +182,7 @@ interface SlippagePolicy {
|
|
|
160
182
|
min_slippage: number;
|
|
161
183
|
max_slippage: number;
|
|
162
184
|
refresh_interval: number;
|
|
185
|
+
/** Number of quote rounds after which to show a transaction-failure warning. Defaults to 2. */
|
|
163
186
|
notice_rounds?: number;
|
|
164
187
|
}
|
|
165
188
|
interface ChainsAndTokens {
|
|
@@ -312,19 +335,61 @@ declare const useChainsStore: zustand.UseBoundStore<zustand.StoreApi<ChainsStore
|
|
|
312
335
|
declare const useTokensStore: zustand.UseBoundStore<zustand.StoreApi<TokenStore>>;
|
|
313
336
|
|
|
314
337
|
/**
|
|
315
|
-
* Hook to get EVM wallet address with fallback to saved address
|
|
338
|
+
* Hook to get EVM wallet address with fallback to saved address
|
|
339
|
+
* This ensures that when a user first connects an EVM wallet (e.g., OKX),
|
|
340
|
+
* then connects a Solana wallet (e.g., MetaMask), the EVM address remains
|
|
341
|
+
* consistent with the first connected wallet.
|
|
316
342
|
*
|
|
317
|
-
*
|
|
343
|
+
* @returns The EVM wallet address (saved address or current wagmi address)
|
|
344
|
+
*/
|
|
345
|
+
declare const useEvmAddress: () => `0x${string}` | undefined;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Platform detection utilities for WebView environments.
|
|
349
|
+
* Used to detect and intercept deep links when the widget runs inside
|
|
350
|
+
* a WebView (e.g., React Native, Android WebView, WKWebView).
|
|
351
|
+
*/
|
|
352
|
+
/** Check if running inside a React Native WebView */
|
|
353
|
+
declare const isReactNativeWebView: () => boolean;
|
|
354
|
+
/** Check if running in any WebView (Android/iOS) */
|
|
355
|
+
declare const isWebView: () => boolean;
|
|
356
|
+
/** Check if running on mobile device */
|
|
357
|
+
declare const isMobileDevice: () => boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Check if we should intercept deep links.
|
|
318
360
|
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* DynamicWagmiConnector reconnecting), we must NOT use wagmi's address as
|
|
322
|
-
* fallback — otherwise the UI will continue to show address/balance info
|
|
323
|
-
* after the user has explicitly disconnected.
|
|
361
|
+
* We ONLY intercept in React Native WebView because that's the only WebView
|
|
362
|
+
* environment where we have a reliable forwarding mechanism (postMessage).
|
|
324
363
|
*
|
|
325
|
-
*
|
|
364
|
+
* Regular browsers (Chrome, Safari) handle deep links natively — we must not
|
|
365
|
+
* interfere there. Generic Android/iOS WebViews may or may not handle deep
|
|
366
|
+
* links depending on host app configuration, so we leave them alone.
|
|
326
367
|
*/
|
|
327
|
-
declare const
|
|
368
|
+
declare const shouldInterceptDeepLinks: () => boolean;
|
|
369
|
+
/** Check if URL is a deep link (non-http/https scheme) */
|
|
370
|
+
declare const isDeepLinkUrl: (url: string) => boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Known wallet universal link (https) domains.
|
|
373
|
+
* Wallet libraries (e.g. Dynamic SDK) may prefer universal links over
|
|
374
|
+
* custom URL schemes. These https:// URLs look like normal web pages but
|
|
375
|
+
* are designed to open wallet apps via OS-level app link resolution.
|
|
376
|
+
* In WebView environments, we must intercept them too.
|
|
377
|
+
*/
|
|
378
|
+
declare const KNOWN_WALLET_UNIVERSAL_LINKS: Record<string, string>;
|
|
379
|
+
/**
|
|
380
|
+
* Convert a wallet universal link to its corresponding deep-link scheme
|
|
381
|
+
* so that `Linking.openURL()` on React Native opens the wallet app
|
|
382
|
+
* directly instead of routing through the system browser.
|
|
383
|
+
*
|
|
384
|
+
* For example:
|
|
385
|
+
* https://phantom.app/ul/v1/connect?... → phantom://ul/v1/connect?...
|
|
386
|
+
*/
|
|
387
|
+
declare const convertToDeepLink: (url: string) => string;
|
|
388
|
+
/**
|
|
389
|
+
* Check if URL is a deep link (non-http/https scheme) OR a known wallet
|
|
390
|
+
* universal link that should be intercepted and forwarded to native.
|
|
391
|
+
*/
|
|
392
|
+
declare const isWalletRelatedUrl: (url: string) => boolean;
|
|
328
393
|
|
|
329
394
|
interface WalletStore {
|
|
330
395
|
isEthWalletConnected: boolean;
|
|
@@ -343,10 +408,8 @@ interface WalletStore {
|
|
|
343
408
|
setIsEvmWalletMetamask: (isEvmWalletMetamask: boolean) => void;
|
|
344
409
|
isLoggingOut: boolean;
|
|
345
410
|
setIsLoggingOut: (isLoggingOut: boolean) => void;
|
|
346
|
-
/** Timestamp (ms) of the most recent manual disconnect. Used to guard
|
|
347
|
-
* against DynamicWagmiConnector auto-reconnecting right after logout. */
|
|
348
411
|
lastDisconnectTimestamp: number;
|
|
349
|
-
setLastDisconnectTimestamp: (
|
|
412
|
+
setLastDisconnectTimestamp: (timestamp: number) => void;
|
|
350
413
|
}
|
|
351
414
|
declare const useWalletConnectedStore: zustand.UseBoundStore<zustand.StoreApi<WalletStore>>;
|
|
352
415
|
|
|
@@ -360,4 +423,4 @@ declare const useDifferentAddressStore: zustand.UseBoundStore<zustand.StoreApi<D
|
|
|
360
423
|
|
|
361
424
|
declare const useSyncWalletConnectedStore: () => void;
|
|
362
425
|
|
|
363
|
-
export { type ChainInfo, type ChainsAndTokens, type FeeLevel, type QuoteErrorType, type QuoteInfo, type QuoteMutationError, type QuoteRequest, type QuoteRequestWithToTokenDecimals, type RefetchQuoteParams, type SlippagePolicy, type TokenConfig, type TokenInfo, type TxInfoProps, WheelXProvider, type WheelXProviderProps, WheelXWidget, type WheelXWidgetProps, type WidgetConfig, type WidgetTheme, WidgetThemeProvider, defaultTheme, getChainsAndTokens, initialQuoteInfo, mergeTokensWithCompositeKey, useChainsAndTokens, useChainsStore, useDifferentAddressStore, useEvmAddress, useGuardChain, useInitSwapAndBridgeState, useRefreshLoading, useResetSwapAndBridgeState, useSwapAndBridgeContextStore, useSyncWalletConnectedStore, useTokenBalance, useTokensStore, useTxStateContextStore, useWalletConnectedStore, useWidgetTheme };
|
|
426
|
+
export { type ChainInfo, type ChainsAndTokens, type FeeLevel, KNOWN_WALLET_UNIVERSAL_LINKS, type QuoteErrorType, type QuoteInfo, type QuoteMutationError, type QuoteRequest, type QuoteRequestWithToTokenDecimals, type RefetchQuoteParams, type SlippagePolicy, type TokenConfig, type TokenInfo, type TxInfoProps, WheelXProvider, type WheelXProviderProps, WheelXWidget, type WheelXWidgetProps, type WidgetConfig, type WidgetTheme, WidgetThemeProvider, convertToDeepLink, defaultTheme, getChainsAndTokens, initialQuoteInfo, isDeepLinkUrl, isMobileDevice, isReactNativeWebView, isWalletRelatedUrl, isWebView, mergeTokensWithCompositeKey, shouldInterceptDeepLinks, useChainsAndTokens, useChainsStore, useDifferentAddressStore, useEvmAddress, useGuardChain, useInitSwapAndBridgeState, useRefreshLoading, useResetSwapAndBridgeState, useSwapAndBridgeContextStore, useSyncWalletConnectedStore, useTokenBalance, useTokensStore, useTxStateContextStore, useWalletConnectedStore, useWidgetTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,9 +27,17 @@ interface WidgetTheme {
|
|
|
27
27
|
normalButtonText: string;
|
|
28
28
|
disabledButtonBg: string;
|
|
29
29
|
disabledButtonText: string;
|
|
30
|
+
/**
|
|
31
|
+
* GetGas Switch colorPalette — accepts Chakra UI color palette names
|
|
32
|
+
* e.g. 'gray', 'red', 'orange', 'yellow', 'green', 'teal', 'cyan', 'blue', 'purple', 'pink'
|
|
33
|
+
* @default 'purple'
|
|
34
|
+
*/
|
|
35
|
+
getGasSwitchColorPalette?: string;
|
|
30
36
|
}
|
|
31
37
|
interface WidgetConfig {
|
|
32
38
|
theme?: Partial<WidgetTheme>;
|
|
39
|
+
/** API base URL. Default 'https://api.wheelx.fi' */
|
|
40
|
+
apiBaseUrl?: string;
|
|
33
41
|
from?: {
|
|
34
42
|
chains?: number[];
|
|
35
43
|
defaultChainId?: number;
|
|
@@ -54,6 +62,18 @@ interface WidgetConfig {
|
|
|
54
62
|
getCurrentPathname?: () => string;
|
|
55
63
|
};
|
|
56
64
|
dynamicEnvironmentId?: string;
|
|
65
|
+
/**
|
|
66
|
+
* 深度链接处理器。当 widget 在 WebView 中运行时,用于将钱包的 deep link URL
|
|
67
|
+
* 传递给宿主 App 处理(如通过 Linking.openURL 打开钱包 App)。
|
|
68
|
+
*
|
|
69
|
+
* 如果不提供此回调,widget 会自动尝试通过 ReactNativeWebView.postMessage
|
|
70
|
+
* 或自定义 DOM 事件进行通信。
|
|
71
|
+
*/
|
|
72
|
+
onDeepLink?: (url: string) => void;
|
|
73
|
+
/** EVM链固定收款异地址(0x格式)。配置后,to网络为EVM链时优先使用此地址 */
|
|
74
|
+
evmDifferentAddress?: string;
|
|
75
|
+
/** Solana链固定收款异地址(base58格式)。配置后,to网络为Solana链时优先使用此地址 */
|
|
76
|
+
solanaDifferentAddress?: string;
|
|
57
77
|
}
|
|
58
78
|
|
|
59
79
|
interface WheelXProviderProps {
|
|
@@ -101,6 +121,7 @@ interface QuoteRequest {
|
|
|
101
121
|
amount: string;
|
|
102
122
|
slippage?: number;
|
|
103
123
|
to_platform_id: number;
|
|
124
|
+
sponsor_gas?: boolean;
|
|
104
125
|
}
|
|
105
126
|
type QuoteErrorType = 'business_error' | 'http_error' | 'network_error' | 'timeout' | 'unknown_error';
|
|
106
127
|
interface QuoteMutationError extends Error {
|
|
@@ -147,6 +168,7 @@ type ChainInfo = {
|
|
|
147
168
|
inbound: boolean;
|
|
148
169
|
is_testnet?: boolean;
|
|
149
170
|
platform_id?: number;
|
|
171
|
+
support_sponsor_gas?: boolean;
|
|
150
172
|
};
|
|
151
173
|
interface Prediction {
|
|
152
174
|
chains: ChainInfo[];
|
|
@@ -160,6 +182,7 @@ interface SlippagePolicy {
|
|
|
160
182
|
min_slippage: number;
|
|
161
183
|
max_slippage: number;
|
|
162
184
|
refresh_interval: number;
|
|
185
|
+
/** Number of quote rounds after which to show a transaction-failure warning. Defaults to 2. */
|
|
163
186
|
notice_rounds?: number;
|
|
164
187
|
}
|
|
165
188
|
interface ChainsAndTokens {
|
|
@@ -312,19 +335,61 @@ declare const useChainsStore: zustand.UseBoundStore<zustand.StoreApi<ChainsStore
|
|
|
312
335
|
declare const useTokensStore: zustand.UseBoundStore<zustand.StoreApi<TokenStore>>;
|
|
313
336
|
|
|
314
337
|
/**
|
|
315
|
-
* Hook to get EVM wallet address with fallback to saved address
|
|
338
|
+
* Hook to get EVM wallet address with fallback to saved address
|
|
339
|
+
* This ensures that when a user first connects an EVM wallet (e.g., OKX),
|
|
340
|
+
* then connects a Solana wallet (e.g., MetaMask), the EVM address remains
|
|
341
|
+
* consistent with the first connected wallet.
|
|
316
342
|
*
|
|
317
|
-
*
|
|
343
|
+
* @returns The EVM wallet address (saved address or current wagmi address)
|
|
344
|
+
*/
|
|
345
|
+
declare const useEvmAddress: () => `0x${string}` | undefined;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Platform detection utilities for WebView environments.
|
|
349
|
+
* Used to detect and intercept deep links when the widget runs inside
|
|
350
|
+
* a WebView (e.g., React Native, Android WebView, WKWebView).
|
|
351
|
+
*/
|
|
352
|
+
/** Check if running inside a React Native WebView */
|
|
353
|
+
declare const isReactNativeWebView: () => boolean;
|
|
354
|
+
/** Check if running in any WebView (Android/iOS) */
|
|
355
|
+
declare const isWebView: () => boolean;
|
|
356
|
+
/** Check if running on mobile device */
|
|
357
|
+
declare const isMobileDevice: () => boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Check if we should intercept deep links.
|
|
318
360
|
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* DynamicWagmiConnector reconnecting), we must NOT use wagmi's address as
|
|
322
|
-
* fallback — otherwise the UI will continue to show address/balance info
|
|
323
|
-
* after the user has explicitly disconnected.
|
|
361
|
+
* We ONLY intercept in React Native WebView because that's the only WebView
|
|
362
|
+
* environment where we have a reliable forwarding mechanism (postMessage).
|
|
324
363
|
*
|
|
325
|
-
*
|
|
364
|
+
* Regular browsers (Chrome, Safari) handle deep links natively — we must not
|
|
365
|
+
* interfere there. Generic Android/iOS WebViews may or may not handle deep
|
|
366
|
+
* links depending on host app configuration, so we leave them alone.
|
|
326
367
|
*/
|
|
327
|
-
declare const
|
|
368
|
+
declare const shouldInterceptDeepLinks: () => boolean;
|
|
369
|
+
/** Check if URL is a deep link (non-http/https scheme) */
|
|
370
|
+
declare const isDeepLinkUrl: (url: string) => boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Known wallet universal link (https) domains.
|
|
373
|
+
* Wallet libraries (e.g. Dynamic SDK) may prefer universal links over
|
|
374
|
+
* custom URL schemes. These https:// URLs look like normal web pages but
|
|
375
|
+
* are designed to open wallet apps via OS-level app link resolution.
|
|
376
|
+
* In WebView environments, we must intercept them too.
|
|
377
|
+
*/
|
|
378
|
+
declare const KNOWN_WALLET_UNIVERSAL_LINKS: Record<string, string>;
|
|
379
|
+
/**
|
|
380
|
+
* Convert a wallet universal link to its corresponding deep-link scheme
|
|
381
|
+
* so that `Linking.openURL()` on React Native opens the wallet app
|
|
382
|
+
* directly instead of routing through the system browser.
|
|
383
|
+
*
|
|
384
|
+
* For example:
|
|
385
|
+
* https://phantom.app/ul/v1/connect?... → phantom://ul/v1/connect?...
|
|
386
|
+
*/
|
|
387
|
+
declare const convertToDeepLink: (url: string) => string;
|
|
388
|
+
/**
|
|
389
|
+
* Check if URL is a deep link (non-http/https scheme) OR a known wallet
|
|
390
|
+
* universal link that should be intercepted and forwarded to native.
|
|
391
|
+
*/
|
|
392
|
+
declare const isWalletRelatedUrl: (url: string) => boolean;
|
|
328
393
|
|
|
329
394
|
interface WalletStore {
|
|
330
395
|
isEthWalletConnected: boolean;
|
|
@@ -343,10 +408,8 @@ interface WalletStore {
|
|
|
343
408
|
setIsEvmWalletMetamask: (isEvmWalletMetamask: boolean) => void;
|
|
344
409
|
isLoggingOut: boolean;
|
|
345
410
|
setIsLoggingOut: (isLoggingOut: boolean) => void;
|
|
346
|
-
/** Timestamp (ms) of the most recent manual disconnect. Used to guard
|
|
347
|
-
* against DynamicWagmiConnector auto-reconnecting right after logout. */
|
|
348
411
|
lastDisconnectTimestamp: number;
|
|
349
|
-
setLastDisconnectTimestamp: (
|
|
412
|
+
setLastDisconnectTimestamp: (timestamp: number) => void;
|
|
350
413
|
}
|
|
351
414
|
declare const useWalletConnectedStore: zustand.UseBoundStore<zustand.StoreApi<WalletStore>>;
|
|
352
415
|
|
|
@@ -360,4 +423,4 @@ declare const useDifferentAddressStore: zustand.UseBoundStore<zustand.StoreApi<D
|
|
|
360
423
|
|
|
361
424
|
declare const useSyncWalletConnectedStore: () => void;
|
|
362
425
|
|
|
363
|
-
export { type ChainInfo, type ChainsAndTokens, type FeeLevel, type QuoteErrorType, type QuoteInfo, type QuoteMutationError, type QuoteRequest, type QuoteRequestWithToTokenDecimals, type RefetchQuoteParams, type SlippagePolicy, type TokenConfig, type TokenInfo, type TxInfoProps, WheelXProvider, type WheelXProviderProps, WheelXWidget, type WheelXWidgetProps, type WidgetConfig, type WidgetTheme, WidgetThemeProvider, defaultTheme, getChainsAndTokens, initialQuoteInfo, mergeTokensWithCompositeKey, useChainsAndTokens, useChainsStore, useDifferentAddressStore, useEvmAddress, useGuardChain, useInitSwapAndBridgeState, useRefreshLoading, useResetSwapAndBridgeState, useSwapAndBridgeContextStore, useSyncWalletConnectedStore, useTokenBalance, useTokensStore, useTxStateContextStore, useWalletConnectedStore, useWidgetTheme };
|
|
426
|
+
export { type ChainInfo, type ChainsAndTokens, type FeeLevel, KNOWN_WALLET_UNIVERSAL_LINKS, type QuoteErrorType, type QuoteInfo, type QuoteMutationError, type QuoteRequest, type QuoteRequestWithToTokenDecimals, type RefetchQuoteParams, type SlippagePolicy, type TokenConfig, type TokenInfo, type TxInfoProps, WheelXProvider, type WheelXProviderProps, WheelXWidget, type WheelXWidgetProps, type WidgetConfig, type WidgetTheme, WidgetThemeProvider, convertToDeepLink, defaultTheme, getChainsAndTokens, initialQuoteInfo, isDeepLinkUrl, isMobileDevice, isReactNativeWebView, isWalletRelatedUrl, isWebView, mergeTokensWithCompositeKey, shouldInterceptDeepLinks, useChainsAndTokens, useChainsStore, useDifferentAddressStore, useEvmAddress, useGuardChain, useInitSwapAndBridgeState, useRefreshLoading, useResetSwapAndBridgeState, useSwapAndBridgeContextStore, useSyncWalletConnectedStore, useTokenBalance, useTokensStore, useTxStateContextStore, useWalletConnectedStore, useWidgetTheme };
|