pub struct Contract<Chain: BootEnvironment> {
pub id: String,
/* private fields */
}
Expand description
An instance of a contract. Contains references to the execution environment (chain) and a local state (state) The state is used to store contract addresses/code-ids
Fields
id: String
ID of the contract, used to retrieve addr/code-id
Implementations
sourceimpl<Chain: BootEnvironment + Clone> Contract<Chain>
impl<Chain: BootEnvironment + Clone> Contract<Chain>
Expose chain and state function to call them on the contract
pub fn new(id: impl ToString, chain: &Chain) -> Self
sourcepub fn get_chain(&self) -> Chain
pub fn get_chain(&self) -> Chain
get_chain
instead of chain
to disambiguate from the std prelude .chain() method.
pub fn with_wasm_path(self, path: impl ToString) -> Self
pub fn with_mock(
self,
mock_contract: Box<dyn TestContract<Empty, Empty>>
) -> Self
sourcepub fn with_address(self, address: Option<&Addr>) -> Self
pub fn with_address(self, address: Option<&Addr>) -> Self
Sets the address of the contract in the local state
pub fn execute<E: Serialize + Debug>(
&self,
msg: &E,
coins: Option<&[Coin]>
) -> Result<TxResponse<Chain>, BootError>
pub fn instantiate<I: Serialize + Debug>(
&self,
msg: &I,
admin: Option<&Addr>,
coins: Option<&[Coin]>
) -> Result<TxResponse<Chain>, BootError>
pub fn upload(&mut self) -> Result<TxResponse<Chain>, BootError>
pub fn query<Q: Serialize + Debug, T: Serialize + DeserializeOwned>(
&self,
query_msg: &Q
) -> Result<T, BootError>
pub fn migrate<M: Serialize + Debug>(
&self,
migrate_msg: &M,
new_code_id: u64
) -> Result<TxResponse<Chain>, BootError>
pub fn address(&self) -> Result<Addr, BootError>
pub fn code_id(&self) -> Result<u64, BootError>
pub fn set_address(&self, address: &Addr)
pub fn set_code_id(&self, code_id: u64)
Auto Trait Implementations
impl<Chain> !RefUnwindSafe for Contract<Chain>
impl<Chain> !Send for Contract<Chain>
impl<Chain> !Sync for Contract<Chain>
impl<Chain> Unpin for Contract<Chain>where
Chain: Unpin,
impl<Chain> !UnwindSafe for Contract<Chain>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request