@@ -34,16 +34,17 @@ def get_latest_info():
3434 if response .status_code == 200 :
3535 data = response .json ()
3636 block_height = int (data ['tipInfo' ]['metadata' ]['best_block_height' ])
37- currentShaHashRate = int (data ['currentShaHashRate' ])
38- currentMoneroHashRate = int (data ['currentMoneroHashRate' ])
39- return block_height , currentShaHashRate , currentMoneroHashRate
37+ currentShaHashRate = int (str (data ['currentSha3xHashRate' ]).replace (',' , '' ))
38+ currentMoneroHashRate = int (str (data ['currentMoneroRandomxHashRate' ]).replace (',' , '' ))
39+ currentTariRXHashRate = int (str (data ['currentTariRandomxHashRate' ]).replace (',' , '' ))
40+ return block_height , currentShaHashRate , currentMoneroHashRate ,currentTariRXHashRate
4041 else :
4142 raise Exception (f"Failed to fetch data: { response .status_code } " )
4243
4344async def post_block_height (client ):
4445 try :
4546 # Fetch the block height stats
46- block_height , x ,y = get_latest_info ()
47+ block_height , x ,y , z = get_latest_info ()
4748
4849 # List of sample questions
4950 questions = [
@@ -93,18 +94,20 @@ def schedule_block_height_job(client, loop):
9394async def post_hash_power (client ):
9495 try :
9596 # Fetch block height and hash rates
96- block_height , current_sha_hash_rate , current_rx_hash_rate = get_latest_info ()
97+ block_height , current_sha_hash_rate , current_rxm_hash_rate , current_rxt_hash_rate = get_latest_info ()
9798
9899 # Format the hash rates with appropriate units
99100 formatted_sha_hash_rate = format_hash_rate (current_sha_hash_rate )
100- formatted_rx_hash_rate = format_hash_rate (current_rx_hash_rate )
101+ formatted_rxm_hash_rate = format_hash_rate (current_rxm_hash_rate )
102+ formatted_rxt_hash_rate = format_hash_rate (current_rxt_hash_rate )
101103
102104 # Create the hash power stats message
103105 hash_power_stats = (
104106 f"📊 Current Tari Network Stats 📊\n "
105107 f"Block Height: { block_height :,} \n "
106- f"SHA3 Hash Rate: { formatted_sha_hash_rate } \n "
107- f"RandomX Hash Rate: { formatted_rx_hash_rate } \n \n "
108+ f"RandomX (Tari) Hash Rate: { formatted_rxt_hash_rate } \n "
109+ f"RandomX (Merged-Mined XMR) Hash Rate: { formatted_rxm_hash_rate } \n "
110+ f"SHA3x Hash Rate: { formatted_sha_hash_rate } \n \n "
108111 f"Want to learn more? Try '/faq mining' to get information about mining Tari."
109112 )
110113
@@ -139,4 +142,16 @@ def schedule_hash_power_job(client, loop):
139142 logging .info ("Scheduler started for hash power job" )
140143
141144
145+ if __name__ == "__main__" :
146+ # test post hash power function
147+ # call and prin the result
148+ block_height , current_sha_hash_rate , current_rxm_hash_rate , current_rxt_hash_rate = get_latest_info ()
149+ formatted_sha_hash_rate = format_hash_rate (current_sha_hash_rate )
150+ formatted_rxm_hash_rate = format_hash_rate (current_rxm_hash_rate )
151+ formatted_rxt_hash_rate = format_hash_rate (current_rxt_hash_rate )
152+ print (f"Block Height: { block_height :,} " )
153+ print (f"RandomX (Tari) Hash Rate: { formatted_rxt_hash_rate } " )
154+ print (f"RandomX (Merged-Mined XMR) Hash Rate: { formatted_rxm_hash_rate } " )
155+ print (f"SHA3x Hash Rate: { formatted_sha_hash_rate } " )
156+
142157
0 commit comments