Esempio n. 1
0
    def __init__(self):
        setup_logging()
        self.data = {}
        self.args = None
        self.parser = argparse.ArgumentParser(
            description="Next-Generation Colored Coin Client "
            "Command-line interface",
            formatter_class=_ApplicationHelpFormatter)

        self.parser.add_argument("--wallet", dest="wallet_path")
        self.parser.add_argument("--testnet", action="store_true")

        subparsers = self.parser.add_subparsers(
            title='subcommands', dest='command')

        parser = subparsers.add_parser(
            'import_config', description="Import json config.")
        parser.add_argument('path', type=self.validate_import_config_path)

        parser = subparsers.add_parser(
            'setval', description="Sets a value in the configuration.")
        parser.add_argument('key')
        parser.add_argument('value', type=self.validate_JSON_decode)

        parser = subparsers.add_parser(
            'getval', description=
            "Returns the value for a given key in the config.")
        parser.add_argument('key')

        parser = subparsers.add_parser(
            'dump_config', description=
            "Returns a JSON dump of the current configuration.")

        parser = subparsers.add_parser(
            'addasset', description="Imports a color definition.")
        parser.add_argument('moniker')
        parser.add_argument('color_desc')
        parser.add_argument('unit', type=int)

        parser = subparsers.add_parser(
            'issue', description="Starts a new color.")
        parser.add_argument('moniker')
        parser.add_argument('coloring_scheme')
        parser.add_argument('units', type=int)
        parser.add_argument('atoms', type=int)

        parser = subparsers.add_parser(
            'newaddr', description=
            "Creates a new bitcoin address for a given asset/color.")
        parser.add_argument('moniker')

        parser = subparsers.add_parser(
            'alladdresses', description=
            "Lists all addresses for a given asset/color.")
        parser.add_argument('moniker')

        parser = subparsers.add_parser(
            'privatekeys', description=
            "Lists all private keys for a given asset/color.")
        parser.add_argument('moniker')

        parser = subparsers.add_parser(
            'allassets', description="Lists all assets registered.")

        parser = subparsers.add_parser(
            'balance', description=
            "Returns the balance in Satoshi for a particular asset/color.")
        parser.add_argument('moniker')
        parser.add_argument('--unconfirmed', action='store_true')
        parser.add_argument('--available', action='store_true')

        parser = subparsers.add_parser(
            'received_by_address', description=
            "Returns total received amount for each address "
            "of a particular asset/color.")
        parser.add_argument('moniker')

        parser = subparsers.add_parser(
            'coinlog', description=
            "Returns the coin transaction log for this wallet.")

        parser = subparsers.add_parser(
            'send', description=
            "Send some amount of an asset/color to an address.")
        parser.add_argument('moniker')
        parser.add_argument('address')
        parser.add_argument('value')

        parser = subparsers.add_parser(
            'scan', description=
            "Check for received payments (unspent transaction outputs).")

        parser = subparsers.add_parser(
            'full_rescan', description=
            "Rebuild information about unspent outputs and wallet transactions.")

        parser = subparsers.add_parser(
            'history', description="Shows the history of transactions "
            "for a particular asset/color in your wallet.")
        parser.add_argument('moniker')

        parser = subparsers.add_parser(
            'p2p_show_orders', description="Show p2ptrade orders")
        parser.add_argument('moniker')

        parser = subparsers.add_parser(
            'p2p_sell', description="sell via p2ptrade")
        parser.add_argument('moniker')
        parser.add_argument('value')
        parser.add_argument('price')
        parser.add_argument("--wait", dest="trade_wait", type=int)

        parser = subparsers.add_parser(
            'p2p_buy', description="buy via p2ptrade")
        parser.add_argument('moniker')
        parser.add_argument('value')
        parser.add_argument('price')
        parser.add_argument("--wait", dest="trade_wait", type=int)
Esempio n. 2
0
#!/usr/bin/env python

