示例#1
0
 def load_wallet(self, wallet):
     self.wallet = wallet
     authmethod = self.config.get('coinapult_auth_method', 'REST')
     if authmethod == 'REST':
         self.client = CoinapultClient(credentials={'key': self.api_key(), 'secret': self.api_secret()})
     else:
         ecc_pub = self.wallet.storage.get("coinapult_ecc_public", '')
         ecc_priv = self.wallet.storage.get("coinapult_ecc_private", '')
         try:
             self.client = CoinapultClient(ecc={'pubkey': ecc_pub, 'privkey': ecc_priv}, authmethod='ecc')
         except (CoinapultError, CoinapultErrorECC):
             self.client = None
             QMessageBox.warning(None, _('Coinapult Connection failed'),
                                 _('Failed to connect to Coinapult. Locks disabled for this session.'), _('OK'))
             self.disable()
     self.init_balances()
示例#2
0
 def __init__(self, parent):
     threading.Thread.__init__(self)
     self.daemon = True
     self.parent = parent
     if hasattr(self.parent, 'client'):
         self.client = self.parent.client
     else:
         authmethod = self.parent.config.get('coinapult_auth_method', 'REST')
         if authmethod == 'REST':
             self.client = CoinapultClient(credentials={'key': self.parent.api_key(),
                                                        'secret': self.parent.api_secret()})
         else:
             ecc_pub = self.parent.wallet.storage.get("coinapult_ecc_public", '')
             ecc_priv = self.parent.wallet.storage.get("coinapult_ecc_private", '')
             try:
                 self.client = CoinapultClient(ecc={'pubkey': ecc_pub, 'privkey': ecc_priv}, authmethod='ecc')
             except (CoinapultError, CoinapultErrorECC):
                 self.client = None
     self.lock = threading.Lock()
     self.query_balances = threading.Event()
     # self.parent.gui.main_window.emit(SIGNAL("refresh_locks_account()"))
     self.is_running = False
示例#3
0
 def signup_done(result):
     self.ca_ok_button.setDisabled(False)
     self.wallet.storage.put("coinapult_ecc_public", str(self.client.ecc_pub_pem))
     self.ecc_pub_key_edit.setText(self.client.ecc_pub_pem)
     self.wallet.storage.put("coinapult_ecc_private", str(self.client.ecc['privkey'].to_pem()))
     self.ecc_priv_key_edit.setText(str(self.client.ecc['privkey'].to_pem()))
     self.config.set_key('coinapult_auth_method', 'ECC', True)
     ecc_pub = self.wallet.storage.get("coinapult_ecc_public", '')
     ecc_priv = self.wallet.storage.get("coinapult_ecc_private", '')
     try:
         self.client = CoinapultClient(ecc={'pubkey': ecc_pub, 'privkey': ecc_priv}, authmethod='ecc')
     except (CoinapultError, CoinapultErrorECC):
         self.client = None
         QMessageBox.warning(None, _('Coinapult Connection failed'),
                             _('Failed to connect to Coinapult. Locks disabled for this session.'), _('OK'))
     d.accept()