@ensofinance/checkout-widget 0.0.13 → 0.0.14

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 (143) hide show
  1. package/dist/checkout-widget.es.js +8421 -8103
  2. package/dist/checkout-widget.es.js.map +1 -1
  3. package/dist/checkout-widget.umd.js +31 -31
  4. package/dist/checkout-widget.umd.js.map +1 -1
  5. package/dist/index.d.ts +7 -0
  6. package/orval.config.ts +40 -6
  7. package/package.json +1 -1
  8. package/src/components/BridgeFee.tsx +3 -3
  9. package/src/components/Checkout.tsx +2 -2
  10. package/src/components/ExchangeConfirmSecurity.tsx +16 -3
  11. package/src/components/QuoteParameters.tsx +33 -18
  12. package/src/components/TransactionDetailRow.tsx +6 -5
  13. package/src/components/cards/AssetCard.tsx +2 -2
  14. package/src/components/cards/OptionCard.tsx +2 -0
  15. package/src/components/steps/ExchangeFlow.tsx +254 -96
  16. package/src/components/steps/FlowSelector.tsx +26 -10
  17. package/src/components/steps/WalletFlow/WalletAmountStep.tsx +22 -23
  18. package/src/components/steps/WalletFlow/WalletTokenStep.tsx +5 -3
  19. package/src/components/ui/index.tsx +0 -3
  20. package/src/enso-api/api.ts +144 -3
  21. package/src/enso-api/custom-instance.ts +1 -0
  22. package/src/enso-api/index.ts +29 -118
  23. package/src/enso-api/model/approveActionDto.ts +17 -0
  24. package/src/enso-api/model/approveArgsDto.ts +22 -0
  25. package/src/enso-api/model/approveArgsDtoAmount.ts +16 -0
  26. package/src/enso-api/model/balanceActionDto.ts +17 -0
  27. package/src/enso-api/model/balanceArgsDto.ts +15 -0
  28. package/src/enso-api/model/borrowActionDto.ts +18 -0
  29. package/src/enso-api/model/borrowArgsDto.ts +22 -0
  30. package/src/enso-api/model/borrowArgsDtoAmountOut.ts +16 -0
  31. package/src/enso-api/model/bridgeActionDto.ts +19 -0
  32. package/src/enso-api/model/bridgeArgsDto.ts +29 -0
  33. package/src/enso-api/model/bridgeArgsDtoAmountIn.ts +16 -0
  34. package/src/enso-api/model/bridgeArgsDtoCallbackItem.ts +64 -0
  35. package/src/enso-api/model/bundleControllerBundleShortcutTransactionBodyItem.ts +69 -0
  36. package/src/enso-api/model/callActionDto.ts +18 -0
  37. package/src/enso-api/model/callArgsDto.ts +29 -0
  38. package/src/enso-api/model/callArgsDtoArgsItem.ts +17 -0
  39. package/src/enso-api/model/callArgsDtoArgsItemAnyOf.ts +12 -0
  40. package/src/enso-api/model/callArgsDtoValue.ts +16 -0
  41. package/src/enso-api/model/callOutput.ts +15 -0
  42. package/src/enso-api/model/depositActionDto.ts +18 -0
  43. package/src/enso-api/model/depositArgsDto.ts +28 -0
  44. package/src/enso-api/model/depositArgsDtoAmountIn.ts +20 -0
  45. package/src/enso-api/model/depositArgsDtoAmountInOneOfItem.ts +13 -0
  46. package/src/enso-api/model/depositArgsDtoTokenIn.ts +15 -0
  47. package/src/enso-api/model/depositArgsDtoTokenOut.ts +15 -0
  48. package/src/enso-api/model/depositCLMMActionDto.ts +18 -0
  49. package/src/enso-api/model/depositCLMMArgsDto.ts +30 -0
  50. package/src/enso-api/model/depositCLMMArgsDtoAmountInItem.ts +17 -0
  51. package/src/enso-api/model/depositCLMMArgsDtoAmountInItemAnyOf.ts +12 -0
  52. package/src/enso-api/model/ensoFeeActionDto.ts +17 -0
  53. package/src/enso-api/model/ensoFeeArgsDto.ts +20 -0
  54. package/src/enso-api/model/ensoFeeArgsDtoAmount.ts +16 -0
  55. package/src/enso-api/model/feeActionDto.ts +17 -0
  56. package/src/enso-api/model/feeArgsDto.ts +22 -0
  57. package/src/enso-api/model/feeArgsDtoAmount.ts +16 -0
  58. package/src/enso-api/model/harvestActionDto.ts +19 -0
  59. package/src/enso-api/model/harvestArgsDto.ts +17 -0
  60. package/src/enso-api/model/index.ts +115 -4
  61. package/src/enso-api/model/mergeActionDto.ts +17 -0
  62. package/src/enso-api/model/mergeArgsDto.ts +22 -0
  63. package/src/enso-api/model/mergeArgsDtoAmountInItem.ts +13 -0
  64. package/src/enso-api/model/minAmountOutActionDto.ts +17 -0
  65. package/src/enso-api/model/minAmountOutArgsDto.ts +19 -0
  66. package/src/enso-api/model/minAmountOutArgsDtoAmountOut.ts +16 -0
  67. package/src/enso-api/model/minAmountOutArgsDtoMinAmountOut.ts +16 -0
  68. package/src/enso-api/model/multiDepositActionDto.ts +18 -0
  69. package/src/enso-api/model/multiDepositArgsDto.ts +24 -0
  70. package/src/enso-api/model/multiDepositArgsDtoAmountInItem.ts +17 -0
  71. package/src/enso-api/model/multiDepositArgsDtoAmountInItemAnyOf.ts +12 -0
  72. package/src/enso-api/model/multiOutSingleDepositActionDto.ts +18 -0
  73. package/src/enso-api/model/multiOutSingleDepositArgsDto.ts +24 -0
  74. package/src/enso-api/model/multiOutSingleDepositArgsDtoAmountIn.ts +16 -0
  75. package/src/enso-api/model/multiRedeemActionDto.ts +18 -0
  76. package/src/enso-api/model/multiRedeemArgs2Dto.ts +24 -0
  77. package/src/enso-api/model/multiRedeemArgs2DtoAmountIn.ts +16 -0
  78. package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionParams.ts +8 -0
  79. package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionRoutingStrategy.ts +1 -0
  80. package/src/enso-api/model/nontokenizedRouteShortcutTransaction.ts +31 -0
  81. package/src/enso-api/model/paymasterFeeActionDto.ts +17 -0
  82. package/src/enso-api/model/paymasterFeeArgsDto.ts +18 -0
  83. package/src/enso-api/model/paymasterFeeArgsDtoAmount.ts +16 -0
  84. package/src/enso-api/model/permitTransferFromActionDto.ts +18 -0
  85. package/src/enso-api/model/permitTransferFromArgsDto.ts +29 -0
  86. package/src/enso-api/model/permitTransferFromArgsDtoAmount.ts +20 -0
  87. package/src/enso-api/model/permitTransferFromArgsDtoAmountOneOfItem.ts +13 -0
  88. package/src/enso-api/model/permitTransferFromArgsDtoToken.ts +15 -0
  89. package/src/enso-api/model/positionModel.ts +14 -0
  90. package/src/enso-api/model/redeemActionDto.ts +18 -0
  91. package/src/enso-api/model/redeemArgsDto.ts +25 -0
  92. package/src/enso-api/model/redeemArgsDtoAmountIn.ts +16 -0
  93. package/src/enso-api/model/redeemArgsDtoTokenOut.ts +15 -0
  94. package/src/enso-api/model/redeemCLMMActionDto.ts +18 -0
  95. package/src/enso-api/model/redeemCLMMArgsDto.ts +24 -0
  96. package/src/enso-api/model/redeemCLMMArgsDtoLiquidity.ts +16 -0
  97. package/src/enso-api/model/repayActionDto.ts +18 -0
  98. package/src/enso-api/model/repayArgsDto.ts +22 -0
  99. package/src/enso-api/model/repayArgsDtoAmountIn.ts +16 -0
  100. package/src/enso-api/model/routeActionDto.ts +20 -0
  101. package/src/enso-api/model/routeArgsDto.ts +38 -0
  102. package/src/enso-api/model/routeArgsDtoAmountIn.ts +16 -0
  103. package/src/enso-api/model/singleDepositActionDto.ts +18 -0
  104. package/src/enso-api/model/singleDepositArgsDto.ts +24 -0
  105. package/src/enso-api/model/singleDepositArgsDtoAmountIn.ts +16 -0
  106. package/src/enso-api/model/singleRedeemActionDto.ts +18 -0
  107. package/src/enso-api/model/singleRedeemArgs2Dto.ts +24 -0
  108. package/src/enso-api/model/singleRedeemArgs2DtoAmountIn.ts +16 -0
  109. package/src/enso-api/model/slippageActionDto.ts +17 -0
  110. package/src/enso-api/model/slippageArgsDto.ts +18 -0
  111. package/src/enso-api/model/slippageArgsDtoAmountOut.ts +16 -0
  112. package/src/enso-api/model/splitActionDto.ts +17 -0
  113. package/src/enso-api/model/splitArgsDto.ts +22 -0
  114. package/src/enso-api/model/splitArgsDtoAmountIn.ts +16 -0
  115. package/src/enso-api/model/swapActionDto.ts +18 -0
  116. package/src/enso-api/model/swapArgsDto.ts +30 -0
  117. package/src/enso-api/model/swapArgsDtoAmountIn.ts +16 -0
  118. package/src/enso-api/model/tokenizedMultiDepositActionDto.ts +18 -0
  119. package/src/enso-api/model/tokenizedMultiDepositArgsDto.ts +24 -0
  120. package/src/enso-api/model/tokenizedMultiDepositArgsDtoAmountInItem.ts +17 -0
  121. package/src/enso-api/model/tokenizedMultiDepositArgsDtoAmountInItemAnyOf.ts +14 -0
  122. package/src/enso-api/model/tokenizedMultiRedeemActionDto.ts +18 -0
  123. package/src/enso-api/model/tokenizedMultiRedeemArgsDto.ts +24 -0
  124. package/src/enso-api/model/tokenizedMultiRedeemArgsDtoAmountIn.ts +16 -0
  125. package/src/enso-api/model/tokenizedSingleDepositActionDto.ts +18 -0
  126. package/src/enso-api/model/tokenizedSingleDepositArgsDto.ts +24 -0
  127. package/src/enso-api/model/tokenizedSingleDepositArgsDtoAmountIn.ts +16 -0
  128. package/src/enso-api/model/tokenizedSingleRedeemActionDto.ts +18 -0
  129. package/src/enso-api/model/tokenizedSingleRedeemArgsDto.ts +24 -0
  130. package/src/enso-api/model/tokenizedSingleRedeemArgsDtoAmountIn.ts +16 -0
  131. package/src/enso-api/model/tokensControllerTokensLiquidityType.ts +19 -0
  132. package/src/enso-api/model/tokensControllerTokensParams.ts +6 -0
  133. package/src/enso-api/model/transferActionDto.ts +18 -0
  134. package/src/enso-api/model/transferArgsDto.ts +22 -0
  135. package/src/enso-api/model/transferArgsDtoAmount.ts +16 -0
  136. package/src/enso-api/model/transferFromActionDto.ts +18 -0
  137. package/src/enso-api/model/transferFromArgsDto.ts +24 -0
  138. package/src/enso-api/model/transferFromArgsDtoAmount.ts +16 -0
  139. package/src/index.ts +1 -0
  140. package/src/store.ts +12 -5
  141. package/src/types/index.ts +9 -3
  142. package/src/util/common.tsx +2 -0
  143. package/src/util/enso-hooks.tsx +72 -11