"""
ngccc-gui.py

QT interface to the Next-Generation Colored Coin Client
This command will start a GUI interface.

Note that this requires the install of PyQt4 and SIP.
Neither of those are accessible by pip.
Use this command in ubuntu to install:
   apt-get install python-qtp python-sip
"""

from ngcccbase.logger import setup_logging
import install_https
from ui.qtui import QtUI

def start_ui():
    QtUI()

setup_logging()
start_ui()
Esempio n. 3
0
    def __init__(self):
        setup_logging()
        self.data = {}
        self.args = None
        self.parser = argparse.ArgumentParser(
            description="Next-Generation Colored Coin Client "
            "Command-line interface",
            formatter_class=_ApplicationHelpFormatter)

        self.parser.add_argument("--wallet", dest="wallet_path")
        self.parser.add_argument("--testnet", action="store_true")

        subparsers = self.parser.add_subparsers(title='subcommands',
                                                dest='command')

        parser = subparsers.add_parser('import_config',
                                       description="Import json config.")
        parser.add_argument('path', type=self.validate_import_config_path)

        parser = subparsers.add_parser(
            'setval', description="Sets a value in the configuration.")
        parser.add_argument('key')
        parser.add_argument('value', type=self.validate_JSON_decode)

        parser = subparsers.add_parser(
            'getval',
            description="Returns the value for a given key in the config.")
        parser.add_argument('key')

        parser = subparsers.add_parser(
            'dump_config',
            description="Returns a JSON dump of the current configuration.")

        parser = subparsers.add_parser(
            'addasset', description="Imports a color definition.")
        parser.add_argument('moniker')
        parser.add_argument('color_desc')
        parser.add_argument('unit', type=int)

        parser = subparsers.add_parser('issue',
                                       description="Starts a new color.")
        parser.add_argument('moniker')
        parser.add_argument('coloring_scheme')
        parser.add_argument('units', type=int)
        parser.add_argument('atoms', type=int)

        parser = subparsers.add_parser(
            'newaddr',
            description="Creates a new bitcoin address for a given asset/color."
        )
        parser.add_argument('moniker')

        parser = subparsers.add_parser(
            'alladdresses',
            description="Lists all addresses for a given asset/color.")
        parser.add_argument('moniker')

        parser = subparsers.add_parser(
            'privatekeys',
            description="Lists all private keys for a given asset/color.")
        parser.add_argument('moniker')

        parser = subparsers.add_parser(
            'allassets', description="Lists all assets registered.")

        parser = subparsers.add_parser(
            'balance',
            description=
            "Returns the balance in Satoshi for a particular asset/color.")
        parser.add_argument('moniker')
        parser.add_argument('--unconfirmed', action='store_true')
        parser.add_argument('--available', action='store_true')

        parser = subparsers.add_parser(
            'received_by_address',
            description="Returns total received amount for each address "
            "of a particular asset/color.")
        parser.add_argument('moniker')

        parser = subparsers.add_parser(
            'coinlog',
            description="Returns the coin transaction log for this wallet.")

        parser = subparsers.add_parser(
            'send',
            description="Send some amount of an asset/color to an address.")
        parser.add_argument('moniker')
        parser.add_argument('address')
        parser.add_argument('value')

        parser = subparsers.add_parser(
            'scan',
            description=
            "Check for received payments (unspent transaction outputs).")

        parser = subparsers.add_parser(
            'full_rescan',
            description=
            "Rebuild information about unspent outputs and wallet transactions."
        )

        parser = subparsers.add_parser(
            'history',
            description="Shows the history of transactions "
            "for a particular asset/color in your wallet.")
        parser.add_argument('moniker')

        parser = subparsers.add_parser('p2p_show_orders',
                                       description="Show p2ptrade orders")
        parser.add_argument('moniker')

        parser = subparsers.add_parser('p2p_sell',
                                       description="sell via p2ptrade")
        parser.add_argument('moniker')
        parser.add_argument('value')
        parser.add_argument('price')

        parser = subparsers.add_parser('p2p_buy',
                                       description="buy via p2ptrade")
        parser.add_argument('moniker')
        parser.add_argument('value')
        parser.add_argument('price')