Getting account balance from sollana web3 library

 

We are easily get our wallet by using the following code - all your need to do is provide your solana wallet: 


import * as web3 from '@solana/web3.js';

const connection = new web3.Connection(web3.clusterApiUrl("devnet"))
    let user = new web3.PublicKey(
      "my-account-number",
    );
    console.log(user.toBase58());
    let balance= await connection.getBalance(user);
    console.log(balance);

Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm