def show_wallet(self, arguments): if not self.Wallet: print("Please open a wallet") return item = get_arg(arguments) if not item: print("Wallet %s " % json.dumps(self.Wallet.ToJson(), indent=4)) return if item in ['v', '--v', 'verbose']: print("Wallet %s " % json.dumps(self.Wallet.ToJson(verbose=True), indent=4)) return elif item == 'migrate' and self.Wallet is not None: self.Wallet.Migrate() print("Migrated wallet") elif item == 'delete_addr': addr_to_delete = get_arg(arguments, 1) DeleteAddress(self, self.Wallet, addr_to_delete) elif item == 'delete_token': token_to_delete = get_arg(arguments, 1) DeleteToken(self.Wallet, token_to_delete) elif item == 'close': self.do_close_wallet() elif item == 'claim': ClaimGas(self.Wallet, True, arguments[1:]) elif item == 'rebuild': self.Wallet.Rebuild() try: item2 = int(get_arg(arguments, 1)) if item2 and item2 > 0: print("Restarting at %s" % item2) self.Wallet._current_height = item2 except Exception as e: pass elif item == 'tkn_send': token_send(self.Wallet, arguments[1:]) elif item == 'tkn_send_from': token_send_from(self.Wallet, arguments[1:]) elif item == 'tkn_send_blog': token_send_blog(self.Wallet, arguments[1:]) elif item == 'tkn_approve': token_approve_allowance(self.Wallet, arguments[1:]) elif item == 'tkn_allowance': token_get_allowance(self.Wallet, arguments[1:], verbose=True) elif item == 'tkn_mint': token_mint(self.Wallet, arguments[1:]) elif item == 'tkn_register': token_crowdsale_register(self.Wallet, arguments[1:]) elif item == 'unspent': ShowUnspentCoins(self.Wallet, arguments[1:]) elif item == 'alias': if len(arguments) == 3: AddAlias(self.Wallet, arguments[1], arguments[2]) else: print("Please supply an address and title") else: print("Wallet: '{}' is an invalid parameter".format(item))
def show_wallet(self, arguments): if not self.Wallet: print("please open a wallet") return item = get_arg(arguments) if not item: print("Wallet %s " % json.dumps(self.Wallet.ToJson(), indent=4)) return if item in ['v', '--v', 'verbose']: print("Wallet %s " % json.dumps(self.Wallet.ToJson(verbose=True), indent=4)) return elif item == 'migrate' and self.Wallet is not None: self.Wallet.Migrate() print("migrated wallet") elif item == 'delete_addr': addr_to_delete = get_arg(arguments, 1) DeleteAddress(self, self.Wallet, addr_to_delete) elif item == 'delete_token': token_to_delete = get_arg(arguments, 1) DeleteToken(self.Wallet, token_to_delete) elif item == 'close': self.do_close_wallet() elif item == 'claim': ClaimGas(self.Wallet) elif item == 'rebuild': self.Wallet.Rebuild() # self._walletdb_loop = task.LoopingCall(self.Wallet.ProcessBlocks) # self._walletdb_loop.start(1) try: item2 = int(get_arg(arguments, 1)) if item2 and item2 > 0: print('restarting at %s ' % item2) self.Wallet._current_height = item2 except Exception as e: pass elif item == 'tkn_send': token_send(self.Wallet, arguments[1:]) elif item == 'tkn_send_from': token_send_from(self.Wallet, arguments[1:]) elif item == 'tkn_approve': token_approve_allowance(self.Wallet, arguments[1:]) elif item == 'tkn_allowance': token_get_allowance(self.Wallet, arguments[1:], verbose=True) elif item == 'tkn_mint': token_mint(self.Wallet, arguments[1:]) elif item == 'tkn_register': token_crowdsale_register(self.Wallet, arguments[1:]) elif item == 'alias': if len(arguments) == 3: AddAlias(self.Wallet, arguments[1], arguments[2]) else: print("Please supply an address and title")
def show_wallet(self, arguments): if not self.Wallet: print("please open a wallet") return item = get_arg(arguments) if not item: print("Wallet %s " % json.dumps(self.Wallet.ToJson(), indent=4)) return if item in ['v', '--v', 'verbose']: print("Wallet %s " % json.dumps(self.Wallet.ToJson(verbose=True), indent=4)) return elif item == 'migrate' and self.Wallet is not None: self.Wallet.Migrate() print("migrated wallet") elif item == 'delete_addr': addr_to_delete = get_arg(arguments, 1) DeleteAddress(self, self.Wallet, addr_to_delete) elif item == 'delete_token': token_to_delete = get_arg(arguments, 1) DeleteToken(self.Wallet, token_to_delete) elif item == 'close': self.do_close_wallet() elif item == 'claim': ClaimGas(self.Wallet) elif item == 'rebuild': self.Wallet.Rebuild() try: item2 = int(get_arg(arguments, 1)) if item2 and item2 > 0: print('restarting at %s ' % item2) self.Wallet._current_height = item2 except Exception as e: pass elif item == 'tkn_send': token_send(self.Wallet, arguments[1:]) elif item == 'tkn_send_from': token_send_from(self.Wallet, arguments[1:]) elif item == 'tkn_approve': token_approve_allowance(self.Wallet, arguments[1:]) elif item == 'tkn_allowance': token_get_allowance(self.Wallet, arguments[1:], verbose=True)
def show_wallet(self, arguments): if not self.Wallet: print("Please open a wallet") return item = get_arg(arguments) if not item: print("Wallet %s " % json.dumps(self.Wallet.ToJson(), indent=4)) return if item in ['v', '--v', 'verbose']: print("Wallet %s " % json.dumps(self.Wallet.ToJson(verbose=True), indent=4)) return elif item == 'migrate' and self.Wallet is not None: self.Wallet.Migrate() print("Migrated wallet") elif item == 'delete_addr': addr_to_delete = get_arg(arguments, 1) DeleteAddress(self, self.Wallet, addr_to_delete) elif item == 'delete_token': token_to_delete = get_arg(arguments, 1) DeleteToken(self.Wallet, token_to_delete) elif item == 'close': self.do_close_wallet() elif item == 'claim': ClaimGas(self.Wallet, True, arguments[1:]) elif item == 'rebuild': self.Wallet.Rebuild() try: item2 = int(get_arg(arguments, 1)) item2 = Blockchain.Default().Height if item2 and item2 > 0: print("Restarting at %s" % item2) self.Wallet._current_height = item2 #TODO - NeoCompiler.io syncing process - BEGINS print( "Waiting, at least, 30 seconds, for wallet to sync and rebuild..." ) #time.sleep(30) timenow = time.time() timebase = time.time() while (timenow - timebase < 30): timenow = time.time() walletheight = self.Wallet._current_height blockchainheight = max(Blockchain.Default().HeaderHeight, Blockchain.Default().Height) while (walletheight < blockchainheight): walletheight = self.Wallet._current_height blockchainheight = max(Blockchain.Default().HeaderHeight, Blockchain.Default().Height) #TODO - NeoCompiler.io syncing process - ENDS except Exception as e: print("Problems happened when rebuilding %s" % e) pass elif item == 'tkn_send': token_send(self.Wallet, arguments[1:]) elif item == 'tkn_send_from': token_send_from(self.Wallet, arguments[1:]) elif item == 'tkn_approve': token_approve_allowance(self.Wallet, arguments[1:]) elif item == 'tkn_allowance': token_get_allowance(self.Wallet, arguments[1:], verbose=True) elif item == 'tkn_mint': token_mint(self.Wallet, arguments[1:]) elif item == 'tkn_register': token_crowdsale_register(self.Wallet, arguments[1:]) elif item == 'unspent': ShowUnspentCoins(self.Wallet, arguments[1:]) elif item == 'alias': if len(arguments) == 3: AddAlias(self.Wallet, arguments[1], arguments[2]) else: print("Please supply an address and title") else: print("Wallet: '{}' is an invalid parameter".format(item))