cosmwasm: Error: post failed: Post "http://MY_IP:26657": EOF

my code:

pub fn execute_batch_publish_message(
    _deps: DepsMut,
    env: Env,
    _info: MessageInfo,
    messages: Vec<Message>,
    enc_pub_keys: Vec<PubKey>,
) -> Result<Response, ContractError> {
    assert!(messages.len() == enc_pub_keys.len());

    let mut msgs = vec![];
    for i in 0..messages.len() {
        let publish_message = ExecuteMsg::PublishMessage {
            message: messages[i].clone(),
            enc_pub_key: enc_pub_keys[i].clone(),
        };

        let msg = WasmMsg::Execute {
            contract_addr: env.contract.address.to_string(),
            msg: to_binary(&publish_message)?,
            funds: vec![],
        };
        msgs.push(msg);
    }

    Ok(Response::new()
        .add_messages(msgs)
        .add_attribute("action", "batch_publish_message"))
}

I need to batch execute a method, but I’m getting this error when calling it.

my command: image

log:

Error: post failed: Post "http://MY_IP:26657": EOF

About this issue

  • Original URL
  • State: open
  • Created 10 months ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Yeah, with signAndBroadcast you can create a transaction with multiple messages. This is the same that executeMultiple does under the hood. You’d just change the MsgExecuteContracts to MsgInstantiateContracts.