コード例 #1
0
    def execute(self, arguments):
        if PromptData.Wallet:
            PromptData.close_wallet()

        path = PromptUtils.get_arg(arguments, 0)

        if not path:
            print("Please specify the required parameter")
            return

        if not os.path.exists(path):
            print("Wallet file not found")
            return

        passwd = prompt("[password]> ", is_password=True)
        password_key = to_aes_key(passwd)

        try:
            PromptData.Wallet = UserWallet.Open(path, password_key)

            PromptData.Prompt.start_wallet_loop()
            print("Opened wallet at %s" % path)
            return PromptData.Wallet
        except Exception as e:
            print("Could not open wallet: %s" % e)
コード例 #2
0
ファイル: Wallet.py プロジェクト: volekerb/neo-python
    def execute(self, arguments):
        if PromptData.Wallet:
            PromptData.close_wallet()

        path = PromptUtils.get_arg(arguments, 0)

        if not path:
            print("Please specify the required parameter")
            return

        if not os.path.exists(path):
            print("Wallet file not found")
            return

        try:
            passwd = prompt("[password]> ", is_password=True)
        except KeyboardInterrupt:
            print("Wallet opening cancelled")
            return
        password_key = to_aes_key(passwd)

        try:
            PromptData.Wallet = UserWallet.Open(path, password_key)
            print("Opened wallet at %s" % path)
            asyncio.create_task(
                PromptData.Wallet.sync_wallet(
                    start_block=PromptData.Wallet._current_height))
            return PromptData.Wallet
        except Exception as e:
            print("Could not open wallet: %s" % e)
コード例 #3
0
ファイル: WalletAddress.py プロジェクト: kartava/neo-python
    def execute(self, arguments):
        addr_to_delete = PromptUtils.get_arg(arguments, 0)

        if not addr_to_delete:
            print("Please specify the required parameter")
            return False

        return DeleteAddress(PromptData.Wallet, addr_to_delete)
コード例 #4
0
ファイル: Wallet.py プロジェクト: volekerb/neo-python
 def execute(self, arguments):
     start_block = PromptUtils.get_arg(arguments, 0, convert_to_int=True)
     if not start_block or start_block < 0:
         start_block = 0
     print(f"Restarting at block {start_block}")
     task = asyncio.create_task(
         PromptData.Wallet.sync_wallet(start_block, rebuild=True))
     return task
コード例 #5
0
    def execute(self, arguments):
        PromptData.Prompt.stop_wallet_loop()

        start_block = PromptUtils.get_arg(arguments, 0, convert_to_int=True)
        if not start_block or start_block < 0:
            start_block = 0
        print(f"Restarting at block {start_block}")

        PromptData.Wallet.Rebuild(start_block)

        PromptData.Prompt.start_wallet_loop()
コード例 #6
0
ファイル: SC.py プロジェクト: ilkericyuz/neo-python
    def execute(self, arguments):
        item = PromptUtils.get_arg(arguments)

        if not item:
            print(f"run `{self.command_desc().command} help` to see supported queries")
            return

        try:
            return self.execute_sub_command(item, arguments[1:])
        except KeyError:
            print(f"{item} is an invalid parameter")
            return
コード例 #7
0
ファイル: Wallet.py プロジェクト: volekerb/neo-python
    def execute(self, arguments):
        path = PromptUtils.get_arg(arguments, 0)

        if not path:
            print("Please specify a path")
            return

        if os.path.exists(path):
            print("File already exists")
            return

        if PromptData.Wallet:
            PromptData.close_wallet()

        try:
            passwd1 = prompt("[password]> ", is_password=True)
            passwd2 = prompt("[password again]> ", is_password=True)
        except KeyboardInterrupt:
            print("Wallet creation cancelled")
            return

        if passwd1 != passwd2 or len(passwd1) < 10:
            print(
                "Please provide matching passwords that are at least 10 characters long"
            )
            return

        password_key = to_aes_key(passwd1)

        try:
            PromptData.Wallet = UserWallet.Create(path=path,
                                                  password=password_key)
            contract = PromptData.Wallet.GetDefaultContract()
            key = PromptData.Wallet.GetKey(contract.PublicKeyHash)
            print("Wallet %s" %
                  json.dumps(PromptData.Wallet.ToJson(), indent=4))
            print("Pubkey %s" % key.PublicKey.encode_point(True))
        except Exception as e:
            print("Exception creating wallet: %s" % e)
            PromptData.Wallet = None
            if os.path.isfile(path):
                try:
                    os.remove(path)
                except Exception as e:
                    print("Could not remove {}: {}".format(path, e))
            return

        if PromptData.Wallet:
            asyncio.create_task(
                PromptData.Wallet.sync_wallet(
                    start_block=PromptData.Wallet._current_height))
            return PromptData.Wallet
コード例 #8
0
ファイル: WalletAddress.py プロジェクト: kartava/neo-python
    def execute(self, arguments):
        wallet = PromptData.Wallet
        item = PromptUtils.get_arg(arguments)

        if not wallet:
            print("Please open a wallet")
            return

        try:
            return self.execute_sub_command(item, arguments[1:])
        except KeyError:
            print(f"{item} is an invalid parameter")
            return
コード例 #9
0
    def execute(self, arguments):
        wallet = PromptData.Wallet
        item = PromptUtils.get_arg(arguments)

        # Create and Open must be handled specially.
        if item in {'create', 'open'}:
            return self.execute_sub_command(item, arguments[1:])

        if not wallet:
            print("Please open a wallet")
            return

        if not item:
            print("Wallet %s " % json.dumps(wallet.ToJson(), indent=4))
            return wallet

        try:
            return self.execute_sub_command(item, arguments[1:])
        except KeyError:
            print(f"{item} is an invalid parameter")
            return
コード例 #10
0
    def execute(self, arguments):
        wallet = PromptData.Wallet
        item = PromptUtils.get_arg(arguments)

        # Create and Open must be handled specially.
        if item in {'create', 'open'}:
            return self.execute_sub_command(item, arguments[1:])

        if not wallet:
            print("Please open a wallet")
            return

        if not item or item == 'verbose':
            wallet.pretty_print(item)
            return wallet

        try:
            return self.execute_sub_command(item, arguments[1:])
        except KeyError:
            print(f"{item} is an invalid parameter")
            return