@wheelx-widget/widget 0.1.19 → 0.2.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.
- package/dist/index.d.mts +60 -6
- package/dist/index.d.ts +60 -6
- package/dist/index.js +5240 -3632
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5244 -3636
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -2
package/dist/index.d.mts
CHANGED
|
@@ -72,6 +72,8 @@ interface WidgetConfig {
|
|
|
72
72
|
evmDifferentAddress?: string;
|
|
73
73
|
/** Solana链固定收款异地址(base58格式)。配置后,to网络为Solana链时优先使用此地址 */
|
|
74
74
|
solanaDifferentAddress?: string;
|
|
75
|
+
/** Tron链固定收款异地址(T地址格式,以T开头)。配置后,to网络为Tron链时优先使用此地址 */
|
|
76
|
+
tronDifferentAddress?: string;
|
|
75
77
|
/**
|
|
76
78
|
* 返佣ID(affiliation code)。
|
|
77
79
|
* 配置后在 quote 请求中优先使用此值;为空时回退到从 URL path 中提取。
|
|
@@ -85,7 +87,7 @@ interface WheelXProviderProps {
|
|
|
85
87
|
}
|
|
86
88
|
declare const WheelXProvider: React.FC<WheelXProviderProps>;
|
|
87
89
|
|
|
88
|
-
interface routesItem {
|
|
90
|
+
interface routesItem$1 {
|
|
89
91
|
name: string;
|
|
90
92
|
logo: string;
|
|
91
93
|
}
|
|
@@ -106,7 +108,9 @@ interface TxInfoProps {
|
|
|
106
108
|
amountOut: string;
|
|
107
109
|
fromTokenInUsd?: Fraction;
|
|
108
110
|
router_type: string | null | undefined;
|
|
109
|
-
routes?: routesItem[] | undefined;
|
|
111
|
+
routes?: routesItem$1[] | undefined;
|
|
112
|
+
onToggleAiRouter?: () => void;
|
|
113
|
+
hasMultipleQuotes?: boolean;
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
interface RefetchQuoteParams {
|
|
@@ -126,6 +130,29 @@ interface QuoteRequest {
|
|
|
126
130
|
to_platform_id: number;
|
|
127
131
|
sponsor_gas?: boolean;
|
|
128
132
|
}
|
|
133
|
+
interface routesItem {
|
|
134
|
+
name: string;
|
|
135
|
+
logo: string;
|
|
136
|
+
}
|
|
137
|
+
interface QuoteItem {
|
|
138
|
+
request_id: string;
|
|
139
|
+
router: string;
|
|
140
|
+
amount_out: string;
|
|
141
|
+
tx: {
|
|
142
|
+
chainId: number;
|
|
143
|
+
data: `0x${string}`;
|
|
144
|
+
to: `0x${string}`;
|
|
145
|
+
value: string;
|
|
146
|
+
gas?: bigint | null;
|
|
147
|
+
maxFeePerGas?: bigint | undefined;
|
|
148
|
+
maxPriorityFeePerGas?: bigint | undefined;
|
|
149
|
+
message?: string;
|
|
150
|
+
sender?: string;
|
|
151
|
+
tx?: string;
|
|
152
|
+
};
|
|
153
|
+
routes: routesItem[];
|
|
154
|
+
gas_fee?: string | null;
|
|
155
|
+
}
|
|
129
156
|
type QuoteErrorType = 'business_error' | 'http_error' | 'network_error' | 'timeout' | 'unknown_error';
|
|
130
157
|
interface QuoteMutationError extends Error {
|
|
131
158
|
httpStatus?: number;
|
|
@@ -152,6 +179,7 @@ interface TokenInfo {
|
|
|
152
179
|
platform_id?: number;
|
|
153
180
|
platform_type?: string[];
|
|
154
181
|
isSolana?: boolean;
|
|
182
|
+
isTron?: boolean;
|
|
155
183
|
fee_level?: FeeLevel;
|
|
156
184
|
}
|
|
157
185
|
interface TokenInfoWithBalance extends TokenInfo {
|
|
@@ -197,7 +225,7 @@ interface ChainsAndTokens {
|
|
|
197
225
|
};
|
|
198
226
|
}
|
|
199
227
|
declare function getChainsAndTokens(): Promise<ChainsAndTokens>;
|
|
200
|
-
declare const useChainsAndTokens: (enabled?: boolean) => _tanstack_react_query.UseQueryResult<ChainsAndTokens
|
|
228
|
+
declare const useChainsAndTokens: (enabled?: boolean) => _tanstack_react_query.UseQueryResult<NoInfer<ChainsAndTokens>, Error>;
|
|
201
229
|
declare function mergeTokensWithCompositeKey(arr1: TokenInfoWithBalance[], arr2: TokenInfoWithBalance[]): TokenInfoWithBalance[];
|
|
202
230
|
|
|
203
231
|
type WheelXWidgetProps = {
|
|
@@ -219,7 +247,8 @@ interface QuoteInfo {
|
|
|
219
247
|
tx_value?: string | null;
|
|
220
248
|
points?: number | 0 | string;
|
|
221
249
|
quote_message?: string | null;
|
|
222
|
-
routes?: routesItem[];
|
|
250
|
+
routes?: routesItem$1[];
|
|
251
|
+
quotes?: QuoteItem[];
|
|
223
252
|
solanaTxMessage?: string;
|
|
224
253
|
solanaTxSender?: string;
|
|
225
254
|
}
|
|
@@ -312,7 +341,7 @@ declare const useRefreshLoading: () => {
|
|
|
312
341
|
interface Props {
|
|
313
342
|
chainId: number;
|
|
314
343
|
tokenAddress?: `0x${string}`;
|
|
315
|
-
connectAddress?:
|
|
344
|
+
connectAddress?: string;
|
|
316
345
|
}
|
|
317
346
|
interface BalanceResult {
|
|
318
347
|
decimals: number;
|
|
@@ -320,7 +349,7 @@ interface BalanceResult {
|
|
|
320
349
|
symbol: string;
|
|
321
350
|
value: bigint;
|
|
322
351
|
}
|
|
323
|
-
declare const useTokenBalance: ({ chainId, tokenAddress, connectAddress }: Props) => BalanceResult | undefined;
|
|
352
|
+
declare const useTokenBalance: ({ chainId, tokenAddress, connectAddress }: Props) => NoInfer<BalanceResult> | undefined;
|
|
324
353
|
|
|
325
354
|
interface ChainsStore {
|
|
326
355
|
chains: ChainInfo[] | null;
|
|
@@ -352,6 +381,27 @@ declare const useEvmAddress: () => `0x${string}` | undefined;
|
|
|
352
381
|
* Used to detect and intercept deep links when the widget runs inside
|
|
353
382
|
* a WebView (e.g., React Native, Android WebView, WKWebView).
|
|
354
383
|
*/
|
|
384
|
+
declare global {
|
|
385
|
+
interface Window {
|
|
386
|
+
ReactNativeWebView?: {
|
|
387
|
+
postMessage?: (msg: string) => void;
|
|
388
|
+
};
|
|
389
|
+
__wheelx_wallet_callback_url__?: string;
|
|
390
|
+
__walletx_callback_params__?: Record<string, string>;
|
|
391
|
+
__wheelx_trigger_url_update__?: () => void;
|
|
392
|
+
__wheelx_callback_listener_installed?: boolean;
|
|
393
|
+
__wheelx_pending_callback__?: string;
|
|
394
|
+
DynamicLabs?: {
|
|
395
|
+
utils?: {
|
|
396
|
+
PlatformService?: unknown;
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
__DYNAMIC_LABS__?: {
|
|
400
|
+
PlatformService?: unknown;
|
|
401
|
+
};
|
|
402
|
+
PlatformService?: unknown;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
355
405
|
/** Check if running inside a React Native WebView */
|
|
356
406
|
declare const isReactNativeWebView: () => boolean;
|
|
357
407
|
/** Check if running in any WebView (Android/iOS) */
|
|
@@ -399,11 +449,15 @@ interface WalletStore {
|
|
|
399
449
|
setIsEthWalletConnected: (isEthWalletConnected: boolean) => void;
|
|
400
450
|
isSolanaWalletConnected: boolean;
|
|
401
451
|
setIsSolanaWalletConnected: (isSolanaWalletConnected: boolean) => void;
|
|
452
|
+
isTronWalletConnected: boolean;
|
|
453
|
+
setIsTronWalletConnected: (isTronWalletConnected: boolean) => void;
|
|
402
454
|
totalConnectedWallets: number;
|
|
403
455
|
setTotalConnectedWallets: () => void;
|
|
404
456
|
totalWallets: number;
|
|
405
457
|
solanaWalletAddress: string | null;
|
|
406
458
|
setSolanaWalletAddress: (address: string | null) => void;
|
|
459
|
+
tronWalletAddress: string | null;
|
|
460
|
+
setTronWalletAddress: (address: string | null) => void;
|
|
407
461
|
evmWalletAddress: string | null;
|
|
408
462
|
evmWalletConnectorId: string | null;
|
|
409
463
|
setEvmWalletInfo: (address: string | null, connectorId: string | null) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,8 @@ interface WidgetConfig {
|
|
|
72
72
|
evmDifferentAddress?: string;
|
|
73
73
|
/** Solana链固定收款异地址(base58格式)。配置后,to网络为Solana链时优先使用此地址 */
|
|
74
74
|
solanaDifferentAddress?: string;
|
|
75
|
+
/** Tron链固定收款异地址(T地址格式,以T开头)。配置后,to网络为Tron链时优先使用此地址 */
|
|
76
|
+
tronDifferentAddress?: string;
|
|
75
77
|
/**
|
|
76
78
|
* 返佣ID(affiliation code)。
|
|
77
79
|
* 配置后在 quote 请求中优先使用此值;为空时回退到从 URL path 中提取。
|
|
@@ -85,7 +87,7 @@ interface WheelXProviderProps {
|
|
|
85
87
|
}
|
|
86
88
|
declare const WheelXProvider: React.FC<WheelXProviderProps>;
|
|
87
89
|
|
|
88
|
-
interface routesItem {
|
|
90
|
+
interface routesItem$1 {
|
|
89
91
|
name: string;
|
|
90
92
|
logo: string;
|
|
91
93
|
}
|
|
@@ -106,7 +108,9 @@ interface TxInfoProps {
|
|
|
106
108
|
amountOut: string;
|
|
107
109
|
fromTokenInUsd?: Fraction;
|
|
108
110
|
router_type: string | null | undefined;
|
|
109
|
-
routes?: routesItem[] | undefined;
|
|
111
|
+
routes?: routesItem$1[] | undefined;
|
|
112
|
+
onToggleAiRouter?: () => void;
|
|
113
|
+
hasMultipleQuotes?: boolean;
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
interface RefetchQuoteParams {
|
|
@@ -126,6 +130,29 @@ interface QuoteRequest {
|
|
|
126
130
|
to_platform_id: number;
|
|
127
131
|
sponsor_gas?: boolean;
|
|
128
132
|
}
|
|
133
|
+
interface routesItem {
|
|
134
|
+
name: string;
|
|
135
|
+
logo: string;
|
|
136
|
+
}
|
|
137
|
+
interface QuoteItem {
|
|
138
|
+
request_id: string;
|
|
139
|
+
router: string;
|
|
140
|
+
amount_out: string;
|
|
141
|
+
tx: {
|
|
142
|
+
chainId: number;
|
|
143
|
+
data: `0x${string}`;
|
|
144
|
+
to: `0x${string}`;
|
|
145
|
+
value: string;
|
|
146
|
+
gas?: bigint | null;
|
|
147
|
+
maxFeePerGas?: bigint | undefined;
|
|
148
|
+
maxPriorityFeePerGas?: bigint | undefined;
|
|
149
|
+
message?: string;
|
|
150
|
+
sender?: string;
|
|
151
|
+
tx?: string;
|
|
152
|
+
};
|
|
153
|
+
routes: routesItem[];
|
|
154
|
+
gas_fee?: string | null;
|
|
155
|
+
}
|
|
129
156
|
type QuoteErrorType = 'business_error' | 'http_error' | 'network_error' | 'timeout' | 'unknown_error';
|
|
130
157
|
interface QuoteMutationError extends Error {
|
|
131
158
|
httpStatus?: number;
|
|
@@ -152,6 +179,7 @@ interface TokenInfo {
|
|
|
152
179
|
platform_id?: number;
|
|
153
180
|
platform_type?: string[];
|
|
154
181
|
isSolana?: boolean;
|
|
182
|
+
isTron?: boolean;
|
|
155
183
|
fee_level?: FeeLevel;
|
|
156
184
|
}
|
|
157
185
|
interface TokenInfoWithBalance extends TokenInfo {
|
|
@@ -197,7 +225,7 @@ interface ChainsAndTokens {
|
|
|
197
225
|
};
|
|
198
226
|
}
|
|
199
227
|
declare function getChainsAndTokens(): Promise<ChainsAndTokens>;
|
|
200
|
-
declare const useChainsAndTokens: (enabled?: boolean) => _tanstack_react_query.UseQueryResult<ChainsAndTokens
|
|
228
|
+
declare const useChainsAndTokens: (enabled?: boolean) => _tanstack_react_query.UseQueryResult<NoInfer<ChainsAndTokens>, Error>;
|
|
201
229
|
declare function mergeTokensWithCompositeKey(arr1: TokenInfoWithBalance[], arr2: TokenInfoWithBalance[]): TokenInfoWithBalance[];
|
|
202
230
|
|
|
203
231
|
type WheelXWidgetProps = {
|
|
@@ -219,7 +247,8 @@ interface QuoteInfo {
|
|
|
219
247
|
tx_value?: string | null;
|
|
220
248
|
points?: number | 0 | string;
|
|
221
249
|
quote_message?: string | null;
|
|
222
|
-
routes?: routesItem[];
|
|
250
|
+
routes?: routesItem$1[];
|
|
251
|
+
quotes?: QuoteItem[];
|
|
223
252
|
solanaTxMessage?: string;
|
|
224
253
|
solanaTxSender?: string;
|
|
225
254
|
}
|
|
@@ -312,7 +341,7 @@ declare const useRefreshLoading: () => {
|
|
|
312
341
|
interface Props {
|
|
313
342
|
chainId: number;
|
|
314
343
|
tokenAddress?: `0x${string}`;
|
|
315
|
-
connectAddress?:
|
|
344
|
+
connectAddress?: string;
|
|
316
345
|
}
|
|
317
346
|
interface BalanceResult {
|
|
318
347
|
decimals: number;
|
|
@@ -320,7 +349,7 @@ interface BalanceResult {
|
|
|
320
349
|
symbol: string;
|
|
321
350
|
value: bigint;
|
|
322
351
|
}
|
|
323
|
-
declare const useTokenBalance: ({ chainId, tokenAddress, connectAddress }: Props) => BalanceResult | undefined;
|
|
352
|
+
declare const useTokenBalance: ({ chainId, tokenAddress, connectAddress }: Props) => NoInfer<BalanceResult> | undefined;
|
|
324
353
|
|
|
325
354
|
interface ChainsStore {
|
|
326
355
|
chains: ChainInfo[] | null;
|
|
@@ -352,6 +381,27 @@ declare const useEvmAddress: () => `0x${string}` | undefined;
|
|
|
352
381
|
* Used to detect and intercept deep links when the widget runs inside
|
|
353
382
|
* a WebView (e.g., React Native, Android WebView, WKWebView).
|
|
354
383
|
*/
|
|
384
|
+
declare global {
|
|
385
|
+
interface Window {
|
|
386
|
+
ReactNativeWebView?: {
|
|
387
|
+
postMessage?: (msg: string) => void;
|
|
388
|
+
};
|
|
389
|
+
__wheelx_wallet_callback_url__?: string;
|
|
390
|
+
__walletx_callback_params__?: Record<string, string>;
|
|
391
|
+
__wheelx_trigger_url_update__?: () => void;
|
|
392
|
+
__wheelx_callback_listener_installed?: boolean;
|
|
393
|
+
__wheelx_pending_callback__?: string;
|
|
394
|
+
DynamicLabs?: {
|
|
395
|
+
utils?: {
|
|
396
|
+
PlatformService?: unknown;
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
__DYNAMIC_LABS__?: {
|
|
400
|
+
PlatformService?: unknown;
|
|
401
|
+
};
|
|
402
|
+
PlatformService?: unknown;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
355
405
|
/** Check if running inside a React Native WebView */
|
|
356
406
|
declare const isReactNativeWebView: () => boolean;
|
|
357
407
|
/** Check if running in any WebView (Android/iOS) */
|
|
@@ -399,11 +449,15 @@ interface WalletStore {
|
|
|
399
449
|
setIsEthWalletConnected: (isEthWalletConnected: boolean) => void;
|
|
400
450
|
isSolanaWalletConnected: boolean;
|
|
401
451
|
setIsSolanaWalletConnected: (isSolanaWalletConnected: boolean) => void;
|
|
452
|
+
isTronWalletConnected: boolean;
|
|
453
|
+
setIsTronWalletConnected: (isTronWalletConnected: boolean) => void;
|
|
402
454
|
totalConnectedWallets: number;
|
|
403
455
|
setTotalConnectedWallets: () => void;
|
|
404
456
|
totalWallets: number;
|
|
405
457
|
solanaWalletAddress: string | null;
|
|
406
458
|
setSolanaWalletAddress: (address: string | null) => void;
|
|
459
|
+
tronWalletAddress: string | null;
|
|
460
|
+
setTronWalletAddress: (address: string | null) => void;
|
|
407
461
|
evmWalletAddress: string | null;
|
|
408
462
|
evmWalletConnectorId: string | null;
|
|
409
463
|
setEvmWalletInfo: (address: string | null, connectorId: string | null) => void;
|