Skip to content

Commit bc02bd6

Browse files
authored
Fix kupo plutusv2 script from kupo (#253)
* Fix kupo plutusv2 script from kupo * Formatting * Apply try_fix_hash procedure if kupo is available * Fix import
1 parent 94f8b96 commit bc02bd6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pycardano/backend/ogmios.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
GenesisParameters,
1717
ProtocolParameters,
1818
)
19+
from pycardano.backend.blockfrost import _try_fix_script
1920
from pycardano.exception import TransactionFailedException
2021
from pycardano.hash import DatumHash, ScriptHash
2122
from pycardano.network import Network
@@ -343,13 +344,11 @@ def _utxos_kupo(self, address: str) -> List[UTxO]:
343344
kupo_script_url = self._kupo_url + "/scripts/" + script_hash
344345
script = requests.get(kupo_script_url).json()
345346
if script["language"] == "plutus:v2":
346-
script = PlutusV2Script(
347-
cbor2.loads(bytes.fromhex(script["script"]))
348-
)
347+
script = PlutusV2Script(bytes.fromhex(script["script"]))
348+
script = _try_fix_script(script_hash, script)
349349
elif script["language"] == "plutus:v1":
350-
script = PlutusV1Script(
351-
cbor2.loads(bytes.fromhex(script["script"]))
352-
)
350+
script = PlutusV1Script(bytes.fromhex(script["script"]))
351+
script = _try_fix_script(script_hash, script)
353352
else:
354353
raise ValueError("Unknown plutus script type")
355354

0 commit comments

Comments
 (0)