Skip to content Skip to sidebar Skip to footer

How To Get Solana Account Info And-or Sol Balance Using Vanilla Js And Json-rpc Via Phantom Wallet Integration?

The following Vanilla JS example connects to and disconnects from the Solana blockchain via Phantom wallet. It successfully connects and gets the public address. It fails when tryi

Solution 1:

It doesn't use JSON-RPC API, but I put below my code to get Solana (Phantom) Wallet Balance on Devnet.

provider = window.solana;
connection = new solanaWeb3.Connection(solanaWeb3.clusterApiUrl('devnet'), 'confirmed');
// After Connecting
connection.getBalance(provider.publicKey).then(function(value) { console.log(value); })


Post a Comment for "How To Get Solana Account Info And-or Sol Balance Using Vanilla Js And Json-rpc Via Phantom Wallet Integration?"