コード例 #1
0
    async def getTransactionReceipt(self, tx_hash):
        chain = self.get_new_chain()
        receipt = chain.chaindb.get_transaction_receipt(tx_hash)

        receipt_dict = receipt_to_dict(receipt, tx_hash, chain)

        return receipt_dict
コード例 #2
0
def format_receipt_for_web3_to_extract_events(receipt, tx_hash, chain):
    def hex_to_32_bit_int_bytes(hex_val):
        sede = BigEndianInt(32)
        return sede.serialize(to_int(hexstr=hex_val))

    from helios.rpc.format import receipt_to_dict
    receipt_dict = receipt_to_dict(receipt, tx_hash, chain)
    for i in range(len(receipt_dict['logs'])):
        receipt_dict['logs'][i]['data'] = decode_hex(
            receipt_dict['logs'][i]['data'])

        receipt_dict['logs'][i]['topics'] = list(
            map(hex_to_32_bit_int_bytes, receipt_dict['logs'][i]['topics']))
    return receipt_dict