From e847bc36a8d937486fe66aca05d826720ed64bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wo=C5=BAniak?= Date: Thu, 3 Oct 2024 11:24:42 +0200 Subject: [PATCH] chore: Add doc comments and use `&str` in `update_admin` --- sylvia/src/types.rs | 8 ++++++-- sylvia/tests/remote.rs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sylvia/src/types.rs b/sylvia/src/types.rs index 86499000..b3999c6e 100644 --- a/sylvia/src/types.rs +++ b/sylvia/src/types.rs @@ -1,4 +1,5 @@ //! Module providing utilities to build and use sylvia contracts. + use cosmwasm_std::{Binary, Coin, Deps, DepsMut, Empty, Env, MessageInfo, WasmMsg}; #[cfg(feature = "sv_replies")] use cosmwasm_std::{Event, MsgResponse}; @@ -431,17 +432,20 @@ impl<'a, Contract: ?Sized> Remote<'a, Contract> { } } + /// Creates a new instance of [ExecutorBuilder] from underlying contract address. pub fn executor(&self) -> ExecutorBuilder<(EmptyExecutorBuilderState, Contract)> { ExecutorBuilder::<(EmptyExecutorBuilderState, Contract)>::new(&self.addr) } - pub fn update_admin(&self, new_admin: String) -> WasmMsg { + /// Creates a new instance of [WasmMsg::UpdateAdmin] from underlying contract address and provided admin address. + pub fn update_admin(&self, new_admin: &str) -> WasmMsg { WasmMsg::UpdateAdmin { contract_addr: self.addr.to_string(), - admin: new_admin, + admin: new_admin.to_string(), } } + /// Creates a new instance of [WasmMsg::ClearAdmin] from underlying contract address. pub fn clear_admin(&self) -> WasmMsg { WasmMsg::ClearAdmin { contract_addr: self.addr.to_string(), diff --git a/sylvia/tests/remote.rs b/sylvia/tests/remote.rs index ad47995c..a5821488 100644 --- a/sylvia/tests/remote.rs +++ b/sylvia/tests/remote.rs @@ -268,7 +268,7 @@ pub mod manager { .remote_counter .load(ctx.deps.storage)? .interface_remote - .update_admin(new_admin); + .update_admin(&new_admin); let resp = Response::new().add_message(wasm); Ok(resp) }