In my code I am synchronizing an account with 2000 addresses to get the latest state.

For this part of the code I am trying to get the amount of NFTs in the first address

def get_available_nfts():
    logger.debug("Checking for available NFTs")
    # Sync account with the node
    wallet = IotaWallet(wallet_db_name, client_options, coin_type, secret_manager)
    account = wallet.get_account(shimmer_account_name)
    response = account.sync()
    logger.debug(f'Synced response in get available: {response}')
    nfts = response['nfts']
    logger.info(f"Available NFTs in get function: {len(nfts)}")
    if len(nfts) == 0:
            f"⚠️There are no NFTs available {nfts}\n⚠️Make sure to have the Collection NFT in this address and to add the Collection NFT ID to the .env file before you continue."
        return nfts

These are the errors I am getting:

iota_wallet.common.IotaWalletError: {'type': 'client', 'error': 'error sending request for url (https://api.testnet.shimmer.network/api/indexer/v1/outputs/nft?address=rms1qz232u0408mw5u4vj96eetpzh2jsqk3ufjw768xrnvpzhfanrltu6slc4yn): operation was canceled: ALPN upgraded to HTTP/2
 File "/home/antonio/dev/shimmer-zealy-nft-dropper/venv/lib/python3.9/site-packages/iota_wallet/common.py", line 20, in wrapper
    raise IotaWalletError(json_response['payload'])
iota_wallet.common.IotaWalletError: {'type': 'client', 'error': 'response error with status code 500: {"error":{"code":"500","message":"Internal Server Error, error: reading outputIDs failed: failed to connect to `host=postgres user=indexer database=indexer`: server error (FATAL: sorry, too many clients already (SQLSTATE 53300)): code=500, message=Internal Server Error"}}\n, URL: https://api.testnet.shimmer.network/api/indexer/v1/outputs/basic?expirationReturnAddress=rms1qzu2780ru2pgta8x46lspercrzxuux2ak3ysh74qs2sg5ge6pnuc5h4wl3d'}

The response = account.sync() is trying to sync an account with 2000 addresses and gets stuck at around address 500 or 1200 depending on the node

How do I get the amount of NFTs in my address?


1 Answer 1


The issue is that the account.sync() is trying to get the data from all 2000 addresses.

One solution in this case, since the NFTs all sit on the same address is to provide specific addresses to sync in the sync options.

To do so change this part here:

response = account.synch()


response = account.sync(options={"addresses": ["rms1qqyathwkmkva9fte8sj3cgd69fp9vfelzs5helawlug0lyr7gc0rk9myjjw"]})

Through the whole code account.sync() was changed with account.sync(options={"addresses": ["rms1qqyathwkmkva9fte8sj3cgd69fp9vfelzs5helawlug0lyr7gc0rk9myjjw"]}) to work properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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