def _add_sendtx_parser(subparsers): parser = subparsers.add_parser( 'sendtx', help='Request icx_sendTransaction with user input json file', description='Request icx_sendTransaction with user input json file' ) parser.add_argument( 'json_file', type=IconPath(), help='File path containing icx_sendTransaction content') parser.add_argument( '-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument('-k', '--key-store', type=IconPath(), help='Keystore file path. Used to generate "from"' 'address and transaction signature', dest='keyStore') parser.add_argument( '-c', '--config', type=IconPath(), help= f'Configuration file path. This file defines the default value for ' f'the "uri" (default: {FN_CLI_CONF})') parser.add_argument('-p', '--password', help='keystore file\'s password', dest='password')
def _add_call_parser(subparsers): parser = subparsers.add_parser('call', help='Request icx_call with the specified json file.', description='Request icx_call with the specified json file.') parser.add_argument('json_file', type=IconPath(), help='File path containing icx_call content') parser.add_argument('-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument('-c', '--config', type=IconPath(), help=f'Configuration file path. This file defines the default value for ' f'"uri" (default: {FN_CLI_CONF})')
def _add_transfer_parser(subparsers): parser = subparsers.add_parser('transfer', help='Transfer ICX coin.', description='Transfer ICX coin.') parser.add_argument('-f', '--from', type=IconAddress(), help='From address.') parser.add_argument('to', type=IconAddress(), help='Recipient') parser.add_argument("value", type=loop, help='Amount of ICX coin in loop to transfer (1 icx = 1e18 loop)') parser.add_argument('-k', '--key-store', type=IconPath(), dest='keyStore', help='Keystore file path. Used to generate "from" address and transaction signature') parser.add_argument('-n', '--nid', help='Network ID (default: 0x3)') parser.add_argument('-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument('-p', '--password', help='Keystore file\'s password', dest='password') parser.add_argument('-s', '--step-limit', dest='stepLimit', type=non_negative_num_type, help='Step limit') parser.add_argument('-c', '--config', type=IconPath(), help=f'Configuration file path. This file defines the default values for ' f'"keyStore", "uri", "from" and "stepLimit". (default: {FN_CLI_CONF})')
def _add_deploy_parser(subparsers): parser = subparsers.add_parser('deploy', help='Deploy the SCORE', description='Deploy the SCORE') # IconPath's 'd' argument means directory parser.add_argument('project', type=IconPath('d'), help='Project name') parser.add_argument( '-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument('-t', '--type', choices=['tbears', 'zip'], dest='contentType', help='Deploy SCORE type (default: tbears)') parser.add_argument('-m', '--mode', choices=['install', 'update'], help='Deploy mode (default: install)') # --from option only accept eoa address('hx') parser.add_argument('-f', '--from', type=IconAddress('hx'), help='From address. i.e. SCORE owner address') # --to option is used only when update score, so eoa address('hx') need to be denied parser.add_argument('-o', '--to', type=IconAddress('cx'), help='To address. i.e. SCORE address') # IconPath's 'r' argument means 'read file' parser.add_argument( '-k', '--key-store', type=IconPath('r'), dest='keyStore', help= 'Keystore file path. Used to generate "from" address and transaction signature' ) parser.add_argument('-n', '--nid', help='Network ID') parser.add_argument( '-c', '--config', type=IconPath(), help=f'deploy config path (default: {FN_CLI_CONF})') parser.add_argument('-p', '--password', help='keystore file\'s password', dest='password')
def _add_start_parser(subparsers) -> None: parser = subparsers.add_parser('start', help='Start tbears service', description='Start tbears service') parser.add_argument('-a', '--address', type=ip_address, help='Address to host on (default: 0.0.0.0)', dest='hostAddress') parser.add_argument('-p', '--port', type=port_type, help='Port to host on (default: 9000)') parser.add_argument('-c', '--config', type=IconPath(), help=f'tbears configuration file path (default: {FN_SERVER_CONF})')
def _add_keystore_parser(subparsers): parser = subparsers.add_parser('keystore', help='Create a keystore file in the specified path', description='Create keystore file in the specified path. Generate privatekey, ' 'publickey pair.') parser.add_argument('path', type=IconPath('w'), help='Path of keystore file.') parser.add_argument('-p', '--password', help='Keystore file\'s password', dest='password')
def _add_block_parser(subparsers): parser = subparsers.add_parser( 'block', help="Get block info using given argument." "Only one of `number` and `hash` arguments can be passed.") parser.add_argument( '-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument('-i', '--id', dest='hash', type=hash_type, help='Hash of the block to be queried.') parser.add_argument('-n', '--number', dest='number', type=non_negative_num_type, help='Height of the block to be queried.') parser.add_argument( '-c', '--config', type=IconPath(), help= f'Configuration file path. This file defines the default value for ' f'"uri" (default: {FN_CLI_CONF}). This command returns the block as it was stored.' )
def _add_totalsupply_parser(subparsers): parser = subparsers.add_parser('totalsupply', help='Query total supply of ICX in loop unit', description='Query total supply of ICX in loop unit') parser.add_argument('-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument('-c', '--config', type=IconPath(), help=f'Configuration file path. This file defines the default value for ' f'"uri" (default: {FN_CLI_CONF})')
def _add_txbyhash_parser(subparsers): parser = subparsers.add_parser('txbyhash', help='Get transaction by transaction hash', description='Get transaction by transaction hash') parser.add_argument('hash', type=hash_type, help='Hash of the transaction to be queried.') parser.add_argument('-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument('-c', '--config', type=IconPath(), help=f'Configuration file path. This file defines the default value for ' f'"uri" (default: {FN_CLI_CONF})')
def _add_sendtx_parser(subparsers): parser = subparsers.add_parser('sendtx', help='Request icx_sendTransaction with the specified json file and ' 'keystore file. If keystore file is not given, tbears sends a ' 'request as it is in the json file.', description='Request icx_sendTransaction with the specified json file and ' 'keystore file. If keystore file is not given, tbears sends a ' 'request as it is in the json file.') parser.add_argument('json_file', type=IconPath(), help='File path containing icx_sendTransaction content') parser.add_argument('-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument('-n', '--nid', help='Network ID (default: 0x3)') parser.add_argument('-k', '--key-store', dest='keyStore', type=IconPath(), help='Keystore file path. Used to generate "from" address and transaction signature') parser.add_argument('-p', '--password', help='Keystore file\'s password', dest='password') parser.add_argument('-s', '--step-limit', dest='stepLimit', type=non_negative_num_type, help='Step limit') parser.add_argument('-c', '--config', type=IconPath(), help=f'Configuration file path. This file defines the default values for ' f'"keyStore", "uri", "from" and "stepLimit". (default: {FN_CLI_CONF})')
def _add_test_parser(subparsers): parser = subparsers.add_parser( 'test', help='Run the unittest in the project', description='Run the unittest in the project') parser.add_argument('project', type=IconPath('d'), help='Project directory path')
def _add_init_parser(subparsers) -> None: parser = subparsers.add_parser('init', help='Initialize tbears project', description='Initialize SCORE development environment.\n' 'Generate <project>.py, package.json and test code in <project>' ' directory. ' 'The name of the score class is <scoreClass>.') parser.add_argument('project', type=IconPath('w'), help='Project name') parser.add_argument('score_class', help='SCORE class name', metavar='scoreClass')
def _add_blockbyheight_parser(subparsers): parser = subparsers.add_parser('blockbyheight', help='Get block info using given block height', description='Get block info using given block height') parser.add_argument('height', type=non_negative_num_type, help='height of the block to be queried.') parser.add_argument('-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument('-c', '--config', type=IconPath(), help=f'Configuration file path. This file defines the default value for ' f'"uri" (default: {FN_CLI_CONF}). This command returns the block in v0.1a format')
def _add_balance_parser(subparsers): parser = subparsers.add_parser('balance', help='Get balance of given address in loop unit', description='Get balance of given address in loop unit') parser.add_argument('address', type=IconAddress(), help='Address to query the ICX balance') parser.add_argument('-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument('-c', '--config', type=IconPath(), help=f'Configuration file path. This file defines the default value for ' f'"uri" (default: {FN_CLI_CONF})')
def _add_keyinfo_parser(subparsers): parser = subparsers.add_parser('keyinfo', help='Show a keystore information in the specified path', description="Show a keystore information(address, privateKey, publicKey) " "in the specified path. If you want to get privateKey, " "input --private-key option" ) parser.add_argument('path', type=IconPath(), help='Path of keystore file.') parser.add_argument('-p', '--password', help='Keystore file\'s password', dest='password') parser.add_argument('--private-key', help='option that whether show privateKey', action='store_true', dest='privateKey')
def _add_keystore_parser(subparsers): parser = subparsers.add_parser( 'keystore', help='Create keystore file in passed path.', description= 'Create keystore file in passed path. Generate privatekey, ' 'publickey pair using secp256k1 library.') parser.add_argument('path', type=IconPath('w'), help='path of keystore file.') parser.add_argument('-p', '--password', help='keystore file\'s password', dest='password')
def _add_lastblock_parser(subparsers): parser = subparsers.add_parser('lastblock', help='Get last block\'s info', description='Get last block\'s info') parser.add_argument( '-u', '--node-uri', dest='uri', help='URI of node (default: http://127.0.0.1:9000/api/v3)') parser.add_argument( '-c', '--config', type=IconPath(), help= f'Configuration file path. This file defines the default value for ' f'the "uri" (default: {FN_CLI_CONF})')