Update scripts
This commit is contained in:
parent
4a916357a6
commit
c58ec93f08
2 changed files with 1 additions and 50 deletions
|
@ -41,10 +41,9 @@ echo ""
|
|||
echo "🚀 Instantiating contract with the following parameters:"
|
||||
echo "--------------------------------------------------------"
|
||||
echo "Label: ${LABEL}"
|
||||
echo "Count: ${COUNT}"
|
||||
echo "--------------------------------------------------------"
|
||||
|
||||
wasmd tx wasm instantiate "$CODE_ID" "{\"count\":${COUNT}}" --from "$USER_ADDR" --label $LABEL $TXFLAG -y --no-admin 2>&1 > /dev/null
|
||||
wasmd tx wasm instantiate "$CODE_ID" "null" --from "$USER_ADDR" --label $LABEL $TXFLAG -y --no-admin 2>&1 > /dev/null
|
||||
|
||||
echo ""
|
||||
echo "🕐 Waiting for contract to be queryable..."
|
||||
|
@ -57,4 +56,3 @@ echo "🆔 Code ID: ${CODE_ID}"
|
|||
echo "📌 Contract Address: ${CONTRACT}"
|
||||
echo "🔑 Contract Key: ${KEY}"
|
||||
echo "🔖 Contract Label: ${LABEL}"
|
||||
echo "🏷️ Count: ${COUNT}"
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use cosmwasm_std::{
|
||||
to_json_binary, Addr, CosmosMsg, CustomQuery, Querier, QuerierWrapper, StdResult, WasmMsg,
|
||||
WasmQuery,
|
||||
};
|
||||
|
||||
use crate::msg::{ExecuteMsg, GetCountResponse, QueryMsg};
|
||||
|
||||
/// CwTemplateContract is a wrapper around Addr that provides a lot of helpers
|
||||
/// for working with this.
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
|
||||
pub struct CwTemplateContract(pub Addr);
|
||||
|
||||
impl CwTemplateContract {
|
||||
pub fn addr(&self) -> Addr {
|
||||
self.0.clone()
|
||||
}
|
||||
|
||||
pub fn call<T: Into<ExecuteMsg>>(&self, msg: T) -> StdResult<CosmosMsg> {
|
||||
let msg = to_json_binary(&msg.into())?;
|
||||
Ok(WasmMsg::Execute {
|
||||
contract_addr: self.addr().into(),
|
||||
msg,
|
||||
funds: vec![],
|
||||
}
|
||||
.into())
|
||||
}
|
||||
|
||||
/// Get Count
|
||||
pub fn count<Q, T, CQ>(&self, querier: &Q) -> StdResult<GetCountResponse>
|
||||
where
|
||||
Q: Querier,
|
||||
T: Into<String>,
|
||||
CQ: CustomQuery,
|
||||
{
|
||||
let msg = QueryMsg::GetCount {};
|
||||
let query = WasmQuery::Smart {
|
||||
contract_addr: self.addr().into(),
|
||||
msg: to_json_binary(&msg)?,
|
||||
}
|
||||
.into();
|
||||
let res: GetCountResponse = QuerierWrapper::<CQ>::new(querier).query(&query)?;
|
||||
Ok(res)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue