@silentswap/react 0.0.48 → 0.0.50

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.
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type Connector } from 'wagmi';
3
3
  import { type WalletClient } from 'viem';
4
- import { ENVIRONMENT, type SilentSwapClient, type SilentSwapClientConfig, type AuthResponse, type QuoteResponse } from '@silentswap/sdk';
4
+ import { ENVIRONMENT, type SilentSwapClient, type SilentSwapClientConfig, type AuthResponse, type QuoteResponse, type CalculationDirection } from '@silentswap/sdk';
5
5
  import { type ExecuteSwapParams, type SwapResult } from '../hooks/silent/useSilentQuote.js';
6
6
  import { type OutputStatus } from '../hooks/silent/useOrderTracking.js';
7
7
  import { type SolanaWalletConnector, type SolanaConnection } from '../hooks/silent/solana-transaction.js';
@@ -37,7 +37,7 @@ export interface SilentSwapContextType {
37
37
  serviceFeeRate: number;
38
38
  overheadUsd: number;
39
39
  egressEstimatesLoading: boolean;
40
- fetchEstimates: (direction?: 'input-to-output' | 'output-to-input') => Promise<void>;
40
+ fetchEstimates: (direction?: CalculationDirection) => Promise<void>;
41
41
  handleNewSwap: () => void;
42
42
  solanaRpcUrl?: string;
43
43
  }
