def main(ctx, config_file, config): """Mine bitcoin and use it to buy and sell digital goods. \b Usage ----- Mine bitcoin, list your balance, and buy a search query without ads. $ {0} mine $ {0} status $ {0} buy search "Satoshi Nakamoto" \b For further details on how you can use your mined bitcoin to buy digital goods both at the command line and programmatically, visit 21.co/learn """ create_wallet_and_account = ctx.invoked_subcommand not in \ ('help', 'update', 'publish', 'sell', 'rate', 'search', 'login') try: cfg = Config(config_file, config, create_wallet=create_wallet_and_account) except DataProviderUnavailableError: raise TwoOneError(UxString.Error.connection_cli) except DataProviderError: raise TwoOneError(UxString.Error.server_err) if create_wallet_and_account: try: check_setup_twentyone_account(cfg) except UnloggedException: sys.exit(1) ctx.obj = dict(config=cfg)
def main(ctx, config_file, config): """Mine bitcoin and use it to buy and sell digital goods. \b Usage ----- Mine bitcoin, list your balance, and buy a search query without ads. $ {0} mine $ {0} status $ {0} buy search "Satoshi Nakamoto" \b For further details on how you can use your mined bitcoin to buy digital goods both at the command line and programmatically, visit 21.co/learn """ create_wallet_and_account = ctx.invoked_subcommand not in \ ('help', 'update', 'publish', 'sell', 'rate', 'search') try: cfg = Config(config_file, config, create_wallet=create_wallet_and_account) except DataProviderUnavailableError as e: raise TwoOneError(UxString.Error.connection_cli) if create_wallet_and_account: check_setup_twentyone_account(cfg) # Disable the auto updater for now. # Todo: This needs to be switched on for the prod channel only. if cfg.auto_update: update_data = update_two1_package(cfg) if update_data["update_successful"]: # TODO: This should exit the CLI and run the same command using the # newly installed software pass ctx.obj = dict(config=cfg)
def main(ctx, config_file, config): """Mine bitcoin and use it to buy and sell digital goods. \b Usage ----- Mine bitcoin, list your balance, and buy a search query without ads. $ {0} mine $ {0} status $ {0} buy search "Satoshi Nakamoto" \b For further details on how you can use your mined bitcoin to buy digital goods both at the command line and programmatically, visit 21.co/learn """ create_wallet_and_account = ctx.invoked_subcommand not in \ ('help', 'update', 'sell', 'login') try: cfg = Config(config_file, config, create_wallet=create_wallet_and_account) except DataProviderUnavailableError: raise TwoOneError(UxString.Error.connection_cli) except DataProviderError: raise TwoOneError(UxString.Error.server_err) if create_wallet_and_account: try: check_setup_twentyone_account(cfg) except UnloggedException: sys.exit(1) ctx.obj = dict(config=cfg)
def create_wallet_and_account(): try: cfg = Config() check_setup_twentyone_account(cfg) except DataProviderUnavailableError: raise TwoOneError(UxString.Error.connection_cli) except DataProviderError: raise TwoOneError(UxString.Error.server_err) except UnloggedException: sys.exit(1)