Example #1
0
 def test_dict_in_ctx(self):
     hex_contract_address = '6690b6638251be951dded8c537678200a470c679'
     bool_value = True
     int_value = 100
     str_value = 'value3'
     dict_value = {'key': 'value'}
     list_value = [1, 10, 1024, [1, 10, 1024, [1, 10, 1024]]]
     dict_msg = {
         'key': dict_value,
         'key1': int_value,
         'key2': str_value,
         'key3': bool_value,
         'key4': list_value
     }
     func = NeoInvokeFunction('testMapInMap')
     func.set_params_value(dict_msg)
     tx_hash = sdk.rpc.send_neo_vm_transaction(hex_contract_address, None,
                                               acct1, self.gas_price,
                                               self.gas_limit, func, False)
     time.sleep(randint(10, 15))
     event = sdk.rpc.get_contract_event_by_tx_hash(tx_hash)
     states = Event.get_states_by_contract_address(event,
                                                   hex_contract_address)
     states[0] = NeoData.to_utf8_str(states[0])
     self.assertEqual('mapInfo', states[0])
     states[1] = NeoData.to_dict(states[1])
     self.assertTrue(isinstance(states[1], dict))
 def parse_status(result: dict):
     status = result['Result']
     if status == '':
         status = False
     else:
         status = NeoData.to_dict(status)
         status = bool(status[3])
     return status