@@ -97,7 +97,6 @@ function SilentSwapInnerProvider({ children, client, evmAddress, solAddress, sol
97
97
  const { fetchEstimates, isLoading: egressEstimatesLoading, egressQuotes: egressQuotesFromEstimates, ingressQuote: ingressQuoteFromEstimates, depositAmountUsd: depositAmountUsdFromEstimates, bridgeProviderFromQuote, usdcPrice: usdcPriceFromEstimates, } = useEgressEstimates({
98
98
  evmAddress,
99
99
  solAddress,
100
- quoteAddress: effectiveQuoteAddress,
101
100
  tokenIn,
102
101
  inputAmount,
103
102
  destinations,
@@ -1,9 +1,8 @@
1
- import { BridgeProvider, type AssetInfo } from '@silentswap/sdk';
1
+ import { BridgeProvider, type AssetInfo, type CalculationDirection } from '@silentswap/sdk';
2
2
  import type { Destination } from './useSwap.js';
3
3
  export interface UseEgressEstimatesOptions {
4
4
  evmAddress: `0x${string}` | string | undefined;
5
5
  solAddress: string | undefined;
6
- quoteAddress: string | undefined;
7
6
  tokenIn: AssetInfo | null;
8
7
  inputAmount: string;
9
8
  destinations: Destination[];
@@ -11,15 +10,15 @@ export interface UseEgressEstimatesOptions {
11
10
  updateDestinationAmount: (index: number, amount: string) => void;
12
11
  serviceFeeRate?: number;
13
12
  overheadUsd?: number;
14
- calculationDirection?: 'input-to-output' | 'output-to-input';
13
+ calculationDirection?: CalculationDirection;
15
14
  setInputAmount?: (amount: string) => void;
16
15
  }
17
16
  /**
18
17
  * Hook to fetch egress estimates and calculate accurate output amounts
19
18
  * Matches the behavior of Svelte Form.svelte's fetch_live_estimate()
20
19
  */
21
- export declare function useEgressEstimates({ evmAddress, solAddress, quoteAddress, tokenIn, inputAmount, destinations, splits, updateDestinationAmount, serviceFeeRate, overheadUsd, calculationDirection, setInputAmount, }: UseEgressEstimatesOptions): {
22
- fetchEstimates: (direction?: "input-to-output" | "output-to-input") => Promise<any>;
20
+ export declare function useEgressEstimates({ evmAddress, solAddress, tokenIn, inputAmount, destinations, splits, updateDestinationAmount, serviceFeeRate, overheadUsd, calculationDirection, setInputAmount, }: UseEgressEstimatesOptions): {
21
+ fetchEstimates: (direction?: CalculationDirection) => Promise<any>;
23
22
  isLoading: boolean;
24
23
  error: Error | null;
25
24
  egressRates: number[];
@@ -1,13 +1,13 @@
1
1
  import { useState, useCallback, useRef, useMemo } from 'react';
2
2
  import { BigNumber } from 'bignumber.js';
3
3
  import { useOrderEstimates } from './useOrderEstimates.js';
4
- import { getAssetByCaip19, S_CAIP19_USDC_AVALANCHE } from '@silentswap/sdk';
4
+ import { getAssetByCaip19, S_CAIP19_USDC_AVALANCHE, CALCULATION_DIRECTION_INPUT_TO_OUTPUT, CALCULATION_DIRECTION_OUTPUT_TO_INPUT, } from '@silentswap/sdk';
5
5
  import { usePrices } from './usePrices.js';
6
6
  /**
7
7
  * Hook to fetch egress estimates and calculate accurate output amounts
8
8
  * Matches the behavior of Svelte Form.svelte's fetch_live_estimate()
9
9
  */
10
- export function useEgressEstimates({ evmAddress, solAddress, quoteAddress, tokenIn, inputAmount, destinations, splits, updateDestinationAmount, serviceFeeRate = 0.01, overheadUsd = 0, calculationDirection = 'input-to-output', setInputAmount, }) {
10
+ export function useEgressEstimates({ evmAddress, solAddress, tokenIn, inputAmount, destinations, splits, updateDestinationAmount, serviceFeeRate = 0.01, overheadUsd = 0, calculationDirection = CALCULATION_DIRECTION_INPUT_TO_OUTPUT, setInputAmount, }) {
11
11
  const { estimateOrder, isLoading, error } = useOrderEstimates({
12
12
  evmAddress: evmAddress,
13
13
  solAddress: solAddress,
@@ -26,18 +26,18 @@ export function useEgressEstimates({ evmAddress, solAddress, quoteAddress, token
26
26
  /**
27
27
  * Fetch egress estimates and calculate output amounts
28
28
  * This matches Svelte's fetch_live_estimate() function
29
- * @param direction - Calculation direction: 'input-to-output' (normal) or 'output-to-input' (reverse)
29
+ * @param direction - Calculation direction: CALCULATION_DIRECTION_INPUT_TO_OUTPUT (normal) or CALCULATION_DIRECTION_OUTPUT_TO_INPUT (reverse)
30
30
  */
31
- const fetchEstimates = useCallback(async (direction = 'input-to-output') => {
31
+ const fetchEstimates = useCallback(async (direction = CALCULATION_DIRECTION_INPUT_TO_OUTPUT) => {
32
32
  console.log('[EgressEstimates] Step 1: Starting fetchEstimates', { direction, tokenIn: tokenIn?.caip19, inputAmount, destinationsCount: destinations.length });
33
33
  // Validate all required inputs before proceeding
34
+ // Note: quoteAddress is not required for estimates - useOrderEstimates uses fallback addresses when needed
34
35
  if (!tokenIn ||
35
36
  !tokenIn.caip19 ||
36
37
  !inputAmount ||
37
38
  parseFloat(inputAmount) <= 0 ||
38
- destinations.length === 0 ||
39
- !quoteAddress) {
40
- console.log('[EgressEstimates] Step 1: Validation failed - missing required inputs');
39
+ destinations.length === 0) {
40
+ console.log('[EgressEstimates] Step 1: Validation failed - missing required inputs', { tokenIn, inputAmount, destinations, splits });
41
41
  return;
42
42
  }
43
43
  const estimateKey = `${tokenIn.caip19}-${inputAmount}-${destinations.map((d) => d.asset).join(',')}-${splits.join(',')}`;
@@ -75,7 +75,7 @@ export function useEgressEstimates({ evmAddress, solAddress, quoteAddress, token
75
75
  }
76
76
  // Fetch estimates (both ingress and egress in parallel)
77
77
  // For reverse calculation (output-to-input), pass output amounts and use EXACT_OUTPUT
78
- const effectiveDirection = direction || calculationDirection || 'input-to-output';
78
+ const effectiveDirection = direction || calculationDirection || CALCULATION_DIRECTION_INPUT_TO_OUTPUT;
79
79
  console.log('[EgressEstimates] Step 4: Calling estimateOrder', {
80
80
  effectiveDirection,
81
81
  sourceAsset: tokenIn.caip19,
@@ -83,7 +83,7 @@ export function useEgressEstimates({ evmAddress, solAddress, quoteAddress, token
83
83
  destinationsCount: destinationAssets.length,
84
84
  splits,
85
85
  });
86
- const requestPromise = estimateOrder(fetchedUsdcPrice || 1, tokenIn, sourcePrice, inputAmount, destinationAssets, destinationPrices, splits, effectiveDirection, effectiveDirection === 'output-to-input'
86
+ const requestPromise = estimateOrder(fetchedUsdcPrice || 1, tokenIn, sourcePrice, inputAmount, destinationAssets, destinationPrices, splits, effectiveDirection, effectiveDirection === CALCULATION_DIRECTION_OUTPUT_TO_INPUT
87
87
  ? destinations.map((dest) => dest.amount) // Pass output amounts for reverse calculation
88
88
  : undefined);
89
89
  // Store the in-flight request
@@ -108,9 +108,9 @@ export function useEgressEstimates({ evmAddress, solAddress, quoteAddress, token
108
108
  // Calculate deposit amount in USD (matches Svelte calculation - lines 173-177)
109
109
  // Note: This is the USD value after ingress retention, not the USDC amount
110
110
  let depositUsd;
111
- // Handle reverse calculation: if direction is 'output-to-input',
111
+ // Handle reverse calculation: if direction is CALCULATION_DIRECTION_OUTPUT_TO_INPUT,
112
112
  // the estimate system calculated the required input amount
113
- if (effectiveDirection === 'output-to-input' && result.calculatedInputAmount && setInputAmount) {
113
+ if (effectiveDirection === CALCULATION_DIRECTION_OUTPUT_TO_INPUT && result.calculatedInputAmount && setInputAmount) {
114
114
  console.log('[EgressEstimates] Step 7: Handling reverse calculation - updating input amount', {
115
115
  calculatedInputAmount: result.calculatedInputAmount,
116
116
  });
@@ -139,7 +139,7 @@ export function useEgressEstimates({ evmAddress, solAddress, quoteAddress, token
139
139
  const actionableUsd = depositUsd - serviceFeeUsd;
140
140
  // Update destination amounts (matches Svelte Form.svelte lines 217-229)
141
141
  // For reverse calculation, preserve user's manual changes
142
- if (effectiveDirection === 'output-to-input') {
142
+ if (effectiveDirection === CALCULATION_DIRECTION_OUTPUT_TO_INPUT) {
143
143
  console.log('[EgressEstimates] Step 9: Reverse calculation - preserving user output amounts');
144
144
  // Don't overwrite user's manual output changes
145
145
  // The outputs are already set correctly
@@ -196,7 +196,6 @@ export function useEgressEstimates({ evmAddress, solAddress, quoteAddress, token
196
196
  estimateOrder,
197
197
  getPrice,
198
198
  updateDestinationAmount,
199
- quoteAddress,
200
199
  serviceFeeRate,
201
200
  overheadUsd,
202
201
  calculationDirection,
@@ -1,5 +1,5 @@
1
1
  import type { Estimate, RelayQuoteResponse, DeBridgeOrderResponse } from '@silentswap/sdk';
2
- import { type AssetInfo } from '@silentswap/sdk';
2
+ import { type AssetInfo, type CalculationDirection } from '@silentswap/sdk';
3
3
  export interface OrderEstimateResult {
4
4
  ingressGasAmount: bigint;
5
5
  ingressRate: number;
@@ -31,7 +31,7 @@ export interface UseOrderEstimatesOptions {
31
31
  * Returns retention rates that account for bridge fees and slippage
32
32
  */
33
33
  export declare function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpactPercent, }?: UseOrderEstimatesOptions): {
34
- estimateOrder: (usdcPrice: number, sourceAsset: AssetInfo, sourcePrice: number, sourceAmount: number | string, destinationAssets: AssetInfo[], destinationPrices: number[], splits: number[], calculationDirection?: "input-to-output" | "output-to-input", outputAmounts?: string[]) => Promise<OrderEstimateResult>;
34
+ estimateOrder: (usdcPrice: number, sourceAsset: AssetInfo, sourcePrice: number, sourceAmount: number | string, destinationAssets: AssetInfo[], destinationPrices: number[], splits: number[], calculationDirection?: CalculationDirection, outputAmounts?: string[]) => Promise<OrderEstimateResult>;
35
35
  isLoading: boolean;
36
36
  error: Error | null;
37
37
  };
@@ -1,10 +1,7 @@
1
1
  import { useCallback, useRef, useState, useMemo } from 'react';
2
2
  import BigNumber from 'bignumber.js';
3
- import { parseEvmCaip19, parseSolanaCaip19, isEvmNativeToken, isSolanaNativeToken, isSolanaAsset, } from '@silentswap/sdk';
3
+ import { parseEvmCaip19, parseSolanaCaip19, isEvmNativeToken, isSolanaNativeToken, isSolanaAsset, EVM_PHONY_ADDRESS, SB58_ADDR_SOL_PROGRAM_SYSTEM, CALCULATION_DIRECTION_INPUT_TO_OUTPUT, CALCULATION_DIRECTION_OUTPUT_TO_INPUT, } from '@silentswap/sdk';
4
4
  import { useQuote } from './useQuote.js';
5
- // Fallback EVM address for egress quotes when evmAddress is not available
6
- // Egress quotes always start from Avalanche (EVM), so they require an EVM address
7
- const EVM_PHONY_ADDRESS_FALLBACK = '0x1111111111111111111111111111111111111111';
8
5
  /**
9
6
  * Hook for fetching both ingress and egress estimates in parallel
10
7
  * Matches the behavior of estimate_order() from silentswap-v2-ui/src/web3/estimate.ts
@@ -17,21 +14,30 @@ const EVM_PHONY_ADDRESS_FALLBACK = '0x1111111111111111111111111111111111111111';
17
14
  */
18
15
  export function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpactPercent, } = {}) {
19
16
  const [error, setError] = useState(null);
17
+ const [isLoading, setIsLoading] = useState(false);
20
18
  // Determine address for ingress quotes based on source chain
21
19
  // For ingress, we need the address that matches the source chain (not sourceAsset)
22
20
  // For egress, we always start from Avalanche (EVM), so we can use evmAddress as default
23
21
  // But we'll create separate useQuote instances to handle this correctly
22
+ // Use fallback addresses when wallet is not connected to allow estimates without wallet
24
23
  const ingressAddress = useMemo(() => {
25
24
  if (sourceAsset) {
26
25
  // For ingress, address should match the source chain
27
- return sourceAsset.caip19.includes('solana') ? solAddress : evmAddress;
26
+ // Use fallback addresses when wallet is not connected (for estimates without wallet)
27
+ if (sourceAsset.caip19.includes('solana')) {
28
+ return solAddress || SB58_ADDR_SOL_PROGRAM_SYSTEM;
29
+ }
30
+ else {
31
+ return evmAddress || EVM_PHONY_ADDRESS;
32
+ }
28
33
  }
29
- return undefined;
34
+ // Default to EVM fallback if no source asset
35
+ return EVM_PHONY_ADDRESS;
30
36
  }, [sourceAsset, solAddress, evmAddress]);
31
37
  // For egress, we always start from Avalanche (EVM), so use EVM address
32
38
  // If evmAddress is undefined, use the phony EVM address as fallback
33
39
  // This ensures egress quotes always use an EVM address format (required for Avalanche origin)
34
- const egressAddress = evmAddress || EVM_PHONY_ADDRESS_FALLBACK;
40
+ const egressAddress = evmAddress || EVM_PHONY_ADDRESS;
35
41
  // Initialize useQuote hooks - one for ingress (uses address based on source chain)
36
42
  // and one for egress (uses EVM address since egress always starts from Avalanche)
37
43
  const ingressQuote = useQuote({
@@ -39,7 +45,7 @@ export function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpa
39
45
  maxImpactPercent,
40
46
  });
41
47
  const egressQuote = useQuote({
42
- address: egressAddress, // Always an EVM address (either evmAddress or EVM_PHONY_ADDRESS_FALLBACK)
48
+ address: egressAddress, // Always an EVM address (either evmAddress or EVM_PHONY_ADDRESS)
43
49
  maxImpactPercent,
44
50
  });
45
51
  const { estimateLive: estimateLiveIngress, interpolateSamples: interpolate } = ingressQuote;
@@ -51,7 +57,7 @@ export function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpa
51
57
  * Fetch both ingress and egress estimates in parallel
52
58
  * Matches estimate_order() from Svelte app
53
59
  */
54
- const estimateOrder = useCallback(async (usdcPrice, sourceAsset, sourcePrice, sourceAmount, destinationAssets, destinationPrices, splits, calculationDirection = 'input-to-output', outputAmounts) => {
60
+ const estimateOrder = useCallback(async (usdcPrice, sourceAsset, sourcePrice, sourceAmount, destinationAssets, destinationPrices, splits, calculationDirection = CALCULATION_DIRECTION_INPUT_TO_OUTPUT, outputAmounts) => {
55
61
  // Validate inputs
56
62
  if (!sourceAsset) {
57
63
  throw new Error('sourceAsset is required');
@@ -66,7 +72,7 @@ export function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpa
66
72
  throw new Error('All destinationAssets must have a valid caip19 property');
67
73
  }
68
74
  // For reverse calculation, validate output amounts
69
- if (calculationDirection === 'output-to-input') {
75
+ if (calculationDirection === CALCULATION_DIRECTION_OUTPUT_TO_INPUT) {
70
76
  if (!outputAmounts || outputAmounts.length !== destinationAssets.length) {
71
77
  throw new Error('outputAmounts are required for reverse calculation');
72
78
  }
@@ -120,7 +126,7 @@ export function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpa
120
126
  // For reverse calculation, calculate total output USD value first
121
127
  let totalOutputUsd = 0;
122
128
  let calculatedInputAmount = undefined;
123
- if (calculationDirection === 'output-to-input' && outputAmounts) {
129
+ if (calculationDirection === CALCULATION_DIRECTION_OUTPUT_TO_INPUT && outputAmounts) {
124
130
  console.log('[OrderEstimates] Step 4: Reverse calculation - calculating total output USD');
125
131
  // Calculate total USD value of outputs
126
132
  totalOutputUsd = destinationAssets.reduce((sum, destAsset, idx) => {
@@ -147,7 +153,7 @@ export function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpa
147
153
  // Ingress: source chain -> Avalanche (USDC)
148
154
  // For reverse calculation, use EXACT_OUTPUT with calculated deposit USD
149
155
  // For normal calculation, use EXACT_INPUT with source amount
150
- calculationDirection === 'output-to-input' && totalOutputUsd > 0
156
+ calculationDirection === CALCULATION_DIRECTION_OUTPUT_TO_INPUT && totalOutputUsd > 0
151
157
  ? estimateLiveIngress('ingress', sourceAsset.caip19, sourceChainId, sourceTokenAddress, totalOutputUsd / sourcePrice, // Approximate input for quote (will be refined)
152
158
  sourcePrice, abortController.signal, undefined, // recipientAddress (not needed for ingress)
153
159
  true, // isReverseCalculation
@@ -179,7 +185,7 @@ export function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpa
179
185
  // For Solana destinations, use Solana address; for EVM, use EVM address
180
186
  const recipientAddress = isDestSolana ? solAddress : evmAddress;
181
187
  // For reverse calculation, use output amount directly with EXACT_OUTPUT
182
- if (calculationDirection === 'output-to-input' && outputAmounts && outputAmounts[idx]) {
188
+ if (calculationDirection === CALCULATION_DIRECTION_OUTPUT_TO_INPUT && outputAmounts && outputAmounts[idx]) {
183
189
  const outputAmount = parseFloat(outputAmounts[idx]);
184
190
  // Use EXACT_OUTPUT for egress: we know the output amount, calculate required USDC
185
191
  // Pass the output amount directly (in human-readable format)
@@ -248,7 +254,7 @@ export function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpa
248
254
  const egressRetentions = [];
249
255
  for (let idx = 0; idx < destinationAssets.length; idx++) {
250
256
  const egressResult = egressResults[idx];
251
- if (calculationDirection === 'output-to-input' && outputAmounts && outputAmounts[idx]) {
257
+ if (calculationDirection === CALCULATION_DIRECTION_OUTPUT_TO_INPUT && outputAmounts && outputAmounts[idx]) {
252
258
  // For reverse calculation, use output USD value for interpolation
253
259
  const outputAmount = parseFloat(outputAmounts[idx]);
254
260
  const destPrice = destinationPrices[idx] || 1;
@@ -321,7 +327,7 @@ export function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpa
321
327
  egressRetentions,
322
328
  });
323
329
  // For reverse calculation, extract calculated input amount from ingress result
324
- if (calculationDirection === 'output-to-input' && ingressResult.calculatedInputAmount) {
330
+ if (calculationDirection === CALCULATION_DIRECTION_OUTPUT_TO_INPUT && ingressResult.calculatedInputAmount) {
325
331
  console.log('[OrderEstimates] Step 9: Reverse calculation - interpolating retention with calculated input', {
326
332
  calculatedInputAmount: ingressResult.calculatedInputAmount,
327
333
  });
@@ -375,19 +381,21 @@ export function useOrderEstimates({ evmAddress, solAddress, sourceAsset, maxImpa
375
381
  throw error;
376
382
  }
377
383
  })();
378
- // Store the in-flight request
384
+ // Store the in-flight request and update loading state
379
385
  inFlightRequestRef.current = requestPromise;
386
+ setIsLoading(true);
380
387
  // Clear in-flight request when promise completes (success or error)
381
388
  requestPromise.finally(() => {
382
389
  if (inFlightRequestRef.current === requestPromise) {
383
390
  inFlightRequestRef.current = null;
391
+ setIsLoading(false);
384
392
  }
385
393
  });
386
394
  return requestPromise;
387
395
  }, [estimateLiveIngress, estimateLiveEgress, interpolate, ingressAddress, egressAddress, sourceAsset, solAddress, evmAddress, maxImpactPercent]);
388
396
  return {
389
397
  estimateOrder,
390
- isLoading: !!inFlightRequestRef.current,
398
+ isLoading,
391
399
  error,
392
400
  };
393
401
  }
@@ -1,9 +1,8 @@
1
1
  import { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import BigNumber from 'bignumber.js';
3
- import { NI_CHAIN_ID_AVALANCHE, S0X_ADDR_USDC_AVALANCHE, S_CAIP19_USDC_AVALANCHE, X_MAX_IMPACT_PERCENT, getBridgeQuote as sdkGetBridgeQuote, interpolateSamples as sdkInterpolateSamples, fetchRelayQuote, fetchDebridgeOrder, normalizeAddress, getAssetByCaip19, N_DEBRIDGE_CHAIN_ID_SOLANA, N_RELAY_CHAIN_ID_SOLANA, SB58_ADDR_SOL_PROGRAM_SYSTEM, S0X_ADDR_EVM_RELAY_LINK_DEAD, SB58_ADDR_SOL_RELAY_LINK_RECIPIENT, isSolanaAsset, } from '@silentswap/sdk';
3
+ import { NI_CHAIN_ID_AVALANCHE, S0X_ADDR_USDC_AVALANCHE, S_CAIP19_USDC_AVALANCHE, X_MAX_IMPACT_PERCENT, getBridgeQuote as sdkGetBridgeQuote, interpolateSamples as sdkInterpolateSamples, fetchRelayQuote, fetchDebridgeOrder, normalizeAddress, getAssetByCaip19, N_DEBRIDGE_CHAIN_ID_SOLANA, N_RELAY_CHAIN_ID_SOLANA, SB58_ADDR_SOL_PROGRAM_SYSTEM, S0X_ADDR_EVM_RELAY_LINK_DEAD, SB58_ADDR_SOL_RELAY_LINK_RECIPIENT, isSolanaAsset, EVM_PHONY_ADDRESS, } from '@silentswap/sdk';
4
4
  // Constants for estimateLive
5
5
  const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
6
- const EVM_PHONY_ADDRESS_FALLBACK = '0x1111111111111111111111111111111111111111';
7
6
  /**
8
7
  * Hook for getting optimized bridge quotes with retention rate tracking
9
8
  * Implements the same functionality as estimate.ts from the original app
@@ -208,14 +207,14 @@ export function useQuote({ address, maxImpactPercent = X_MAX_IMPACT_PERCENT } =
208
207
  // For EVM ingress, use EVM address (or phony if not available)
209
208
  userAddress = normalizedAddress && normalizedAddress.startsWith('0x')
210
209
  ? normalizedAddress
211
- : EVM_PHONY_ADDRESS_FALLBACK;
210
+ : EVM_PHONY_ADDRESS;
212
211
  }
213
212
  }
214
213
  else {
215
214
  // For egress, origin is always Avalanche (EVM), so user must be EVM address
216
215
  userAddress = normalizedAddress && normalizedAddress.startsWith('0x')
217
216
  ? normalizedAddress
218
- : EVM_PHONY_ADDRESS_FALLBACK;
217
+ : EVM_PHONY_ADDRESS;
219
218
  }
220
219
  // For Solana, use different chain IDs for different providers
221
220
  const relayChainId = isSolanaChain ? N_RELAY_CHAIN_ID_SOLANA : numericChainId;
@@ -274,7 +273,7 @@ export function useQuote({ address, maxImpactPercent = X_MAX_IMPACT_PERCENT } =
274
273
  }),
275
274
  // For Solana ingress, set recipient to EVM phony address (for Avalanche destination)
276
275
  ...(isSolanaChain
277
- ? { recipient: EVM_PHONY_ADDRESS_FALLBACK }
276
+ ? { recipient: EVM_PHONY_ADDRESS }
278
277
  : {}),
279
278
  }
280
279
  : {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silentswap/react",
3
3
  "type": "module",
4
- "version": "0.0.48",
4
+ "version": "0.0.50",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@ensdomains/ensjs": "^4.2.0",
26
- "@silentswap/sdk": "0.0.48",
27
- "@silentswap/ui-kit": "0.0.48",
26
+ "@silentswap/sdk": "0.0.50",
27
+ "@silentswap/ui-kit": "0.0.50",
28
28
  "@solana/codecs-strings": "^5.1.0",
29
29
  "@solana/kit": "^5.1.0",
30
30
  "@solana/rpc": "^5.1.0",