-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into release-notes-ui
- Loading branch information
Showing
29 changed files
with
856 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"binaries": { | ||
"xmrig": "=6.22.0", | ||
"mmproxy": "=1.8.0-pre.0", | ||
"minotari_node": "=1.8.0-pre.0", | ||
"wallet": "=1.8.0-pre.0", | ||
"sha-p2pool": "=0.8.0", | ||
"xtrgpuminer": "=0.1.17", | ||
"mmproxy": "=1.9.0-pre.0", | ||
"minotari_node": "=1.9.0-pre.0", | ||
"wallet": "=1.9.0-pre.0", | ||
"sha-p2pool": "=0.9.0", | ||
"xtrgpuminer": "=0.1.22", | ||
"tor": "=13.5.7" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"binaries": { | ||
"xmrig": "=6.22.0", | ||
"mmproxy": "=1.8.0-rc.0", | ||
"minotari_node": "=1.8.0-rc.0", | ||
"wallet": "=1.8.0-rc.0", | ||
"sha-p2pool": "=0.8.0", | ||
"xtrgpuminer": "=0.1.17", | ||
"mmproxy": "=1.9.0-rc.0", | ||
"minotari_node": "=1.9.0-rc.0", | ||
"wallet": "=1.9.0-rc.0", | ||
"sha-p2pool": "=0.9.0", | ||
"xtrgpuminer": "=0.1.22", | ||
"tor": "=13.5.7" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
use serde::Deserialize; | ||
use std::fmt::Write as _; | ||
use tari_common::configuration::Network; | ||
|
||
fn get_text_explore_blocks_url(network: Network, block_height: u64) -> String { | ||
match network { | ||
Network::StageNet => format!( | ||
"https://textexplore-stagenet.tari.com/blocks/{}?json", | ||
block_height | ||
), | ||
Network::NextNet => format!( | ||
"https://textexplore-nextnet.tari.com/blocks/{}?json", | ||
block_height | ||
), | ||
Network::Esmeralda => format!( | ||
"https://textexplore-esmeralda.tari.com/blocks/{}?json", | ||
block_height | ||
), | ||
_ => format!( | ||
"https://textexplore-esmeralda.tari.com/blocks/{}?json", | ||
block_height | ||
), | ||
} | ||
} | ||
|
||
fn get_text_explore_url(network: Network) -> String { | ||
match network { | ||
Network::StageNet => "https://textexplore-stagenet.tari.com/?json".to_string(), | ||
Network::NextNet => "https://textexplore-nextnet.tari.com/?json".to_string(), | ||
Network::Esmeralda => "https://textexplore-esmeralda.tari.com/?json".to_string(), | ||
_ => "https://textexplore-esmeralda.tari.com/?json".to_string(), | ||
} | ||
} | ||
|
||
pub(crate) async fn get_best_block_from_block_scan(network: Network) -> Result<u64, anyhow::Error> { | ||
#[derive(Deserialize)] | ||
struct BlockScanResponse { | ||
#[serde(rename = "tipInfo")] | ||
tip_info: TipInfo, | ||
} | ||
|
||
#[derive(Deserialize)] | ||
struct TipInfo { | ||
metadata: Metadata, | ||
} | ||
|
||
#[derive(Deserialize)] | ||
struct Metadata { | ||
best_block_height: String, | ||
} | ||
|
||
let response = reqwest::get(&get_text_explore_url(network)) | ||
.await? | ||
.json::<BlockScanResponse>() | ||
.await?; | ||
|
||
let best_block_height = response | ||
.tip_info | ||
.metadata | ||
.best_block_height | ||
.parse::<u64>()?; | ||
|
||
Ok(best_block_height) | ||
} | ||
|
||
pub(crate) async fn get_block_info_from_block_scan( | ||
network: Network, | ||
block_height: &u64, | ||
) -> Result<(u64, String), anyhow::Error> { | ||
#[derive(Deserialize)] | ||
struct BlockHeader { | ||
hash: HashData, | ||
height: String, | ||
} | ||
|
||
#[derive(Deserialize)] | ||
struct HashData { | ||
data: Vec<u8>, | ||
} | ||
|
||
#[derive(Deserialize)] | ||
struct BlockResponse { | ||
header: BlockHeader, | ||
} | ||
|
||
let response = reqwest::get(&get_text_explore_blocks_url(network, *block_height)) | ||
.await? | ||
.json::<BlockResponse>() | ||
.await?; | ||
|
||
let hash = response | ||
.header | ||
.hash | ||
.data | ||
.iter() | ||
.fold(String::new(), |mut acc, x| { | ||
write!(acc, "{:02x}", x).expect("Unable to write"); | ||
acc | ||
}); | ||
let height = response.header.height.parse::<u64>()?; | ||
|
||
Ok((height, hash)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.