def __init__(self, config, daemon, plugins): self.config = config network = daemon.network storage = WalletStorage(config.get_wallet_path()) if not storage.file_exists: print "Wallet not found. try 'electrum create'" exit() self.done = 0 self.last_balance = "" set_verbosity(False) self.str_recipient = "" self.str_description = "" self.str_amount = "" self.str_fee = "" self.wallet = Wallet(storage) self.wallet.start_threads(network) self.contacts = StoreDict(self.config, 'contacts') network.register_callback(self.on_network, ['updated', 'banner']) self.commands = [_("[h] - displays this help text"), \ _("[i] - display transaction history"), \ _("[o] - enter payment order"), \ _("[p] - print stored payment order"), \ _("[s] - send stored payment order"), \ _("[r] - show own receipt addresses"), \ _("[c] - display contacts"), \ _("[b] - print server banner"), \ _("[q] - quit") ] self.num_commands = len(self.commands)
def __init__(self, config, network, path): super(BaseWizard, self).__init__() self.config = config self.network = network self.storage = WalletStorage(path) self.wallet = None self.stack = []
def init_storage_from_path(self, path): self.storage = WalletStorage(path) self.basename = self.storage.basename() if not self.storage.file_exists(): self.require_password = False self.message = _('Press Next to create') elif self.storage.is_encrypted(): if not self.storage.is_encrypted_with_user_pw(): raise Exception( "Kivy GUI does not support this type of encrypted wallet files." ) self.pw_check = self.storage.check_password if self.app.password and self.check_password(self.app.password): self.pw = self.app.password # must be set so that it is returned in callback self.require_password = False self.message = _('Press Next to open') else: self.require_password = True self.message = self.enter_pw_message else: # it is a bit wasteful load the wallet here and load it again in main_window, # but that is fine, because we are progressively enforcing storage encryption. db = WalletDB(self.storage.read(), manual_upgrades=False) wallet = Wallet(db, self.storage, config=self.app.electrum_config) self.require_password = wallet.has_password() self.pw_check = wallet.check_password self.message = self.enter_pw_message if self.require_password else _( 'Wallet not encrypted')
def __init__(self, config, network): self.network = network self.config = config storage = WalletStorage(self.config.get_wallet_path()) if not storage.file_exists: raise BaseException("Wallet not found") self.wallet = Wallet(storage) self.cmd_runner = Commands(self.config, self.wallet, self.network) host = config.get('rpchost', 'localhost') port = config.get('rpcport', 7777) self.server = SimpleJSONRPCServer((host, port), requestHandler=RequestHandler) self.server.socket.settimeout(1) for cmdname in known_commands: self.server.register_function(getattr(self.cmd_runner, cmdname), cmdname)
def init_storage_from_path(self, path): self.storage = WalletStorage(path) self.basename = self.storage.basename() if not self.storage.file_exists(): self.require_password = False self.message = _('Press Next to create') elif self.storage.is_encrypted(): if not self.storage.is_encrypted_with_user_pw(): raise Exception( "Kivy GUI does not support this type of encrypted wallet files." ) self.require_password = True self.pw_check = self.storage.check_password self.message = self.enter_pw_message else: # it is a bit wasteful load the wallet here and load it again in main_window, # but that is fine, because we are progressively enforcing storage encryption. wallet = self.app.daemon.load_wallet(path, None) self.require_password = wallet.has_password() self.pw_check = wallet.check_password self.message = self.enter_pw_message if self.require_password else _( 'Wallet not encrypted')
def __init__(self, config, network): self.network = network self.config = config storage = WalletStorage(config) if not storage.file_exists: print "Wallet not found. try 'electrum create'" exit() self.done = 0 self.last_balance = "" set_verbosity(False) self.str_recipient = "" self.str_description = "" self.str_amount = "" self.str_fee = "" self.wallet = Wallet(storage) self.wallet.start_threads(network) self.wallet.network.register_callback('updated', self.updated) self.wallet.network.register_callback('connected', self.connected) self.wallet.network.register_callback('disconnected', self.disconnected) self.wallet.network.register_callback('disconnecting', self.disconnecting) self.wallet.network.register_callback('peers', self.peers) self.wallet.network.register_callback('banner', self.print_banner) self.commands = [_("[h] - displays this help text"), \ _("[i] - display transaction history"), \ _("[o] - enter payment order"), \ _("[p] - print stored payment order"), \ _("[s] - send stored payment order"), \ _("[r] - show own receipt addresses"), \ _("[c] - display contacts"), \ _("[b] - print server banner"), \ _("[q] - quit") ] self.num_commands = len(self.commands)
type=str, nargs='+', help='Electrum wallet path') args = parser.parse_args() exec_path = os.path.dirname(os.path.realpath(__file__)) + '/' # test electrum daemon try: pid = subprocess.check_output('pgrep electrum', shell=True) except subprocess.CalledProcessError: # start daemon f = subprocess.call(['electrum', 'daemon', 'start']) if os.path.isfile(args.wallet_path[0]): storage = WalletStorage(args.wallet_path[0]) w = electrum.wallet.NewWallet(storage) else: print('Wrong Wallet Path!') sys.exit() if not os.path.isfile(exec_path + 'murtcele.db'): conn = sqlite3.connect(exec_path + 'murtcele.db') c = conn.cursor() c.execute( '''CREATE TABLE electrum (id integer primary key autoincrement ,address text not null, balance real not null, t datetime not null default CURRENT_TIMESTAMP)''' ) # fill db with wallet addresses addresses = subprocess.check_output('electrum listaddresses', shell=True)