@@ -6,7 +6,7 @@ import { Address } from "viem";
6
6
  import { useAppStore } from "@/store";
7
7
  import { Button, IconButton, Tab, Input } from "@/components/ui";
8
8
  import CurrencySwapDisplay from "@/components/CurrencySwapDisplay";
9
- import { useEnsoPrice, useEnsoToken } from "@/enso-api/api";
9
+ import { useEnsoPrice } from "@/enso-api/api";
10
10
  import {
11
11
  normalizeValue,
12
12
  denormalizeValue,
@@ -14,6 +14,7 @@ import {
14
14
  formatUSD,
15
15
  } from "@/util";
16
16
  import { useTokenBalance } from "@/util/wallet";
17
+ import { useAppDetails } from "@/util/enso-hooks";
17
18
 
18
19
  type InputMode = "usd" | "token";
19
20
 
@@ -29,31 +30,28 @@ const WalletAmountStep = ({ setStep }: { setStep: (step: string) => void }) => {
29
30
  // const [tokenAmount, setTokenAmount] = useState<string>("");
30
31
  const [inputMode, setInputMode] = useState<InputMode>("usd");
31
32
 
32
- const tokenIn = useAppStore((state) => state.tokenIn);
33
- const tokenOut = useAppStore((state) => state.tokenOut);
34
- const chainIdOut = useAppStore((state) => state.chainIdOut);
35
- const chainIdIn = useAppStore((state) => state.chainIdIn);
36
33
  const setAmountIn = useAppStore((state) => state.setAmountIn);
37
34
  const amountIn = useAppStore((state) => state.amountIn);
38
35
  const [initialLoad, setInitialLoad] = useState(true);
39
-
40
- const {
41
- data: [tokenDetails],
42
- } = useEnsoToken(tokenIn, chainIdIn);
43
36
  const {
44
- data: [tokenOutDetails],
45
- } = useEnsoToken(tokenOut, chainIdOut);
37
+ tokenInData,
38
+ effectiveTokenOutData,
39
+ tokenIn,
40
+ chainIdOut,
41
+ chainIdIn,
42
+ } = useAppDetails();
43
+
46
44
  const { data: priceData } = useEnsoPrice(chainIdIn, tokenIn);
47
45
 
48
46
  const tokenValue = useMemo(() => {
49
- return normalizeValue(amountIn, tokenDetails?.decimals);
50
- }, [amountIn, tokenDetails?.decimals]);
47
+ return normalizeValue(amountIn, tokenInData?.decimals);
48
+ }, [amountIn, tokenInData?.decimals]);
51
49
 
