From d96b7408db0866373378928b3de83dede6f5b308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Wed, 17 Aug 2022 13:27:53 +0100 Subject: [PATCH] Allowing optional fee for top-level NymdClient (#1541) * Allowing optional fee for top-level NymdClient * Updated changelog * Fixed usages of said methods in validator-api --- CHANGELOG.md | 9 +++++++++ common/client-libs/validator-client/src/nymd/mod.rs | 6 ++++-- validator-api/src/nymd_client.rs | 5 ++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 293737b04e..5f25c11931 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ Post 1.0.0 release, the changelog 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 + +### Changed + +- validator-client: made `fee` argument optional for `execute` and `execute_multiple` ([#1541]) + +[#1541]: https://github.com/nymtech/nym/pull/1541 + + ## [nym-binaries-1.0.2](https://github.com/nymtech/nym/tree/nym-binaries-1.0.2) ### Added diff --git a/common/client-libs/validator-client/src/nymd/mod.rs b/common/client-libs/validator-client/src/nymd/mod.rs index a279324ff8..2e714f3c38 100644 --- a/common/client-libs/validator-client/src/nymd/mod.rs +++ b/common/client-libs/validator-client/src/nymd/mod.rs @@ -893,7 +893,7 @@ impl NymdClient { &self, contract_address: &AccountId, msg: &M, - fee: Fee, + fee: Option, memo: impl Into + Send + 'static, funds: Vec, ) -> Result @@ -901,6 +901,7 @@ impl NymdClient { C: SigningCosmWasmClient + Sync, M: ?Sized + Serialize + Sync, { + let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); self.client .execute(self.address(), contract_address, msg, fee, memo, funds) .await @@ -910,7 +911,7 @@ impl NymdClient { &self, contract_address: &AccountId, msgs: I, - fee: Fee, + fee: Option, memo: impl Into + Send + 'static, ) -> Result where @@ -918,6 +919,7 @@ impl NymdClient { I: IntoIterator)> + Send, M: Serialize, { + let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); self.client .execute_multiple(self.address(), contract_address, msgs, fee, memo) .await diff --git a/validator-api/src/nymd_client.rs b/validator-api/src/nymd_client.rs index 38eed11f45..eedaebe547 100644 --- a/validator-api/src/nymd_client.rs +++ b/validator-api/src/nymd_client.rs @@ -364,15 +364,14 @@ impl Client { let memo = "Performing epoch operations".to_string(); - self.execute_multiple_with_retry(msgs, Default::default(), memo) - .await?; + self.execute_multiple_with_retry(msgs, None, memo).await?; Ok(()) } async fn execute_multiple_with_retry( &self, msgs: Vec<(M, Vec)>, - fee: Fee, + fee: Option, memo: String, ) -> Result<(), RewardingError> where