def method(casperlabs_client: CasperLabsClient, args: Dict): kwargs = dict( account_public_key_hashes=_add_to_list(args.get("account_hash")), deploy_hashes=_add_to_list(args.get("deploy_hash")), ) for key in ( "all", "block_added", "block_finalized", "deploy_added", "deploy_discarded", "deploy_requeued", "deploy_processed", "deploy_finalized", "deploy_orphaned", "min_event_id", "max_event_id", ): kwargs[key] = args.get(key) stream = casperlabs_client.stream_events(**kwargs) output_format = args.get("format") for event in stream: if output_format == "binary": print(base64.b64encode(event.SerializeToString()).decode()) elif output_format == "json": print(reformat.jsonify(event)) else: print(reformat.hexify(event))
def method(casperlabs_client: CasperLabsClient, args: Dict): deploy_hash = casperlabs_client.deploy( from_addr=args.get("from"), private_key=args.get("private_key"), algorithm=args.get("algorithm"), payment=args.get("payment"), payment_args=args.get("payment_args"), payment_amount=args.get("payment_amount"), payment_hash=args.get("payment_hash"), payment_name=args.get("payment_name"), payment_package_hash=args.get("payment_package_hash"), payment_package_name=args.get("payment_package_name"), payment_entry_point=args.get("payment_entry_point"), payment_version=args.get("payment_version"), session=args.get("session"), session_args=args.get("session_args"), session_hash=args.get("session_hash"), session_name=args.get("session_name"), session_package_hash=args.get("session_package_hash"), session_package_name=args.get("session_package_name"), session_entry_point=args.get("session_entry_point"), session_version=args.get("session_version"), ttl_millis=args.get("ttl_millis"), dependencies=args.get("dependencies"), chain_name=args.get("chain_name"), ) print(f"Success! Deploy {deploy_hash} deployed") if args.get("wait_for_processed", False): deploy_info = casperlabs_client.show_deploy( deploy_hash, full_view=False, wait_for_processed=True, timeout_seconds=args.get("timeout_seconds", consts.STATUS_TIMEOUT), ) print(reformat.hexify(deploy_info))
def method(casperlabs_client: CasperLabsClient, args: Dict): response = casperlabs_client.show_deploy( args.get("hash"), full_view=False, wait_for_processed=args.get("wait_for_processed", False), timeout_seconds=args.get("timeout_seconds", consts.STATUS_TIMEOUT), ) print(reformat.hexify(response))
def method(casperlabs_client: CasperLabsClient, _: Dict): peers = casperlabs_client.show_peers() i = 0 for i, node in enumerate(peers, 1): print(f"------------- node {i} ---------------") print(reformat.hexify(node)) print("-----------------------------------------------------") print(f"count: {i}")
def method(casperlabs_client: CasperLabsClient, args: dict): deploy_hash = casperlabs_client.transfer( amount=args.get("amount"), target_account=args.get("target_account"), target_purse=args.get("target_purse"), source_purse=args.get("source_purse"), from_addr=args.get("from_addr"), private_key=args.get("private_key"), ttl_millis=args.get("ttl_millis"), dependencies=args.get("dependencies"), chain_name=args.get("chain_name"), ) print(f"Success! Deploy {deploy_hash} deployed") if args.get("wait_for_processed", False): deploy_info = casperlabs_client.showDeploy( deploy_hash, full_view=False, wait_for_processed=True, timeout_seconds=args.get("timeout_seconds", consts.STATUS_TIMEOUT), ) print(reformat.hexify(deploy_info))
def print_block(block): print(hexify(block))
def method(casperlabs_client: CasperLabsClient, args: Dict): response = casperlabs_client.query_state( args.get("block_hash"), args.get("key"), args.get("path", ""), args.get("type") ) print(reformat.hexify(response))