@0xsquid/react-hooks 8.7.2-beta-interactive-to-amount.0 → 8.7.2

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.
Files changed (31) hide show
  1. package/dist/core/queries/queries-keys.d.ts +1 -1
  2. package/dist/core/types/config.d.ts +1 -1
  3. package/dist/core/types/event.d.ts +2 -1
  4. package/dist/core/types/route.d.ts +4 -0
  5. package/dist/hooks/store/useSquidStore.d.ts +1 -2
  6. package/dist/hooks/swap/useSwap.d.ts +2 -4
  7. package/dist/hooks/transaction/useGetRoute.d.ts +8 -8
  8. package/dist/{index-uUESkMSI.js → index-D3bbd13Z.js} +35 -63
  9. package/dist/index-D3bbd13Z.js.map +1 -0
  10. package/dist/{index-6eFn7nS3.js → index-DaYYG81O.js} +36 -63
  11. package/dist/index-DaYYG81O.js.map +1 -0
  12. package/dist/{index.es-CRHo3jIu.js → index.es-Bn83pLT9.js} +2 -2
  13. package/dist/{index.es-CRHo3jIu.js.map → index.es-Bn83pLT9.js.map} +1 -1
  14. package/dist/{index.es-C0R5BhSh.js → index.es-Ds1lt_e4.js} +2 -2
  15. package/dist/{index.es-C0R5BhSh.js.map → index.es-Ds1lt_e4.js.map} +1 -1
  16. package/dist/index.esm.js +1 -1
  17. package/dist/index.js +1 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/{secretService-C8LsM_VG.js → secretService-CKReaNYo.js} +2 -2
  20. package/dist/{secretService-C8LsM_VG.js.map → secretService-CKReaNYo.js.map} +1 -1
  21. package/dist/{secretService-B87PUWJl.js → secretService-CM6noWhX.js} +2 -2
  22. package/dist/{secretService-B87PUWJl.js.map → secretService-CM6noWhX.js.map} +1 -1
  23. package/dist/services/internal/eventService.d.ts +2 -1
  24. package/dist/services/internal/numberService.d.ts +0 -1
  25. package/dist/{stellarService.client-BFgOtfFI.js → stellarService.client-0dfuo3PJ.js} +3 -3
  26. package/dist/{stellarService.client-BFgOtfFI.js.map → stellarService.client-0dfuo3PJ.js.map} +1 -1
  27. package/dist/{stellarService.client-DidQHS07.js → stellarService.client-Ko2roGXL.js} +3 -3
  28. package/dist/{stellarService.client-DidQHS07.js.map → stellarService.client-Ko2roGXL.js.map} +1 -1
  29. package/package.json +3 -3
  30. package/dist/index-6eFn7nS3.js.map +0 -1
  31. package/dist/index-uUESkMSI.js.map +0 -1
