Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ae1505bd1 | |||
| a18a38eb6e |
@@ -82,6 +82,7 @@ jobs:
|
||||
target/release/nym-cli
|
||||
target/release/nymvisor
|
||||
target/release/nym-node
|
||||
target/release/foomp
|
||||
retention-days: 30
|
||||
|
||||
# If this was a pull_request or nightly, upload to build server
|
||||
@@ -100,6 +101,7 @@ jobs:
|
||||
cp target/release/nym-node $OUTPUT_DIR
|
||||
cp target/release/nym-cli $OUTPUT_DIR
|
||||
cp target/release/explorer-api $OUTPUT_DIR
|
||||
cp target/release/foomp $OUTPUT_DIR
|
||||
if [ ${{ github.event_name == 'workflow_dispatch' && inputs.enable_deb == true }} = true ]; then
|
||||
cp target/debian/*.deb $OUTPUT_DIR
|
||||
fi
|
||||
|
||||
Generated
+14
-3
@@ -234,9 +234,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.95"
|
||||
version = "1.0.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
|
||||
checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f"
|
||||
|
||||
[[package]]
|
||||
name = "arbitrary"
|
||||
@@ -2597,6 +2597,16 @@ version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "foomp"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"nym-http-api-client",
|
||||
"nym-validator-client",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.2.1"
|
||||
@@ -5118,6 +5128,7 @@ dependencies = [
|
||||
name = "nym-client-core"
|
||||
version = "1.1.15"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"base64 0.22.1",
|
||||
"bs58",
|
||||
@@ -5767,7 +5778,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strum 0.26.3",
|
||||
"subtle 2.6.1",
|
||||
"subtle 2.5.0",
|
||||
"thiserror 2.0.11",
|
||||
"time",
|
||||
"tokio",
|
||||
|
||||
+3
-2
@@ -100,7 +100,7 @@ members = [
|
||||
"documentation/autodoc",
|
||||
"explorer-api",
|
||||
"explorer-api/explorer-api-requests",
|
||||
"explorer-api/explorer-client",
|
||||
"explorer-api/explorer-client", "foomp",
|
||||
"gateway",
|
||||
"integrations/bity",
|
||||
"nym-api",
|
||||
@@ -151,6 +151,7 @@ members = [
|
||||
]
|
||||
|
||||
default-members = [
|
||||
"foomp",
|
||||
"clients/native",
|
||||
"clients/socks5",
|
||||
"explorer-api",
|
||||
@@ -446,4 +447,4 @@ dbg_macro = "deny"
|
||||
exit = "deny"
|
||||
panic = "deny"
|
||||
unimplemented = "deny"
|
||||
unreachable = "deny"
|
||||
unreachable = "deny"
|
||||
|
||||
@@ -118,6 +118,8 @@ features = ["wasm-bindgen"]
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = { workspace = true }
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
anyhow = "1.0.96"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@@ -171,3 +171,33 @@ impl TopologyProvider for NymApiTopologyProvider {
|
||||
Some(topology)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn foomp() -> anyhow::Result<()> {
|
||||
let provider = NymApiTopologyProvider::new(
|
||||
Config {
|
||||
min_mixnode_performance: 0,
|
||||
min_gateway_performance: 0,
|
||||
use_extended_topology: false,
|
||||
ignore_egress_epoch_role: false,
|
||||
},
|
||||
vec!["https://validator.nymtech.net/api/".parse()?],
|
||||
None,
|
||||
);
|
||||
|
||||
let a = provider
|
||||
.validator_client
|
||||
.get_current_rewarded_set()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
println!("{a:#?}");
|
||||
|
||||
panic!("");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -871,19 +871,20 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
println!("response:\n{res:#?}");
|
||||
|
||||
if res.status().is_success() {
|
||||
let text = res.text().await?;
|
||||
println!("response text:\n{}", text);
|
||||
// internally reqwest is first retrieving bytes and then performing parsing via serde_json
|
||||
// (and similarly does the same thing for text())
|
||||
let full = res.bytes().await?;
|
||||
match serde_json::from_slice(&full) {
|
||||
// let full = res.bytes().await?;
|
||||
match serde_json::from_str(&text) {
|
||||
Ok(data) => Ok(data),
|
||||
Err(err) => {
|
||||
let text = String::from_utf8_lossy(&full);
|
||||
Err(HttpClientError::ResponseDecodeFailure {
|
||||
source: err,
|
||||
content: text.into_owned(),
|
||||
})
|
||||
}
|
||||
Err(err) => Err(HttpClientError::ResponseDecodeFailure {
|
||||
source: err,
|
||||
content: text.clone(),
|
||||
}),
|
||||
}
|
||||
} else if res.status() == StatusCode::NOT_FOUND {
|
||||
Err(HttpClientError::NotFound)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
[package]
|
||||
name = "foomp"
|
||||
version = "0.1.0"
|
||||
authors.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
readme.workspace = true
|
||||
|
||||
[dependencies]
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
anyhow.workspace = true
|
||||
nym-http-api-client = { path = "../common/http-api-client" }
|
||||
nym-validator-client = { path = "../common/client-libs/validator-client", features = ["http-client"] }
|
||||
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,15 @@
|
||||
use nym_http_api_client::{ApiClient, Client};
|
||||
use nym_validator_client::nym_api::NymApiClientExt;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let url = "https://validator.nymtech.net/api/";
|
||||
|
||||
let client = Client::new(url.parse()?, None);
|
||||
|
||||
let res = client.get_rewarded_set().await;
|
||||
println!("{:?}", res);
|
||||
println!("Hello, world!");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user