52
50
  const balanceIn = useTokenBalance(tokenIn as Address, chainIdIn);
53
51
 
54
52
  // Handle percentage selection
55
53
  const handlePercentageSelect = (percent: number) => {
56
- if (!balanceIn || !priceData || !tokenDetails?.decimals) {
54
+ if (!balanceIn || !priceData || !tokenInData?.decimals) {
57
55
  setUsdValue("0.00");
58
56
  return;
59
57
  }
@@ -66,33 +64,33 @@ const WalletAmountStep = ({ setStep }: { setStep: (step: string) => void }) => {
66
64
  setAmountIn(amountToSet);
67
65
  setUsdValue(
68
66
  (
69
- +normalizeValue(amountToSet, tokenDetails?.decimals) * priceData
67
+ +normalizeValue(amountToSet, tokenInData?.decimals) * priceData
70
68
  ).toFixed(2),
71
69
  );
72
70
  };
73
71
 
74
72
  useEffect(() => {
75
- if (initialLoad && priceData && tokenDetails && +balanceIn > 0) {
73
+ if (initialLoad && priceData && tokenInData && +balanceIn > 0) {
76
74
  setInitialLoad(false);
77
75
  handlePercentageSelect(100);
78
76
  }
79
- }, [balanceIn, initialLoad, priceData, tokenDetails, balanceIn]);
77
+ }, [balanceIn, initialLoad, priceData, tokenInData, balanceIn]);
80
78
 
81
79
  // Handle input change based on current mode
82
80
  const handleInputChange = (value: string) => {
83
81
  if (inputMode === "usd") {
84
82
  const cleanUsd = value.replace("$", "");
85
83
  // Clean the input from usd sign
86
- console.log(cleanUsd, priceData, tokenDetails?.decimals);
84
+ console.log(cleanUsd, priceData, tokenInData?.decimals);
87
85
  setUsdValue(cleanUsd);
88
86
  setAmountIn(
89
87
  denormalizeValue(
90
88
  (parseFloat(cleanUsd) / priceData).toString(),
91
- tokenDetails?.decimals,
89
+ tokenInData?.decimals,
92
90
  ),
93
91
  );
94
92
  } else {
95
- setAmountIn(denormalizeValue(value, tokenDetails?.decimals));
93
+ setAmountIn(denormalizeValue(value, tokenInData?.decimals));
96
94
  setUsdValue((parseFloat(value) * priceData).toFixed(2));
97
95
  }
98
96
  };
@@ -112,7 +110,7 @@ const WalletAmountStep = ({ setStep }: { setStep: (step: string) => void }) => {
112
110
  placeholder: "$10.00",
113
111
  displayValue: safeUsdValue ? `$${safeUsdValue}` : "",
114
112
  equivalentValue: tokenValue
115
- ? `${formattedValue} ${tokenDetails?.symbol}`
113
+ ? `${formattedValue} ${tokenInData?.symbol}`
116
114
  : "—",
117
115
  };
118
116
  }
