def query_commit_event(self, tx_hash: str): event = self._sdk.default_network.get_contract_event_by_tx_hash(tx_hash) notify = Event.get_notify_by_contract_address(event, self.__hex_contract_address) if len(notify) == 0: return notify if len(notify['States']) == 4: notify['States'][0] = NeoData.to_utf8_str(notify['States'][0]) notify['States'][1] = NeoData.to_b58_address(notify['States'][1]) notify['States'][2] = NeoData.to_utf8_str(notify['States'][2]) notify['States'][3] = NeoData.to_hex_str(notify['States'][3]) if len(notify['States']) == 3: notify['States'][0] = NeoData.to_utf8_str(notify['States'][0]) notify['States'][1] = NeoData.to_hex_str(notify['States'][1]) notify['States'][2] = NeoData.to_utf8_str(notify['States'][2]) return notify
def decode_neo_raw_data(data: str, d_type: str): if d_type.lower() == 'hex': return NeoData.to_hex_str(data) if d_type.lower() == 'int': return NeoData.to_int(data) if d_type.lower() == 'bool': return NeoData.to_bool(data) if d_type.lower() == 'utf8': return NeoData.to_utf8_str(data) if d_type.lower() == 'dict': return NeoData.to_dict(data) if d_type.lower() == 'bytes': return NeoData.to_bytes(data) if d_type.lower() == 'address': return NeoData.to_b58_address(data) return data
def to_hex_cmd(ctx, data: str): """ Convert ASCII string to a HEX string. """ echo(NeoData.to_hex_str(data))