From a9ea38cfc1e53865d9deec58c8e26f4de46a43fe Mon Sep 17 00:00:00 2001 From: kakysha Date: Wed, 20 Mar 2024 01:48:07 +0200 Subject: [PATCH] refactorL make PrepareFactory client method public needed to sdk clients that use own tx factory and want to initialize it --- client/chain/chain.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/chain/chain.go b/client/chain/chain.go index 00566a26..04fabbb8 100644 --- a/client/chain/chain.go +++ b/client/chain/chain.go @@ -419,11 +419,11 @@ func (c *chainClient) syncTimeoutHeight() { } } -// prepareFactory ensures the account defined by ctx.GetFromAddress() exists and +// PrepareFactory ensures the account defined by ctx.GetFromAddress() exists and // if the account number and/or the account sequence number are zero (not set), // they will be queried for and set on the provided Factory. A new Factory with // the updated fields will be returned. -func prepareFactory(clientCtx client.Context, txf tx.Factory) (tx.Factory, error) { +func PrepareFactory(clientCtx client.Context, txf tx.Factory) (tx.Factory, error) { from := clientCtx.GetFromAddress() if err := txf.AccountRetriever().EnsureExists(clientCtx, from); err != nil { @@ -633,7 +633,7 @@ func (c *chainClient) GetFeeDiscountInfo(ctx context.Context, account string) (* func (c *chainClient) SimulateMsg(clientCtx client.Context, msgs ...sdk.Msg) (*txtypes.SimulateResponse, error) { c.txFactory = c.txFactory.WithSequence(c.accSeq) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) - txf, err := prepareFactory(clientCtx, c.txFactory) + txf, err := PrepareFactory(clientCtx, c.txFactory) if err != nil { err = errors.Wrap(err, "failed to prepareFactory") return nil, err @@ -710,7 +710,7 @@ func (c *chainClient) buildSignedTx(clientCtx client.Context, txf tx.Factory, ms c.gasWanted = adjustedGas } - txf, err := prepareFactory(clientCtx, txf) + txf, err := PrepareFactory(clientCtx, txf) if err != nil { return nil, errors.Wrap(err, "failed to prepareFactory") }