def execute(self, client, params, **kwargs): try: sn = client.get_sequence_number(params[1]) json_print_in_cmd({"sequence": sn}) except AccountError: print( f"Failed to get sequence number: No account exists at {params[1]}" )
def execute(self, client, params, **kwargs): wfile = params[2] wallet = WalletLibrary.recover(wfile) sender_account = wallet.get_account_by_address_or_refid(params[1]) fresh_address = wallet.new_account().address client.create_account(sender_account, fresh_address) wallet.write_recovery(wfile) json_print_in_cmd({"new_account_address": fresh_address})
def execute(self, client, params, **kwargs): wallet = WalletLibrary.recover(params[1]) arr = [] for index, account in enumerate(wallet.accounts): amap = to_json_serializable(account) amap["index"] = index arr.append(amap) json_print_in_cmd(arr)
def execute(self, client, params, **kwargs): is_blocking = blocking_cmd(params[0]) wallet = WalletLibrary.recover(params[4]) account = wallet.get_account_by_address_or_refid(params[1]) resp = client.transfer_coin(account, params[2], Uint64.int_safe(params[3]), is_blocking=is_blocking) json_print_in_cmd(resp)
def execute(self, client, params, **kwargs): if len(params) < 4: include_events = True else: include_events = parse_bool(params[3]) sn = client.get_transactions(Uint64.int_safe(params[1]), Uint64.int_safe(params[2]), include_events) json_print_in_cmd([x.to_json_serializable() for x in sn])
def execute(self, client, params, **kwargs): client = self.get_real_client(client, **kwargs) start_time = client.get_transaction(1).transaction.timestamp_usecs latest_time = client.get_metadata().timestamp start_time = datetime.fromtimestamp(start_time / 1000_000) latest_time = datetime.fromtimestamp(latest_time / 1000_000) json_print_in_cmd( { "start_time": start_time.strftime("%Y-%m-%dT%H:%M:%S"), "latest_time": latest_time.strftime("%Y-%m-%dT%H:%M:%S") }, sort_keys=False)
def execute(self, client, params, **kwargs): wallet = WalletLibrary.recover(params[1]) maps = {} for account in wallet.accounts: try: maps[account.address_hex] = client.get_balance( account.address_hex) # TODO: multi query combine to one except AccountError: maps[account.address_hex] = 0 maps["total_balance"] = sum(maps.values()) json_print_in_cmd(maps)
def execute(self, client, params, **kwargs): wallet = WalletLibrary.recover(params[3]) account = wallet.get_account_by_address_or_refid(params[1]) client.rotate_authentication_key(account, params[2]) index, _account = wallet.find_account_by_publickey_hex(params[2]) wallet.rotate_key(params[1], index) wallet.write_recovery(params[3]) # TODO: Exec Transaction throw major_status: 2, after rotate key. # account_resource = client.get_account_resource(account.address) # key = account_resource.to_json_serializable()["authentication_key"] json_print_in_cmd({ "address": account.address_hex, "authentication_key": params[2] })
def execute(self, client, params, **kwargs): ver = client.get_latest_transaction_version() tx = client.get_transaction(ver) json_print_in_cmd(tx)
def execute(self, client, params, **kwargs): wallet = WalletLibrary.recover(params[1]) json_print_in_cmd(wallet)
def execute(self, client, params, **kwargs): tx = client.get_latest_transaction_version() json_print_in_cmd({"latest_version": tx})
def execute(self, client, params, **kwargs): json_print_in_cmd(AccountConfig.all_config(), sort_keys=False)
def execute(self, client, params, **kwargs): tx = client.get_transaction(int(params[1])) json_print_in_cmd(tx)
def execute(self, client, params, **kwargs): try: balance = client.get_balance(params[1]) json_print_in_cmd({"balance": balance}) except AccountError: print(f"Failed to get balance: No account exists at {params[1]}")
def execute(self, client, params, **kwargs): is_blocking = blocking_cmd(params[0]) resp = client.mint_coins(params[1], Uint64.int_safe(params[2]), is_blocking) json_print_in_cmd({"sequence_number": resp})
def execute(self, client, params, **kwargs): client = self.get_real_client(client, **kwargs) info = client.get_latest_ledger_info() json_print_in_cmd(info.to_json_serializable())
def execute(self, client, params, **kwargs): state = client.get_account_state(params[1]) json_print_in_cmd(state)
def execute(self, client, params, **kwargs): wallet = WalletLibrary.new() wallet.write_recovery(params[1]) jobj = to_json_serializable(wallet) jobj["file_save_to"] = params[1] json_print_in_cmd(jobj)
def execute(self, client, params, **kwargs): include_events = parse_bool(params[3]) seq = Uint64.int_safe(params[2]) transaction = client.get_account_transaction(params[1], seq, include_events) json_print_in_cmd(transaction)