-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuse-lido.ts
More file actions
36 lines (29 loc) · 837 Bytes
/
Copy pathuse-lido.ts
File metadata and controls
36 lines (29 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"use client";
import { useReadContract } from "wagmi";
import { wstETHAbi, WSTETH_ADDRESS } from "@/config/contracts";
export function useWstETHConversion(wstETHAmount?: bigint) {
const stETHValue = useReadContract({
address: WSTETH_ADDRESS,
abi: wstETHAbi,
functionName: "getStETHByWstETH",
args: wstETHAmount ? [wstETHAmount] : undefined,
});
return stETHValue;
}
export function useStETHToWstETH(stETHAmount?: bigint) {
const wstETHValue = useReadContract({
address: WSTETH_ADDRESS,
abi: wstETHAbi,
functionName: "getWstETHByStETH",
args: stETHAmount ? [stETHAmount] : undefined,
});
return wstETHValue;
}
export function useStEthPerToken() {
const rate = useReadContract({
address: WSTETH_ADDRESS,
abi: wstETHAbi,
functionName: "stEthPerToken",
});
return rate;
}