fix(x/auth): properly populate tx config options and deprecate ProtoCodecMarshaler (backport #17946) (#17952)
This commit is contained in:
@@ -289,10 +289,10 @@ func (f Factory) WithExtensionOptions(extOpts ...*codectypes.Any) Factory {
|
||||
func (f Factory) BuildUnsignedTx(msgs ...sdk.Msg) (client.TxBuilder, error) {
|
||||
if f.offline && f.generateOnly {
|
||||
if f.chainID != "" {
|
||||
return nil, fmt.Errorf("chain ID cannot be used when offline and generate-only flags are set")
|
||||
return nil, errors.New("chain ID cannot be used when offline and generate-only flags are set")
|
||||
}
|
||||
} else if f.chainID == "" {
|
||||
return nil, fmt.Errorf("chain ID required but not specified")
|
||||
return nil, errors.New("chain ID required but not specified")
|
||||
}
|
||||
|
||||
fees := f.fees
|
||||
@@ -370,7 +370,12 @@ func (f Factory) PrintUnsignedTx(clientCtx client.Context, msgs ...sdk.Msg) erro
|
||||
return err
|
||||
}
|
||||
|
||||
json, err := clientCtx.TxConfig.TxJSONEncoder()(unsignedTx.GetTx())
|
||||
encoder := f.txConfig.TxJSONEncoder()
|
||||
if encoder == nil {
|
||||
return errors.New("cannot print unsigned tx: tx json encoder is nil")
|
||||
}
|
||||
|
||||
json, err := encoder(unsignedTx.GetTx())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+6
-1
@@ -100,7 +100,12 @@ func BroadcastTx(clientCtx client.Context, txf Factory, msgs ...sdk.Msg) error {
|
||||
}
|
||||
|
||||
if !clientCtx.SkipConfirm {
|
||||
txBytes, err := clientCtx.TxConfig.TxJSONEncoder()(tx.GetTx())
|
||||
encoder := txf.txConfig.TxJSONEncoder()
|
||||
if encoder == nil {
|
||||
return errors.New("failed to encode transaction: tx json encoder is nil")
|
||||
}
|
||||
|
||||
txBytes, err := encoder(tx.GetTx())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user