#Algoexplorer alternative

3 messages · Page 1 of 1 (latest)

wind vaporBOT
#

Hi @fiery nexus. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To replace your previous Algoexplorer API call for fetching an account's asset holdings, you should use the official Algorand REST API endpoints or SDKs. The equivalent endpoint is:

GET /v2/accounts/{address}/assets

This endpoint returns a list of assets held by an account, including asset parameters. You can call this endpoint directly on an Algorand node (algod REST API) or use the Algorand Indexer for more advanced queries.

Example using aiohttp (similar to your old code):

import aiohttp

address = "YOUR_ACCOUNT_ADDRESS"
request_assets_string = f"<https://mainnet-api.algonode.cloud/v2/accounts/{address}/assets">
async with aiohttp.ClientSession() as session:
    async with session.get(request_assets_string) as request:
        if request.status == 200:
            holder_data = await request.json(content_type=None)
            # holder_data['assets'] contains the asset holdings

Replace the URL with your preferred Algorand API provider (e.g., Algonode, PureStake, or your own node).

Official documentation for this endpoint:
Get a list of assets held by an account, inclusive of asset params

If you want to use the Python SDK, you can use:

from algosdk.v2client import algod

algod_client = algod.AlgodClient(algod_token, algod_address)
account_assets = algod_client.account_asset_info(address, asset_id)

Or to get all assets:

account_info = algod_client.account_info(address)
assets = account_info.get("assets", [])

AlgodClient documentation

#

Summary:

  • Use the /v2/accounts/{address}/assets endpoint for asset holdings.
  • Use a public node provider or your own node.
  • The Python SDK provides convenient wrappers for these endpoints.

Let me know if you need a specific example for another language or SDK!

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: