@@ -561,26 +561,23 @@ def json_description(self) -> str:
561561 """
562562 return self .__class__ .__doc__ or "Generated with PyCardano"
563563
564- def to_json (self , ** kwargs ) -> str :
564+ def to_json (self , key_type : Optional [ str ] = None , description : Optional [ str ] = None ) -> str :
565565 """
566566 Convert the CBORSerializable object to a JSON string containing type, description, and CBOR hex.
567567
568568 This method returns a JSON representation of the object, including its type, description, and CBOR hex encoding.
569569
570570 Args:
571- **kwargs: Additional keyword arguments that can include:
572- - key_type (str): The type to use in the JSON output. Defaults to the class name.
573- - description (str): The description to use in the JSON output. Defaults to the class docstring.
571+ key_type (str): The type to use in the JSON output. Defaults to the class name.
572+ description (str): The description to use in the JSON output. Defaults to the class docstring.
574573
575574 Returns:
576575 str: The JSON string representation of the object.
577576 """
578- key_type = kwargs .pop ("key_type" , self .json_type )
579- description = kwargs .pop ("description" , self .json_description )
580577 return json .dumps (
581578 {
582- "type" : key_type ,
583- "description" : description ,
579+ "type" : key_type or self . json_type ,
580+ "description" : description or self . json_description ,
584581 "cborHex" : self .to_cbor_hex (),
585582 },
586583 indent = 2 ,
@@ -625,8 +622,8 @@ def save(
625622
626623 Args:
627624 path (str): The file path to save the object to.
628- key_type (str, optional): The type to use in the JSON output.
629- description (str, optional): The description to use in the JSON output.
625+ key_type (str, optional): The type to use in the JSON output. Defaults to the class name.
626+ description (str, optional): The description to use in the JSON output. Defaults to the class docstring.
630627
631628 Raises:
632629 IOError: If the file already exists and is not empty.
0 commit comments