pub struct MockEnv {
pub sent_funds: Vec<Coin>,
/* private fields */
}
Fields§
§sent_funds: Vec<Coin>
Implementations§
source§impl MockEnv
impl MockEnv
sourcepub const MAX_ADDRESS_LEN: usize = 54usize
pub const MAX_ADDRESS_LEN: usize = 54usize
The maximum length that the address is allowed to be.
We want to be consistent with how cosmwasm_std::testing::MockApi
works which is what the ensemble uses internally.
Otherwise if you canonize any addresses longer than that you will
get a cryptic error telling that your address is too long but
not exactly how much longer. This detail is intentionally hidden
in CosmWasm but there is no reason for you not to know in tests,
because if you ran into that error you’d just have to guess anyways…
so we tell you.
sourcepub fn new(sender: impl Into<String>, contract: impl Into<String>) -> Self
pub fn new(sender: impl Into<String>, contract: impl Into<String>) -> Self
Constructs a new instance of MockEnv
.
Arguments
sender
- The address that executes the contract i.einfo.sender
.contract
- The address of the contract to be executed/instantiated i.eenv.contract.address
.
Panics
Panics if either the sender
or contract
arguments are longer than
MockEnv::MAX_ADDRESS_LEN
bytes or have upper case letters.
We do this in order to respect how cosmwasm_std::testing::MockApi
works which
we use internally. This way we avoid any inconsistencies when you set an address that
has upper case letters but then it gets canonicalized and becomes all lower case.
sourcepub fn sent_funds(self, funds: Vec<Coin>) -> Self
pub fn sent_funds(self, funds: Vec<Coin>) -> Self
Any funds that the sender is transferring to the executed contract.
i.e info.funds
.
pub fn sender(&self) -> &str
pub fn contract(&self) -> &str
Trait Implementations§
source§impl<'de> Deserialize<'de> for MockEnv
impl<'de> Deserialize<'de> for MockEnv
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl JsonSchema for MockEnv
impl JsonSchema for MockEnv
source§fn schema_name() -> String
fn schema_name() -> String
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more