def parse_send_amount(self, input_send_amount, btcusd_spot): if '$' in input_send_amount: if btcusd_spot <= 0.0: raise Exception('Unable to get exchange rate for local currency. Please specify amount in BTC instead.') usd_send_amount = float(input_send_amount.replace('$', '')) btc_send_amount = (1.0*usd_send_amount) / btcusd_spot sat_send_amount = core.btc_to_satoshi(btc_send_amount) btc_send_amount = core.satoshi_to_btc(sat_send_amount) else: btc_send_amount = float(input_send_amount) sat_send_amount = core.btc_to_satoshi(btc_send_amount) btc_send_amount = core.satoshi_to_btc(sat_send_amount) usd_send_amount = btc_send_amount*btcusd_spot return btc_send_amount, usd_send_amount
def set_send_amount(self, btc_amount): amount = core.btc_to_satoshi(btc_amount) if amount <= 0: raise InputError("Amount to send must be strictly positive!") self.send_amount = amount self.is_send_amount_set = True return
def set_txfee(self, btc_txfee): txfee = core.btc_to_satoshi(btc_txfee) msg = "OK" if txfee < 0: raise InputError("Negative transaction fee.") if txfee >= self.txfee_warn_above: msg = "LARGE" if txfee == 0: msg = "ZERO" self.txfee = txfee return msg