Skip to content

Commit

Permalink
feat: add is mainnet request
Browse files Browse the repository at this point in the history
  • Loading branch information
raindust committed Nov 12, 2023
1 parent d607096 commit 74079c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions system-actors/src/env/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,12 @@ pub struct GetActorVersionsRequest;
#[doc(hidden)]
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct GetActorVersionsResponse(pub HashMap<String, String>);

#[doc(hidden)]
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct IsMainNetRequest;

#[doc(hidden)]
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct IsMainNetResponse(pub bool);
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 @@ -80,6 +80,11 @@ pub async fn usdt_id() -> Result<TokenId> {
Ok(TokenId::from_hex(usdt_id.0)?)
}

pub async fn is_mainnet() -> Result<bool> {
let is_mainnet = ActorId::Static(NAME).call(IsMainNetRequest).await?;
Ok(is_mainnet.0)
}

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

0 comments on commit 74079c5

Please sign in to comment.