@@ -6,12 +6,10 @@ import { zapAbi } from "@delvtech/hyperdrive-js";
66import { useAddRecentTransaction } from "@rainbow-me/rainbowkit" ;
77import { MutationStatus } from "@tanstack/query-core" ;
88import { useMutation } from "@tanstack/react-query" ;
9- import { Token } from "@uniswap/sdk-core" ;
109import toast from "react-hot-toast" ;
1110import { useAppConfigForConnectedChain } from "src/ui/appconfig/useAppConfigForConnectedChain" ;
1211import { SUCCESS_TOAST_DURATION } from "src/ui/base/toasts" ;
1312import { usePreviewCloseLong } from "src/ui/hyperdrive/longs/hooks/usePreviewCloseLong" ;
14- import { fetchUniswapPath } from "src/ui/hyperdrive/zaps/fetchUniswapPath" ;
1513import { useTokenFiatPrice } from "src/ui/token/hooks/useTokenFiatPrice" ;
1614import TransactionToast from "src/ui/transactions/TransactionToast" ;
1715import { Address , encodePacked , WalletClient } from "viem" ;
@@ -106,25 +104,6 @@ export function useCloseLongZap({
106104 } ) ,
107105 ) ;
108106
109- const swapPath = await fetchUniswapPath ( {
110- tokenIn : new Token (
111- 1 , // TODO: Use the chainId from the current chain
112- baseToken . address ,
113- baseToken . decimals ,
114- baseToken . symbol ,
115- baseToken . name ,
116- ) ,
117- tokenOut : new Token (
118- 1 , // TODO: Use the chainId from the current chain
119- tokenOut . address ,
120- tokenOut . decimals ,
121- tokenOut . symbol ,
122- tokenOut . name ,
123- ) ,
124- recipient : destination ?? account ,
125- amountIn : previewBaseTokenAmountOut ,
126- } ) ;
127-
128107 try {
129108 const hash = await drift . write ( {
130109 abi : zapAbi ,
@@ -151,13 +130,11 @@ export function useCloseLongZap({
151130 amountOutMinimum : minAmountOut ?? 1n ,
152131 deadline : block . timestamp + 60n ,
153132 // Use the fetched Uniswap path if available, otherwise fall back to direct path
154- path : swapPath
155- ? swapPath
156- : encodePacked (
157- // Direct path between tokens with 1% fee
158- [ "address" , "uint24" , "address" ] ,
159- [ baseToken . address , 100 , tokenOut . address ] ,
160- ) ,
133+ path : encodePacked (
134+ // Direct path between tokens with 1% fee
135+ [ "address" , "uint24" , "address" ] ,
136+ [ baseToken . address , 100 , tokenOut . address ] ,
137+ ) ,
161138 recipient : destination ?? account ,
162139 } ,
163140 } ,
0 commit comments