From b89f5e078025634413020376ea302869a35e33ef Mon Sep 17 00:00:00 2001 From: German Date: Wed, 23 Nov 2022 15:24:37 +0000 Subject: [PATCH] Add output-json check for `instantiate` command (#839) * add output-json check * add CHANGELOG entry --- CHANGELOG.md | 3 +++ crates/cargo-contract/src/cmd/extrinsics/instantiate.rs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66a34871f..0ac64f7bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased +- Fixed having non-JSON output after calling `instantiate` with `--output-json` - [#839](https://github.com/paritytech/cargo-contract/pull/839/files) + ## [2.0.0-beta] - 2022-11-22 This release supports the ink! [`v4.0.0-beta`](https://github.com/paritytech/ink/releases/tag/v4.0.0-beta) release. diff --git a/crates/cargo-contract/src/cmd/extrinsics/instantiate.rs b/crates/cargo-contract/src/cmd/extrinsics/instantiate.rs index b91c035cc..1e8ada9fd 100644 --- a/crates/cargo-contract/src/cmd/extrinsics/instantiate.rs +++ b/crates/cargo-contract/src/cmd/extrinsics/instantiate.rs @@ -430,7 +430,9 @@ impl Exec { let instantiate_result = self.instantiate_dry_run(code).await?; match instantiate_result.result { Ok(_) => { - super::print_gas_required_success(instantiate_result.gas_required); + if !self.output_json { + super::print_gas_required_success(instantiate_result.gas_required); + } // use user specified values where provided, otherwise use the estimates let ref_time = self .args