Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix fmt
  • Loading branch information
lean-apple committed Feb 9, 2023
commit 8e74f46f6eb3e74fb664d9fe618ebf63614379ec
23 changes: 13 additions & 10 deletions crates/cargo-contract/src/cmd/extrinsics/instantiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,29 +266,32 @@ impl Exec {
.find_first::<api::contracts::events::CodeStored>()?
.map(|code_stored| code_stored.code_hash);

// //TODO:Rremove the useless part
// //TODO:Remove the useless part
// let instantiated = result
// .find_first::<api::contracts::events::Instantiated>()?
// .ok_or_else(|| anyhow!("Failed to find Instantiated event"))?;


// println!("Test Code Hash Instantiated'{:?}'", instantiated.contract.to_string());

let last_instantiated = result
.iter()
.filter_map(|ev| {
ev.and_then(|ev| ev.as_event::<api::contracts::events::Instantiated>().map_err(Into::into))
.transpose()
ev.and_then(|ev| {
ev.as_event::<api::contracts::events::Instantiated>()
.map_err(Into::into)
})
})
.last()
.transpose()?
.ok_or_else(|| anyhow!("Failed to find Last Instantiated event"))?;

println!("Test Code Hash Last Instantiated'{:?}'", last_instantiated.contract.to_string());
// println!("Test Code Hash Last Instantiated'{:?}'", last_instantiated.contract.to_string());

let token_metadata = TokenMetadata::query(&self.client).await?;
self.display_result(&result, code_hash, last_instantiated.contract, &token_metadata)
.await
self.display_result(
&result,
code_hash,
last_instantiated.contract,
&token_metadata,
)
.await
}

async fn instantiate(
Expand Down