Пример #1
0
 def get_max_amount(self):
     inputs = self.wallet.get_spendable_coins(None, self.electrum_config)
     addr = str(self.send_screen.screen.address) or self.wallet.dummy_address()
     outputs = [(TYPE_ADDRESS, addr, '!')]
     tx = self.wallet.make_unsigned_transaction(inputs, outputs, self.electrum_config)
     amount = tx.output_value()
     return format_satoshis_plain(amount, self.decimal_point())
Пример #2
0
 def get_max_amount(self):
     from electrum_nyc.transaction import TxOutput
     if run_hook('abort_send', self):
         return ''
     inputs = self.wallet.get_spendable_coins(None, self.electrum_config)
     if not inputs:
         return ''
     addr = str(
         self.send_screen.screen.address) or self.wallet.dummy_address()
     outputs = [TxOutput(TYPE_ADDRESS, addr, '!')]
     try:
         tx = self.wallet.make_unsigned_transaction(inputs, outputs,
                                                    self.electrum_config)
     except NoDynamicFeeEstimates as e:
         Clock.schedule_once(
             lambda dt, bound_e=e: self.show_error(str(bound_e)))
         return ''
     except NotEnoughFunds:
         return ''
     except InternalAddressCorruption as e:
         self.show_error(str(e))
         send_exception_to_crash_reporter(e)
         return ''
     amount = tx.output_value()
     __, x_fee_amount = run_hook('get_tx_extra_fee', self.wallet,
                                 tx) or (None, 0)
     amount_after_all_fees = amount - x_fee_amount
     return format_satoshis_plain(amount_after_all_fees,
                                  self.decimal_point())
Пример #3
0
 def fiat_to_btc(self, fiat_amount):
     if not fiat_amount:
         return ''
     rate = self.fx.exchange_rate()
     if not rate:
         return ''
     satoshis = int(pow(10,8) * Decimal(fiat_amount) / Decimal(rate))
     return format_satoshis_plain(satoshis, self.decimal_point())
Пример #4
0
 def format_amount_and_units(self, x):
     return format_satoshis_plain(x, self.decimal_point()) + ' ' + self.base_unit
Пример #5
0
 def setAmount(self, amount):
     if amount is None:
         self.setText(" ") # Space forces repaint in case units changed
     else:
         self.setText(format_satoshis_plain(amount, self.decimal_point()))