Skip to content

Querying UTxOs from an address never used before raises an exception #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mateusap1 opened this issue Apr 12, 2023 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@mateusap1
Copy link
Contributor

If I create a new address and don't send any tokens to it, I would expect to get an empty list as a result if I used chain_context.utxos(address). Currently, however, it raises the following exception:

      |   File "/usr/local/lib/python3.9/site-packages/blockfrost/utils.py", line 83, in recursive_append
      |     raise ApiError(request_response)
      | blockfrost.utils.ApiError: {'status_code': 404, 'error': 'Not Found', 'message': 'The requested component has not been found.'}

This is a snippet if you want to reproduce the error,

import pycardano as pyc

skey = pyc.PaymentSigningKey.generate()
vkey = pyc.PaymentVerificationKey.from_signing_key(skey)

address = pyc.Address(payment_part=vkey.hash(), network=pyc.Network.TESNET)

chain_context = pyc.BlockfrostChainContext(...)

print(chain_context.utxos(str(address)))

This will give us the exception written above, but I would expect to get an empty list instead.

@mateusap1
Copy link
Contributor Author

The solution is to update the blockfrost chain context to try and catch the blockfrost api for this address. If it receives a 404 error, should return an empty list.

@cffls cffls added the enhancement New feature or request label Apr 12, 2023
@cffls
Copy link
Collaborator

cffls commented Apr 12, 2023

This feature request makes sense. We may need to update Ogmios too.

@cffls
Copy link
Collaborator

cffls commented Apr 22, 2023

Closing this issue as it is addressed in #219

@cffls cffls closed this as completed Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants