Skip to content

Spending UTxOs containing a plutus V3 script fails with Ogmios backend #381

Closed
@nullhashpixel

Description

@nullhashpixel

Describe the bug

Spending UTxOs containing a plutus V3 script fails with Ogmios backend

https://github.com/Python-Cardano/pycardano/blob/main/pycardano/backend/ogmios_v6.py#L264-L266

To Reproduce
Steps to reproduce the behavior. e.g. A python script.

Logs

  File "/home/.local/lib/python3.8/site-packages/pycardano/txbuilder.py", line 1489, in build_and_sign
    tx_body = self.build(
  File "/home/.local/lib/python3.8/site-packages/pycardano/logging.py", line 37, in wrapper
    raise e
  File "/home/.local/lib/python3.8/site-packages/pycardano/logging.py", line 28, in wrapper
    output = func(obj, *args, **kwargs)
  File "/home/.local/lib/python3.8/site-packages/pycardano/txbuilder.py", line 1220, in build
    for utxo in self.context.utxos(address):
  File "/home/.local/lib/python3.8/site-packages/pycardano/backend/base.py", line 155, in utxos
    return self._utxos(str(address))
  File "/home/.local/lib/python3.8/site-packages/pycardano/backend/ogmios_v6.py", line 230, in _utxos
    utxos = self._utxos_ogmios(OgmiosAddress(address=address))
  File "/home/.local/lib/python3.8/site-packages/pycardano/backend/ogmios_v6.py", line 253, in _utxos_ogmios
    utxos.append(self._utxo_from_ogmios_result(result))
  File "/home/.local/lib/python3.8/site-packages/pycardano/backend/ogmios_v6.py", line 267, in _utxo_from_ogmios_result
    if script["language"] == "plutus:v2":
TypeError: byte indices must be integers or slices, not str

Additional context

fix:

            if script["language"] == "plutus:v3":
                script = PlutusV3Script(bytes.fromhex(script["cbor"]))
            if script["language"] == "plutus:v2":

==>

            if script["language"] == "plutus:v3":
                script = PlutusV3Script(bytes.fromhex(script["cbor"]))
            elif script["language"] == "plutus:v2":

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions