This Python script fetches and prints the mint addresses of tokens owned by a specified Solana wallet using the Solana JSON RPC API.
- Python 3.x
requests
library
-
Clone the repository or download the script:
git clone https://github.com/your-repo/solana-token-fetcher.git cd solana-token-fetcher
Or simply download the script
token_mint_addresses.py
. -
Install the required Python library:
pip install requests
-
Open the script
token_mint_addresses.py
in your preferred text editor. -
Set the Solana wallet address in the script:
# Wallet address for which to get token mint addresses wallet_address = "39azUYFWPz3VHgKCf3VChUwbpURdCHRxjWVowf5jUJjg"
-
Run the script:
python token_mint_addresses.py
-
View the output, which will list the mint addresses of tokens owned by the specified wallet:
Mint addresses of tokens created by wallet 39azUYFWPz3VHgKCf3VChUwbpURdCHRxjWVowf5jUJjg: <mint_address_1> <mint_address_2> ...
If you want to save the mint addresses to a file during runtime:
-
Run the script with an additional argument to save the addresses:
python main.py > mint_addresses.txt
-
Check the output file
mint_addresses.txt
in the script's directory to find the saved mint addresses.
- Ensure you have an active internet connection as the script makes HTTP requests to the Solana JSON RPC API.
- If you encounter any issues, double-check the wallet address and ensure it is correctly set in the script.
- Make sure the
requests
library is installed and up to date.