示例#1
0
 def store_network(self):
     """
     Saves selected network to the store.
     """
     store = Store.get_store()
     network = self.get_ui_network()
     store.put('network', value=network.name)
示例#2
0
 def store_gas_price(self):
     """
     Saves gas price value to the store.
     """
     store = Store.get_store()
     gas_price = self.get_ui_gas_price()
     store.put('gas_price', value=gas_price)
示例#3
0
 def account_utils(self):
     """
     Gets or creates the AccountUtils object so it loads lazily.
     """
     from ethereum_utils import AccountUtils
     from etheroll.store import Store
     if self._account_utils is None:
         keystore_dir = Store.get_keystore_path()
         self._account_utils = AccountUtils(keystore_dir=keystore_dir)
     return self._account_utils
示例#4
0
 def get_stored_gas_price():
     """
     Retrieves stored gas price value, defaults to DEFAULT_GAS_PRICE_GWEI.
     """
     store = Store.get_store()
     try:
         gas_price_dict = store['gas_price']
     except KeyError:
         gas_price_dict = {}
     gas_price = gas_price_dict.get('value', DEFAULT_GAS_PRICE_GWEI)
     return gas_price
示例#5
0
 def get_stored_network():
     """
     Retrieves last stored network value, defaults to Mainnet.
     """
     store = Store.get_store()
     try:
         network_dict = store['network']
     except KeyError:
         network_dict = {}
     network_name = network_dict.get('value', ChainID.MAINNET.name)
     network = ChainID[network_name]
     return network
示例#6
0
 def is_persistent_keystore(cls):
     """
     Retrieves the settings value regarding the keystore persistency.
     Defaults to False.
     """
     store = Store.get_store()
     try:
         persist_keystore_dict = store[PERSIST_KEYSTORE_SETTINGS]
     except KeyError:
         persist_keystore_dict = {}
     persist_keystore = persist_keystore_dict.get(
         'value', False)
     return persist_keystore
示例#7
0
 def set_is_persistent_keystore(cls, persist_keystore: bool):
     """
     Saves keystore persistency settings.
     """
     store = Store.get_store()
     store.put(PERSIST_KEYSTORE_SETTINGS, value=persist_keystore)
示例#8
0
 def set_stored_gas_price(cls, gas_price: int):
     """
     Persists gas price settings.
     """
     store = Store.get_store()
     store.put(GAS_PRICE_SETTINGS, value=gas_price)
示例#9
0
 def set_stored_network(cls, network: ChainID):
     """
     Persists network settings.
     """
     store = Store.get_store()
     store.put(NETWORK_SETTINGS, value=network.name)
示例#10
0
 def _after_init(self, dt):
     """
     Sets keystore_path.
     """
     self.keystore_path = Store.get_keystore_path()
示例#11
0
 def user_data_dir(cls):
     app = cls.get_running_app()
     return Store.get_user_data_dir(app)