from decimal import Decimal
_ = lambda x:x
#from i18n import _
-from electrum.util import format_satoshis, set_verbosity
-from electrum.bitcoin import is_valid
+from electrum_nvc.util import format_satoshis, set_verbosity
+from electrum_nvc.bitcoin import is_valid
-from electrum import Wallet, WalletStorage
+from electrum_nvc import Wallet, WalletStorage
import tty, sys
self.network = network
storage = WalletStorage(config)
if not storage.file_exists:
- print "Wallet not found. try 'electrum create'"
+ print "Wallet not found. try 'electrum-nvc create'"
exit()
self.wallet = Wallet(storage)
def set_cursor(self, x):
try:
curses.curs_set(x)
- except:
+ except Exception:
pass
def restore_or_create(self):
if conf:
try:
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
- except:
+ except Exception:
time_str = "------"
else:
time_str = 'pending'
def print_balance(self):
- if self.network and self.network.interface and self.network.interface.is_connected:
+ if not self.network:
+ msg = _("Offline")
+ elif self.network.interface and self.network.interface.is_connected:
if not self.wallet.up_to_date:
- msg = _( "Synchronizing..." )
+ msg = _("Synchronizing...")
else:
c, u = self.wallet.get_balance()
- msg = _("Balance")+": %f "%(Decimal( c ) / 100000000)
- if u: msg += " [%f unconfirmed]"%(Decimal( u ) / 100000000)
+ msg = _("Balance")+": %f "%(Decimal( c ) / 1000000)
+ if u: msg += " [%f unconfirmed]"%(Decimal( u ) / 1000000)
else:
- msg = _( "Not connected" )
+ msg = _("Not connected")
self.stdscr.addstr( self.maxy -1, 3, msg)
def do_send(self):
if not is_valid(self.str_recipient):
- self.show_message(_('Invalid Bitcoin address'))
+ self.show_message(_('Invalid Novacoin address'))
return
try:
- amount = int( Decimal( self.str_amount) * 100000000 )
- except:
+ amount = int( Decimal( self.str_amount) * 1000000 )
+ except Exception:
self.show_message(_('Invalid Amount'))
return
try:
- fee = int( Decimal( self.str_fee) * 100000000 )
- except:
+ fee = int( Decimal( self.str_fee) * 1000000 )
+ except Exception:
self.show_message(_('Invalid Fee'))
return
try:
tx = self.wallet.mktx( [(self.str_recipient, amount)], password, fee)
- except BaseException, e:
+ except Exception as e:
self.show_message(str(e))
return
h = self.wallet.send_tx(tx)
self.show_message(_("Please wait..."), getchar=False)
self.wallet.tx_event.wait()
- status, msg = self.wallet.receive_tx( h )
+ status, msg = self.wallet.receive_tx( h, tx )
if status:
self.show_message(_('Payment sent.'))
if not auto_connect:
try:
host, port, protocol = server.split(':')
- except:
+ except Exception:
self.show_message("Error:" + server + "\nIn doubt, type \"auto-connect\"")
return False
choices = item.get('choices')
try:
j = choices.index(item.get('value'))
- except:
+ except Exception:
j = 0
new_choice = choices[(j + 1)% len(choices)]
item['value'] = new_choice