@silentswap/react 0.0.68 → 0.0.70

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.
@@ -43,7 +43,7 @@ export interface SilentSwapContextType {
43
43
  solanaRpcUrl?: string;
44
44
  }
45
45
  export declare function useSilentSwap(): SilentSwapContextType;
46
- export declare function SilentSwapProvider({ children, client, evmAddress, solAddress, connector, isConnected, solanaConnector, solanaConnection, bitcoinConnector, bitcoinConnection, environment, baseUrl, solanaRpcUrl, walletClient, bitcoinAddress, bitcoinRpcUrl, }: {
46
+ export declare function SilentSwapProvider({ children, client, evmAddress, solAddress, connector, isConnected, solanaConnector, solanaConnection, bitcoinConnector, bitcoinConnection, environment, baseUrl, solanaRpcUrl, walletClient, bitcoinAddress, bitcoinRpcUrl, proId, }: {
47
47
  children: React.ReactNode;
48
48
  client: SilentSwapClient;
49
49
  evmAddress?: string;
@@ -60,4 +60,6 @@ export declare function SilentSwapProvider({ children, client, evmAddress, solAd
60
60
  solanaRpcUrl?: string;
61
61
  bitcoinAddress?: string;
62
62
  bitcoinRpcUrl?: string;
63
+ /** Pro user ID for volume tracking (from ?pro= URL or localStorage silentswap:pro) */
64
+ proId?: string;
63
65
  }): import("react/jsx-runtime").JSX.Element;
@@ -63,7 +63,7 @@ export function useSilentSwap() {
63
63
  }
64
64
  return context;
65
65
  }
66
- function SilentSwapInnerProvider({ children, client, evmAddress, solAddress, bitcoinAddress, solanaConnector, solanaConnection, bitcoinConnector, bitcoinConnection, environment, config, solanaRpcUrl, connector, isConnected = false, walletClient, }) {
66
+ function SilentSwapInnerProvider({ children, client, evmAddress, solAddress, bitcoinAddress, solanaConnector, solanaConnection, bitcoinConnector, bitcoinConnection, environment, config, solanaRpcUrl, connector, isConnected = false, walletClient, proId, }) {
67
67
  // Authentication hook - only for EVM
68
68
  const { auth, isLoading: authLoading } = useAuth({
69
69
  client,
@@ -130,6 +130,7 @@ function SilentSwapInnerProvider({ children, client, evmAddress, solAddress, bit
130
130
  bitcoinConnector,
131
131
  bitcoinConnection,
132
132
  getPrice,
133
+ proId,
133
134
  });
134
135
  const effectiveDepositAmountUsd = useMemo(() => {
135
136
  return depositAmountUsdFromEstimates > 0 ? depositAmountUsdFromEstimates : depositAmountUsdc;
@@ -221,7 +222,7 @@ function SilentSwapInnerProvider({ children, client, evmAddress, solAddress, bit
221
222
  solanaRpcUrl,
222
223
  }, children: children });
223
224
  }
224
- export function SilentSwapProvider({ children, client, evmAddress, solAddress, connector, isConnected, solanaConnector, solanaConnection, bitcoinConnector, bitcoinConnection, environment = ENVIRONMENT.STAGING, baseUrl, solanaRpcUrl, walletClient, bitcoinAddress, bitcoinRpcUrl, }) {
225
+ export function SilentSwapProvider({ children, client, evmAddress, solAddress, connector, isConnected, solanaConnector, solanaConnection, bitcoinConnector, bitcoinConnection, environment = ENVIRONMENT.STAGING, baseUrl, solanaRpcUrl, walletClient, bitcoinAddress, bitcoinRpcUrl, proId, }) {
225
226
  const config = useMemo(() => {
226
227
  const computedBaseUrl = baseUrl ?? ENVIRONMENT_CONFIGS[environment].baseUrl;
227
228
  console.log('[SilentSwapProvider] Creating config:', { environment, baseUrl, computedBaseUrl });
@@ -230,5 +231,5 @@ export function SilentSwapProvider({ children, client, evmAddress, solAddress, c
230
231
  baseUrl: computedBaseUrl,
231
232
  };
232
233
  }, [environment, baseUrl]);
233
- return (_jsx(AssetsProvider, { children: _jsx(PricesProvider, { children: _jsx(BalancesProvider, { evmAddress: evmAddress, solAddress: solAddress, solanaRpcUrl: solanaRpcUrl, bitcoinAddress: bitcoinAddress, bitcoinRpcUrl: bitcoinRpcUrl, children: _jsx(OrdersProvider, { baseUrl: config.baseUrl, children: _jsx(SilentSwapInnerProvider, { client: client, connector: connector, isConnected: isConnected, evmAddress: evmAddress, solAddress: solAddress, bitcoinAddress: bitcoinAddress, solanaConnector: solanaConnector, solanaConnection: solanaConnection, bitcoinConnector: bitcoinConnector, bitcoinConnection: bitcoinConnection, environment: environment, config: config, solanaRpcUrl: solanaRpcUrl, walletClient: walletClient, children: children }) }) }) }) }));
234
+ return (_jsx(AssetsProvider, { children: _jsx(PricesProvider, { children: _jsx(BalancesProvider, { evmAddress: evmAddress, solAddress: solAddress, solanaRpcUrl: solanaRpcUrl, bitcoinAddress: bitcoinAddress, bitcoinRpcUrl: bitcoinRpcUrl, children: _jsx(OrdersProvider, { baseUrl: config.baseUrl, children: _jsx(SilentSwapInnerProvider, { client: client, connector: connector, isConnected: isConnected, evmAddress: evmAddress, solAddress: solAddress, bitcoinAddress: bitcoinAddress, solanaConnector: solanaConnector, solanaConnection: solanaConnection, bitcoinConnector: bitcoinConnector, bitcoinConnection: bitcoinConnection, environment: environment, config: config, solanaRpcUrl: solanaRpcUrl, walletClient: walletClient, proId: proId, children: children }) }) }) }) }));
234
235
  }
@@ -28,6 +28,8 @@ export interface UseQuoteCalculationOptions {
28
28
  getPrice: (asset: AssetInfo) => Promise<number>;
29
29
  /** Set destinations callback */
30
30
  setDestinations: (updater: Destination[] | ((prev: Destination[]) => Destination[])) => void;
31
+ /** Pro user ID for volume tracking (sent with quote request) */
32
+ proId?: string;
31
33
  }
32
34
  export interface UseQuoteCalculationReturn {
33
35
  /** Calculate quote and return result */
@@ -47,4 +49,4 @@ export interface UseQuoteCalculationReturn {
47
49
  * - Quote request construction and fetching
48
50
  * - Destination amount updates
49
51
  */
50
- export declare function useQuoteCalculation({ address, evmAddress, wallet, depositorAddress, getQuote, getPrice, setDestinations, }: UseQuoteCalculationOptions): UseQuoteCalculationReturn;
52
+ export declare function useQuoteCalculation({ address, evmAddress, wallet, depositorAddress, getQuote, getPrice, setDestinations, proId, }: UseQuoteCalculationOptions): UseQuoteCalculationReturn;
@@ -12,7 +12,7 @@ import { BigNumber } from 'bignumber.js';
12
12
  * - Quote request construction and fetching
13
13
  * - Destination amount updates
14
14
  */
15
- export function useQuoteCalculation({ address, evmAddress, wallet, depositorAddress, getQuote, getPrice, setDestinations, }) {
15
+ export function useQuoteCalculation({ address, evmAddress, wallet, depositorAddress, getQuote, getPrice, setDestinations, proId, }) {
16
16
  const [loadingAmounts, setLoadingAmounts] = useState(false);
17
17
  const [depositAmountUsdc, setDepositAmountUsdc] = useState(0);
18
18
  const calculateQuote = useCallback(async (debouncedSourceAsset, debouncedSourceAmount, destinations, splits) => {
@@ -353,6 +353,7 @@ export function useQuoteCalculation({ address, evmAddress, wallet, depositorAddr
353
353
  signer: quoteSignerAddress,
354
354
  viewer: viewerPk,
355
355
  outputs,
356
+ ...(proId ? { pro: proId } : {}),
356
357
  });
357
358
  if (abortController.signal.aborted) {
358
359
  setLoadingAmounts(false);
@@ -433,7 +434,7 @@ export function useQuoteCalculation({ address, evmAddress, wallet, depositorAddr
433
434
  // Always ensure loading state is reset (safety net)
434
435
  setLoadingAmounts(false);
435
436
  }
436
- }, [wallet, address, evmAddress, getQuote, getPrice, setDestinations, depositorAddress]);
437
+ }, [wallet, address, evmAddress, getQuote, getPrice, setDestinations, depositorAddress, proId]);
437
438
  return {
438
439
  calculateQuote,
439
440
  loadingAmounts,
@@ -61,6 +61,8 @@ export interface useSilentQuoteOptions {
61
61
  /** Get price function */
62
62
  getPrice: (asset: AssetInfo) => Promise<number>;
63
63
  setDestinations: (updater: Destination[] | ((prev: Destination[]) => Destination[])) => void;
64
+ /** Pro user ID for volume tracking (sent with quote request, matching Svelte's AppState.proId) */
65
+ proId?: string;
64
66
  }
65
67
  /**
66
68
  * Return type for useSilentQuote hook
@@ -96,4 +98,4 @@ export interface ExecuteSwapParams {
96
98
  /** Optional integrator ID for tracking */
97
99
  integratorId?: string;
98
100
  }
99
- export declare function useSilentQuote({ client, address, evmAddress, solAddress, walletClient, connector, wallet, walletLoading, walletError, generateWallet, onStatus, solanaConnector, solanaConnection, solanaRpcUrl, bitcoinConnector, bitcoinConnection, getPrice, setDestinations, }: useSilentQuoteOptions): useSilentQuoteReturn;
101
+ export declare function useSilentQuote({ client, address, evmAddress, solAddress, walletClient, connector, wallet, walletLoading, walletError, generateWallet, onStatus, solanaConnector, solanaConnection, solanaRpcUrl, bitcoinConnector, bitcoinConnection, getPrice, setDestinations, proId, }: useSilentQuoteOptions): useSilentQuoteReturn;
@@ -7,7 +7,7 @@ import { useOrderSigning } from './useOrderSigning.js';
7
7
  import { useBridgeExecution } from './useBridgeExecution.js';
8
8
  import { useTransaction } from '../useTransaction.js';
9
9
  import { useQuoteCalculation } from './useQuoteCalculation.js';
10
- export function useSilentQuote({ client, address, evmAddress, solAddress, walletClient, connector, wallet, walletLoading = false, walletError = null, generateWallet, onStatus, solanaConnector, solanaConnection, solanaRpcUrl, bitcoinConnector, bitcoinConnection, getPrice, setDestinations, }) {
10
+ export function useSilentQuote({ client, address, evmAddress, solAddress, walletClient, connector, wallet, walletLoading = false, walletError = null, generateWallet, onStatus, solanaConnector, solanaConnection, solanaRpcUrl, bitcoinConnector, bitcoinConnection, getPrice, setDestinations, proId, }) {
11
11
  const [isLoading, setIsLoading] = useState(false);
12
12
  const [currentStep, setCurrentStep] = useState('');
13
13
  const [quote, setQuote] = useState(null);
@@ -86,6 +86,7 @@ export function useSilentQuote({ client, address, evmAddress, solAddress, wallet
86
86
  getQuote,
87
87
  getPrice,
88
88
  setDestinations,
89
+ proId,
89
90
  });
90
91
  /**
91
92
  * Execute the complete swap flow
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silentswap/react",
3
3
  "type": "module",
4
- "version": "0.0.68",
4
+ "version": "0.0.70",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -24,8 +24,8 @@
24
24
  "dependencies": {
25
25
  "@bigmi/core": "^0.6.5",
26
26
  "@ensdomains/ensjs": "^4.2.0",
27
- "@silentswap/sdk": "0.0.68",
28
- "@silentswap/ui-kit": "0.0.68",
27
+ "@silentswap/sdk": "0.0.70",
28
+ "@silentswap/ui-kit": "0.0.70",
29
29
  "@solana/codecs-strings": "^5.1.0",
30
30
  "@solana/kit": "^5.1.0",
31
31
  "@solana/rpc": "^5.1.0",