refactor(x/auth): doc and remove deprecated fn from #15822 (#15932)

This commit is contained in:
Matt Kocubinski 2023-04-24 12:38:51 -05:00 committed by GitHub
parent 866cfa4860
commit dde6fcd7bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,13 +29,12 @@ type config struct {
// first enabled sign mode will become the default sign mode.
//
// NOTE: Use NewTxConfigWithHandler to provide a custom signing handler in case the sign mode
// is not supported by default (eg: SignMode_SIGN_MODE_EIP_191). Use NewTxConfigWithTextual
// is not supported by default (eg: SignMode_SIGN_MODE_EIP_191). Use NewTxConfigWithOptions
// to enable SIGN_MODE_TEXTUAL (for testing purposes for now).
//
// We prefer to use depinject to provide client.TxConfig, but we permit this constructor usage. Within the SDK,
// this constructor is primarily used in tests, but also sees usage in app chains like:
// https://github.com/evmos/evmos/blob/719363fbb92ff3ea9649694bd088e4c6fe9c195f/encoding/config.go#L37
// TODO: collapse enabledSignModes and customSignModes
func NewTxConfig(protoCodec codec.ProtoCodecMarshaler, enabledSignModes []signingtypes.SignMode,
customSignModes ...txsigning.SignModeHandler,
) client.TxConfig {
@ -65,7 +64,7 @@ func NewTxConfig(protoCodec codec.ProtoCodecMarshaler, enabledSignModes []signin
Encoder: &aminoJSONEncoder,
}
case signingtypes.SignMode_SIGN_MODE_TEXTUAL:
panic("cannot use NewTxConfig with SIGN_MODE_TEXTUAL enabled; please use NewTxConfigWithTextual")
panic("cannot use NewTxConfig with SIGN_MODE_TEXTUAL enabled; please use NewTxConfigWithOptions")
}
}
@ -78,17 +77,6 @@ func NewTxConfigWithOptions(protoCodec codec.ProtoCodecMarshaler, signModeOption
return NewTxConfigWithHandler(protoCodec, makeSignModeHandler(signModeOptions, customSignModes...))
}
// NewTxConfigWithTextual is like NewTxConfig with the ability to add
// a SIGN_MODE_TEXTUAL renderer. It is currently still EXPERIMENTAL, for should
// be used for TESTING purposes only, until Textual is fully released.
//
// Deprecated: use NewTxConfigWithOptions instead.
func NewTxConfigWithTextual(protoCodec codec.ProtoCodecMarshaler, _ []signingtypes.SignMode,
signModeOptions SignModeOptions, customSignModes ...txsigning.SignModeHandler,
) client.TxConfig {
return NewTxConfigWithOptions(protoCodec, signModeOptions, customSignModes...)
}
// NewTxConfigWithHandler returns a new protobuf TxConfig using the provided ProtoCodec and signing handler.
func NewTxConfigWithHandler(protoCodec codec.ProtoCodecMarshaler, handler *txsigning.HandlerMap) client.TxConfig {
return &config{