Exemple #1
0
 def __init__(self, import_config=None):
     self.store_conn = store.DataStoreConnection("wallet.db")
     self.wallet_config = store.PersistentDictStore(self.store_conn.conn,
                                                    "wallet")
     if import_config:
         self.import_config(import_config)
     self.wallet_model = None
Exemple #2
0
 def __init__(self, wallet_path=None, import_config=None):
     """Create a persistent wallet. If a configuration is passed
     in, put that configuration into the db by overwriting
     the relevant data, never deleting. Otherwise, load with
     the configuration from the persistent data-store.
     """
     if wallet_path is None:
         wallet_path = "wallet.db"
     self.store_conn = store.DataStoreConnection(wallet_path, True)
     self.store_conn.conn.row_factory = sqlite3.Row
     self.wallet_config = store.PersistentDictStore(
         self.store_conn.conn, "wallet")
     if import_config:
         self.import_config(import_config)
     self.wallet_model = None
Exemple #3
0
 def __init__(self, wallet_path, testnet):
     """Create a persistent wallet. If a configuration is passed
     in, put that configuration into the db by overwriting
     the relevant data, never deleting. Otherwise, load with
     the configuration from the persistent data-store.
     """
     if wallet_path is None:
         if testnet:
             wallet_path = "testnet.wallet"
         else:
             wallet_path = "mainnet.wallet"
     new_wallet = not os.path.exists(wallet_path)
     self.store_conn = store.DataStoreConnection(wallet_path, True)
     self.store_conn.conn.row_factory = sqlite3.Row
     self.wallet_config = store.PersistentDictStore(self.store_conn.conn,
                                                    "wallet")
     if new_wallet:
         self.initialize_new_wallet(testnet)
     if testnet and not self.wallet_config['testnet']:
         raise Exception("not a testnet wallet")
     self.wallet_model = None