Blockchain Development Programming Tutorials, Guides & Best Practices
Explore 30+ expertly crafted blockchain development tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.
Adblocker Detected
It looks like you're using an adblocker. Our website relies on ads to keep running. Please consider disabling your adblocker to support us and access the content.
Tutorial
javascript json
Fetching Address Details from Solana
Next, let's fetch the balance of a specific wallet address. Add the following function to your index.js file:
async function getWalletBalance(walletAddress) {
try {
const publicKey = new solanaWeb3.PublicKey(walletAddress);
const balance = await connection.getBalance(publicKey);
console.log(`Wallet Balance: ${balance / solanaWeb3.LAMPORTS_PER_SOL} SOL`);
} catch (error) {
console.error('Error fetching wallet balance:', error);
}
}
// Replace with your Solana wallet address
const walletAddress = 'YourWalletAddressHere';
getWalletBalance(walletAddress);Aug 09, 2024
Read More