From e4dcdb79842d79adbdbf9983fe2eed2569ba9a8e Mon Sep 17 00:00:00 2001 From: Tomas R Date: Mon, 16 Dec 2024 22:27:00 -0300 Subject: [PATCH] fix address format --- react/react-solana/src/App.tsx | 4 +-- .../src/components/ActionButtonList.tsx | 32 +++++++++++-------- .../react-solana/src/components/InfoList.tsx | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/react/react-solana/src/App.tsx b/react/react-solana/src/App.tsx index 47969bc..006b7e9 100644 --- a/react/react-solana/src/App.tsx +++ b/react/react-solana/src/App.tsx @@ -17,11 +17,11 @@ createAppKit({ }) export function App() { - const [transactionHash, setTransactionHash] = useState<`0x${string}` | undefined>(undefined); + const [transactionHash, setTransactionHash] = useState(undefined); const [signedMsg, setSignedMsg] = useState(''); const [balance, setBalance] = useState(''); - const receiveHash = (hash: `0x${string}`) => { + const receiveHash = (hash: string) => { setTransactionHash(hash); // Update the state with the transaction hash }; diff --git a/react/react-solana/src/components/ActionButtonList.tsx b/react/react-solana/src/components/ActionButtonList.tsx index a427fe9..8e5ff11 100644 --- a/react/react-solana/src/components/ActionButtonList.tsx +++ b/react/react-solana/src/components/ActionButtonList.tsx @@ -14,7 +14,7 @@ export const ActionButtonList = ({ sendHash, sendSignMsg, sendBalance }: ActionB const { disconnect } = useDisconnect(); const { open } = useAppKit(); const { switchNetwork } = useAppKitNetwork(); - const { address } = useAppKitAccount() + const { isConnected, address } = useAppKitAccount() const { connection } = useAppKitConnection(); const { walletProvider } = useAppKitProvider('solana') @@ -75,16 +75,20 @@ export const ActionButtonList = ({ sendHash, sendSignMsg, sendBalance }: ActionB console.error("Failed to disconnect:", error); } }; - return ( -
-
- - - - - - -
-
- ) -} + return ( + <> + {isConnected ? ( +
+
+ + + + + + +
+
+ ) : null} + + ); + } \ No newline at end of file diff --git a/react/react-solana/src/components/InfoList.tsx b/react/react-solana/src/components/InfoList.tsx index adfedd5..8e1fffd 100644 --- a/react/react-solana/src/components/InfoList.tsx +++ b/react/react-solana/src/components/InfoList.tsx @@ -8,7 +8,7 @@ import { } from '@reown/appkit/react' interface InfoListProps { - hash: `0x${string}` | undefined; + hash: string | undefined; signedMsg: string; balance: string; }