Пример #1
0
 def get_tx_height(self, txid):
     # because we use a current timestamp, and history is empty,
     # FxThread.history_rate will use spot prices
     return TxMinedInfo(height=10,
                        conf=10,
                        timestamp=int(time.time()),
                        header_hash='def')
Пример #2
0
 def get_card(self, tx_item):  #tx_hash, tx_mined_status, value, balance):
     is_lightning = tx_item.get('lightning', False)
     timestamp = tx_item['timestamp']
     key = tx_item.get('txid') or tx_item['payment_hash']
     if is_lightning:
         status = 0
         txpos = tx_item['txpos']
         status_str = 'unconfirmed' if timestamp is None else format_time(
             int(timestamp))
         icon = "atlas://electrum_ltc/gui/kivy/theming/light/lightning"
         message = tx_item['label']
         fee_msat = tx_item['fee_msat']
         fee = int(fee_msat / 1000) if fee_msat else None
         fee_text = '' if fee is None else 'fee: %d sat' % fee
     else:
         tx_hash = tx_item['txid']
         conf = tx_item['confirmations']
         txpos = tx_item['txpos_in_block'] or 0
         height = tx_item['height']
         tx_mined_info = TxMinedInfo(height=tx_item['height'],
                                     conf=tx_item['confirmations'],
                                     timestamp=tx_item['timestamp'])
         status, status_str = self.app.wallet.get_tx_status(
             tx_hash, tx_mined_info)
         icon = "atlas://electrum_ltc/gui/kivy/theming/light/" + TX_ICONS[
             status]
         message = tx_item['label'] or tx_hash
         fee = tx_item['fee_sat']
         fee_text = '' if fee is None else 'fee: %d sat' % fee
     ri = {}
     ri['screen'] = self
     ri['key'] = key
     ri['icon'] = icon
     ri['date'] = status_str
     ri['message'] = message
     ri['fee_text'] = fee_text
     value = tx_item['value'].value
     if value is not None:
         ri['is_mine'] = value <= 0
         ri['amount'] = self.app.format_amount(value, is_diff=True)
         if 'fiat_value' in tx_item:
             ri['quote_text'] = str(tx_item['fiat_value'])
     return ri
Пример #3
0
 def tx_mined_info_from_tx_item(tx_item):
     tx_mined_info = TxMinedInfo(height=tx_item['height'],
                                 conf=tx_item['confirmations'],
                                 timestamp=tx_item['timestamp'])
     return tx_mined_info