diff --git a/CHANGELOG.md b/CHANGELOG.md index fc1f43ebb41d..53f12dd4bda0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (cli) [#13064](https://github.com/cosmos/cosmos-sdk/pull/13064) Add `debug prefixes` to list supported HRP prefixes via . * (cli) [#12742](https://github.com/cosmos/cosmos-sdk/pull/12742) Add the `prune` CLI cmd to manually prune app store history versions based on the pruning options. * (ledger) [#12935](https://github.com/cosmos/cosmos-sdk/pull/12935) Generalize Ledger integration to allow for different apps or keytypes that use SECP256k1. +* (x/bank) [#11981](https://github.com/cosmos/cosmos-sdk/pull/11981) Create the `SetSendEnabled` endpoint for managing the bank's SendEnabled settings. ### Improvements diff --git a/api/cosmos/bank/v1beta1/tx.pulsar.go b/api/cosmos/bank/v1beta1/tx.pulsar.go index 4acdbe2f6c62..24183be65d90 100644 --- a/api/cosmos/bank/v1beta1/tx.pulsar.go +++ b/api/cosmos/bank/v1beta1/tx.pulsar.go @@ -2837,6 +2837,1044 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } +var _ protoreflect.List = (*_MsgSetSendEnabled_2_list)(nil) + +type _MsgSetSendEnabled_2_list struct { + list *[]*SendEnabled +} + +func (x *_MsgSetSendEnabled_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgSetSendEnabled_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgSetSendEnabled_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*SendEnabled) + (*x.list)[i] = concreteValue +} + +func (x *_MsgSetSendEnabled_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*SendEnabled) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgSetSendEnabled_2_list) AppendMutable() protoreflect.Value { + v := new(SendEnabled) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgSetSendEnabled_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgSetSendEnabled_2_list) NewElement() protoreflect.Value { + v := new(SendEnabled) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgSetSendEnabled_2_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_MsgSetSendEnabled_3_list)(nil) + +type _MsgSetSendEnabled_3_list struct { + list *[]string +} + +func (x *_MsgSetSendEnabled_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgSetSendEnabled_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_MsgSetSendEnabled_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_MsgSetSendEnabled_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgSetSendEnabled_3_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message MsgSetSendEnabled at list field UseDefaultFor as it is not of Message kind")) +} + +func (x *_MsgSetSendEnabled_3_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_MsgSetSendEnabled_3_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_MsgSetSendEnabled_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgSetSendEnabled protoreflect.MessageDescriptor + fd_MsgSetSendEnabled_authority protoreflect.FieldDescriptor + fd_MsgSetSendEnabled_send_enabled protoreflect.FieldDescriptor + fd_MsgSetSendEnabled_use_default_for protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_bank_v1beta1_tx_proto_init() + md_MsgSetSendEnabled = File_cosmos_bank_v1beta1_tx_proto.Messages().ByName("MsgSetSendEnabled") + fd_MsgSetSendEnabled_authority = md_MsgSetSendEnabled.Fields().ByName("authority") + fd_MsgSetSendEnabled_send_enabled = md_MsgSetSendEnabled.Fields().ByName("send_enabled") + fd_MsgSetSendEnabled_use_default_for = md_MsgSetSendEnabled.Fields().ByName("use_default_for") +} + +var _ protoreflect.Message = (*fastReflection_MsgSetSendEnabled)(nil) + +type fastReflection_MsgSetSendEnabled MsgSetSendEnabled + +func (x *MsgSetSendEnabled) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSetSendEnabled)(x) +} + +func (x *MsgSetSendEnabled) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_bank_v1beta1_tx_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgSetSendEnabled_messageType fastReflection_MsgSetSendEnabled_messageType +var _ protoreflect.MessageType = fastReflection_MsgSetSendEnabled_messageType{} + +type fastReflection_MsgSetSendEnabled_messageType struct{} + +func (x fastReflection_MsgSetSendEnabled_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSetSendEnabled)(nil) +} +func (x fastReflection_MsgSetSendEnabled_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSetSendEnabled) +} +func (x fastReflection_MsgSetSendEnabled_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSetSendEnabled +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSetSendEnabled) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSetSendEnabled +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgSetSendEnabled) Type() protoreflect.MessageType { + return _fastReflection_MsgSetSendEnabled_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSetSendEnabled) New() protoreflect.Message { + return new(fastReflection_MsgSetSendEnabled) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSetSendEnabled) Interface() protoreflect.ProtoMessage { + return (*MsgSetSendEnabled)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgSetSendEnabled) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgSetSendEnabled_authority, value) { + return + } + } + if len(x.SendEnabled) != 0 { + value := protoreflect.ValueOfList(&_MsgSetSendEnabled_2_list{list: &x.SendEnabled}) + if !f(fd_MsgSetSendEnabled_send_enabled, value) { + return + } + } + if len(x.UseDefaultFor) != 0 { + value := protoreflect.ValueOfList(&_MsgSetSendEnabled_3_list{list: &x.UseDefaultFor}) + if !f(fd_MsgSetSendEnabled_use_default_for, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgSetSendEnabled) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.bank.v1beta1.MsgSetSendEnabled.authority": + return x.Authority != "" + case "cosmos.bank.v1beta1.MsgSetSendEnabled.send_enabled": + return len(x.SendEnabled) != 0 + case "cosmos.bank.v1beta1.MsgSetSendEnabled.use_default_for": + return len(x.UseDefaultFor) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabled")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabled does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSetSendEnabled) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.bank.v1beta1.MsgSetSendEnabled.authority": + x.Authority = "" + case "cosmos.bank.v1beta1.MsgSetSendEnabled.send_enabled": + x.SendEnabled = nil + case "cosmos.bank.v1beta1.MsgSetSendEnabled.use_default_for": + x.UseDefaultFor = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabled")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabled does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgSetSendEnabled) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.bank.v1beta1.MsgSetSendEnabled.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cosmos.bank.v1beta1.MsgSetSendEnabled.send_enabled": + if len(x.SendEnabled) == 0 { + return protoreflect.ValueOfList(&_MsgSetSendEnabled_2_list{}) + } + listValue := &_MsgSetSendEnabled_2_list{list: &x.SendEnabled} + return protoreflect.ValueOfList(listValue) + case "cosmos.bank.v1beta1.MsgSetSendEnabled.use_default_for": + if len(x.UseDefaultFor) == 0 { + return protoreflect.ValueOfList(&_MsgSetSendEnabled_3_list{}) + } + listValue := &_MsgSetSendEnabled_3_list{list: &x.UseDefaultFor} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabled")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabled does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSetSendEnabled) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.bank.v1beta1.MsgSetSendEnabled.authority": + x.Authority = value.Interface().(string) + case "cosmos.bank.v1beta1.MsgSetSendEnabled.send_enabled": + lv := value.List() + clv := lv.(*_MsgSetSendEnabled_2_list) + x.SendEnabled = *clv.list + case "cosmos.bank.v1beta1.MsgSetSendEnabled.use_default_for": + lv := value.List() + clv := lv.(*_MsgSetSendEnabled_3_list) + x.UseDefaultFor = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabled")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabled does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSetSendEnabled) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.bank.v1beta1.MsgSetSendEnabled.send_enabled": + if x.SendEnabled == nil { + x.SendEnabled = []*SendEnabled{} + } + value := &_MsgSetSendEnabled_2_list{list: &x.SendEnabled} + return protoreflect.ValueOfList(value) + case "cosmos.bank.v1beta1.MsgSetSendEnabled.use_default_for": + if x.UseDefaultFor == nil { + x.UseDefaultFor = []string{} + } + value := &_MsgSetSendEnabled_3_list{list: &x.UseDefaultFor} + return protoreflect.ValueOfList(value) + case "cosmos.bank.v1beta1.MsgSetSendEnabled.authority": + panic(fmt.Errorf("field authority of message cosmos.bank.v1beta1.MsgSetSendEnabled is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabled")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabled does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgSetSendEnabled) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.bank.v1beta1.MsgSetSendEnabled.authority": + return protoreflect.ValueOfString("") + case "cosmos.bank.v1beta1.MsgSetSendEnabled.send_enabled": + list := []*SendEnabled{} + return protoreflect.ValueOfList(&_MsgSetSendEnabled_2_list{list: &list}) + case "cosmos.bank.v1beta1.MsgSetSendEnabled.use_default_for": + list := []string{} + return protoreflect.ValueOfList(&_MsgSetSendEnabled_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabled")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabled does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgSetSendEnabled) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.bank.v1beta1.MsgSetSendEnabled", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgSetSendEnabled) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSetSendEnabled) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgSetSendEnabled) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgSetSendEnabled) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSetSendEnabled) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.SendEnabled) > 0 { + for _, e := range x.SendEnabled { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.UseDefaultFor) > 0 { + for _, s := range x.UseDefaultFor { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgSetSendEnabled) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.UseDefaultFor) > 0 { + for iNdEx := len(x.UseDefaultFor) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.UseDefaultFor[iNdEx]) + copy(dAtA[i:], x.UseDefaultFor[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.UseDefaultFor[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(x.SendEnabled) > 0 { + for iNdEx := len(x.SendEnabled) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.SendEnabled[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgSetSendEnabled) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSetSendEnabled: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSetSendEnabled: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SendEnabled", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SendEnabled = append(x.SendEnabled, &SendEnabled{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SendEnabled[len(x.SendEnabled)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field UseDefaultFor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.UseDefaultFor = append(x.UseDefaultFor, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgSetSendEnabledResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_bank_v1beta1_tx_proto_init() + md_MsgSetSendEnabledResponse = File_cosmos_bank_v1beta1_tx_proto.Messages().ByName("MsgSetSendEnabledResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgSetSendEnabledResponse)(nil) + +type fastReflection_MsgSetSendEnabledResponse MsgSetSendEnabledResponse + +func (x *MsgSetSendEnabledResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSetSendEnabledResponse)(x) +} + +func (x *MsgSetSendEnabledResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_bank_v1beta1_tx_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgSetSendEnabledResponse_messageType fastReflection_MsgSetSendEnabledResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgSetSendEnabledResponse_messageType{} + +type fastReflection_MsgSetSendEnabledResponse_messageType struct{} + +func (x fastReflection_MsgSetSendEnabledResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSetSendEnabledResponse)(nil) +} +func (x fastReflection_MsgSetSendEnabledResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSetSendEnabledResponse) +} +func (x fastReflection_MsgSetSendEnabledResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSetSendEnabledResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSetSendEnabledResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSetSendEnabledResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgSetSendEnabledResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgSetSendEnabledResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSetSendEnabledResponse) New() protoreflect.Message { + return new(fastReflection_MsgSetSendEnabledResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSetSendEnabledResponse) Interface() protoreflect.ProtoMessage { + return (*MsgSetSendEnabledResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgSetSendEnabledResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgSetSendEnabledResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabledResponse")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabledResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSetSendEnabledResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabledResponse")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabledResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgSetSendEnabledResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabledResponse")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabledResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSetSendEnabledResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabledResponse")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabledResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSetSendEnabledResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabledResponse")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabledResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgSetSendEnabledResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.bank.v1beta1.MsgSetSendEnabledResponse")) + } + panic(fmt.Errorf("message cosmos.bank.v1beta1.MsgSetSendEnabledResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgSetSendEnabledResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.bank.v1beta1.MsgSetSendEnabledResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgSetSendEnabledResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSetSendEnabledResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgSetSendEnabledResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgSetSendEnabledResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSetSendEnabledResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgSetSendEnabledResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgSetSendEnabledResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSetSendEnabledResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSetSendEnabledResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -3082,6 +4120,98 @@ func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return file_cosmos_bank_v1beta1_tx_proto_rawDescGZIP(), []int{5} } +// MsgSetSendEnabled is the Msg/SetSendEnabled request type. +// +// Only entries to add/update/delete need to be included. +// Existing SendEnabled entries that are not included in this +// message are left unchanged. +// +// Since: cosmos-sdk 0.47 +type MsgSetSendEnabled struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // send_enabled is the list of entries to add or update. + SendEnabled []*SendEnabled `protobuf:"bytes,2,rep,name=send_enabled,json=sendEnabled,proto3" json:"send_enabled,omitempty"` + // use_default_for is a list of denoms that should use the params.default_send_enabled value. + // Denoms listed here will have their SendEnabled entries deleted. + // If a denom is included that doesn't have a SendEnabled entry, + // it will be ignored. + UseDefaultFor []string `protobuf:"bytes,3,rep,name=use_default_for,json=useDefaultFor,proto3" json:"use_default_for,omitempty"` +} + +func (x *MsgSetSendEnabled) Reset() { + *x = MsgSetSendEnabled{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bank_v1beta1_tx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSetSendEnabled) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSetSendEnabled) ProtoMessage() {} + +// Deprecated: Use MsgSetSendEnabled.ProtoReflect.Descriptor instead. +func (*MsgSetSendEnabled) Descriptor() ([]byte, []int) { + return file_cosmos_bank_v1beta1_tx_proto_rawDescGZIP(), []int{6} +} + +func (x *MsgSetSendEnabled) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgSetSendEnabled) GetSendEnabled() []*SendEnabled { + if x != nil { + return x.SendEnabled + } + return nil +} + +func (x *MsgSetSendEnabled) GetUseDefaultFor() []string { + if x != nil { + return x.UseDefaultFor + } + return nil +} + +// MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. +// +// Since: cosmos-sdk 0.47 +type MsgSetSendEnabledResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgSetSendEnabledResponse) Reset() { + *x = MsgSetSendEnabledResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_bank_v1beta1_tx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSetSendEnabledResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSetSendEnabledResponse) ProtoMessage() {} + +// Deprecated: Use MsgSetSendEnabledResponse.ProtoReflect.Descriptor instead. +func (*MsgSetSendEnabledResponse) Descriptor() ([]byte, []int) { + return file_cosmos_bank_v1beta1_tx_proto_rawDescGZIP(), []int{7} +} + var File_cosmos_bank_v1beta1_tx_proto protoreflect.FileDescriptor var file_cosmos_bank_v1beta1_tx_proto_rawDesc = []byte{ @@ -3136,37 +4266,58 @@ var file_cosmos_bank_v1beta1_tx_proto_rawDesc = []byte{ 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x90, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x4a, 0x0a, - 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, - 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, - 0x65, 0x6e, 0x64, 0x1a, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, - 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, - 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x09, 0x4d, 0x75, 0x6c, - 0x74, 0x69, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x53, 0x65, 0x6e, 0x64, 0x1a, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc8, 0x01, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, + 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, + 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x12, 0x43, 0x0a, 0x0c, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, - 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xc2, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, + 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x0b, 0x73, 0x65, 0x6e, + 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x5f, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0d, 0x75, 0x73, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x6f, 0x72, + 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xfa, 0x02, + 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x4a, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x1c, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x1a, 0x24, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x59, 0x0a, 0x09, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x62, 0x61, 0x6e, 0x6b, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x42, 0x61, 0x6e, 0x6b, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, - 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, - 0x42, 0x61, 0x6e, 0x6b, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x53, 0x65, 0x6e, + 0x64, 0x1a, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x75, 0x6c, 0x74, 0x69, + 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0c, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x68, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x53, + 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xc2, 0x01, 0x0a, 0x17, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x6e, 0x6b, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x62, 0x61, 0x6e, 0x6b, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x6e, 0x6b, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, + 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, + 0x61, 0x6e, 0x6b, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x3a, 0x3a, 0x42, 0x61, 0x6e, 0x6b, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3181,35 +4332,41 @@ func file_cosmos_bank_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_bank_v1beta1_tx_proto_rawDescData } -var file_cosmos_bank_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_cosmos_bank_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_cosmos_bank_v1beta1_tx_proto_goTypes = []interface{}{ - (*MsgSend)(nil), // 0: cosmos.bank.v1beta1.MsgSend - (*MsgSendResponse)(nil), // 1: cosmos.bank.v1beta1.MsgSendResponse - (*MsgMultiSend)(nil), // 2: cosmos.bank.v1beta1.MsgMultiSend - (*MsgMultiSendResponse)(nil), // 3: cosmos.bank.v1beta1.MsgMultiSendResponse - (*MsgUpdateParams)(nil), // 4: cosmos.bank.v1beta1.MsgUpdateParams - (*MsgUpdateParamsResponse)(nil), // 5: cosmos.bank.v1beta1.MsgUpdateParamsResponse - (*v1beta1.Coin)(nil), // 6: cosmos.base.v1beta1.Coin - (*Input)(nil), // 7: cosmos.bank.v1beta1.Input - (*Output)(nil), // 8: cosmos.bank.v1beta1.Output - (*Params)(nil), // 9: cosmos.bank.v1beta1.Params + (*MsgSend)(nil), // 0: cosmos.bank.v1beta1.MsgSend + (*MsgSendResponse)(nil), // 1: cosmos.bank.v1beta1.MsgSendResponse + (*MsgMultiSend)(nil), // 2: cosmos.bank.v1beta1.MsgMultiSend + (*MsgMultiSendResponse)(nil), // 3: cosmos.bank.v1beta1.MsgMultiSendResponse + (*MsgUpdateParams)(nil), // 4: cosmos.bank.v1beta1.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 5: cosmos.bank.v1beta1.MsgUpdateParamsResponse + (*MsgSetSendEnabled)(nil), // 6: cosmos.bank.v1beta1.MsgSetSendEnabled + (*MsgSetSendEnabledResponse)(nil), // 7: cosmos.bank.v1beta1.MsgSetSendEnabledResponse + (*v1beta1.Coin)(nil), // 8: cosmos.base.v1beta1.Coin + (*Input)(nil), // 9: cosmos.bank.v1beta1.Input + (*Output)(nil), // 10: cosmos.bank.v1beta1.Output + (*Params)(nil), // 11: cosmos.bank.v1beta1.Params + (*SendEnabled)(nil), // 12: cosmos.bank.v1beta1.SendEnabled } var file_cosmos_bank_v1beta1_tx_proto_depIdxs = []int32{ - 6, // 0: cosmos.bank.v1beta1.MsgSend.amount:type_name -> cosmos.base.v1beta1.Coin - 7, // 1: cosmos.bank.v1beta1.MsgMultiSend.inputs:type_name -> cosmos.bank.v1beta1.Input - 8, // 2: cosmos.bank.v1beta1.MsgMultiSend.outputs:type_name -> cosmos.bank.v1beta1.Output - 9, // 3: cosmos.bank.v1beta1.MsgUpdateParams.params:type_name -> cosmos.bank.v1beta1.Params - 0, // 4: cosmos.bank.v1beta1.Msg.Send:input_type -> cosmos.bank.v1beta1.MsgSend - 2, // 5: cosmos.bank.v1beta1.Msg.MultiSend:input_type -> cosmos.bank.v1beta1.MsgMultiSend - 4, // 6: cosmos.bank.v1beta1.Msg.UpdateParams:input_type -> cosmos.bank.v1beta1.MsgUpdateParams - 1, // 7: cosmos.bank.v1beta1.Msg.Send:output_type -> cosmos.bank.v1beta1.MsgSendResponse - 3, // 8: cosmos.bank.v1beta1.Msg.MultiSend:output_type -> cosmos.bank.v1beta1.MsgMultiSendResponse - 5, // 9: cosmos.bank.v1beta1.Msg.UpdateParams:output_type -> cosmos.bank.v1beta1.MsgUpdateParamsResponse - 7, // [7:10] is the sub-list for method output_type - 4, // [4:7] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 8, // 0: cosmos.bank.v1beta1.MsgSend.amount:type_name -> cosmos.base.v1beta1.Coin + 9, // 1: cosmos.bank.v1beta1.MsgMultiSend.inputs:type_name -> cosmos.bank.v1beta1.Input + 10, // 2: cosmos.bank.v1beta1.MsgMultiSend.outputs:type_name -> cosmos.bank.v1beta1.Output + 11, // 3: cosmos.bank.v1beta1.MsgUpdateParams.params:type_name -> cosmos.bank.v1beta1.Params + 12, // 4: cosmos.bank.v1beta1.MsgSetSendEnabled.send_enabled:type_name -> cosmos.bank.v1beta1.SendEnabled + 0, // 5: cosmos.bank.v1beta1.Msg.Send:input_type -> cosmos.bank.v1beta1.MsgSend + 2, // 6: cosmos.bank.v1beta1.Msg.MultiSend:input_type -> cosmos.bank.v1beta1.MsgMultiSend + 4, // 7: cosmos.bank.v1beta1.Msg.UpdateParams:input_type -> cosmos.bank.v1beta1.MsgUpdateParams + 6, // 8: cosmos.bank.v1beta1.Msg.SetSendEnabled:input_type -> cosmos.bank.v1beta1.MsgSetSendEnabled + 1, // 9: cosmos.bank.v1beta1.Msg.Send:output_type -> cosmos.bank.v1beta1.MsgSendResponse + 3, // 10: cosmos.bank.v1beta1.Msg.MultiSend:output_type -> cosmos.bank.v1beta1.MsgMultiSendResponse + 5, // 11: cosmos.bank.v1beta1.Msg.UpdateParams:output_type -> cosmos.bank.v1beta1.MsgUpdateParamsResponse + 7, // 12: cosmos.bank.v1beta1.Msg.SetSendEnabled:output_type -> cosmos.bank.v1beta1.MsgSetSendEnabledResponse + 9, // [9:13] is the sub-list for method output_type + 5, // [5:9] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_cosmos_bank_v1beta1_tx_proto_init() } @@ -3291,6 +4448,30 @@ func file_cosmos_bank_v1beta1_tx_proto_init() { return nil } } + file_cosmos_bank_v1beta1_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSetSendEnabled); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_bank_v1beta1_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSetSendEnabledResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3298,7 +4479,7 @@ func file_cosmos_bank_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_bank_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/bank/v1beta1/tx_grpc.pb.go b/api/cosmos/bank/v1beta1/tx_grpc.pb.go index de5738bfa470..eaddfe59a278 100644 --- a/api/cosmos/bank/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/bank/v1beta1/tx_grpc.pb.go @@ -31,6 +31,13 @@ type MsgClient interface { // // Since: cosmos-sdk 0.47 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // SetSendEnabled is a governance operation for setting the SendEnabled flag + // on any number of Denoms. Only the entries to add or update should be + // included. Entries that already exist in the store, but that aren't + // included in this message, will be left unchanged. + // + // Since: cosmos-sdk 0.47 + SetSendEnabled(ctx context.Context, in *MsgSetSendEnabled, opts ...grpc.CallOption) (*MsgSetSendEnabledResponse, error) } type msgClient struct { @@ -68,6 +75,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) SetSendEnabled(ctx context.Context, in *MsgSetSendEnabled, opts ...grpc.CallOption) (*MsgSetSendEnabledResponse, error) { + out := new(MsgSetSendEnabledResponse) + err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Msg/SetSendEnabled", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -81,6 +97,13 @@ type MsgServer interface { // // Since: cosmos-sdk 0.47 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // SetSendEnabled is a governance operation for setting the SendEnabled flag + // on any number of Denoms. Only the entries to add or update should be + // included. Entries that already exist in the store, but that aren't + // included in this message, will be left unchanged. + // + // Since: cosmos-sdk 0.47 + SetSendEnabled(context.Context, *MsgSetSendEnabled) (*MsgSetSendEnabledResponse, error) mustEmbedUnimplementedMsgServer() } @@ -97,6 +120,9 @@ func (UnimplementedMsgServer) MultiSend(context.Context, *MsgMultiSend) (*MsgMul func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (UnimplementedMsgServer) SetSendEnabled(context.Context, *MsgSetSendEnabled) (*MsgSetSendEnabledResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetSendEnabled not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -164,6 +190,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_SetSendEnabled_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetSendEnabled) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetSendEnabled(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.bank.v1beta1.Msg/SetSendEnabled", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetSendEnabled(ctx, req.(*MsgSetSendEnabled)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -183,6 +227,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "SetSendEnabled", + Handler: _Msg_SetSendEnabled_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/bank/v1beta1/tx.proto", diff --git a/go.mod b/go.mod index ae64bd90d6f2..88181b2c399d 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.2 cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/math v1.0.0-beta.3 + cosmossdk.io/simapp v0.0.0-20220908203654-84d4bf5accad github.com/99designs/keyring v1.2.1 github.com/armon/go-metrics v0.4.0 github.com/bgentry/speakeasy v0.1.0 diff --git a/go.sum b/go.sum index 75f662e29994..a8edc9c4b498 100644 --- a/go.sum +++ b/go.sum @@ -69,6 +69,8 @@ cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= cosmossdk.io/math v1.0.0-beta.3 h1:TbZxSopz2LqjJ7aXYfn7nJSb8vNaBklW6BLpcei1qwM= cosmossdk.io/math v1.0.0-beta.3/go.mod h1:3LYasri3Zna4XpbrTNdKsWmD5fHHkaNAod/mNT9XdE4= +cosmossdk.io/simapp v0.0.0-20220908203654-84d4bf5accad h1:5y0F7FHvbJ/uE8L2Ab+0AtKvy5nUyFfxPEAAIy62T/Y= +cosmossdk.io/simapp v0.0.0-20220908203654-84d4bf5accad/go.mod h1://fc0lbQ4/I2Gm2xQkzq1U6SjZP+UMomSBFw/nodk9U= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= diff --git a/proto/cosmos/bank/v1beta1/tx.proto b/proto/cosmos/bank/v1beta1/tx.proto index a67e76d27098..3bb2a123b1f8 100644 --- a/proto/cosmos/bank/v1beta1/tx.proto +++ b/proto/cosmos/bank/v1beta1/tx.proto @@ -22,6 +22,14 @@ service Msg { // // Since: cosmos-sdk 0.47 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // SetSendEnabled is a governance operation for setting the SendEnabled flag + // on any number of Denoms. Only the entries to add or update should be + // included. Entries that already exist in the store, but that aren't + // included in this message, will be left unchanged. + // + // Since: cosmos-sdk 0.47 + rpc SetSendEnabled(MsgSetSendEnabled) returns (MsgSetSendEnabledResponse); } // MsgSend represents a message to send coins from one account to another. @@ -75,3 +83,30 @@ message MsgUpdateParams { // // Since: cosmos-sdk 0.47 message MsgUpdateParamsResponse {} + +// MsgSetSendEnabled is the Msg/SetSendEnabled request type. +// +// Only entries to add/update/delete need to be included. +// Existing SendEnabled entries that are not included in this +// message are left unchanged. +// +// Since: cosmos-sdk 0.47 +message MsgSetSendEnabled { + option (cosmos.msg.v1.signer) = "authority"; + + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // send_enabled is the list of entries to add or update. + repeated SendEnabled send_enabled = 2; + + // use_default_for is a list of denoms that should use the params.default_send_enabled value. + // Denoms listed here will have their SendEnabled entries deleted. + // If a denom is included that doesn't have a SendEnabled entry, + // it will be ignored. + repeated string use_default_for = 3; +} + +// MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. +// +// Since: cosmos-sdk 0.47 +message MsgSetSendEnabledResponse {} diff --git a/tests/go.mod b/tests/go.mod index a636a9e631ec..90189085e067 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( cosmossdk.io/api v0.2.0 cosmossdk.io/math v1.0.0-beta.3 - cosmossdk.io/simapp v0.0.0-00010101000000-000000000000 + cosmossdk.io/simapp v0.0.0-20220908203654-84d4bf5accad github.com/cosmos/cosmos-sdk v0.0.0-00010101000000-000000000000 github.com/cosmos/gogoproto v1.4.1 github.com/google/uuid v1.3.0 diff --git a/x/authz/testutil/bank_helpers.go b/x/authz/testutil/bank_helpers.go index 913271393856..24928118343d 100644 --- a/x/authz/testutil/bank_helpers.go +++ b/x/authz/testutil/bank_helpers.go @@ -19,3 +19,7 @@ func (k MockBankKeeper) MultiSend(goCtx context.Context, msg *bank.MsgMultiSend) func (k MockBankKeeper) UpdateParams(goCtx context.Context, req *bank.MsgUpdateParams) (*bank.MsgUpdateParamsResponse, error) { return nil, nil } + +func (k MockBankKeeper) SetSendEnabled(goCtx context.Context, req *bank.MsgSetSendEnabled) (*bank.MsgSetSendEnabledResponse, error) { + return nil, nil +} diff --git a/x/bank/README.md b/x/bank/README.md index 31645d4825b6..54cf03448823 100644 --- a/x/bank/README.md +++ b/x/bank/README.md @@ -321,6 +321,18 @@ The message handling can fail if: * signer is not the gov module account address. +### MsgSetSendEnabled + +Used with the x/gov module to set create/edit SendEnabled entries. ++++ https://github.com/cosmos/cosmos-sdk/blob/1bb627e7324278218560d2dd61e010881394f504/proto/cosmos/bank/v1beta1/tx.proto#L94-L107 + +The message will fail under the following conditions: + +* The authority is not a bech32 address. +* The authority is not x/gov module's address. +* There are multiple SendEnabled entries with the same Denom. +* One or more SendEnabled entries has an invalid Denom. + ## Events diff --git a/x/bank/app_test.go b/x/bank/app_test.go index 5cb32662516e..d23f5362381e 100644 --- a/x/bank/app_test.go +++ b/x/bank/app_test.go @@ -3,9 +3,11 @@ package bank_test import ( "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "cosmossdk.io/simapp" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -20,6 +22,7 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/cosmos/cosmos-sdk/x/bank/testutil" "github.com/cosmos/cosmos-sdk/x/bank/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" _ "github.com/cosmos/cosmos-sdk/x/params" _ "github.com/cosmos/cosmos-sdk/x/staking" ) @@ -39,6 +42,7 @@ type ( accSeqs []uint64 privKeys []cryptotypes.PrivKey expectedBalances []expectedBalance + expInError []string } ) @@ -333,3 +337,103 @@ func TestMsgMultiSendDependent(t *testing.T) { } } } + +func TestMsgSetSendEnabled(t *testing.T) { + acc1 := authtypes.NewBaseAccountWithAddress(addr1) + genAccs := []authtypes.GenesisAccount{acc1} + app := simapp.SetupWithGenesisAccounts(t, genAccs) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + require.NoError(t, testutil.FundAccount(app.BankKeeper, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 101)))) + addr1Str := addr1.String() + govAddr := app.BankKeeper.GetAuthority() + goodGovProp, err := govv1.NewMsgSubmitProposal( + []sdk.Msg{ + types.NewMsgSetSendEnabled(govAddr, nil, nil), + }, + sdk.Coins{{"foocoin", sdk.NewInt(5)}}, + addr1Str, + "set default send enabled to true", + ) + require.NoError(t, err, "making goodGovProp") + badGovProp, err := govv1.NewMsgSubmitProposal( + []sdk.Msg{ + types.NewMsgSetSendEnabled(govAddr, []*types.SendEnabled{{"bad coin name!", true}}, nil), + }, + sdk.Coins{{"foocoin", sdk.NewInt(5)}}, + addr1Str, + "set default send enabled to true", + ) + require.NoError(t, err, "making badGovProp") + + testCases := []appTestCase{ + { + desc: "wrong authority", + expSimPass: false, + expPass: false, + msgs: []sdk.Msg{ + types.NewMsgSetSendEnabled(addr1Str, nil, nil), + }, + accSeqs: []uint64{0}, + expInError: []string{ + "invalid authority", + "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + addr1Str, + "expected gov account as only signer for proposal message", + }, + }, + { + desc: "right authority wrong signer", + expSimPass: false, + expPass: false, + msgs: []sdk.Msg{ + types.NewMsgSetSendEnabled(govAddr, nil, nil), + }, + accSeqs: []uint64{1}, // wrong signer, so this sequence doesn't actually get used. + expInError: []string{ + "pubKey does not match signer address", + govAddr, + "with signer index: 0", + "invalid pubkey", + }, + }, + { + desc: "submitted good as gov prop", + expSimPass: true, + expPass: true, + msgs: []sdk.Msg{ + goodGovProp, + }, + accSeqs: []uint64{1}, + expInError: nil, + }, + { + desc: "submitted bad as gov prop", + expSimPass: false, + expPass: false, + msgs: []sdk.Msg{ + badGovProp, + }, + accSeqs: []uint64{2}, + expInError: []string{ + "invalid denom: bad coin name!", + "invalid proposal message", + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.desc, func(tt *testing.T) { + header := tmproto.Header{Height: app.LastBlockHeight() + 1} + txGen := moduletestutil.MakeTestEncodingConfig().TxConfig + _, _, err = simtestutil.SignCheckDeliver(tt, txGen, app.BaseApp, header, tc.msgs, "", []uint64{0}, tc.accSeqs, tc.expSimPass, tc.expPass, priv1) + if len(tc.expInError) > 0 { + require.Error(tt, err) + for _, exp := range tc.expInError { + assert.ErrorContains(tt, err, exp) + } + } else { + require.NoError(tt, err) + } + }) + } +} diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 090f79456123..14fa86537afe 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -195,6 +195,32 @@ func (suite *KeeperTestSuite) mockUnDelegateCoins(ctx sdk.Context, acc authtypes suite.authKeeper.EXPECT().GetAccount(ctx, mAcc.GetAddress()).Return(mAcc) } +func (suite *KeeperTestSuite) TestGetAuthority() { + NewKeeperWithAuthority := func(authority string) keeper.BaseKeeper { + return keeper.NewBaseKeeper( + moduletestutil.MakeTestEncodingConfig().Codec, + sdk.NewKVStoreKey(banktypes.StoreKey), + nil, + nil, + authority, + ) + } + + tests := map[string]string{ + "some random account": "cosmos139f7kncmglres2nf3h4hc4tade85ekfr8sulz5", + "gov module account": authtypes.NewModuleAddress(govtypes.ModuleName).String(), + "another module account": authtypes.NewModuleAddress(minttypes.ModuleName).String(), + } + + for name, expected := range tests { + suite.T().Run(name, func(t *testing.T) { + kpr := NewKeeperWithAuthority(expected) + actual := kpr.GetAuthority() + assert.Equal(t, expected, actual) + }) + } +} + func (suite *KeeperTestSuite) TestSupply() { ctx := suite.ctx require := suite.Require() @@ -1570,9 +1596,7 @@ func (suite *KeeperTestSuite) TestIterateSendEnabledEntries() { }) } - for _, denom := range denoms { - bankKeeper.DeleteSendEnabled(ctx, denom) - } + bankKeeper.DeleteSendEnabled(ctx, denoms...) suite.T().Run("no entries to iterate again after deleting all of them", func(t *testing.T) { count := 0 diff --git a/x/bank/keeper/msg_server.go b/x/bank/keeper/msg_server.go index f0c4571976d1..40888349de6b 100644 --- a/x/bank/keeper/msg_server.go +++ b/x/bank/keeper/msg_server.go @@ -124,3 +124,27 @@ func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam return &types.MsgUpdateParamsResponse{}, nil } + +func (k msgServer) SetSendEnabled(goCtx context.Context, msg *types.MsgSetSendEnabled) (*types.MsgSetSendEnabledResponse, error) { + if k.GetAuthority() != msg.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if len(msg.SendEnabled) > 0 { + k.SetAllSendEnabled(ctx, msg.SendEnabled) + } + if len(msg.UseDefaultFor) > 0 { + k.DeleteSendEnabled(ctx, msg.UseDefaultFor...) + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.Authority), + ), + ) + + return &types.MsgSetSendEnabledResponse{}, nil +} diff --git a/x/bank/keeper/send.go b/x/bank/keeper/send.go index e7f7727c98c9..6fa89f9cc52c 100644 --- a/x/bank/keeper/send.go +++ b/x/bank/keeper/send.go @@ -28,7 +28,7 @@ type SendKeeper interface { GetSendEnabledEntry(ctx sdk.Context, denom string) (types.SendEnabled, bool) SetSendEnabled(ctx sdk.Context, denom string, value bool) SetAllSendEnabled(ctx sdk.Context, sendEnableds []*types.SendEnabled) - DeleteSendEnabled(ctx sdk.Context, denom string) + DeleteSendEnabled(ctx sdk.Context, denoms ...string) IterateSendEnabledEntries(ctx sdk.Context, cb func(denom string, sendEnabled bool) (stop bool)) GetAllSendEnabledEntries(ctx sdk.Context) []types.SendEnabled @@ -426,10 +426,13 @@ func (k BaseSendKeeper) setSendEnabledEntry(store sdk.KVStore, denom string, val store.Set(key, []byte{val}) } -// DeleteSendEnabled deletes a SendEnabled flag for a denom. -func (k BaseSendKeeper) DeleteSendEnabled(ctx sdk.Context, denom string) { +// DeleteSendEnabled deletes the SendEnabled flags for one or more denoms. +// If a denom is provided that doesn't have a SendEnabled entry, it is ignored. +func (k BaseSendKeeper) DeleteSendEnabled(ctx sdk.Context, denoms ...string) { store := ctx.KVStore(k.storeKey) - store.Delete(types.CreateSendEnabledKey(denom)) + for _, denom := range denoms { + store.Delete(types.CreateSendEnabledKey(denom)) + } } // getSendEnabledPrefixStore gets a prefix store for the SendEnabled entries. diff --git a/x/bank/types/msgs.go b/x/bank/types/msgs.go index e164c37ca7da..988d0964861b 100644 --- a/x/bank/types/msgs.go +++ b/x/bank/types/msgs.go @@ -211,3 +211,49 @@ func (msg MsgUpdateParams) GetSignBytes() []byte { func (msg MsgUpdateParams) ValidateBasic() error { return msg.Params.Validate() } + +// NewMsgSetSendEnabled Construct a message to set one or more SendEnabled entries. +func NewMsgSetSendEnabled(authority string, sendEnabled []*SendEnabled, useDefaultFor []string) *MsgSetSendEnabled { + return &MsgSetSendEnabled{ + Authority: authority, + SendEnabled: sendEnabled, + UseDefaultFor: useDefaultFor, + } +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgSetSendEnabled) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for MsgSoftwareUpgrade. +func (msg MsgSetSendEnabled) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic runs basic validation on this MsgSetSendEnabled. +func (msg MsgSetSendEnabled) ValidateBasic() error { + if len(msg.Authority) > 0 { + _, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid authority address: %s", err) + } + } + seen := map[string]bool{} + for _, se := range msg.SendEnabled { + if _, alreadySeen := seen[se.Denom]; alreadySeen { + return sdkerrors.ErrInvalidRequest.Wrapf("duplicate denom entries found for %q", se.Denom) + } + seen[se.Denom] = true + if err := se.Validate(); err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("invalid SendEnabled denom %q: %s", se.Denom, err) + } + } + for _, denom := range msg.UseDefaultFor { + if err := sdk.ValidateDenom(denom); err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("invalid UseDefaultFor denom %q: %s", denom, err) + } + } + return nil +} diff --git a/x/bank/types/msgs_test.go b/x/bank/types/msgs_test.go index d9ce4e60345d..d4252b7f93a3 100644 --- a/x/bank/types/msgs_test.go +++ b/x/bank/types/msgs_test.go @@ -3,9 +3,12 @@ package types import ( "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) func TestMsgSendRoute(t *testing.T) { @@ -278,6 +281,19 @@ func TestMsgMultiSendGetSigners(t *testing.T) { } } +func TestNewMsgSetSendEnabled(t *testing.T) { + // Punt. Just setting one to all non-default values and making sure they're as expected. + msg := NewMsgSetSendEnabled("milton", []*SendEnabled{{"barrycoin", true}}, []string{"billcoin"}) + assert.Equal(t, "milton", msg.Authority, "msg.Authority") + if assert.Len(t, msg.SendEnabled, 1, "msg.SendEnabled length") { + assert.Equal(t, "barrycoin", msg.SendEnabled[0].Denom, "msg.SendEnabled[0].Denom") + assert.True(t, msg.SendEnabled[0].Enabled, "msg.SendEnabled[0].Enabled") + } + if assert.Len(t, msg.UseDefaultFor, 1, "msg.UseDefault") { + assert.Equal(t, "billcoin", msg.UseDefaultFor[0], "msg.UseDefault[0]") + } +} + func TestMsgSendGetSigners(t *testing.T) { from := sdk.AccAddress([]byte("input111111111111111")) msg := NewMsgSend(from, sdk.AccAddress{}, sdk.NewCoins()) @@ -285,3 +301,116 @@ func TestMsgSendGetSigners(t *testing.T) { require.Equal(t, 1, len(res)) require.True(t, from.Equals(res[0])) } + +func TestMsgSetSendEnabledGetSignBytes(t *testing.T) { + msg := NewMsgSetSendEnabled("cartman", []*SendEnabled{{"casafiestacoin", false}, {"kylecoin", true}}, nil) + expected := `{"authority":"cartman","send_enabled":[{"denom":"casafiestacoin"},{"denom":"kylecoin","enabled":true}]}` + actualBz := msg.GetSignBytes() + actual := string(actualBz) + assert.Equal(t, expected, actual) +} + +func TestMsgSetSendEnabledGetSigners(t *testing.T) { + govModuleAddr := authtypes.NewModuleAddress(govtypes.ModuleName) + msg := NewMsgSetSendEnabled(govModuleAddr.String(), nil, nil) + expected := []sdk.AccAddress{govModuleAddr} + actual := msg.GetSigners() + assert.Equal(t, expected, actual) +} + +func TestMsgSetSendEnabledValidateBasic(t *testing.T) { + govModuleAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + tests := []struct { + name string + msg MsgSetSendEnabled + exp string + }{ + { + name: "valid with two entries", + msg: MsgSetSendEnabled{ + Authority: govModuleAddr, + SendEnabled: []*SendEnabled{ + {"somecoina", true}, + {"somecoinb", false}, + }, + UseDefaultFor: []string{"defcoinc", "defcoind"}, + }, + exp: "", + }, + { + name: "valid with two entries but no authority", + msg: MsgSetSendEnabled{ + Authority: "", + SendEnabled: []*SendEnabled{ + {"somecoina", true}, + {"somecoinb", false}, + }, + UseDefaultFor: []string{"defcoinc", "defcoind"}, + }, + exp: "", + }, + { + name: "bad authority", + msg: MsgSetSendEnabled{ + Authority: "farva", + SendEnabled: []*SendEnabled{ + {"somecoina", true}, + {"somecoinb", false}, + }, + }, + exp: "invalid authority address: decoding bech32 failed: invalid bech32 string length 5: invalid address", + }, + { + name: "bad first denom name", + msg: MsgSetSendEnabled{ + Authority: govModuleAddr, + SendEnabled: []*SendEnabled{ + {"Not A Denom", true}, + {"somecoinb", false}, + }, + }, + exp: `invalid SendEnabled denom "Not A Denom": invalid denom: Not A Denom: invalid request`, + }, + { + name: "bad second denom", + msg: MsgSetSendEnabled{ + Authority: govModuleAddr, + SendEnabled: []*SendEnabled{ + {"somecoina", true}, + {"", false}, + }, + }, + exp: `invalid SendEnabled denom "": invalid denom: : invalid request`, + }, + { + name: "duplicate denom", + msg: MsgSetSendEnabled{ + Authority: govModuleAddr, + SendEnabled: []*SendEnabled{ + {"copycoin", true}, + {"copycoin", false}, + }, + }, + exp: `duplicate denom entries found for "copycoin": invalid request`, + }, + { + name: "bad denom to delete", + msg: MsgSetSendEnabled{ + Authority: govModuleAddr, + UseDefaultFor: []string{"very \t bad denom string~~~!"}, + }, + exp: "invalid UseDefaultFor denom \"very \\t bad denom string~~~!\": invalid denom: very \t bad denom string~~~!: invalid request", + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(tt *testing.T) { + actual := tc.msg.ValidateBasic() + if len(tc.exp) > 0 { + require.EqualError(tt, actual, tc.exp) + } else { + require.NoError(tt, actual) + } + }) + } +} diff --git a/x/bank/types/tx.pb.go b/x/bank/types/tx.pb.go index 1862f8d50a5c..b3b48940cea1 100644 --- a/x/bank/types/tx.pb.go +++ b/x/bank/types/tx.pb.go @@ -300,6 +300,117 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgSetSendEnabled is the Msg/SetSendEnabled request type. +// +// Only entries to add/update/delete need to be included. +// Existing SendEnabled entries that are not included in this +// message are left unchanged. +// +// Since: cosmos-sdk 0.47 +type MsgSetSendEnabled struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // send_enabled is the list of entries to add or update. + SendEnabled []*SendEnabled `protobuf:"bytes,2,rep,name=send_enabled,json=sendEnabled,proto3" json:"send_enabled,omitempty"` + // use_default_for is a list of denoms that should use the params.default_send_enabled value. + // Denoms listed here will have their SendEnabled entries deleted. + // If a denom is included that doesn't have a SendEnabled entry, + // it will be ignored. + UseDefaultFor []string `protobuf:"bytes,3,rep,name=use_default_for,json=useDefaultFor,proto3" json:"use_default_for,omitempty"` +} + +func (m *MsgSetSendEnabled) Reset() { *m = MsgSetSendEnabled{} } +func (m *MsgSetSendEnabled) String() string { return proto.CompactTextString(m) } +func (*MsgSetSendEnabled) ProtoMessage() {} +func (*MsgSetSendEnabled) Descriptor() ([]byte, []int) { + return fileDescriptor_1d8cb1613481f5b7, []int{6} +} +func (m *MsgSetSendEnabled) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetSendEnabled) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetSendEnabled.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSetSendEnabled) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetSendEnabled.Merge(m, src) +} +func (m *MsgSetSendEnabled) XXX_Size() int { + return m.Size() +} +func (m *MsgSetSendEnabled) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetSendEnabled.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetSendEnabled proto.InternalMessageInfo + +func (m *MsgSetSendEnabled) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgSetSendEnabled) GetSendEnabled() []*SendEnabled { + if m != nil { + return m.SendEnabled + } + return nil +} + +func (m *MsgSetSendEnabled) GetUseDefaultFor() []string { + if m != nil { + return m.UseDefaultFor + } + return nil +} + +// MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. +// +// Since: cosmos-sdk 0.47 +type MsgSetSendEnabledResponse struct { +} + +func (m *MsgSetSendEnabledResponse) Reset() { *m = MsgSetSendEnabledResponse{} } +func (m *MsgSetSendEnabledResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetSendEnabledResponse) ProtoMessage() {} +func (*MsgSetSendEnabledResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1d8cb1613481f5b7, []int{7} +} +func (m *MsgSetSendEnabledResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetSendEnabledResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetSendEnabledResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSetSendEnabledResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetSendEnabledResponse.Merge(m, src) +} +func (m *MsgSetSendEnabledResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetSendEnabledResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetSendEnabledResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetSendEnabledResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSend)(nil), "cosmos.bank.v1beta1.MsgSend") proto.RegisterType((*MsgSendResponse)(nil), "cosmos.bank.v1beta1.MsgSendResponse") @@ -307,46 +418,54 @@ func init() { proto.RegisterType((*MsgMultiSendResponse)(nil), "cosmos.bank.v1beta1.MsgMultiSendResponse") proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.bank.v1beta1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.bank.v1beta1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgSetSendEnabled)(nil), "cosmos.bank.v1beta1.MsgSetSendEnabled") + proto.RegisterType((*MsgSetSendEnabledResponse)(nil), "cosmos.bank.v1beta1.MsgSetSendEnabledResponse") } func init() { proto.RegisterFile("cosmos/bank/v1beta1/tx.proto", fileDescriptor_1d8cb1613481f5b7) } var fileDescriptor_1d8cb1613481f5b7 = []byte{ - // 535 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x3b, 0x6f, 0xd3, 0x50, - 0x14, 0xb6, 0x93, 0x2a, 0x55, 0x4e, 0x23, 0x2a, 0x4c, 0x44, 0x13, 0x53, 0x39, 0xc5, 0x62, 0x48, - 0x11, 0xb5, 0x49, 0x91, 0x78, 0xa4, 0x13, 0xe9, 0x04, 0x52, 0x04, 0x4a, 0xc5, 0x00, 0x4b, 0xe5, - 0xc7, 0xc5, 0xb5, 0x8a, 0x7d, 0x2d, 0xdf, 0xeb, 0xaa, 0x5d, 0x99, 0x18, 0x3b, 0x20, 0xe6, 0xce, - 0x4c, 0x0c, 0xfc, 0x88, 0x8e, 0x15, 0x13, 0x13, 0xa0, 0x64, 0x80, 0x7f, 0x01, 0xba, 0x0f, 0x3b, - 0x29, 0xe4, 0xc1, 0x74, 0x2d, 0x7f, 0x8f, 0xf3, 0x9d, 0x73, 0xae, 0x0d, 0xeb, 0x1e, 0x26, 0x11, - 0x26, 0xb6, 0xeb, 0xc4, 0x87, 0xf6, 0x51, 0xc7, 0x45, 0xd4, 0xe9, 0xd8, 0xf4, 0xd8, 0x4a, 0x52, - 0x4c, 0xb1, 0x76, 0x4d, 0xa0, 0x16, 0x43, 0x2d, 0x89, 0xea, 0xf5, 0x00, 0x07, 0x98, 0xe3, 0x36, - 0x7b, 0x12, 0x54, 0xdd, 0x28, 0x8c, 0x08, 0x2a, 0x8c, 0x3c, 0x1c, 0xc6, 0xff, 0xe0, 0x13, 0x85, - 0xb8, 0xaf, 0xc0, 0x9b, 0x02, 0xdf, 0x17, 0xc6, 0xb2, 0xae, 0x80, 0xd6, 0xa4, 0x34, 0x22, 0x81, - 0x7d, 0xd4, 0x61, 0x87, 0x00, 0xcc, 0xdf, 0x2a, 0x2c, 0xf7, 0x49, 0xb0, 0x87, 0x62, 0x5f, 0xdb, - 0x81, 0xda, 0xeb, 0x14, 0x47, 0xfb, 0x8e, 0xef, 0xa7, 0x88, 0x90, 0x86, 0xba, 0xa1, 0xb6, 0xab, - 0xbd, 0xc6, 0x97, 0xcf, 0x5b, 0x75, 0x69, 0xf6, 0x58, 0x20, 0x7b, 0x34, 0x0d, 0xe3, 0x60, 0xb0, - 0xc2, 0xd8, 0xf2, 0x95, 0xf6, 0x00, 0x80, 0xe2, 0x42, 0x5a, 0x5a, 0x20, 0xad, 0x52, 0x9c, 0x0b, - 0x3d, 0xa8, 0x38, 0x11, 0xce, 0x62, 0xda, 0x28, 0x6f, 0x94, 0xdb, 0x2b, 0xdb, 0x4d, 0xab, 0x98, - 0x18, 0x41, 0xf9, 0xc4, 0xac, 0x5d, 0x1c, 0xc6, 0xbd, 0xbb, 0xe7, 0xdf, 0x5a, 0xca, 0xc7, 0xef, - 0xad, 0x76, 0x10, 0xd2, 0x83, 0xcc, 0xb5, 0x3c, 0x1c, 0xc9, 0x36, 0xe5, 0xb1, 0x45, 0xfc, 0x43, - 0x9b, 0x9e, 0x24, 0x88, 0x70, 0x01, 0x19, 0x48, 0xeb, 0x6e, 0xf3, 0xdd, 0x59, 0x4b, 0xf9, 0x75, - 0xd6, 0x52, 0xde, 0xfe, 0xfc, 0x74, 0xfb, 0x52, 0x97, 0xe6, 0x55, 0x58, 0x95, 0x03, 0x18, 0x20, - 0x92, 0xe0, 0x98, 0x20, 0xf3, 0x83, 0x0a, 0xb5, 0x3e, 0x09, 0xfa, 0xd9, 0x1b, 0x1a, 0xf2, 0xc9, - 0x3c, 0x84, 0x4a, 0x18, 0x27, 0x19, 0x65, 0x33, 0x61, 0x19, 0x75, 0x6b, 0xca, 0x56, 0xad, 0x27, - 0x8c, 0xd2, 0x5b, 0x62, 0x21, 0x07, 0x92, 0xaf, 0xed, 0xc0, 0x32, 0xce, 0x28, 0x97, 0x96, 0xb8, - 0xf4, 0xc6, 0x54, 0xe9, 0x33, 0xce, 0x91, 0xda, 0x5c, 0xd1, 0x5d, 0xcd, 0x13, 0x4b, 0x37, 0xf3, - 0x3a, 0xd4, 0x27, 0x73, 0x15, 0x81, 0xdf, 0xab, 0xbc, 0x89, 0x17, 0x89, 0xef, 0x50, 0xf4, 0xdc, - 0x49, 0x9d, 0x88, 0x68, 0xf7, 0xa1, 0xea, 0x64, 0xf4, 0x00, 0xa7, 0x21, 0x3d, 0x59, 0xb8, 0xca, - 0x31, 0x55, 0x7b, 0x04, 0x95, 0x84, 0x3b, 0xf0, 0x25, 0xce, 0x0a, 0x2c, 0x8a, 0xe4, 0xcd, 0x0a, - 0x41, 0xf7, 0x0a, 0xcb, 0x3a, 0xb6, 0x32, 0x9b, 0xb0, 0xf6, 0x57, 0xaa, 0x3c, 0xf1, 0xf6, 0x69, - 0x09, 0xca, 0x7d, 0x12, 0x68, 0x4f, 0x61, 0x89, 0x4f, 0x78, 0x7d, 0x6a, 0x15, 0xb9, 0x18, 0xfd, - 0xd6, 0x3c, 0x34, 0xf7, 0xd4, 0x5e, 0x42, 0x75, 0xbc, 0xb2, 0x9b, 0xb3, 0x24, 0x05, 0x45, 0xdf, - 0x5c, 0x48, 0x29, 0xac, 0x5d, 0xa8, 0x5d, 0x1a, 0xee, 0xcc, 0x40, 0x93, 0x2c, 0xfd, 0xce, 0xff, - 0xb0, 0xf2, 0x1a, 0xbd, 0xdd, 0xf3, 0xa1, 0xa1, 0x5e, 0x0c, 0x0d, 0xf5, 0xc7, 0xd0, 0x50, 0x4f, - 0x47, 0x86, 0x72, 0x31, 0x32, 0x94, 0xaf, 0x23, 0x43, 0x79, 0xb5, 0x39, 0xf7, 0xbe, 0x1f, 0x8b, - 0x1f, 0x02, 0xbf, 0xf6, 0x6e, 0x85, 0x7f, 0xd6, 0xf7, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7c, - 0xb9, 0xe1, 0x24, 0x95, 0x04, 0x00, 0x00, + // 631 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xbf, 0x6f, 0xd3, 0x4e, + 0x14, 0xb7, 0xdb, 0x2a, 0x55, 0xae, 0xf9, 0xb6, 0xaa, 0xbf, 0x11, 0x4d, 0xdc, 0xca, 0x09, 0x11, + 0xaa, 0x52, 0x44, 0x6d, 0x52, 0x24, 0x7e, 0xa4, 0x13, 0x09, 0x20, 0x81, 0x14, 0x81, 0x5c, 0x31, + 0xc0, 0x12, 0xd9, 0xf1, 0xc5, 0xb1, 0x1a, 0xfb, 0x2c, 0xdf, 0xb9, 0x6a, 0x57, 0x26, 0x46, 0x06, + 0xc4, 0xdc, 0x99, 0x89, 0x81, 0x3f, 0x22, 0x63, 0xc5, 0xc4, 0x04, 0x28, 0x19, 0xe0, 0x6f, 0x60, + 0x01, 0xf9, 0xee, 0xec, 0xb8, 0x4d, 0xd2, 0x54, 0x4c, 0xb6, 0xee, 0xf3, 0xe3, 0x7d, 0xde, 0xbb, + 0xa7, 0x03, 0x5b, 0x1d, 0x84, 0x5d, 0x84, 0x35, 0xd3, 0xf0, 0x0e, 0xb5, 0xa3, 0x9a, 0x09, 0x89, + 0x51, 0xd3, 0xc8, 0xb1, 0xea, 0x07, 0x88, 0x20, 0xe9, 0x7f, 0x86, 0xaa, 0x11, 0xaa, 0x72, 0x54, + 0xce, 0xdb, 0xc8, 0x46, 0x14, 0xd7, 0xa2, 0x3f, 0x46, 0x95, 0x95, 0xc4, 0x08, 0xc3, 0xc4, 0xa8, + 0x83, 0x1c, 0x6f, 0x02, 0x4f, 0x15, 0xa2, 0xbe, 0x0c, 0x2f, 0x32, 0xbc, 0xcd, 0x8c, 0x79, 0x5d, + 0x06, 0x6d, 0x70, 0xa9, 0x8b, 0x6d, 0xed, 0xa8, 0x16, 0x7d, 0x18, 0x50, 0xf9, 0x23, 0x82, 0xe5, + 0x16, 0xb6, 0x0f, 0xa0, 0x67, 0x49, 0xfb, 0x20, 0xd7, 0x0d, 0x90, 0xdb, 0x36, 0x2c, 0x2b, 0x80, + 0x18, 0x17, 0xc4, 0xb2, 0x58, 0xcd, 0x36, 0x0a, 0x5f, 0x3e, 0xef, 0xe6, 0xb9, 0xd9, 0x43, 0x86, + 0x1c, 0x90, 0xc0, 0xf1, 0x6c, 0x7d, 0x25, 0x62, 0xf3, 0x23, 0xe9, 0x1e, 0x00, 0x04, 0x25, 0xd2, + 0x85, 0x39, 0xd2, 0x2c, 0x41, 0xb1, 0xb0, 0x03, 0x32, 0x86, 0x8b, 0x42, 0x8f, 0x14, 0x16, 0xcb, + 0x8b, 0xd5, 0x95, 0xbd, 0xa2, 0x9a, 0x4c, 0x0c, 0xc3, 0x78, 0x62, 0x6a, 0x13, 0x39, 0x5e, 0xe3, + 0xf6, 0xe0, 0x5b, 0x49, 0xf8, 0xf8, 0xbd, 0x54, 0xb5, 0x1d, 0xd2, 0x0b, 0x4d, 0xb5, 0x83, 0x5c, + 0xde, 0x26, 0xff, 0xec, 0x62, 0xeb, 0x50, 0x23, 0x27, 0x3e, 0xc4, 0x54, 0x80, 0x75, 0x6e, 0x5d, + 0x2f, 0xbe, 0x3d, 0x2d, 0x09, 0xbf, 0x4e, 0x4b, 0xc2, 0x9b, 0x9f, 0x9f, 0x6e, 0x9e, 0xeb, 0xb2, + 0xb2, 0x0e, 0xd6, 0xf8, 0x00, 0x74, 0x88, 0x7d, 0xe4, 0x61, 0x58, 0xf9, 0x20, 0x82, 0x5c, 0x0b, + 0xdb, 0xad, 0xb0, 0x4f, 0x1c, 0x3a, 0x99, 0xfb, 0x20, 0xe3, 0x78, 0x7e, 0x48, 0xa2, 0x99, 0x44, + 0x19, 0x65, 0x75, 0xca, 0xad, 0xaa, 0x4f, 0x23, 0x4a, 0x63, 0x29, 0x0a, 0xa9, 0x73, 0xbe, 0xb4, + 0x0f, 0x96, 0x51, 0x48, 0xa8, 0x74, 0x81, 0x4a, 0x37, 0xa7, 0x4a, 0x9f, 0x53, 0x0e, 0xd7, 0xc6, + 0x8a, 0xfa, 0x5a, 0x9c, 0x98, 0xbb, 0x55, 0xae, 0x81, 0x7c, 0x3a, 0x57, 0x12, 0xf8, 0xbd, 0x48, + 0x9b, 0x78, 0xe9, 0x5b, 0x06, 0x81, 0x2f, 0x8c, 0xc0, 0x70, 0xb1, 0x74, 0x17, 0x64, 0x8d, 0x90, + 0xf4, 0x50, 0xe0, 0x90, 0x93, 0xb9, 0x57, 0x39, 0xa6, 0x4a, 0x0f, 0x40, 0xc6, 0xa7, 0x0e, 0xf4, + 0x12, 0x67, 0x05, 0x66, 0x45, 0xe2, 0x66, 0x99, 0xa0, 0xbe, 0x1a, 0x65, 0x1d, 0x5b, 0x55, 0x8a, + 0x60, 0xe3, 0x42, 0xaa, 0x24, 0xf1, 0x40, 0x04, 0xeb, 0x74, 0xec, 0x24, 0x6a, 0xe4, 0xb1, 0x67, + 0x98, 0x7d, 0x68, 0xfd, 0x73, 0xe6, 0x26, 0xc8, 0x61, 0xe8, 0x59, 0x6d, 0xc8, 0x7c, 0xf8, 0xa8, + 0xcb, 0x53, 0x93, 0xa7, 0xea, 0xe9, 0x2b, 0x38, 0x55, 0x7c, 0x1b, 0xac, 0x85, 0x18, 0xb6, 0x2d, + 0xd8, 0x35, 0xc2, 0x3e, 0x69, 0x77, 0x51, 0x40, 0x37, 0x32, 0xab, 0xff, 0x17, 0x62, 0xf8, 0x88, + 0x9d, 0x3e, 0x41, 0xc1, 0x44, 0x97, 0x9b, 0xa0, 0x38, 0xd1, 0x49, 0xdc, 0xe7, 0xde, 0xef, 0x05, + 0xb0, 0xd8, 0xc2, 0xb6, 0xf4, 0x0c, 0x2c, 0xd1, 0x4d, 0xda, 0x9a, 0x9a, 0x89, 0x2f, 0xa0, 0x7c, + 0xe3, 0x32, 0x34, 0xf6, 0x94, 0x5e, 0x81, 0xec, 0x78, 0x35, 0xaf, 0xcf, 0x92, 0x24, 0x14, 0x79, + 0x67, 0x2e, 0x25, 0xb1, 0x36, 0x41, 0xee, 0xdc, 0x12, 0xcd, 0x0c, 0x94, 0x66, 0xc9, 0xb7, 0xae, + 0xc2, 0x4a, 0x6a, 0xf4, 0xc0, 0xea, 0x85, 0x6b, 0xdf, 0x9e, 0xdd, 0x76, 0x9a, 0x27, 0xab, 0x57, + 0xe3, 0xc5, 0x95, 0x1a, 0xcd, 0xc1, 0x50, 0x11, 0xcf, 0x86, 0x8a, 0xf8, 0x63, 0xa8, 0x88, 0xef, + 0x46, 0x8a, 0x70, 0x36, 0x52, 0x84, 0xaf, 0x23, 0x45, 0x78, 0xbd, 0x73, 0xe9, 0x0b, 0x72, 0xcc, + 0x9e, 0x58, 0xfa, 0x90, 0x98, 0x19, 0xfa, 0x50, 0xde, 0xf9, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xed, + 0xc0, 0x85, 0x96, 0xe7, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -370,6 +489,13 @@ type MsgClient interface { // // Since: cosmos-sdk 0.47 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // SetSendEnabled is a governance operation for setting the SendEnabled flag + // on any number of Denoms. Only the entries to add or update should be + // included. Entries that already exist in the store, but that aren't + // included in this message, will be left unchanged. + // + // Since: cosmos-sdk 0.47 + SetSendEnabled(ctx context.Context, in *MsgSetSendEnabled, opts ...grpc.CallOption) (*MsgSetSendEnabledResponse, error) } type msgClient struct { @@ -407,6 +533,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) SetSendEnabled(ctx context.Context, in *MsgSetSendEnabled, opts ...grpc.CallOption) (*MsgSetSendEnabledResponse, error) { + out := new(MsgSetSendEnabledResponse) + err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Msg/SetSendEnabled", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // Send defines a method for sending coins from one account to another account. @@ -418,6 +553,13 @@ type MsgServer interface { // // Since: cosmos-sdk 0.47 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // SetSendEnabled is a governance operation for setting the SendEnabled flag + // on any number of Denoms. Only the entries to add or update should be + // included. Entries that already exist in the store, but that aren't + // included in this message, will be left unchanged. + // + // Since: cosmos-sdk 0.47 + SetSendEnabled(context.Context, *MsgSetSendEnabled) (*MsgSetSendEnabledResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -433,6 +575,9 @@ func (*UnimplementedMsgServer) MultiSend(ctx context.Context, req *MsgMultiSend) func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) SetSendEnabled(ctx context.Context, req *MsgSetSendEnabled) (*MsgSetSendEnabledResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetSendEnabled not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -492,6 +637,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_SetSendEnabled_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetSendEnabled) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetSendEnabled(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.bank.v1beta1.Msg/SetSendEnabled", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetSendEnabled(ctx, req.(*MsgSetSendEnabled)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.bank.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -508,6 +671,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "SetSendEnabled", + Handler: _Msg_SetSendEnabled_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/bank/v1beta1/tx.proto", @@ -724,6 +891,82 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgSetSendEnabled) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSetSendEnabled) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetSendEnabled) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UseDefaultFor) > 0 { + for iNdEx := len(m.UseDefaultFor) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.UseDefaultFor[iNdEx]) + copy(dAtA[i:], m.UseDefaultFor[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.UseDefaultFor[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.SendEnabled) > 0 { + for iNdEx := len(m.SendEnabled) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SendEnabled[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetSendEnabledResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSetSendEnabledResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetSendEnabledResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -821,6 +1064,40 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgSetSendEnabled) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.SendEnabled) > 0 { + for _, e := range m.SendEnabled { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.UseDefaultFor) > 0 { + for _, s := range m.UseDefaultFor { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgSetSendEnabledResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1358,6 +1635,204 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgSetSendEnabled) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetSendEnabled: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetSendEnabled: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SendEnabled", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SendEnabled = append(m.SendEnabled, &SendEnabled{}) + if err := m.SendEnabled[len(m.SendEnabled)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UseDefaultFor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UseDefaultFor = append(m.UseDefaultFor, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSetSendEnabledResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetSendEnabledResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetSendEnabledResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/gov/testutil/expected_keepers_mocks.go b/x/gov/testutil/expected_keepers_mocks.go index 9fc3d2769f27..e119ee2bf6e9 100644 --- a/x/gov/testutil/expected_keepers_mocks.go +++ b/x/gov/testutil/expected_keepers_mocks.go @@ -217,15 +217,20 @@ func (mr *MockBankKeeperMockRecorder) DelegateCoinsFromAccountToModule(ctx, send } // DeleteSendEnabled mocks base method. -func (m *MockBankKeeper) DeleteSendEnabled(ctx types.Context, denom string) { +func (m *MockBankKeeper) DeleteSendEnabled(ctx types.Context, denoms ...string) { m.ctrl.T.Helper() - m.ctrl.Call(m, "DeleteSendEnabled", ctx, denom) + varargs := []interface{}{ctx} + for _, a := range denoms { + varargs = append(varargs, a) + } + m.ctrl.Call(m, "DeleteSendEnabled", varargs...) } // DeleteSendEnabled indicates an expected call of DeleteSendEnabled. -func (mr *MockBankKeeperMockRecorder) DeleteSendEnabled(ctx, denom interface{}) *gomock.Call { +func (mr *MockBankKeeperMockRecorder) DeleteSendEnabled(ctx interface{}, denoms ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSendEnabled", reflect.TypeOf((*MockBankKeeper)(nil).DeleteSendEnabled), ctx, denom) + varargs := append([]interface{}{ctx}, denoms...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSendEnabled", reflect.TypeOf((*MockBankKeeper)(nil).DeleteSendEnabled), varargs...) } // DenomMetadata mocks base method. diff --git a/x/group/testutil/expected_keepers_mocks.go b/x/group/testutil/expected_keepers_mocks.go index 54584b0e9d63..ea9ae48066e6 100644 --- a/x/group/testutil/expected_keepers_mocks.go +++ b/x/group/testutil/expected_keepers_mocks.go @@ -172,6 +172,21 @@ func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderMo return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } +// SetSendEnabled mocks base method. +func (m *MockBankKeeper) SetSendEnabled(arg0 context.Context, arg1 *types1.MsgSetSendEnabled) (*types1.MsgSetSendEnabledResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetSendEnabled", arg0, arg1) + ret0, _ := ret[0].(*types1.MsgSetSendEnabledResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetSendEnabled indicates an expected call of SetSendEnabled. +func (mr *MockBankKeeperMockRecorder) SetSendEnabled(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSendEnabled", reflect.TypeOf((*MockBankKeeper)(nil).SetSendEnabled), arg0, arg1) +} + // SpendableCoins mocks base method. func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { m.ctrl.T.Helper()