def to_dict()

in resdb_driver/transaction.py [0:0]


    def to_dict(self):
        """! Transforms the object to a Python dictionary.
        Note:
            A dictionary serialization of the Input the Output was
            derived from is always provided.

            @return The Output as an alternative serialization format.
        """
        # TODO FOR CC: It must be able to recognize a hashlock condition
        #              and fulfillment!
        condition = {}
        try:
            condition["details"] = _fulfillment_to_details(self.fulfillment)
        except AttributeError:
            pass

        try:
            condition["uri"] = self.fulfillment.condition_uri
        except AttributeError:
            condition["uri"] = self.fulfillment

        output = {
            "public_keys": self.public_keys,
            "condition": condition,
            "amount": str(self.amount),
        }
        return output