How to make a simple query of what tokens I have in my wallet from cardano-cli?

How to make a simple query of what tokens I have in my wallet from cardano-cli?


cardano-cli itself has no concept of wallet.

You can ask what currently is at a single address with cardano-cli query utxo --mainnet --address addr1….

But getting all addresses of your wallet would be a task for cardano-wallet and/or cardano-address.

Thanks for your answer, at the moment I am just testing and I would like to be able to check the balance of adas of my wallet by terminal. Should I use cardano-wallet?

Haven’t used them myself, but my thoughts would be:

cardano-wallet is running as a server. I somehow don’t like that. If I’m using CLI, I want to have it small and simple. That’s why I’m using CLI.

So, I’d rather look at cardano-address. I’m not aware of a good tutorial for that, though. might get you started.

1 Like

thanks for your help

Feel free to ask more specific if you are stuck somewhere.

I suggest trying stakepool_python_tools/ at main · Josef3110/stakepool_python_tools · GitHub which is a wrapper around cardano-cli in python.

It does not take digits definition into account but works pretty nice.

1 Like

Thanks for your answer, I finally found this shortcut in and made the following script to query revenue$Address

import os
import json
from time import sleep

    wallet = os.popen("curl$Address").read()
    json_final = round(json.loads(wallet)["lovelaces"]/1000000,2)
    print(f"En la cuenta hay {json_final} adas")
    print("Dormiremos 60 segundos antes de volver a consultar")

Later I will look carefully at what you sent me that seems very interesting

1 Like