示例#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 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())
示例#3
0
 def format_amount_and_units(self, x):
     return format_satoshis_plain(x, self.decimal_point()) + ' ' + self.base_unit
示例#4
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()))