Skip to content

Commit

Permalink
fix(go/client): set gas prices option from flag
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Mar 11, 2024
1 parent cf6181f commit 68dce07
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions go/node/client/types/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ func NewTxFactory(cctx client.Context, opts ...ClientOption) (tx.Factory, error)
WithFees(clOpts.Fees)

if !cctx.Offline {
from := cctx.GetFromAddress()
address := cctx.GetFromAddress()

if err := txf.AccountRetriever().EnsureExists(cctx, from); err != nil {
if err := txf.AccountRetriever().EnsureExists(cctx, address); err != nil {
return txf, err
}

if txf.AccountNumber() == 0 || txf.Sequence() == 0 {
num, seq, err := txf.AccountRetriever().GetAccountNumberSequence(cctx, from)
num, seq, err := txf.AccountRetriever().GetAccountNumberSequence(cctx, address)
if err != nil {
return txf, err
}
Expand Down Expand Up @@ -151,10 +151,8 @@ func ClientOptionsFromFlags(flagSet *pflag.FlagSet) ([]ClientOption, error) {
opts = append(opts, WithAccountSequence(accSeq))
}

// if flagSet.Changed(flags.FlagGasAdjustment) {
gasAdj, _ := flagSet.GetFloat64(flags.FlagGasAdjustment)
opts = append(opts, WithGasAdjustment(gasAdj))
// }

if flagSet.Changed(flags.FlagNote) {
memo, _ := flagSet.GetString(flags.FlagNote)
Expand All @@ -166,16 +164,15 @@ func ClientOptionsFromFlags(flagSet *pflag.FlagSet) ([]ClientOption, error) {
opts = append(opts, WithTimeoutHeight(timeoutHeight))
}

// if flagSet.Changed(flags.FlagGas) {
gasStr, _ := flagSet.GetString(flags.FlagGas)
gasSetting, _ := flags.ParseGasSetting(gasStr)
opts = append(opts, WithGas(gasSetting))
// }

// if flagSet.Changed(flags.FlagFees) {
feesStr, _ := flagSet.GetString(flags.FlagFees)
opts = append(opts, WithFees(feesStr))
// }

gasPrices, _ := flagSet.GetString(flags.FlagGasPrices)
opts = append(opts, WithGasPrices(gasPrices))

return opts, nil
}

0 comments on commit 68dce07

Please sign in to comment.