Skip to content

Commit

Permalink
add base api to return genesis network
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacky.li committed Nov 14, 2023
1 parent 01dda8d commit 2d8bb38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils/wasm-actor-utils/src/client/api/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::client::types::txn_callback;

use crate::client::api::state;
use crate::enclave::actors::enclave::get_my_tea_id;
use crate::enclave::actors::env::tappstore_id;
use crate::enclave::actors::env::{genesis_network, tappstore_id};
use crate::enclave::actors::util as actor_util;
use prost::Message;
use serde::Deserialize;
Expand Down Expand Up @@ -679,6 +679,7 @@ pub async fn query_system_version(payload: Vec<u8>, from_actor: String) -> Resul
"enclave_version": r.enclave.version,
"enclave_url": r.enclave.url,
"epoch": "alpha 0.1".to_string(),
"tea_network": genesis_network().await?,
});
help::set_query_cache(&cache_key, x.clone()).await?;
help::cache_json_with_uuid(&uuid, x).await?;
Expand Down
5 changes: 5 additions & 0 deletions utils/wasm-actor-utils/src/enclave/actors/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ pub async fn is_mainnet() -> Result<bool> {
Ok(is_mainnet.0)
}

pub async fn genesis_network() -> Result<String> {
let res = ActorId::Static(NAME).call(GetNetworkRequest).await?;
Ok(res.0)
}

#[cfg(feature = "__test")]
#[mockable]
pub async fn tappstore_id() -> Result<TokenId> {
Expand Down

0 comments on commit 2d8bb38

Please sign in to comment.