Skip to content

Commit cae36ef

Browse files
authored
Merge pull request #210 from OpShin/feat/kupo_unspent
Make use of spent_at and unspent flag
2 parents 6ec8623 + fd3ce34 commit cae36ef

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pycardano/backend/ogmios.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def _utxos_kupo(self, address: str) -> List[UTxO]:
258258
"kupo_url object attribute has not been assigned properly."
259259
)
260260

261-
kupo_utxo_url = self._kupo_url + "/matches/" + address
261+
kupo_utxo_url = self._kupo_url + "/matches/" + address + "?unspent"
262262
results = requests.get(kupo_utxo_url).json()
263263

264264
utxos = []
@@ -267,11 +267,7 @@ def _utxos_kupo(self, address: str) -> List[UTxO]:
267267
tx_id = result["transaction_id"]
268268
index = result["output_index"]
269269

270-
# Right now, all UTxOs of the address will be returned with Kupo, which requires Ogmios to
271-
# validate if the UTxOs are spent with output reference. This feature is being considered to
272-
# be added to Kupo to avoid extra API calls.
273-
# See discussion here: https://github.com/CardanoSolutions/kupo/discussions/19.
274-
if self._check_utxo_unspent(tx_id, index):
270+
if result["spent_at"] is None:
275271
tx_in = TransactionInput.from_primitive([tx_id, index])
276272

277273
lovelace_amount = result["value"]["coins"]

0 commit comments

Comments
 (0)