Skip to content

ogmios.txsubmit.EvaluateTransaction with additional_utxo

Intro

I'm using pycardano for transaction building in a project that has a smart contract with two consecutive transactions, and the goal was to implement a way to estimate tx fee for the second tx inside the first tx builder. So first tx is not yet submitted, but we need the fee for the second transaction. This could be done by ogmios if "additionalUtxo" is supplied, additional meaning it is not yet part of the blockchain, see docs. In pycardano this method is not fully implemented, so I forked the repos to add this functionality, see api reference.

The error

First attempt was just to use this parameter in pycardano, it's using the ogmios.datatypes.Utxo class for this, which is a wrapper on ogmios.model.ogmios_model.Utxo class. So it gave me "Utxo object is not JSON serializable" error (it has no fields). Second attempt was to use a list of utxo items instead, it's using the ogmios.model.ogmios_model.UtxoItem class, but it fails with this error, which I have not been able to fix:

"/lib/python3.11/site-packages/pydantic/v1/main.py", line 706, in validate
    return value._copy_and_set_values(value.__dict__, value.__fields_set__, deep=deep_copy)
                                                      ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'UtxoItem' object has no attribute '__fields_set__'. Did you mean: '__fields__'?

Links to WIP branches in other repos

  1. pycardano - https://github.com/stanislav-az/pycardano/tree/odv-multisig-ext/evaluate-tx-with-additional-utxo
  2. ogmios - https://gitlab.com/st.zhdanovich/ogmios-python/-/tree/feature/evaluate-tx-with-additional-utxo?ref_type=heads
Edited by Stanislav Zhdanovich