@@ -1526,33 +1526,33 @@ class Meta:
15261526 def __str__ (self ):
15271527 return f"{ self .safe } - { self .nonce } - { self .safe_tx_hash } "
15281528
1529- def to_log (self , message : str ) -> str :
1529+ def to_dict (self ) -> dict :
15301530 """
1531- :param message:
1532- :return: MultisigTransaction ready to be printed in a log line
1531+ :return: MultisigTransaction as dict
15331532 """
15341533 safe_tx_hash_str = to_0x_hex_str (HexBytes (self .safe_tx_hash ))
1535- return (
1536- f"[MultisigTransaction { safe_tx_hash_str } ] { message } . "
1537- f"safe_tx_hash={ safe_tx_hash_str } "
1538- f"safe={ self .safe } "
1539- f"proposer={ self .proposer } "
1540- f"proposed_by_delegate={ self .proposed_by_delegate } "
1541- f"to={ self .to } "
1542- f"value={ self .value } "
1543- f"data={ to_0x_hex_str (HexBytes (self .data )) if self .data else None } "
1544- f"operation={ self .operation } "
1545- f"safe_tx_gas={ self .safe_tx_gas } "
1546- f"base_gas={ self .base_gas } "
1547- f"gas_price={ self .gas_price } "
1548- f"gas_token={ self .gas_token } "
1549- f"refund_receiver={ self .refund_receiver } "
1550- f"signatures={ to_0x_hex_str (HexBytes (self .signatures )) if self .signatures else None } "
1551- f"nonce={ self .nonce } "
1552- f"failed={ self .failed } "
1553- f"origin={ self .origin } "
1554- f"trusted={ self .trusted } "
1555- )
1534+ return {
1535+ "safe_tx_hash" : safe_tx_hash_str ,
1536+ "safe" : self .safe ,
1537+ "proposer" : self .proposer ,
1538+ "proposed_by_delegate" : self .proposed_by_delegate ,
1539+ "to" : self .to ,
1540+ "value" : self .value ,
1541+ "data" : to_0x_hex_str (HexBytes (self .data )) if self .data else None ,
1542+ "operation" : self .operation ,
1543+ "safe_tx_gas" : self .safe_tx_gas ,
1544+ "base_gas" : self .base_gas ,
1545+ "gas_price" : self .gas_price ,
1546+ "gas_token" : self .gas_token ,
1547+ "refund_receiver" : self .refund_receiver ,
1548+ "signatures" : (
1549+ to_0x_hex_str (HexBytes (self .signatures )) if self .signatures else None
1550+ ),
1551+ "nonce" : self .nonce ,
1552+ "failed" : self .failed ,
1553+ "origin" : self .origin ,
1554+ "trusted" : self .trusted ,
1555+ }
15561556
15571557 @property
15581558 def execution_date (self ) -> Optional [datetime .datetime ]:
@@ -1713,10 +1713,9 @@ def __str__(self):
17131713 else :
17141714 return f"Confirmation of owner={ self .owner } for existing transaction={ self .multisig_transaction_hash } "
17151715
1716- def to_log (self , message : str ) -> str :
1716+ def to_dict (self ) -> dict :
17171717 """
1718- :param message:
1719- :return: MultisigTransaction ready to be printed in a log line
1718+ :return: MultisigConfirmatiom as dict
17201719 """
17211720 multisig_transaction_hash_str = to_0x_hex_str (
17221721 HexBytes (
@@ -1725,15 +1724,20 @@ def to_log(self, message: str) -> str:
17251724 else self .multisig_transaction_id
17261725 )
17271726 )
1728- return (
1729- f"[MultisigConfirmation for { multisig_transaction_hash_str } ] { message } . "
1730- f"ethereum_tx={ to_0x_hex_str (HexBytes (self .ethereum_tx_id )) if self .ethereum_tx else None } "
1731- f"multisig_transaction={ 'SET' if self .multisig_transaction else 'UNSET' } "
1732- f"multisig_transaction-hash={ multisig_transaction_hash_str } "
1733- f"owner={ self .owner } "
1734- f"signature={ to_0x_hex_str (bytes (self .signature )) if self .signature else None } "
1735- f"signature_type={ SafeSignatureType (self .signature_type ).name } "
1736- )
1727+ return {
1728+ "ethereum_tx" : (
1729+ to_0x_hex_str (HexBytes (self .ethereum_tx_id ))
1730+ if self .ethereum_tx
1731+ else None
1732+ ),
1733+ "multisig_transaction" : "SET" if self .multisig_transaction else "UNSET" ,
1734+ "multisig_transaction-hash" : multisig_transaction_hash_str ,
1735+ "owner" : self .owner ,
1736+ "signature" : (
1737+ to_0x_hex_str (bytes (self .signature )) if self .signature else None
1738+ ),
1739+ "signature_type" : SafeSignatureType (self .signature_type ).name ,
1740+ }
17371741
17381742
17391743class MonitoredAddress (models .Model ):
0 commit comments