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)
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)
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
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
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
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
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)
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)
def set_stored_network(cls, network: ChainID): """ Persists network settings. """ store = Store.get_store() store.put(NETWORK_SETTINGS, value=network.name)
def _after_init(self, dt): """ Sets keystore_path. """ self.keystore_path = Store.get_keystore_path()
def user_data_dir(cls): app = cls.get_running_app() return Store.get_user_data_dir(app)