Test contract instantiate

This commit is contained in:
Andrew Jones
2020-09-14 16:12:48 +01:00
parent 9a8680246e
commit 0e7bc2d2e5
+35 -35
View File
@@ -153,39 +153,39 @@ mod tests {
); );
} }
// #[test] #[async_std::test]
// #[cfg(feature = "integration-tests")] #[cfg(feature = "integration-tests")]
// fn tx_instantiate() { async fn tx_instantiate() {
// env_logger::try_init().ok(); env_logger::try_init().ok();
// let result: Result<_, Error> = async_std::task::block_on(async move { let signer = PairSigner::new(AccountKeyring::Bob.pair());
// let signer = AccountKeyring::Bob.pair(); let client = ClientBuilder::<ContractsTemplateRuntime>::new().build().await.unwrap();
// let client = test_client().await;
// // call put_code extrinsic
// let code_hash = put_code(&client, signer.clone()).await?; let code = contract_wasm();
// let result = client.put_code_and_watch(&signer, &code).await.unwrap();
// log::info!("Code hash: {:?}", code_hash); let code_stored = result.code_stored().unwrap();
// let code_hash = code_stored.unwrap().code_hash;
// let xt = client.xt(signer, None).await?;
// let result = xt log::info!("Code hash: {:?}", code_hash);
// .watch()
// .submit(InstantiateCall { // call instantiate extrinsic
// endowment: 100_000_000_000_000, let result = client
// gas_limit: 500_000_000, .instantiate_and_watch(
// code_hash: &code_hash, &signer,
// data: &[], 100_000_000_000_000, // endowment
// }) 500_000_000, // gas_limit
// .await?; &code_hash,
// let event = result &[], // data
// .find_event::<InstantiatedEvent<_>>()? )
// .ok_or(Error::Other("Failed to find Instantiated event".into()))?; .await
// Ok(event) .unwrap();
// });
// log::info!("Instantiate result: {:?}", result);
// log::info!("Instantiate result: {:?}", result); let event = result.instantiated().unwrap();
//
// assert!( assert!(
// result.is_ok(), event.is_some(),
// format!("Error instantiating contract: {:?}", result) format!("Error instantiating contract: {:?}", result)
// ); );
// } }
} }