@@ -178,6 +176,7 @@ const WalletAmountStep = ({ setStep }: { setStep: (step: string) => void }) => {
178
176
  </Text>
179
177
  </Box>
180
178
  </Box>
179
+
181
180
  <Box
182
181
  display={"flex"}
183
182
  gap={"4px"}
@@ -196,8 +195,8 @@ const WalletAmountStep = ({ setStep }: { setStep: (step: string) => void }) => {
196
195
  </Box>
197
196
 
198
197
  <CurrencySwapDisplay
199
- tokenOut={tokenOutDetails}
200
- tokenIn={tokenDetails}
198
+ tokenOut={effectiveTokenOutData}
199
+ tokenIn={tokenInData}
201
200
  chainIdIn={chainIdIn}
202
201
  chainIdOut={chainIdOut}
203
202
  />
@@ -8,15 +8,17 @@ import { useWalletBalance } from "@/enso-api/api";
8
8
  import { formatNumber, formatUSD, normalizeValue } from "@/util";
9
9
 
10
10
  const WalletAssetStep = ({ setStep }: { setStep: (step: string) => void }) => {
11
- const setIsCheckout = useAppStore((state) => state.setActiveExchange);
11
+ const setSelectedIntegration = useAppStore(
12
+ (state) => state.setSelectedIntegration,
13
+ );
12
14
  const setTokenIn = useAppStore((state) => state.setTokenIn);
13
15
  const tokenIn = useAppStore((state) => state.tokenIn);
14
16
  const setChainIdIn = useAppStore((state) => state.setChainIdIn);
15
17
  const chainIdIn = useAppStore((state) => state.chainIdIn);
16
- const { holdingsList, total, isLoading } = useWalletBalance();
18
+ const { holdingsList, isLoading } = useWalletBalance();
17
19
 
18
20
  useEffect(() => {
19
- setIsCheckout(false);
21
+ setSelectedIntegration(null);
20
22
  }, []);
21
23
 
22
24
  return (
@@ -108,9 +108,6 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
108
108
  variant="ghost"
109
109
  bg="transparent"
110
110
  border="none"
111
- _hover={{
112
- bg: "bg.subtle",
113
- }}
114
111
  _active={{
115
112
  bg: "bg.emphasized",
116
113
  }}
@@ -5,6 +5,8 @@ import {
5
5
  useTokensControllerTokens,
6
6
  useWalletControllerCreateApproveTransaction,
7
7
  useWalletControllerWalletBalances,
8
+ useNonTokenizedControllerTokens,
9
+ useNontokenizedControllerRouteNontokenizedShorcutTransaction,
8
10
  } from "@/enso-api";
9
11
  import { useMemo } from "react";
10
12
  import { usePricesControllerGetPrice } from "@/enso-api";
@@ -13,7 +15,11 @@ import { useAppStore } from "@/store";
13
15
  import { Address } from "viem";
14
16
  import { formatNumber, normalizeValue } from "@/util";
15
17
  import { VITALIK_ADDRESS } from "@/util/constants";
16
- import { RouterControllerRouteShortcutTransactionParams } from "./model";
18
+ import {
19
+ RouterControllerRouteShortcutTransactionParams,
20
+ NontokenizedControllerRouteNontokenizedShorcutTransactionParams,
21
+ NonTokenizedModel,
22
+ } from "./model";
17
23
 
18
24
  export const useWalletBalance = () => {
19
25
  const { address } = useAccount();
@@ -140,7 +146,7 @@ export const useEnsoPrice = (chainId: number, token: string) => {
140
146
  return { data: data?.price, isLoading };
141
147
  };
142
148
 
143
- export const useEnsoData = ({
149
+ export const useTokenizedRouteData = ({
144
150
  chainId,
145
151
  outChainId,
146
152
  fromAddress,
@@ -152,6 +158,7 @@ export const useEnsoData = ({
152
158
  slippage,
153
159
  referralCode,
154
160
  routingStrategy = "router",
161
+ enabled = true,
155
162
  }: {
156
163
  chainId: number;
157
164
  outChainId: number;
@@ -164,6 +171,7 @@ export const useEnsoData = ({
164
171
  slippage: number;
165
172
  referralCode?: string;
166
173
  routingStrategy?: "router" | "checkout";
174
+ enabled?: boolean;
167
175
  }) => {
168
176
  const routerParams: RouterControllerRouteShortcutTransactionParams = {
169
177
  referralCode,
@@ -202,7 +210,10 @@ export const useEnsoData = ({
202
210
  query: {
203
211
  retry: 2,
204
212
  enabled:
205
- !!routerParams.amountIn && !!tokenFromData && !!tokenToData,
213
+ !!routerParams.amountIn &&
214
+ !!tokenFromData &&
215
+ !!tokenToData &&
216
+ enabled,
206
217
  },
207
218
  },
208
219
  );
@@ -230,3 +241,133 @@ export const useApproveData = ({
230
241
 
231
242
  return { approveData: res.data, approveFetched: res.isFetched };
232
243
  };
244
+
245
+ export const useNontokenizedTokens = () => {
246
+ const config = useConfig();
247
+
248
+ const supportedChainIds = useMemo(
249
+ () => config.chains.map((chain) => chain.id),
250
+ [config.chains],
251
+ );
252
+
253
+ const { data, isLoading } = useNonTokenizedControllerTokens(
254
+ {},
255
+ {
256
+ query: {
257
+ enabled: true,
258
+ },
259
+ },
260
+ );
261
+
262
+ const nontokenizedMap = useMemo(() => {
263
+ if (!data?.data) return new Map<string, NonTokenizedModel>();
264
+
265
+ const map = new Map<string, NonTokenizedModel>();
266
+ data.data.forEach((token) => {
267
+ if (supportedChainIds.includes(token.chainId)) {
268
+ const key = `${token.chainId}-${token.address.toLowerCase()}`;
269
+ map.set(key, token);
270
+ }
271
+ });
272
+
273
+ return map;
274
+ }, [data, supportedChainIds]);
275
+
276
+ console.log(nontokenizedMap);
277
+
278
+ return { nontokenizedMap, isLoading };
279
+ };
280
+
281
+ export const useIsNontokenized = (tokenAddress?: string, chainId?: number) => {
282
+ const { nontokenizedMap, isLoading } = useNontokenizedTokens();
283
+
284
+ const nontokenizedData = useMemo(() => {
285
+ if (!tokenAddress || !chainId) return null;
286
+
287
+ const key = `${chainId}-${tokenAddress.toLowerCase()}`;
288
+ return nontokenizedMap.get(key) || null;
289
+ }, [tokenAddress, chainId, nontokenizedMap]);
290
+
291
+ return {
292
+ isNontokenized: !!nontokenizedData,
293
+ nontokenizedData,
294
+ isLoading,
295
+ };
296
+ };
297
+
298
+ export const useNontokenizedRouteData = ({
299
+ chainId,
300
+ fromAddress,
301
+ receiver,
302
+ spender,
303
+ amountIn,
304
+ tokenIn,
305
+ positionOut,
306
+ slippage,
307
+ referralCode,
308
+ outChainId,
309
+ routingStrategy = "router",
310
+ enabled = true,
311
+ }: {
312
+ chainId: number;
313
+ fromAddress: string;
314
+ receiver: string;
315
+ spender: string;
316
+ amountIn: string;
317
+ tokenIn: string;
318
+ positionOut: string;
319
+ slippage: number;
320
+ referralCode?: string;
321
+ outChainId;
322
+ routingStrategy?: "router" | "checkout";
323
+ enabled?: boolean;
324
+ }) => {
325
+ const routerParams: NontokenizedControllerRouteNontokenizedShorcutTransactionParams =
326
+ {
327
+ referralCode,
328
+ amountIn: [amountIn],
329
+ tokenIn: [tokenIn],
330
+ positionOut,
331
+ slippage: slippage.toString(),
332
+ fromAddress,
333
+ receiver,
334
+ spender,
335
+ // @ts-ignore
336
+ routingStrategy,
337
+ chainId,
338
+ };
339
+
340
+ let isCrosschain = outChainId !== chainId;
341
+
342
+ if (isCrosschain) {
343
+ // @ts-ignore
344
+ routerParams.destinationChainId = outChainId;
345
+ }
346
+
347
+ const {
348
+ data: [tokenFromData],
349
+ } = useEnsoToken(tokenIn, chainId);
350
+
351
+ const swapTitle = `Purchase ${formatNumber(
352
+ normalizeValue(amountIn, tokenFromData?.decimals),
353
+ )} ${tokenFromData?.symbol} of nontokenized position`;
354
+
355
+ const routerData =
356
+ useNontokenizedControllerRouteNontokenizedShorcutTransaction(
357
+ routerParams,
358
+ {
359
+ query: {
360
+ retry: 2,
361
+ enabled:
362
+ !!routerParams.amountIn && !!tokenFromData && enabled,
363
+ },
364
+ },
365
+ );
366
+
367
+ const data = {
368
+ ...routerData.data,
369
+ amountOut: routerData?.data?.amountDeposited,
370
+ };
371
+
372
+ return { ...routerData, data, title: swapTitle };
373
+ };
@@ -18,6 +18,7 @@ export const useCustomClient = <T>(): CustomClient<T> => {
18
18
  const token = useAppStore((state) => state.ensoApiToken);
19
19
 
20
20
  return async ({ url, method, params, data }) => {
21
+ // const response = await fetch(url.replace("https://api.enso.finance", "http://localhost:3000") + "?" + new URLSearchParams(params), {
21
22
  const response = await fetch(url + "?" + new URLSearchParams(params), {
22
23
  method,
23
24
  headers: { ...data?.headers, Authorization: `Bearer ${token}` },