Skip to content

Commit

Permalink
fix: make PrepareFactory public so chilliass can re-use it
Browse files Browse the repository at this point in the history
  • Loading branch information
kakysha committed Jul 12, 2024
1 parent d7aa99d commit e12052b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,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 (c *chainClient) 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 {
Expand Down Expand Up @@ -703,7 +703,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 := c.prepareFactory(clientCtx, c.txFactory)
txf, err := PrepareFactory(clientCtx, c.txFactory)
if err != nil {
err = errors.Wrap(err, "failed to prepareFactory")
return nil, err
Expand Down Expand Up @@ -785,7 +785,7 @@ func (c *chainClient) buildSignedTx(clientCtx client.Context, txf tx.Factory, ms
c.gasWanted = adjustedGas
}

txf, err := c.prepareFactory(clientCtx, txf)
txf, err := PrepareFactory(clientCtx, txf)
if err != nil {
return nil, errors.Wrap(err, "failed to prepareFactory")
}
Expand Down

0 comments on commit e12052b

Please sign in to comment.