File tree Expand file tree Collapse file tree
src/hiero_sdk_python/contract Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -507,6 +507,6 @@ def _to_proto(self) -> contract_types_pb2.ContractFunctionResult:
507507 gas = self .gas_available ,
508508 amount = self .amount ,
509509 functionParameters = self .function_parameters ,
510- signer_nonce = Int64Value (value = self .signer_nonce ),
510+ signer_nonce = Int64Value (value = self .signer_nonce ) if self . signer_nonce is not None else None ,
511511 contract_nonces = [contract_nonce ._to_proto () for contract_nonce in self .contract_nonces or []],
512512 )
Original file line number Diff line number Diff line change @@ -405,3 +405,17 @@ def test_to_proto(contract_function_result):
405405 assert proto .amount == contract_function_result .amount
406406 assert proto .functionParameters == contract_function_result .function_parameters
407407 assert proto .signer_nonce .value == contract_function_result .signer_nonce
408+
409+
410+ def test_to_proto_signer_nonce ():
411+ """Test _to_proto method with None and 0 signer_nonce."""
412+ # Test with None
413+ result_none = ContractFunctionResult (signer_nonce = None )
414+ proto_none = result_none ._to_proto ()
415+ assert not proto_none .HasField ("signer_nonce" )
416+
417+ # Test with 0
418+ result_zero = ContractFunctionResult (signer_nonce = 0 )
419+ proto_zero = result_zero ._to_proto ()
420+ assert proto_zero .HasField ("signer_nonce" )
421+ assert proto_zero .signer_nonce .value == 0
You can’t perform that action at this time.
0 commit comments