Skip to content

Commit 91e13e8

Browse files
committed
Return empty utxo list from blockfrost when an address is never used before
1 parent 7e46dcb commit 91e13e8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pycardano/backend/blockfrost.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,13 @@ def _get_script(
181181
return NativeScript.from_dict(script_json)
182182

183183
def _utxos(self, address: str) -> List[UTxO]:
184-
results = self.api.address_utxos(address, gather_pages=True)
184+
try:
185+
results = self.api.address_utxos(address, gather_pages=True)
186+
except ApiError as e:
187+
if e.status_code == 404:
188+
return []
189+
else:
190+
raise e
185191

186192
utxos = []
187193

0 commit comments

Comments
 (0)