@@ -56,7 +56,7 @@ export declare const keys: () => {
56
56
  tokenData: (token?: TokenWithBalance) => (string | undefined)[];
57
57
  balance: (chainId?: number | string, tokenAddress?: string, userAddress?: string) => (string | number | undefined)[];
58
58
  allTokensBalance: (address: string | undefined, chainType: ChainType | undefined, direction?: SwapDirection) => (string | undefined)[];
59
- transaction: (fromChainId: string | undefined, toChainId: string | undefined, toTokenAddress: string | undefined, fromTokenAddress: string | undefined, fromAmount: string | undefined, toAmount: string | undefined, slippage: SlippageOption | undefined, sourceUserAddress: string | undefined, degenMode: boolean | undefined, destinationAddress: string | undefined, fallbackAddress: string | undefined, quoteOnly: boolean | undefined, fromChainType: ChainType | undefined, preHook: AppConfig["preHook"] | undefined, postHook: AppConfig["postHook"] | undefined, overrideGasRefundAddress: AppConfig["overrideGasRefundAddress"] | undefined) => (string | number | boolean | Omit<import("@0xsquid/squid-types").Hook, "fundAmount" | "fundToken"> | undefined)[];
59
+ transaction: (fromChainId: string | undefined, toChainId: string | undefined, toTokenAddress: string | undefined, fromTokenAddress: string | undefined, price: string | undefined, slippage: SlippageOption | undefined, sourceUserAddress: string | undefined, degenMode: boolean | undefined, destinationAddress: string | undefined, fallbackAddress: string | undefined, quoteOnly: boolean | undefined, fromChainType: ChainType | undefined, preHook: AppConfig["preHook"] | undefined, postHook: AppConfig["postHook"] | undefined, overrideGasRefundAddress: AppConfig["overrideGasRefundAddress"] | undefined) => (string | number | boolean | Omit<import("@0xsquid/squid-types").Hook, "fundAmount" | "fundToken"> | undefined)[];
60
60
  swapTransactionStatus: (transactionId: string | undefined) => (string | undefined)[];
61
61
  fiatToCryptoStatus: (transactionId?: string) => (string | undefined)[];
62
62
  sendTransactionStatus: (txHash: string | undefined, chainId: string | undefined) => (string | undefined)[];
@@ -1,4 +1,4 @@
1
- import { RouteRequest } from "@0xsquid/squid-types";
1
+ import { RouteRequest } from "./route";
2
2
  export type SlippageOption = RouteRequest["slippage"];
3
3
  export type TokenConfig = {
4
4
  address: string;
@@ -1,6 +1,7 @@
1
- import type { RouteRequest, RouteResponse } from "@0xsquid/squid-types";
1
+ import type { RouteResponse } from "@0xsquid/squid-types";
2
2
  import { TransactionErrorWithMessage } from "./error";
3
3
  import { ExecuteQuoteServer } from "./onramps";
4
+ import { RouteRequest } from "./route";
4
5
  type BaseSwapEventParams = Pick<RouteRequest, "fromAddress" | "toAddress" | "fromChain" | "toChain" | "fromToken" | "toToken" | "fromAmount">;
5
6
  type BaseSendTransactionEventParams = {
6
7
  fromAddress: string;
@@ -0,0 +1,4 @@
1
+ import { RouteRequest as SquidRouteRequest } from "@0xsquid/squid-types";
2
+ export type RouteRequest = SquidRouteRequest & {
3
+ overrideGasRefundAddress?: string;
4
+ };
@@ -21,8 +21,7 @@ export interface ConfigState {
21
21
  }
22
22
  export declare const useConfigStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ConfigState>>;
23
23
  interface TransactionState {
24
- fromAmount?: string;
25
- toAmount?: string;
24
+ fromPrice?: string;
26
25
  txLocalId?: string;
27
26
  transactions: Record<string, TransactionParams>;
28
27
  currentTransaction?: TransactionParams;
@@ -7,10 +7,8 @@ export declare const useSwap: () => {
7
7
  };
8
8
  onSwapChange: (inputSwapParams: SwapParams) => SwapParams;
9
9
  invertSwaps: (() => SwapParams) | undefined;
10
- fromAmount: string | undefined;
11
- toAmount: string | undefined;
12
- fromAmountChanged: (amount: string) => void;
13
- toAmountChanged: (amount: string) => void;
10
+ fromPrice: string | undefined;
11
+ fromPriceChanged: (price: string) => void;
14
12
  toToken: import("../../core").Token | undefined;
15
13
  fromToken: import("../../core").Token | undefined;
16
14
  fromChain: import("@0xsquid/squid-types").ChainData | undefined;
@@ -1,11 +1,12 @@
1
1
  import { RouteResponse } from "@0xsquid/sdk/dist/types";
2
- import { ChainType, RouteRequest, Token } from "@0xsquid/squid-types";
2
+ import { ChainType, Token } from "@0xsquid/squid-types";
3
3
  import { QueryObserverOptions } from "@tanstack/react-query";
4
4
  import type { AppConfig } from "../../core/types/config";
5
+ import { RouteRequest } from "../../core/types/route";
5
6
  export declare const useGetRoute: () => import("@tanstack/react-query").UseMutationResult<{
6
7
  estimate: import("@0xsquid/squid-types").Estimate;
7
8
  transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
8
- params: RouteRequest;
9
+ params: import("@0xsquid/squid-types").RouteRequest;
9
10
  quoteId: string;
10
11
  } | undefined, unknown, {
11
12
  fromChain: RouteRequest["fromChain"] | undefined;
@@ -15,7 +16,6 @@ export declare const useGetRoute: () => import("@tanstack/react-query").UseMutat
15
16
  sourceUserAddress: string | undefined;
16
17
  destinationAddress: string | undefined;
17
18
  fromPrice: string | undefined;
18
- toPrice: string | undefined;
19
19
  bypassGuardrails: RouteRequest["bypassGuardrails"] | undefined;
20
20
  quoteOnly: boolean | undefined;
21
21
  fromChainType: ChainType | undefined;
@@ -26,17 +26,17 @@ export declare const useGetRoute: () => import("@tanstack/react-query").UseMutat
26
26
  export declare const useGetRouteWrapper: ({ enabled, cacheTime, staleTime, refetchOnWindowFocus, refetchIntervalInBackground, refetchInterval, quoteOnly, }: Pick<QueryObserverOptions<{
27
27
  estimate: import("@0xsquid/squid-types").Estimate;
28
28
  transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
29
- params: RouteRequest;
29
+ params: import("@0xsquid/squid-types").RouteRequest;
30
30
  quoteId: string;
31
31
  } | undefined, unknown, {
32
32
  estimate: import("@0xsquid/squid-types").Estimate;
33
33
  transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
34
- params: RouteRequest;
34
+ params: import("@0xsquid/squid-types").RouteRequest;
35
35
  quoteId: string;
36
36
  } | undefined, {
37
37
  estimate: import("@0xsquid/squid-types").Estimate;
38
38
  transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
39
- params: RouteRequest;
39
+ params: import("@0xsquid/squid-types").RouteRequest;
40
40
  quoteId: string;
41
41
  } | undefined, import("@tanstack/react-query").QueryKey>, "cacheTime" | "enabled" | "staleTime" | "refetchInterval" | "refetchIntervalInBackground" | "refetchOnWindowFocus"> & {
42
42
  quoteOnly?: boolean | undefined;
@@ -44,7 +44,7 @@ export declare const useGetRouteWrapper: ({ enabled, cacheTime, staleTime, refet
44
44
  squidRoute: import("@tanstack/react-query").UseQueryResult<{
45
45
  estimate: import("@0xsquid/squid-types").Estimate;
46
46
  transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
47
- params: RouteRequest;
47
+ params: import("@0xsquid/squid-types").RouteRequest;
48
48
  quoteId: string;
49
49
  } | undefined, unknown>;
50
50
  showLoading: boolean;
@@ -52,7 +52,7 @@ export declare const useGetRouteWrapper: ({ enabled, cacheTime, staleTime, refet
52
52
  routeData: {
53
53
  estimate: import("@0xsquid/squid-types").Estimate;
54
54
  transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
55
- params: RouteRequest;
55
+ params: import("@0xsquid/squid-types").RouteRequest;
56
56
  quoteId: string;
57
57
  } | undefined;
58
58
  };
@@ -3971,9 +3971,6 @@ const getNumericValue = ({ value, precision, useComaEvery3Digits = true, hideIfZ
3971
3971
  const finalValue = `${isNegative ? "-" : ""}${prefix}${formattedIfVerySmall}${suffix ? ` ${suffix}` : ""}`;
3972
3972
  return wrapInParens ? `(${finalValue})` : finalValue;
3973
3973
  };
3974
- function isZeroAmount(amount) {
3975
- return !amount || amount === "0";
3976
- }
3977
3974
 
3978
3975
  /**
3979
3976
  * Creates a hash string from quote request parameters to track changes
@@ -22416,15 +22413,14 @@ const keys = () => ({
22416
22413
  // ============
22417
22414
  // Transactions
22418
22415
  // ============
22419
- transaction: (fromChainId, toChainId, toTokenAddress, fromTokenAddress, fromAmount, toAmount, slippage, sourceUserAddress, degenMode, destinationAddress, fallbackAddress, quoteOnly, fromChainType, preHook, postHook, overrideGasRefundAddress) => [
22416
+ transaction: (fromChainId, toChainId, toTokenAddress, fromTokenAddress, price, slippage, sourceUserAddress, degenMode, destinationAddress, fallbackAddress, quoteOnly, fromChainType, preHook, postHook, overrideGasRefundAddress) => [
22420
22417
  ...keys().transactions(),
22421
22418
  exports.QueryKeys.Transaction,
22422
22419
  fromChainId,
22423
22420
  toChainId,
22424
22421
  toTokenAddress,
22425
22422
  fromTokenAddress,
22426
- fromAmount,
22427
- toAmount,
22423
+ price,
22428
22424
  slippage,
22429
22425
  sourceUserAddress,
22430
22426
  degenMode,
@@ -23319,7 +23315,7 @@ const filterViewableTokens = (tokens, config, direction) => {
23319
23315
  };
23320
23316
  const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
23321
23317
  const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
23322
- const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-C8LsM_VG.js'); });
23318
+ const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-CKReaNYo.js'); });
23323
23319
  return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
23324
23320
  };
23325
23321
  function getTokenAssetsKey(token) {
@@ -25176,7 +25172,10 @@ const useConfigStore = zustand.create(() => ({
25176
25172
  isInitialized: false,
25177
25173
  }));
25178
25174
  const useTransactionStore = zustand.create((set, get) => ({
25175
+ fromPrice: undefined,
25176
+ txLocalId: undefined,
25179
25177
  transactions: {},
25178
+ currentTransaction: undefined,
25180
25179
  setTransactionState(txId, tx) {
25181
25180
  if (!txId)
25182
25181
  return;
@@ -26713,8 +26712,8 @@ function useStellarWallets() {
26713
26712
  return;
26714
26713
  try {
26715
26714
  const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
26716
- const { LedgerModule } = await import('@creit.tech/stellar-wallets-kit/modules/ledger.module');
26717
- const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-BFgOtfFI.js'); });
26715
+ const { LedgerModule } = await import('@creit.tech/stellar-wallets-kit/modules/ledger.module.mjs');
26716
+ const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-0dfuo3PJ.js'); });
26718
26717
  const modules = [...initializeAllModules(), new LedgerModule()];
26719
26718
  const promises = modules.map(async (module) => {
26720
26719
  const isAvailable = await module.isAvailable();
@@ -27613,8 +27612,7 @@ const useMultiChainWallet = (chain) => {
27613
27612
 
27614
27613
  const useSwap = () => {
27615
27614
  const { initialAssets, defaultTokensPerChain, disabledChains, availableChains, } = useConfigStore((state) => state.config);
27616
- const fromAmount = useTransactionStore((state) => state.fromAmount);
27617
- const toAmount = useTransactionStore((state) => state.toAmount);
27615
+ const fromPrice = useTransactionStore((state) => state.fromPrice);
27618
27616
  const { swapRoute } = useSwapRoutePersistStore();
27619
27617
  const { tokens } = useSquidTokens();
27620
27618
  const queryClient = reactQuery.useQueryClient();
@@ -27666,17 +27664,8 @@ const useSwap = () => {
27666
27664
  }),
27667
27665
  };
27668
27666
  }, [destAddressData, destAddressEnsData.data, toChain?.chainType]);
27669
- const fromAmountChanged = React.useCallback((amount) => {
27670
- useTransactionStore.setState({
27671
- fromAmount: amount || undefined,
27672
- toAmount: undefined,
27673
- });
27674
- }, []);
27675
- const toAmountChanged = React.useCallback((amount) => {
27676
- useTransactionStore.setState({
27677
- toAmount: amount || undefined,
27678
- fromAmount: undefined,
27679
- });
27667
+ const fromPriceChanged = React.useCallback((price) => {
27668
+ useTransactionStore.setState({ fromPrice: price || undefined });
27680
27669
  }, []);
27681
27670
  /**
27682
27671
  * When user changes something from the SwapView
@@ -27836,10 +27825,8 @@ const useSwap = () => {
27836
27825
  tokenItems,
27837
27826
  onSwapChange,
27838
27827
  invertSwaps,
27839
- fromAmount,
27840
- toAmount,
27841
- fromAmountChanged,
27842
- toAmountChanged,
27828
+ fromPrice,
27829
+ fromPriceChanged,
27843
27830
  toToken,
27844
27831
  fromToken,
27845
27832
  fromChain,
@@ -30046,7 +30033,7 @@ function hederaWalletConnect(parameters) {
30046
30033
  const optionalChains = config.chains.map((x) => x.id);
30047
30034
  if (!optionalChains.length)
30048
30035
  return;
30049
- const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-C0R5BhSh.js'); });
30036
+ const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-Ds1lt_e4.js'); });
30050
30037
  const rawProvider = await EthereumProvider.init({
30051
30038
  ...restParameters,
30052
30039
  disableProviderPing: true,
@@ -30183,6 +30170,7 @@ const createWagmiConfig = (squidChains, hederaExtensions) => {
30183
30170
  description: SQUID_METADATA.description,
30184
30171
  };
30185
30172
  return wagmi.createConfig({
30173
+ ssr: true,
30186
30174
  chains: wagmiChains,
30187
30175
  transports: Object.fromEntries(wagmiChains.map((chain) => [
30188
30176
  chain.id,
@@ -32451,7 +32439,7 @@ const useHistory = (txType) => {
32451
32439
  fromChain: tx.params.fromChain,
32452
32440
  fromToken: tx.params.fromToken,
32453
32441
  fromAddress: tx.params.fromAddress,
32454
- fromAmount: tx.params.fromAmount || tx.estimate.fromAmount,
32442
+ fromAmount: tx.params.fromAmount,
32455
32443
  toChain: tx.params.toChain,
32456
32444
  toToken: tx.params.toToken,
32457
32445
  toAddress: tx.params.toAddress,
@@ -32692,7 +32680,7 @@ const useApproval = ({ squidRoute, }) => {
32692
32680
  const publicClient = wagmi.usePublicClient();
32693
32681
  const queryClient = reactQuery.useQueryClient();
32694
32682
  const squid = useSquidStore((state) => state.squid);
32695
- const { fromChain, fromToken, fromAmount, toAmount, isSameChain } = useSwap();
32683
+ const { fromChain, fromToken, fromPrice, isSameChain } = useSwap();
32696
32684
  const { evmSigner } = useSigner({ chain: fromChain });
32697
32685
  const { connector: activeConnector } = wagmi.useAccount();
32698
32686
  const { getChainType } = useSquidChains();
@@ -32865,7 +32853,7 @@ const useApproval = ({ squidRoute, }) => {
32865
32853
  // This is to ensure we're using the latest expiry timestamp
32866
32854
  if (squidRoute) {
32867
32855
  queryClient.refetchQueries({
32868
- queryKey: keys().transaction(squidRoute.params.fromChain, squidRoute.params.toChain, squidRoute.params.toToken, squidRoute.params.fromToken, fromAmount, toAmount, squidRoute.params.slippage, squidRoute.params.fromAddress, squidRoute.params.bypassGuardrails, squidRoute.params.toAddress, squidRoute.params.fallbackAddresses?.[0]?.address, squidRoute.params.quoteOnly, getChainType(squidRoute.params.fromChain), squidRoute.params.preHook, squidRoute.params.postHook,
32856
+ queryKey: keys().transaction(squidRoute.params.fromChain, squidRoute.params.toChain, squidRoute.params.toToken, squidRoute.params.fromToken, fromPrice, squidRoute.params.slippage, squidRoute.params.fromAddress, squidRoute.params.bypassGuardrails, squidRoute.params.toAddress, squidRoute.params.fallbackAddresses?.[0]?.address, squidRoute.params.quoteOnly, getChainType(squidRoute.params.fromChain), squidRoute.params.preHook, squidRoute.params.postHook,
32869
32857
  // TODO: update types
32870
32858
  squidRoute.params?.overrideGasRefundAddress),
32871
32859
  });
@@ -32884,7 +32872,7 @@ const AXELAR_PROVIDER_IMAGE_URL = "https://raw.githubusercontent.com/0xsquid/ass
32884
32872
  const useEstimate = (squidRoute) => {
32885
32873
  const collectFees = useConfigStore((state) => state.config.collectFees);
32886
32874
  const { tokens } = useSquidTokens();
32887
- const { fromChain, toChain, fromAmount } = useSwap();
32875
+ const { fromChain, toChain, fromPrice } = useSwap();
32888
32876
  const fromToken = React.useMemo(() => findToken(tokens, squidRoute?.params.fromChain, squidRoute?.params.fromToken), [tokens, squidRoute?.params.fromChain, squidRoute?.params.fromToken]);
32889
32877
  const { chainFeeParams, gasToken } = useSourceChainGasToken({
32890
32878
  fromChain,
@@ -32980,9 +32968,9 @@ const useEstimate = (squidRoute) => {
32980
32968
  const slippageFormatted = Number(squidRoute?.estimate?.aggregateSlippage ?? 0).toFixed(2) + "%";
32981
32969
  const fromBalanceEnoughToSwap = React.useMemo(() => {
32982
32970
  const fromBalanceNum = Number(fromBalanceFormatted ?? 0);
32983
- const fromAmountNum = Number(fromAmount ?? 0);
32984
- return fromBalanceNum >= fromAmountNum;
32985
- }, [fromBalanceFormatted, fromAmount]);
32971
+ const fromPriceNum = Number(fromPrice ?? 0);
32972
+ return fromBalanceNum >= fromPriceNum;
32973
+ }, [fromBalanceFormatted, fromPrice]);
32986
32974
  return {
32987
32975
  ...estimateResults,
32988
32976
  fromBalanceFormatted,
@@ -36201,12 +36189,8 @@ const useExecuteTransaction = (squidRoute) => {
36201
36189
  if (!depositData?.depositAddress) {
36202
36190
  throw new Error("Deposit address is required");
36203
36191
  }
36204
- const fromAmount = route.params.fromAmount || route.estimate.fromAmount;
36205
- if (isZeroAmount(fromAmount)) {
36206
- throw new Error("fromAmount is required for Solana transfer");
36207
- }
36208
36192
  const signature = await executeSolanaTransfer({
36209
- amount: BigInt(fromAmount),
36193
+ amount: BigInt(route.params.fromAmount),
36210
36194
  target: depositData.depositAddress,
36211
36195
  signer: solanaSigner,
36212
36196
  connection: solanaConnection,
@@ -36716,12 +36700,8 @@ const useGetRoute = () => {
36716
36700
  * These data will be used to trigger the transaction
36717
36701
  * @returns {Route} Route data
36718
36702
  */
36719
- return reactQuery.useMutation(async ({ fromChain, toChain, fromToken, toToken, sourceUserAddress, destinationAddress, fromPrice = "", toPrice = "", bypassGuardrails, quoteOnly, fromChainType, postHook, preHook, overrideGasRefundAddress, }) => {
36720
- if (!fromChain ||
36721
- !toChain ||
36722
- !fromToken ||
36723
- !toToken ||
36724
- (!fromPrice && !toPrice)) {
36703
+ return reactQuery.useMutation(async ({ fromChain, toChain, fromToken, toToken, sourceUserAddress, destinationAddress, fromPrice, bypassGuardrails, quoteOnly, fromChainType, postHook, preHook, overrideGasRefundAddress, }) => {
36704
+ if (!fromChain || !toChain || !fromToken || !toToken || !fromPrice) {
36725
36705
  return undefined;
36726
36706
  }
36727
36707
  // Dispatch requestQuote event
@@ -36731,7 +36711,6 @@ const useGetRoute = () => {
36731
36711
  fromToken: fromToken.address,
36732
36712
  toToken: toToken.address,
36733
36713
  fromAmount: fromPrice,
36734
- toAmount: toPrice,
36735
36714
  fromAddress: sourceUserAddress,
36736
36715
  toAddress: destinationAddress,
36737
36716
  });
@@ -36740,13 +36719,13 @@ const useGetRoute = () => {
36740
36719
  const fromTokenAddress = fromToken.address;
36741
36720
  const toTokenAddress = toToken.address;
36742
36721
  const fromAmount = parseToBigInt(fromPrice?.toString() ?? "0", fromToken?.decimals).toString();
36743
- const toAmount = parseToBigInt(toPrice?.toString() ?? "0", toToken?.decimals).toString();
36744
36722
  const fromAddress = sourceUserAddress ??
36745
36723
  chainTypeToZeroAddressMap[fromChainType ?? squidTypes.ChainType.EVM];
36746
36724
  const params = {
36747
36725
  fromChain,
36748
36726
  fromToken: fromTokenAddress,
36749
36727
  fromAddress,
36728
+ fromAmount,
36750
36729
  toChain,
36751
36730
  toToken: toTokenAddress,
36752
36731
  toAddress: destinationAddress ?? "",
@@ -36763,18 +36742,12 @@ const useGetRoute = () => {
36763
36742
  cosmosFallbackAddresses[0].address) {
36764
36743
  params.fallbackAddresses = cosmosFallbackAddresses;
36765
36744
  }
36766
- if (!isZeroAmount(fromAmount)) {
36767
- params.fromAmount = fromAmount;
36768
- }
36769
- else if (!isZeroAmount(toAmount)) {
36770
- params.toAmount = toAmount;
36771
- }
36772
36745
  const { route } = await squid.getRoute({
36773
36746
  ...params,
36774
36747
  });
36775
36748
  // Cache the route data
36776
36749
  // Useful when the getRoute mutation is called from another hook
36777
- queryClient.setQueryData(keys().transaction(fromChain, toChain, toToken.address, fromToken.address, fromPrice, toPrice, config.slippage, sourceUserAddress, config.degenMode, destinationAddress, swapRoute?.fallbackAddress, quoteOnly, fromChainType, config.preHook, config.postHook, overrideGasRefundAddress), route);
36750
+ queryClient.setQueryData(keys().transaction(fromChain, toChain, toToken.address, fromToken.address, fromPrice, config.slippage, sourceUserAddress, config.degenMode, destinationAddress, swapRoute?.fallbackAddress, quoteOnly, fromChainType, config.preHook, config.postHook, overrideGasRefundAddress), route);
36778
36751
  return route;
36779
36752
  });
36780
36753
  };
@@ -36788,7 +36761,7 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
36788
36761
  const depositRefundAddress = useSwapRoutePersistStore((store) => store.swapRoute?.depositRefundAddress);
36789
36762
  const { isAvailableAsPaymentMethod, isEnabled: isDepositAddressEnabled } = useDepositAddress();
36790
36763
  const getRouteMutation = useGetRoute();
36791
- const { fromChain, toChain, fromAmount, toAmount, destinationAddress: { address: destinationAddress } = {}, fromToken, toToken, } = useSwap();
36764
+ const { fromChain, toChain, fromPrice, destinationAddress: { address: destinationAddress } = {}, fromToken, toToken, } = useSwap();
36792
36765
  const { connectedAddress: { address: sourceConnectedAddress }, } = useMultiChainWallet(fromChain);
36793
36766
  // When the payment method is deposit address, users can specify a refund address on the source chain
36794
36767
  // Tokens will be sent to this address in case of swap failure
@@ -36797,13 +36770,12 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
36797
36770
  const sourceUserAddress = isDepositAddressEnabled && isAvailableAsPaymentMethod
36798
36771
  ? depositRefundAddress ?? sourceConnectedAddress
36799
36772
  : sourceConnectedAddress;
36800
- const squidRouteQueryKeys = React.useMemo(() => keys().transaction(fromChain?.chainId, toChain?.chainId, toToken?.address, fromToken?.address, fromAmount, toAmount, config.slippage, sourceUserAddress, config.degenMode, destinationAddress, fallbackAddress, quoteOnly, fromChain?.chainType, config.preHook, config.postHook, config.overrideGasRefundAddress), [
36773
+ const squidRouteQueryKeys = React.useMemo(() => keys().transaction(fromChain?.chainId, toChain?.chainId, toToken?.address, fromToken?.address, fromPrice, config.slippage, sourceUserAddress, config.degenMode, destinationAddress, fallbackAddress, quoteOnly, fromChain?.chainType, config.preHook, config.postHook, config.overrideGasRefundAddress), [
36801
36774
  fromChain?.chainId,
36802
36775
  toChain?.chainId,
36803
36776
  toToken?.address,
36804
36777
  fromToken?.address,
36805
- fromAmount,
36806
- toAmount,
36778
+ fromPrice,
36807
36779
  config.slippage,
36808
36780
  sourceUserAddress,
36809
36781
  config.degenMode,
@@ -36818,7 +36790,8 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
36818
36790
  const queryEnabled = enabled != undefined
36819
36791
  ? enabled
36820
36792
  : squid !== undefined &&
36821
- (!isZeroAmount(fromAmount) || !isZeroAmount(toAmount)) &&
36793
+ fromPrice !== undefined &&
36794
+ fromPrice !== "0" &&
36822
36795
  toChain?.chainId !== undefined &&
36823
36796
  toToken?.address !== undefined;
36824
36797
  const queryClient = reactQuery.useQueryClient();
@@ -36836,8 +36809,7 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
36836
36809
  toToken,
36837
36810
  sourceUserAddress,
36838
36811
  destinationAddress,
36839
- fromPrice: fromAmount,
36840
- toPrice: toAmount,
36812
+ fromPrice,
36841
36813
  bypassGuardrails: config.degenMode,
36842
36814
  quoteOnly,
36843
36815
  fromChainType: fromChain?.chainType,
@@ -37465,6 +37437,7 @@ const SquidProvider = ({ children, config, placeholder, }) => {
37465
37437
  // Even with an error, we want wagmi to be defined so that we can display the maintenance mode layout
37466
37438
  // Create wagmi config with mainnet as fallback in maintenance mode
37467
37439
  const newWagmiConfig = wagmi.createConfig({
37440
+ ssr: true,
37468
37441
  chains: [chains$1.mainnet],
37469
37442
  connectors: [connectors.injected()],
37470
37443
  transports: {
@@ -37644,7 +37617,6 @@ exports.isWalletAddressValid = isWalletAddressValid;
37644
37617
  exports.isXamanXAppContext = isXamanXAppContext;
37645
37618
  exports.isXionSmartContractAddress = isXionSmartContractAddress;
37646
37619
  exports.isXrplAddressValid = isXrplAddressValid;
37647
- exports.isZeroAmount = isZeroAmount;
37648
37620
  exports.mergeWallets = mergeWallets;
37649
37621
  exports.nativeBitcoinTokenAddress = nativeBitcoinTokenAddress;
37650
37622
  exports.nativeCosmosTokenAddress = nativeCosmosTokenAddress;
@@ -37767,4 +37739,4 @@ exports.useXrplTrustLine = useXrplTrustLine;
37767
37739
  exports.waitForReceiptWithRetry = waitForReceiptWithRetry;
37768
37740
  exports.walletIconBaseUrl = walletIconBaseUrl;
37769
37741
  exports.walletSupportsChainType = walletSupportsChainType;
37770
- //# sourceMappingURL=index-uUESkMSI.js.map
37742
+ //# sourceMappingURL=index-D3bbd13Z.js.map