From d8f668179558f6bd48359293d4fcf882ad56c729 Mon Sep 17 00:00:00 2001 From: Ironman Date: Thu, 21 Dec 2023 13:05:37 +0530 Subject: [PATCH 1/2] adding withName to tx factory --- client/tx/factory.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/tx/factory.go b/client/tx/factory.go index 76829eda7745..b449d20ea970 100644 --- a/client/tx/factory.go +++ b/client/tx/factory.go @@ -132,6 +132,7 @@ func (f Factory) Fees() sdk.Coins { return f.fees } func (f Factory) GasPrices() sdk.DecCoins { return f.gasPrices } func (f Factory) AccountRetriever() client.AccountRetriever { return f.accountRetriever } func (f Factory) TimeoutHeight() uint64 { return f.timeoutHeight } +func (f Factory) FromName() string { return f.fromName } // SimulateAndExecute returns the option to simulate and then execute the transaction // using the gas from the simulation results @@ -189,6 +190,12 @@ func (f Factory) WithKeybase(keybase keyring.Keyring) Factory { return f } +// WithFromName returns a copy of the Factory with updated fromName +func (f Factory) WithFromName(fromName string) Factory { + f.fromName = fromName + return f +} + // WithSequence returns a copy of the Factory with an updated sequence number. func (f Factory) WithSequence(sequence uint64) Factory { f.sequence = sequence From b30c8a5dad6f564d199c95d6f4f14f6bd162ef53 Mon Sep 17 00:00:00 2001 From: Ironman Date: Thu, 21 Dec 2023 15:13:48 +0530 Subject: [PATCH 2/2] update the changelog --- CHANGELOG.md | 1 + client/tx/factory.go | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68df353191e7..943f05034c48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (crypto | x/auth) [#14372](https://github.com/cosmos/cosmos-sdk/pull/18194) Key checks on signatures antehandle. * (staking) [#18506](https://github.com/cosmos/cosmos-sdk/pull/18506) Detect the length of the ed25519 pubkey in CreateValidator to prevent panic. * (tx) [#18772](https://github.com/cosmos/cosmos-sdk/pull/18772) Remove misleading gas wanted from tx simulation failure log. +* (tx) [#18852](https://github.com/cosmos/cosmos-sdk/pull/18852) Add `WithFromName` to tx factory. ### Bug Fixes diff --git a/client/tx/factory.go b/client/tx/factory.go index b449d20ea970..196260f1fad6 100644 --- a/client/tx/factory.go +++ b/client/tx/factory.go @@ -191,6 +191,7 @@ func (f Factory) WithKeybase(keybase keyring.Keyring) Factory { } // WithFromName returns a copy of the Factory with updated fromName +// fromName will be use for building a simulation tx. func (f Factory) WithFromName(fromName string) Factory { f.fromName = fromName return f