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')
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_str = 'unconfirmed' if timestamp is None else format_time( int(timestamp)) icon = f'atlas://{KIVY_GUI_PATH}/theming/atlas/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'] 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 = f'atlas://{KIVY_GUI_PATH}/theming/atlas/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) ri['base_unit'] = self.app.base_unit if 'fiat_value' in tx_item: ri['quote_text'] = str(tx_item['fiat_value']) ri['fx_ccy'] = tx_item['fiat_value'].ccy return ri
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