diff --git a/src/app/components/Delegations/Delegations.tsx b/src/app/components/Delegations/Delegations.tsx index 17a31e3b..04716366 100644 --- a/src/app/components/Delegations/Delegations.tsx +++ b/src/app/components/Delegations/Delegations.tsx @@ -1,4 +1,4 @@ -import { networks } from "bitcoinjs-lib"; +import type { networks } from "bitcoinjs-lib"; import { useEffect, useState } from "react"; import InfiniteScroll from "react-infinite-scroll-component"; import { useLocalStorage } from "usehooks-ts"; @@ -7,6 +7,7 @@ import { SignPsbtTransaction } from "@/app/common/utils/psbt"; import { LoadingTableList } from "@/app/components/Loading/Loading"; import { DelegationsPointsProvider } from "@/app/context/api/DelegationsPointsProvider"; import { useError } from "@/app/context/Error/ErrorContext"; +import { useWallet } from "@/app/context/wallet/WalletProvider"; import { useHealthCheck } from "@/app/hooks/useHealthCheck"; import { QueryMeta } from "@/app/types/api"; import { @@ -35,14 +36,10 @@ interface DelegationsProps { delegationsAPI: DelegationInterface[]; delegationsLocalStorage: DelegationInterface[]; globalParamsVersion: GlobalParamsVersion; - publicKeyNoCoord: string; - btcWalletNetwork: networks.Network; - address: string; signPsbtTx: SignPsbtTransaction; pushTx: WalletProvider["pushTx"]; queryMeta: QueryMeta; getNetworkFees: WalletProvider["getNetworkFees"]; - isWalletConnected: boolean; } export const Delegations: React.FC = ({ @@ -53,36 +50,50 @@ export const Delegations: React.FC = ({ pushTx, queryMeta, getNetworkFees, - address, - btcWalletNetwork, - publicKeyNoCoord, - isWalletConnected, }) => { + const { address, publicKeyNoCoord, connected, network } = useWallet(); + return ( - - - + > + + + ) ); }; -const DelegationsContent: React.FC = ({ +interface DelegationsContentProps { + delegationsAPI: DelegationInterface[]; + delegationsLocalStorage: DelegationInterface[]; + globalParamsVersion: GlobalParamsVersion; + publicKeyNoCoord: string; + btcWalletNetwork: networks.Network; + address: string; + signPsbtTx: SignPsbtTransaction; + pushTx: WalletProvider["pushTx"]; + queryMeta: QueryMeta; + getNetworkFees: WalletProvider["getNetworkFees"]; + isWalletConnected: boolean; +} + +const DelegationsContent: React.FC = ({ delegationsAPI, delegationsLocalStorage, globalParamsVersion, diff --git a/src/app/components/Header/Header.tsx b/src/app/components/Header/Header.tsx index a7cdbbd9..451e51cb 100644 --- a/src/app/components/Header/Header.tsx +++ b/src/app/components/Header/Header.tsx @@ -1,3 +1,4 @@ +import { useWallet } from "@/app/context/wallet/WalletProvider"; import { shouldDisplayTestingMsg } from "@/config"; import { ConnectSmall } from "../Connect/ConnectSmall"; @@ -8,19 +9,15 @@ import { ThemeToggle } from "../ThemeToggle/ThemeToggle"; interface HeaderProps { loading?: boolean; - onConnect: () => void; - address: string; btcWalletBalanceSat?: number; - onDisconnect: () => void; } export const Header: React.FC = ({ loading, - onConnect, - address, btcWalletBalanceSat, - onDisconnect, }) => { + const { address, open, disconnect } = useWallet(); + return (