title: Solana - How to get the balance from my Phantom wallet?
body: <p>I'm working on a web app that can connect to Phantom Wallet. I've established the connection and have successfully retrieved the wallet's public key. The problem is, I can't seem to find any solution to get the account balance.</p>
  <p>For reference, I wanted to display the account balance just like how solanart.io displays it.</p>
  <p>Note that I've gone through all related docs (Solana/web3.js, Solana JSON RPC API etc). Please guide me as I'm still new to JSON RPC API.</p>
  <p>For a heads up, I'm using vanilla js.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>try {
        const resp = window.solana.request({
          method: "getAccountTokenBalance",
          params: [
            id, //wallet's public key
            {
              encoding: "base58",
            },
          ],
        });
        console.log(resp);
      } catch(err) {
        // error message
      }</code></pre>
  </div>
  </div>
  </p>