3

I'm trying to just get the SOL balance, but I get returned a full list of tokens.

https://public-api.solscan.io/account/tokens?account=34qHtfUqxgsnTDewwoXEXuhknymJ1sqoXD7H38aKADEw

I'm using solscan public api's. But should I be using something else to get SOL balance of an address?

1

1 Answer 1

4

You can use Solana JSON RPC API by calling getBalance request example

Or @solana/web3.js using connection.getBalance example

6
  • i want to do it without installing a library. mainly want to just fetch this info from an REST api call using curl. Aug 25 at 15:57
  • Yeah already told you the way to do it. You can use Solana JSON RPC API by calling getBalance request example :)
    – vicyyn
    Aug 25 at 19:20
  • curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' {"jsonrpc":"2.0", "id":1, "method":"getBalance", "params":["83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"]} '
    – vicyyn
    Aug 25 at 19:20
  • I'm trying to do it with: public-api.solscan.io --- i don't want to install anything on my server or local. Aug 29 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.