Skip to content

Commit

Permalink
fix: rename EnablesSignModes
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianToledano committed Oct 25, 2024
1 parent f738991 commit 71e7f67
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/v2/offchain/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func Sign(ctx client.Context, rawBytes []byte, fromName, encoding, signMode, out
AddressCodec: ctx.AddressCodec,
Cdc: ctx.Codec,
ValidatorAddressCodec: ctx.ValidatorAddressCodec,
EnablesSignModes: enabledSignModes,
EnabledSignModes: enabledSignModes,
})
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion client/v2/offchain/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func Verify(ctx client.Context, digest []byte, fileFormat string) error {
AddressCodec: ctx.AddressCodec,
Cdc: ctx.Codec,
ValidatorAddressCodec: ctx.ValidatorAddressCodec,
EnablesSignModes: enabledSignModes,
EnabledSignModes: enabledSignModes,
})
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion client/v2/offchain/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func Test_unmarshal(t *testing.T) {
AddressCodec: address.NewBech32Codec("cosmos"),
Cdc: getCodec(),
ValidatorAddressCodec: address.NewBech32Codec("cosmosvaloper"),
EnablesSignModes: enabledSignModes,
EnabledSignModes: enabledSignModes,
})
require.NoError(t, err)
tests := []struct {
Expand Down
10 changes: 5 additions & 5 deletions client/v2/tx/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type ConfigOptions struct {
CustomGetSigner map[protoreflect.FullName]signing.GetSignersFunc
MaxRecursionDepth int

EnablesSignModes []apitxsigning.SignMode
EnabledSignModes []apitxsigning.SignMode
CustomSignModes []signing.SignModeHandler
TextualCoinMetadataQueryFn textual.CoinMetadataQueryFn
}
Expand All @@ -102,8 +102,8 @@ func (c *ConfigOptions) validate() error {
}

// set default signModes if none are provided
if len(c.EnablesSignModes) == 0 {
c.EnablesSignModes = defaultEnabledSignModes
if len(c.EnabledSignModes) == 0 {
c.EnabledSignModes = defaultEnabledSignModes
}
return nil
}
Expand Down Expand Up @@ -308,10 +308,10 @@ func newSigningContext(opts ConfigOptions) (*signing.Context, error) {
// newHandlerMap constructs a new HandlerMap based on the provided ConfigOptions and signing context.
// It initializes handlers for each enabled and custom sign mode specified in the options.
func newHandlerMap(opts ConfigOptions, signingCtx *signing.Context) (*signing.HandlerMap, error) {
lenSignModes := len(opts.EnablesSignModes)
lenSignModes := len(opts.EnabledSignModes)
handlers := make([]signing.SignModeHandler, lenSignModes+len(opts.CustomSignModes))

for i, m := range opts.EnablesSignModes {
for i, m := range opts.EnabledSignModes {
var err error
switch m {
case apitxsigning.SignMode_SIGN_MODE_DIRECT:
Expand Down
4 changes: 2 additions & 2 deletions client/v2/tx/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func Test_newHandlerMap(t *testing.T) {
Decoder: decoder,
Cdc: cdc,
ValidatorAddressCodec: address.NewBech32Codec("cosmosvaloper"),
EnablesSignModes: []apitxsigning.SignMode{apitxsigning.SignMode_SIGN_MODE_DIRECT},
EnabledSignModes: []apitxsigning.SignMode{apitxsigning.SignMode_SIGN_MODE_DIRECT},
},
},
{
Expand All @@ -136,7 +136,7 @@ func Test_newHandlerMap(t *testing.T) {
handlerMap, err := newHandlerMap(tt.opts, signingCtx)
require.NoError(t, err)
require.NotNil(t, handlerMap)
require.Equal(t, len(handlerMap.SupportedModes()), len(tt.opts.EnablesSignModes)+len(tt.opts.CustomSignModes))
require.Equal(t, len(handlerMap.SupportedModes()), len(tt.opts.EnabledSignModes)+len(tt.opts.CustomSignModes))
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/v2/tx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func newFactory(ctx client.Context, flagSet *pflag.FlagSet) (Factory, error) {
AddressCodec: ctx.AddressCodec,
Cdc: ctx.Codec,
ValidatorAddressCodec: ctx.ValidatorAddressCodec,
EnablesSignModes: ctx.TxConfig.SignModeHandler().SupportedModes(),
EnabledSignModes: ctx.TxConfig.SignModeHandler().SupportedModes(),
})
if err != nil {
return Factory{}, err
Expand Down

0 comments on commit 71e7f67

Please sign in to comment.