Skip to content

Commit

Permalink
Parse instantiate reponse data using parse reply helper
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolacy committed Oct 27, 2021
1 parent 71daa7e commit 2922cfe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/multi-test/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::transactions::transactional;
use cosmwasm_std::testing::mock_wasmd_attr;

use anyhow::{anyhow, bail, Result as AnyResult};
use cw0::parse_instantiate_response_data;

// Contract state is kept in Storage, separate from the contracts themselves
const CONTRACTS: Map<&Addr, ContractData> = Map::new("contracts");
Expand Down Expand Up @@ -856,11 +857,11 @@ pub fn parse_contract_addr(data: &Option<Binary>) -> AnyResult<Addr> {
.ok_or_else(|| anyhow!("No data response"))?
.to_vec();
// parse the protobuf struct
let init_data = InstantiateData::decode(bin.as_slice())?;
if init_data.address.is_empty() {
let init_data = parse_instantiate_response_data(bin.as_slice())?;
if init_data.contract_address.is_empty() {
bail!("no contract address provided");
}
Ok(Addr::unchecked(init_data.address))
Ok(Addr::unchecked(init_data.contract_address))
}

#[cfg(test)]
Expand Down

0 comments on commit 2922cfe

Please sign in to comment.