Skip to content

Expose Response from contract in cw-multi-test execute #763

@kaimen-sano

Description

@kaimen-sano

Currently when a contract uses app.execute_contract in cw-multi-test, there is no way to get the resulting Response returned by the contract. cw-multi-test parses the responding messages and only returns the events and data from the result of the execution.

This is the relevant code that needs to be exposed somehow:

let res = self.call_execute(
api,
storage,
contract_addr.clone(),
router,
block,
info,
msg.to_vec(),
)?;

Currently process_response will lose the reference to the Response, as can be seen here:

// recurse in all messages
let data = messages.into_iter().try_fold(data, |data, resend| {
let subres =
self.execute_submsg(api, router, storage, block, contract.clone(), resend)?;
events.extend_from_slice(&subres.events);
Ok::<_, anyhow::Error>(subres.data.or(data))
})?;

It is beneficial to expose the Response returned by the executing function as it allows developers to test the SubMsgs (currently not testable) and attributes that is returned by the execute function in an easier manner than parsing the events vec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions