fix: Fixed a judgment statement error
issue
@@ -232,7 +232,7 @@ class CFunctionGen():
with open(abi_file_name) as file_handle:
self.abi_object = json.load(file_handle)
self.abi_file_name = os.path.basename(abi_file_name)
- #print(self.abi_object);
+ #print(self.abi_object)
self.output_path = output_path
@@ -766,7 +766,7 @@ class CFunctionGen():
# Generate local variables
- if abi_item['stateMutability'] != "pure" and abi_item['stateMutability'] != "view":
+ if abi_item['constant'] == True:
func_body_str += ' BCHAR *call_result_str = NULL;\n'
else:
func_body_str += ' static BCHAR tx_hash_str[67] = \"\";\n'
@@ -815,7 +815,7 @@ class CFunctionGen():
func_body_str += ' }\n\n'
# Set Nonce
- if abi_item['stateMutability'] != "pure" and abi_item['stateMutability'] != "view":
+ if abi_item['constant'] == False:
func_body_str += ' boat_try(BoatFiscobcosTxSetNonce(tx_ptr, BOAT_FISCOBCOS_NONCE_AUTO));\n\n'
@@ -1005,7 +1005,7 @@ class CFunctionGen():
func_body_str += ' }\n\n'
i = i + 1
- if abi_item['stateMutability'] != "pure" and abi_item['stateMutability'] != "view":
+ if abi_item['constant'] == True:
# for state-less funciton call
func_body_str += ' call_result_str = BoatFiscobcosCallContractFunc(tx_ptr, function_prototye_str, data_field.field_ptr+4, data_field.field_len-4);\n\n'
else:
@@ -1029,7 +1029,7 @@ class CFunctionGen():
func_body_str += '\n BoatFree(data_field.field_ptr);\n'
- if abi_item['stateMutability'] != "pure" and abi_item['stateMutability'] != "view":
+ if abi_item['constant'] == True:
func_body_str += ' return(call_result_str);\n'
else:
func_body_str += ' return(tx_hash_str);\n'
