@wheelx-widget/widget 0.2.0 → 0.3.1

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 CHANGED
@@ -111,6 +111,8 @@ interface TxInfoProps {
111
111
  routes?: routesItem$1[] | undefined;
112
112
  onToggleAiRouter?: () => void;
113
113
  hasMultipleQuotes?: boolean;
114
+ /** Current quote request_id — TxInfo re-expands whenever it changes */
115
+ quoteRequestId?: string | null;
114
116
  }
115
117
 
116
118
  interface RefetchQuoteParams {
@@ -127,8 +129,12 @@ interface QuoteRequest {
127
129
  to_address: string;
128
130
  amount: string;
129
131
  slippage?: number;
132
+ /** Whether the user is in auto (recommended) slippage mode — recorded by
133
+ * the backend. false = manual preset/custom value. */
134
+ is_auto_slippage?: boolean;
130
135
  to_platform_id: number;
131
136
  sponsor_gas?: boolean;
137
+ btc_transfer_mode?: 'psbt' | 'deposit';
132
138
  }
133
139
  interface routesItem {
134
140
  name: string;
@@ -149,9 +155,27 @@ interface QuoteItem {
149
155
  message?: string;
150
156
  sender?: string;
151
157
  tx?: string;
158
+ psbt?: string;
159
+ encoding?: string;
160
+ /** JSON-serialized TronTxInfo for Tron approve transactions */
161
+ approveTx?: string;
152
162
  };
153
163
  routes: routesItem[];
154
164
  gas_fee?: string | null;
165
+ /** Provider fee (USD) — legacy fallback: `fee_usd` */
166
+ fee_usd?: string | null;
167
+ /** Network cost (USD) */
168
+ native_fee_usd?: string | null;
169
+ /** Per-route approve payload (ERC-20 / TRC-20) */
170
+ approve?: {
171
+ token: string;
172
+ spender: string;
173
+ amount: bigint;
174
+ } | null;
175
+ /** Deposit address for deposit-address flows (Tron / Bitcoin) */
176
+ deposit_address?: string | null;
177
+ /** Per-route estimated completion time (seconds) */
178
+ estimated_time?: number;
155
179
  }
156
180
  type QuoteErrorType = 'business_error' | 'http_error' | 'network_error' | 'timeout' | 'unknown_error';
157
181
  interface QuoteMutationError extends Error {
@@ -180,6 +204,7 @@ interface TokenInfo {
180
204
  platform_type?: string[];
181
205
  isSolana?: boolean;
182
206
  isTron?: boolean;
207
+ isBitcoin?: boolean;
183
208
  fee_level?: FeeLevel;
184
209
  }
185
210
  interface TokenInfoWithBalance extends TokenInfo {
@@ -225,9 +250,35 @@ interface ChainsAndTokens {
225
250
  };
226
251
  }
227
252
  declare function getChainsAndTokens(): Promise<ChainsAndTokens>;
228
- declare const useChainsAndTokens: (enabled?: boolean) => _tanstack_react_query.UseQueryResult<NoInfer<ChainsAndTokens>, Error>;
253
+ declare const useChainsAndTokens: (enabled?: boolean) => _tanstack_react_query.UseQueryResult<ChainsAndTokens, Error>;
229
254
  declare function mergeTokensWithCompositeKey(arr1: TokenInfoWithBalance[], arr2: TokenInfoWithBalance[]): TokenInfoWithBalance[];
230
255
 
256
+ /**
257
+ * Parameter section of a Tron transaction from the backend.
258
+ *
259
+ * Two shapes come back from the quote API:
260
+ * - TriggerSmartContract (TRC-20 swap / approve): contract_address + data
261
+ * - TransferContract (native TRX, deposit-address bridges): to_address + amount
262
+ * and NO calldata at all
263
+ */
264
+ interface TronTxParameter {
265
+ owner_address: string;
266
+ contract_address?: string;
267
+ data?: string;
268
+ call_value?: number;
269
+ /** Native TransferContract only. */
270
+ to_address?: string;
271
+ /** Native TransferContract only. */
272
+ amount?: number;
273
+ }
274
+ /** Tron transaction data returned by the quote API (tron→X swaps) */
275
+ interface TronTxInfo {
276
+ parameter: TronTxParameter;
277
+ type: string;
278
+ gas: null | number;
279
+ chainId: number;
280
+ }
281
+
231
282
  type WheelXWidgetProps = {
232
283
  config?: WidgetConfig;
233
284
  };
@@ -251,6 +302,16 @@ interface QuoteInfo {
251
302
  quotes?: QuoteItem[];
252
303
  solanaTxMessage?: string;
253
304
  solanaTxSender?: string;
305
+ tronTx?: TronTxInfo | null;
306
+ tronApproveTx?: TronTxInfo | null;
307
+ tronDepositAddress?: string | null;
308
+ bitcoinPsbt?: string;
309
+ bitcoinDepositAddress?: string | null;
310
+ approve?: {
311
+ token: string;
312
+ spender: string;
313
+ amount: bigint;
314
+ } | null;
254
315
  }
255
316
  interface QuoteRequestWithToTokenDecimals extends QuoteRequest {
256
317
  toTokenDecimals: number;
@@ -284,6 +345,10 @@ interface SwapState {
284
345
  shortLink?: string;
285
346
  transactionType?: string;
286
347
  autoSlippage?: number | undefined;
348
+ /** Session-level slippage mode: true = auto (recommended), false = manual.
349
+ * Synced from the per-address localStorage preference by SlippageSettings
350
+ * and used by the quote request funnel (getState read, always fresh). */
351
+ isAutoSlippage: boolean;
287
352
  tradeType?: string | null;
288
353
  }
289
354
  interface SwapAndBridgeContextStore extends SwapState {
@@ -302,6 +367,7 @@ interface SwapAndBridgeContextStore extends SwapState {
302
367
  setShortLink: (value: string) => void;
303
368
  setTransactionType: (value: string) => void;
304
369
  setAutoSlippage: (value: number | undefined) => void;
370
+ setIsAutoSlippage: (value: boolean) => void;
305
371
  }
306
372
  declare const useSwapAndBridgeContextStore: zustand.UseBoundStore<zustand.StoreApi<SwapAndBridgeContextStore>>;
307
373
  declare const useInitSwapAndBridgeState: (config?: WidgetConfig) => void;
@@ -325,6 +391,14 @@ interface TxStateContextStore {
325
391
  setSolanaFromTxHash: (hash: string | null) => void;
326
392
  isSolanaTransaction: boolean;
327
393
  setIsSolanaTransaction: (isSolana: boolean) => void;
394
+ tronFromTxHash: string | null;
395
+ setTronFromTxHash: (hash: string | null) => void;
396
+ isTronTransaction: boolean;
397
+ setIsTronTransaction: (isTronTransaction: boolean) => void;
398
+ bitcoinFromTxHash: string | null;
399
+ setBitcoinFromTxHash: (hash: string | null) => void;
400
+ isBitcoinTransaction: boolean;
401
+ setIsBitcoinTransaction: (isBitcoinTransaction: boolean) => void;
328
402
  }
329
403
  declare const useTxStateContextStore: zustand.UseBoundStore<zustand.StoreApi<TxStateContextStore>>;
330
404
 
@@ -349,7 +423,7 @@ interface BalanceResult {
349
423
  symbol: string;
350
424
  value: bigint;
351
425
  }
352
- declare const useTokenBalance: ({ chainId, tokenAddress, connectAddress }: Props) => NoInfer<BalanceResult> | undefined;
426
+ declare const useTokenBalance: ({ chainId, tokenAddress, connectAddress }: Props) => BalanceResult | undefined;
353
427
 
354
428
  interface ChainsStore {
355
429
  chains: ChainInfo[] | null;
@@ -451,6 +525,8 @@ interface WalletStore {
451
525
  setIsSolanaWalletConnected: (isSolanaWalletConnected: boolean) => void;
452
526
  isTronWalletConnected: boolean;
453
527
  setIsTronWalletConnected: (isTronWalletConnected: boolean) => void;
528
+ isBitcoinWalletConnected: boolean;
529
+ setIsBitcoinWalletConnected: (isBitcoinWalletConnected: boolean) => void;
454
530
  totalConnectedWallets: number;
455
531
  setTotalConnectedWallets: () => void;
456
532
  totalWallets: number;
@@ -458,6 +534,8 @@ interface WalletStore {
458
534
  setSolanaWalletAddress: (address: string | null) => void;
459
535
  tronWalletAddress: string | null;
460
536
  setTronWalletAddress: (address: string | null) => void;
537
+ bitcoinWalletAddress: string | null;
538
+ setBitcoinWalletAddress: (address: string | null) => void;
461
539
  evmWalletAddress: string | null;
462
540
  evmWalletConnectorId: string | null;
463
541
  setEvmWalletInfo: (address: string | null, connectorId: string | null) => void;
package/dist/index.d.ts CHANGED
@@ -111,6 +111,8 @@ interface TxInfoProps {
111
111
  routes?: routesItem$1[] | undefined;
112
112
  onToggleAiRouter?: () => void;
113
113
  hasMultipleQuotes?: boolean;
114
+ /** Current quote request_id — TxInfo re-expands whenever it changes */
115
+ quoteRequestId?: string | null;
114
116
  }
115
117
 
116
118
  interface RefetchQuoteParams {
@@ -127,8 +129,12 @@ interface QuoteRequest {
127
129
  to_address: string;
128
130
  amount: string;
129
131
  slippage?: number;
132
+ /** Whether the user is in auto (recommended) slippage mode — recorded by
133
+ * the backend. false = manual preset/custom value. */
134
+ is_auto_slippage?: boolean;
130
135
  to_platform_id: number;
131
136
  sponsor_gas?: boolean;
137
+ btc_transfer_mode?: 'psbt' | 'deposit';
132
138
  }
133
139
  interface routesItem {
134
140
  name: string;
@@ -149,9 +155,27 @@ interface QuoteItem {
149
155
  message?: string;
150
156
  sender?: string;
151
157
  tx?: string;
158
+ psbt?: string;
159
+ encoding?: string;
160
+ /** JSON-serialized TronTxInfo for Tron approve transactions */
161
+ approveTx?: string;
152
162
  };
153
163
  routes: routesItem[];
154
164
  gas_fee?: string | null;
165
+ /** Provider fee (USD) — legacy fallback: `fee_usd` */
166
+ fee_usd?: string | null;
167
+ /** Network cost (USD) */
168
+ native_fee_usd?: string | null;
169
+ /** Per-route approve payload (ERC-20 / TRC-20) */
170
+ approve?: {
171
+ token: string;
172
+ spender: string;
173
+ amount: bigint;
174
+ } | null;
175
+ /** Deposit address for deposit-address flows (Tron / Bitcoin) */
176
+ deposit_address?: string | null;
177
+ /** Per-route estimated completion time (seconds) */
178
+ estimated_time?: number;
155
179
  }
156
180
  type QuoteErrorType = 'business_error' | 'http_error' | 'network_error' | 'timeout' | 'unknown_error';
157
181
  interface QuoteMutationError extends Error {
@@ -180,6 +204,7 @@ interface TokenInfo {
180
204
  platform_type?: string[];
181
205
  isSolana?: boolean;
182
206
  isTron?: boolean;
207
+ isBitcoin?: boolean;
183
208
  fee_level?: FeeLevel;
184
209
  }
185
210
  interface TokenInfoWithBalance extends TokenInfo {
@@ -225,9 +250,35 @@ interface ChainsAndTokens {
225
250
  };
226
251
  }
227
252
  declare function getChainsAndTokens(): Promise<ChainsAndTokens>;
228
- declare const useChainsAndTokens: (enabled?: boolean) => _tanstack_react_query.UseQueryResult<NoInfer<ChainsAndTokens>, Error>;
253
+ declare const useChainsAndTokens: (enabled?: boolean) => _tanstack_react_query.UseQueryResult<ChainsAndTokens, Error>;
229
254
  declare function mergeTokensWithCompositeKey(arr1: TokenInfoWithBalance[], arr2: TokenInfoWithBalance[]): TokenInfoWithBalance[];
230
255
 
256
+ /**
257
+ * Parameter section of a Tron transaction from the backend.
258
+ *
259
+ * Two shapes come back from the quote API:
260
+ * - TriggerSmartContract (TRC-20 swap / approve): contract_address + data
261
+ * - TransferContract (native TRX, deposit-address bridges): to_address + amount
262
+ * and NO calldata at all
263
+ */
264
+ interface TronTxParameter {
265
+ owner_address: string;
266
+ contract_address?: string;
267
+ data?: string;
268
+ call_value?: number;
269
+ /** Native TransferContract only. */
270
+ to_address?: string;
271
+ /** Native TransferContract only. */
272
+ amount?: number;
273
+ }
274
+ /** Tron transaction data returned by the quote API (tron→X swaps) */
275
+ interface TronTxInfo {
276
+ parameter: TronTxParameter;
277
+ type: string;
278
+ gas: null | number;
279
+ chainId: number;
280
+ }
281
+
231
282
  type WheelXWidgetProps = {
232
283
  config?: WidgetConfig;
233
284
  };
@@ -251,6 +302,16 @@ interface QuoteInfo {
251
302
  quotes?: QuoteItem[];
252
303
  solanaTxMessage?: string;
253
304
  solanaTxSender?: string;
305
+ tronTx?: TronTxInfo | null;
306
+ tronApproveTx?: TronTxInfo | null;
307
+ tronDepositAddress?: string | null;
308
+ bitcoinPsbt?: string;
309
+ bitcoinDepositAddress?: string | null;
310
+ approve?: {
311
+ token: string;
312
+ spender: string;
313
+ amount: bigint;
314
+ } | null;
254
315
  }
255
316
  interface QuoteRequestWithToTokenDecimals extends QuoteRequest {
256
317
  toTokenDecimals: number;
@@ -284,6 +345,10 @@ interface SwapState {
284
345
  shortLink?: string;
285
346
  transactionType?: string;
286
347
  autoSlippage?: number | undefined;
348
+ /** Session-level slippage mode: true = auto (recommended), false = manual.
349
+ * Synced from the per-address localStorage preference by SlippageSettings
350
+ * and used by the quote request funnel (getState read, always fresh). */
351
+ isAutoSlippage: boolean;
287
352
  tradeType?: string | null;
288
353
  }
289
354
  interface SwapAndBridgeContextStore extends SwapState {
@@ -302,6 +367,7 @@ interface SwapAndBridgeContextStore extends SwapState {
302
367
  setShortLink: (value: string) => void;
303
368
  setTransactionType: (value: string) => void;
304
369
  setAutoSlippage: (value: number | undefined) => void;
370
+ setIsAutoSlippage: (value: boolean) => void;
305
371
  }
306
372
  declare const useSwapAndBridgeContextStore: zustand.UseBoundStore<zustand.StoreApi<SwapAndBridgeContextStore>>;
307
373
  declare const useInitSwapAndBridgeState: (config?: WidgetConfig) => void;
@@ -325,6 +391,14 @@ interface TxStateContextStore {
325
391
  setSolanaFromTxHash: (hash: string | null) => void;
326
392
  isSolanaTransaction: boolean;
327
393
  setIsSolanaTransaction: (isSolana: boolean) => void;
394
+ tronFromTxHash: string | null;
395
+ setTronFromTxHash: (hash: string | null) => void;
396
+ isTronTransaction: boolean;
397
+ setIsTronTransaction: (isTronTransaction: boolean) => void;
398
+ bitcoinFromTxHash: string | null;
399
+ setBitcoinFromTxHash: (hash: string | null) => void;
400
+ isBitcoinTransaction: boolean;
401
+ setIsBitcoinTransaction: (isBitcoinTransaction: boolean) => void;
328
402
  }
329
403
  declare const useTxStateContextStore: zustand.UseBoundStore<zustand.StoreApi<TxStateContextStore>>;
330
404
 
@@ -349,7 +423,7 @@ interface BalanceResult {
349
423
  symbol: string;
350
424
  value: bigint;
351
425
  }
352
- declare const useTokenBalance: ({ chainId, tokenAddress, connectAddress }: Props) => NoInfer<BalanceResult> | undefined;
426
+ declare const useTokenBalance: ({ chainId, tokenAddress, connectAddress }: Props) => BalanceResult | undefined;
353
427
 
354
428
  interface ChainsStore {
355
429
  chains: ChainInfo[] | null;
@@ -451,6 +525,8 @@ interface WalletStore {
451
525
  setIsSolanaWalletConnected: (isSolanaWalletConnected: boolean) => void;
452
526
  isTronWalletConnected: boolean;
453
527
  setIsTronWalletConnected: (isTronWalletConnected: boolean) => void;
528
+ isBitcoinWalletConnected: boolean;
529
+ setIsBitcoinWalletConnected: (isBitcoinWalletConnected: boolean) => void;
454
530
  totalConnectedWallets: number;
455
531
  setTotalConnectedWallets: () => void;
456
532
  totalWallets: number;
@@ -458,6 +534,8 @@ interface WalletStore {
458
534
  setSolanaWalletAddress: (address: string | null) => void;
459
535
  tronWalletAddress: string | null;
460
536
  setTronWalletAddress: (address: string | null) => void;
537
+ bitcoinWalletAddress: string | null;
538
+ setBitcoinWalletAddress: (address: string | null) => void;
461
539
  evmWalletAddress: string | null;
462
540
  evmWalletConnectorId: string | null;
463
541
  setEvmWalletInfo: (address: string | null, connectorId: string | null) => void;