Esempio n. 1
0
    def process_event(self, event):
        if isinstance(event, MouseEvent):
            return None

        if event.key_code is 4:
            # drop to debug console
            debug(); pdb.set_trace()
            print("end_debug();; continue will get you back to the app")

        return super(SLFrame, self).process_event(event)
Esempio n. 2
0
    def open(cls):
        #pdb.set_trace()
        try:
            cls.transport = get_transport(None, prefix_search=False)
        except StopIteration as e:
            debug()
            pdb.set_trace()

        init_msg = proto.Initialize()

        if cls.state is not None:
            init_msg.state = cls.state

        try:
            cls.features = cls.call_raw(init_msg)
            logging.info("call_raw transport.write(msg): %s", init_msg)
        except (TransportException, USBErrorBusy):
            raise OpenCredstickError("Error opening Trezor")
Esempio n. 3
0
 def lock(self):
     debug()
     pdb.set_trace()
     self.lock_eth(self.cup_id, 0.05)
Esempio n. 4
0
    def process_event(self, event):

        #ord('C')

        if type(event) != KeyboardEvent:
            return event

        # if event.key_code == -1:    # esc.  for some reason esc has lag.

        # Q, q for quit
        if event.key_code in [113, 81]:
            self._scene.add_effect(QuitDialog(self._screen))
        # S, s  for send
        elif event.key_code in [115, 83]:
            if self._interface.node.eth_balance is None:
                self._scene.add_effect(
                    MessageDialog(self._screen, "Cannot Send without Ether", 3,
                                  35))
                return

            self._scene.add_effect(SendBox(self._screen, self._interface))
        ## Tokens
        # Uniswap
        elif event.key_code in [ord('U'), ord('u')]:
            if self._interface.node.erc20_balances is None:
                self._scene.add_effect(
                    MessageDialog(self._screen, "Need ERC20 balance data.", 3,
                                  35))
                return

            TokenUniswapper(self._screen, self._scene, self._interface.node,
                            self._interface.config,
                            self._interface._block_callback_watcher)
        # T, t for tokens
        elif event.key_code in [ord('a'), ord('A')]:
            TokenAdder(self._screen, self._scene, self._interface.node,
                       self._interface.config,
                       self._interface._block_callback_watcher)
        # T, t for tokens
        elif event.key_code in [ord('R'), ord('r')]:
            TokenRemover(self._screen, self._scene, self._interface.node,
                         self._interface.config,
                         self._interface._block_callback_watcher)

        elif event.key_code in [ord('B')]:
            debug()
            pdb.set_trace()

        # C, c  for copy
        elif event.key_code in [67, 99]:
            pyperclip.copy(self._interface.credstick.addressStr())
            self._scene.add_effect(
                MessageDialog(self._screen, "Address copied to clipboard", 3,
                              35))
        # E, e for ens
        #elif event.key_code in [ord('e'), ord('E')]:
        #    SLNetworkDapp(
        #        self._screen,
        #        self._scene,
        #        self._interface.node,
        #        self._interface.config,
        #        'ens.shadowlands'
        #    )
        # N, n for network
        elif event.key_code in [78, 110]:
            #self._scene.add_effect(NetworkOptions(self._screen, self._interface))
            NetworkConnection(self._screen, self._scene, self._interface.node,
                              self._interface.config,
                              self._interface._block_callback_watcher)

        # D, d for Deploy
        elif event.key_code in [ord('D'), ord('d')]:
            DappBrowser(self._screen, self._scene, self._interface.node,
                        self._interface.config,
                        self._interface._block_callback_watcher)
        elif event.key_code is 18:
            # super top secret shadowlands release management dapp. (ctrl-r)
            ReleaseVersion(self._screen, self._scene, self._interface.node,
                           self._interface.config,
                           self._interface._block_callback_watcher)
        elif event.key_code in [104, 72]:
            # Test to see if we're able to derive before launching this..
            HDAddressPicker(self._screen, self._scene, self._interface.node,
                            self._interface.config,
                            self._interface._block_callback_watcher)
        elif event.key_code in [
                ord('0'), ord('1'),
                ord('2'), ord('3'),
                ord('4')
        ]:
            ''' 
            TODO allow ctrl-0 through ctrl-4, and pass through
            these chars on SLDapp API frames, so that txs can
            be inspected even when using 3rd party dapps.
            '''
            TxInspector(self._screen, self._scene, self._interface.node,
                        self._interface.config,
                        self._interface._block_callback_watcher,
                        int(chr(event.key_code)))

        else:
            return None
Esempio n. 5
0
 def approve(self, target, amount):
     debug()
     pdb.set_trace()
     fn = self.functions.approve(solf.to_sol_addr(target), int(amount))
Esempio n. 6
0
 def allowance(self, src, target):
     debug()
     pdb.set_trace()
     response = self.functions.allowance(self.to_sol_addr(src),
                                         self.to_sol_addr(target)).call()
     return response