def mine(player): header = { "Authorization": f"Token {API_KEY}", "Content-Type": "application/json", } response = dreamy.get( f"{URL}/api/bc/last_proof/", headers=header) last_bl = response["proof"] new_proof = proof_of_work(last_bl) data = {"proof": new_proof} response = dreamy.post( f"{URL}/api/bc/mine/", headers=header, data=data) print(response)
def balance(self): balance_header = { "Authorization": f"Token {API_KEY}", "Content-Type": "application/json", } response = dreamy.get(f"{URL}/api/bc/get_balance/", headers=balance_header, cooldown=self.cooldown) self.cooldown = response["cooldown"] time.sleep(self.cooldown) self.status_update() return response
def mine(player): header = { "Authorization": f"Token {API_KEY}", "Content-Type": "application/json", } response = dreamy.get(f"{URL}/api/bc/last_proof/", headers=header) last_bl = response["proof"] difficulty = response["difficulty"] new_proof = proof_of_work(last_bl, difficulty) data = {"proof": new_proof} print(f"Submitting proof: {new_proof}") response = dreamy.post(f"{URL}/api/bc/mine/", headers=header, data=data) # print(response) time.sleep(response["cooldown"]) return response
def init_player(self): header = { "Authorization": f"Token {API_KEY}", "Content-Type": "application/json", } response = dreamy.get(f"{URL}/api/adv/init/", headers=header) self.current_room = response["room_id"] self.room_items = response["items"] self.room_exits = response["exits"] self.errors = response["errors"] self.messages = response["messages"] self.cooldown = response["cooldown"] time.sleep(self.cooldown) return response
def mine(player): print( f"\n⛏️ MINING for a LambdaCoin...", end="", flush=True) header = { "Authorization": f"Token {API_KEY}", "Content-Type": "application/json", } response = dreamy.get( f"{URL}/api/bc/last_proof/", headers=header) last_bl = response["proof"] difficulty = response["difficulty"] new_proof = proof_of_work(last_bl, difficulty) data = {"proof": new_proof} response = dreamy.post( f"{URL}/api/bc/mine/", headers=header, data=data) status_message(response) # print(response) time.sleep(response["cooldown"]) return response