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, show_dip2): timestamp = tx_item['timestamp'] islock = tx_item['islock'] key = tx_item.get('txid') tx_hash = tx_item['txid'] conf = tx_item['confirmations'] tx_mined_info = TxMinedInfo(height=tx_item['height'], conf=conf, timestamp=timestamp) status, status_str = self.app.wallet.get_tx_status( tx_hash, tx_mined_info, islock) icon = self.atlas_path + TX_ICONS[status] message = tx_item['label'] or tx_hash fee = tx_item['fee_sat'] fee_text = '' if fee is None else 'fee: %d duffs' % fee ri = {} ri['screen'] = self ri['tx_type'] = tx_item['tx_type'] if show_dip2 else '' ri['key'] = key ri['icon'] = icon ri['group_icn'] = tx_item['group_icon'] ri['group_txid'] = tx_item['group_txid'] 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
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