Skip to content

Commit 708f487

Browse files
authored
remove ethers (#1825)
1 parent ec1d790 commit 708f487

File tree

4 files changed

+19
-231
lines changed

4 files changed

+19
-231
lines changed

apps/hyperdrive-trading/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
"d3-format": "^3.1.0",
6565
"daisyui": "^4.12.2",
6666
"dnum": "^2.9.0",
67-
"ethers": "^6.13.5",
6867
"fuse.js": "^7.0.0",
6968
"graphql": "^16.9.0",
7069
"graphql-request": "^7.1.0",

apps/hyperdrive-trading/src/ui/hyperdrive/zaps/fetchUniswapPath.ts

Lines changed: 0 additions & 74 deletions
This file was deleted.

apps/hyperdrive-trading/src/ui/hyperdrive/zaps/hooks/useCloseLongZap.tsx

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ import { zapAbi } from "@delvtech/hyperdrive-js";
66
import { useAddRecentTransaction } from "@rainbow-me/rainbowkit";
77
import { MutationStatus } from "@tanstack/query-core";
88
import { useMutation } from "@tanstack/react-query";
9-
import { Token } from "@uniswap/sdk-core";
109
import toast from "react-hot-toast";
1110
import { useAppConfigForConnectedChain } from "src/ui/appconfig/useAppConfigForConnectedChain";
1211
import { SUCCESS_TOAST_DURATION } from "src/ui/base/toasts";
1312
import { usePreviewCloseLong } from "src/ui/hyperdrive/longs/hooks/usePreviewCloseLong";
14-
import { fetchUniswapPath } from "src/ui/hyperdrive/zaps/fetchUniswapPath";
1513
import { useTokenFiatPrice } from "src/ui/token/hooks/useTokenFiatPrice";
1614
import TransactionToast from "src/ui/transactions/TransactionToast";
1715
import { 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

Comments
 (0)