-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
528f6a6
commit a5bf223
Showing
5 changed files
with
77 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
"license": "ISC", | ||
"description": "", | ||
"dependencies": { | ||
"cors": "^2.8.5", | ||
"express": "^4.21.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
const Home = () => { | ||
const [walletData, setWalletData] = useState(null); | ||
|
||
useEffect(() => { | ||
// Fetch wallet data from the backend | ||
const fetchWalletData = async () => { | ||
try { | ||
const response = await fetch('http://localhost:3001/api/wallet'); // Adjust the API endpoint as necessary | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok'); | ||
} | ||
const data = await response.json(); | ||
setWalletData(data); | ||
} catch (error) { | ||
console.error('Error fetching wallet data:', error); | ||
} | ||
}; | ||
|
||
fetchWalletData(); | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<h1>Welcome to the Web3 Wallet</h1> | ||
{walletData ? ( | ||
<div> | ||
<h2>Your Wallet Information</h2> | ||
<p>Address: {walletData.address}</p> | ||
<p>Balance: {walletData.balance} ETH</p> | ||
</div> | ||
) : ( | ||
<p>Loading wallet information...</p> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Home; |