so at the end of lesson2 is a challenge to change the connection url to main net and check the balance for of the address toly.sol for example.
I found that, I have to change the Connection url to: "https://api.mainnet-beta.solana.com" in order to connect to main net. But when I type: npx esrun check-balance.ts toly.sol. The console shows me an error. And I understand that, because toly.sol is not a public key. But How do I find out the public key of toly.sol?
This is the code from my check-balance.ts:
import { Connection, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";const suppliedPublicKey = process.argv[2];if (!suppliedPublicKey) { throw new Error("Provide a public key to check the balance of!");}const connection = new Connection("https://api.mainnet-beta.solana.com", "confirmed");const publicKey = new PublicKey(suppliedPublicKey);const balanceInLamports = await connection.getBalance(publicKey);const balanceInSOL = balanceInLamports / LAMPORTS_PER_SOL;console.log( `✅ Finished! The balance for the wallet at address ${publicKey} is ${balanceInSOL}!`);
What am I missing here?
Greetings Lukan