pub struct ContractInstance<'a> {
pub deployment: &'a Deployment,
pub name: &'a str,
pub sender: Wallet<'a>,
/* private fields */
}
Fields§
§deployment: &'a Deployment
§name: &'a str
§sender: Wallet<'a>
Implementations§
Source§impl<'a> ContractInstance<'a>
impl<'a> ContractInstance<'a>
pub fn new( name: &'a str, sender: Wallet<'a>, deployment: &'a Deployment, ) -> Result<Self>
Sourcepub fn overwrite_code_id_key(&mut self, code_id_key_to_use: &'static str)
pub fn overwrite_code_id_key(&mut self, code_id_key_to_use: &'static str)
Used to overwrite the code-id getter key. Useful when you want shared code between multiple contract instances Example: Two CW20 tokens that use the same code-id but have a different name. see
pub async fn execute<E: Serialize>( &self, exec_msg: &E, coins: &[Coin], ) -> Result<CosmTxResponse, CosmScriptError>
pub async fn instantiate<I: Serialize>( &self, init_msg: I, admin: Option<String>, coins: &[Coin], ) -> Result<CosmTxResponse, CosmScriptError>
pub async fn query<Q: Serialize, T: Serialize + DeserializeOwned>( &self, query_msg: Q, ) -> Result<T, CosmScriptError>
Sourcepub async fn upload(
&self,
path: &str,
) -> Result<CosmTxResponse, CosmScriptError>
pub async fn upload( &self, path: &str, ) -> Result<CosmTxResponse, CosmScriptError>
Uploads given .wasm file and stores resulting code-id in contract store. path can be either a full/relative path. (indicated by the .wasm) or just a regular name. In the second case the WASM_DIR env var will be read and the path will be costructed to be WASM_DIR/path.wasm
pub async fn migrate<M: Serialize>( &self, _migrate_msg: M, _new_code_id: u64, ) -> Result<CosmTxResponse, CosmScriptError>
pub fn get_address(&self) -> Result<String, CosmScriptError>
Sourcepub async fn get_code_id(&self) -> Result<u64, CosmScriptError>
pub async fn get_code_id(&self) -> Result<u64, CosmScriptError>
get the on-chain contract code-id
pub fn save_code_id(&self, code_id: u64) -> Result<(), CosmScriptError>
pub fn save_contract_address( &self, contract_address: &str, ) -> Result<(), CosmScriptError>
pub async fn is_local_version(&self) -> Result<bool>
Auto Trait Implementations§
impl<'a> Freeze for ContractInstance<'a>
impl<'a> !RefUnwindSafe for ContractInstance<'a>
impl<'a> !Send for ContractInstance<'a>
impl<'a> !Sync for ContractInstance<'a>
impl<'a> Unpin for ContractInstance<'a>
impl<'a> !UnwindSafe for ContractInstance<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request