Skip to content

Commit d4168ab

Browse files
update utxo query with kupo
1 parent 24b5de8 commit d4168ab

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

integration-test/test/test_plutus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def test_plutus_v2_ref_script(self):
293293
for utxo in self.chain_context.utxos(str(script_address)):
294294
if not utxo.output.script and (
295295
utxo.output.datum_hash == datum_hash(datum)
296-
or utxo.output.datum == datum
296+
or datum_hash(utxo.output.datum) == datum_hash(datum)
297297
):
298298
utxo_to_spend = utxo
299299
break

pycardano/backend/ogmios.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33
import time
44
from enum import Enum
5-
from typing import Any, Dict, List, Optional, Union, Tuple
5+
from typing import Any, Dict, List, Optional, Tuple, Union
66

77
import cbor2
88
import requests
@@ -234,7 +234,9 @@ def _utxos_kupo(self, address: str) -> List[UTxO]:
234234
List[UTxO]: A list of UTxOs.
235235
"""
236236
if self._kupo_url is None:
237-
raise AssertionError("kupo_url object attribute has not been assigned properly.")
237+
raise AssertionError(
238+
"kupo_url object attribute has not been assigned properly."
239+
)
238240

239241
kupo_utxo_url = self._kupo_url + "/matches/" + address
240242
results = requests.get(kupo_utxo_url).json()
@@ -279,9 +281,8 @@ def _utxos_kupo(self, address: str) -> List[UTxO]:
279281
if datum_hash:
280282
kupo_datum_url = self._kupo_url + "/datums/" + result["datum_hash"]
281283
datum_result = requests.get(kupo_datum_url).json()
282-
if datum_result and datum_result['datum'] != datum_hash:
283-
#datum = RawCBOR(bytes.fromhex(datum_result["datum"]))
284-
datum = cbor2.loads(bytes.fromhex(datum_result["datum"]))
284+
if datum_result and datum_result["datum"] != datum_hash:
285+
datum = RawCBOR(bytes.fromhex(datum_result["datum"]))
285286
datum_hash = None
286287

287288
if not result["value"]["assets"]:

0 commit comments

Comments
 (0)