diff --git a/api/cosmos/accounts/testing/counter/v1/counter.pulsar.go b/api/cosmos/accounts/testing/counter/v1/counter.pulsar.go index 5e35a263c8..a75c464c44 100644 --- a/api/cosmos/accounts/testing/counter/v1/counter.pulsar.go +++ b/api/cosmos/accounts/testing/counter/v1/counter.pulsar.go @@ -2,8 +2,10 @@ package counterv1 import ( + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -1936,12 +1938,64 @@ func (x *fastReflection_MsgTestDependencies) ProtoMethods() *protoiface.Methods } } +var _ protoreflect.List = (*_MsgTestDependenciesResponse_5_list)(nil) + +type _MsgTestDependenciesResponse_5_list struct { + list *[]*v1beta1.Coin +} + +func (x *_MsgTestDependenciesResponse_5_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgTestDependenciesResponse_5_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgTestDependenciesResponse_5_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + (*x.list)[i] = concreteValue +} + +func (x *_MsgTestDependenciesResponse_5_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgTestDependenciesResponse_5_list) AppendMutable() protoreflect.Value { + v := new(v1beta1.Coin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgTestDependenciesResponse_5_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgTestDependenciesResponse_5_list) NewElement() protoreflect.Value { + v := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgTestDependenciesResponse_5_list) IsValid() bool { + return x.list != nil +} + var ( md_MsgTestDependenciesResponse protoreflect.MessageDescriptor fd_MsgTestDependenciesResponse_chain_id protoreflect.FieldDescriptor fd_MsgTestDependenciesResponse_address protoreflect.FieldDescriptor fd_MsgTestDependenciesResponse_before_gas protoreflect.FieldDescriptor fd_MsgTestDependenciesResponse_after_gas protoreflect.FieldDescriptor + fd_MsgTestDependenciesResponse_funds protoreflect.FieldDescriptor ) func init() { @@ -1951,6 +2005,7 @@ func init() { fd_MsgTestDependenciesResponse_address = md_MsgTestDependenciesResponse.Fields().ByName("address") fd_MsgTestDependenciesResponse_before_gas = md_MsgTestDependenciesResponse.Fields().ByName("before_gas") fd_MsgTestDependenciesResponse_after_gas = md_MsgTestDependenciesResponse.Fields().ByName("after_gas") + fd_MsgTestDependenciesResponse_funds = md_MsgTestDependenciesResponse.Fields().ByName("funds") } var _ protoreflect.Message = (*fastReflection_MsgTestDependenciesResponse)(nil) @@ -2042,6 +2097,12 @@ func (x *fastReflection_MsgTestDependenciesResponse) Range(f func(protoreflect.F return } } + if len(x.Funds) != 0 { + value := protoreflect.ValueOfList(&_MsgTestDependenciesResponse_5_list{list: &x.Funds}) + if !f(fd_MsgTestDependenciesResponse_funds, value) { + return + } + } } // Has reports whether a field is populated. @@ -2065,6 +2126,8 @@ func (x *fastReflection_MsgTestDependenciesResponse) Has(fd protoreflect.FieldDe return x.BeforeGas != uint64(0) case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.after_gas": return x.AfterGas != uint64(0) + case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.funds": + return len(x.Funds) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse")) @@ -2089,6 +2152,8 @@ func (x *fastReflection_MsgTestDependenciesResponse) Clear(fd protoreflect.Field x.BeforeGas = uint64(0) case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.after_gas": x.AfterGas = uint64(0) + case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.funds": + x.Funds = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse")) @@ -2117,6 +2182,12 @@ func (x *fastReflection_MsgTestDependenciesResponse) Get(descriptor protoreflect case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.after_gas": value := x.AfterGas return protoreflect.ValueOfUint64(value) + case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.funds": + if len(x.Funds) == 0 { + return protoreflect.ValueOfList(&_MsgTestDependenciesResponse_5_list{}) + } + listValue := &_MsgTestDependenciesResponse_5_list{list: &x.Funds} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse")) @@ -2145,6 +2216,10 @@ func (x *fastReflection_MsgTestDependenciesResponse) Set(fd protoreflect.FieldDe x.BeforeGas = value.Uint() case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.after_gas": x.AfterGas = value.Uint() + case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.funds": + lv := value.List() + clv := lv.(*_MsgTestDependenciesResponse_5_list) + x.Funds = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse")) @@ -2165,6 +2240,12 @@ func (x *fastReflection_MsgTestDependenciesResponse) Set(fd protoreflect.FieldDe // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgTestDependenciesResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.funds": + if x.Funds == nil { + x.Funds = []*v1beta1.Coin{} + } + value := &_MsgTestDependenciesResponse_5_list{list: &x.Funds} + return protoreflect.ValueOfList(value) case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.chain_id": panic(fmt.Errorf("field chain_id of message cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse is not mutable")) case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.address": @@ -2194,6 +2275,9 @@ func (x *fastReflection_MsgTestDependenciesResponse) NewField(fd protoreflect.Fi return protoreflect.ValueOfUint64(uint64(0)) case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.after_gas": return protoreflect.ValueOfUint64(uint64(0)) + case "cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.funds": + list := []*v1beta1.Coin{} + return protoreflect.ValueOfList(&_MsgTestDependenciesResponse_5_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse")) @@ -2277,6 +2361,12 @@ func (x *fastReflection_MsgTestDependenciesResponse) ProtoMethods() *protoiface. if x.AfterGas != 0 { n += 1 + runtime.Sov(uint64(x.AfterGas)) } + if len(x.Funds) > 0 { + for _, e := range x.Funds { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -2306,6 +2396,22 @@ func (x *fastReflection_MsgTestDependenciesResponse) ProtoMethods() *protoiface. i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Funds) > 0 { + for iNdEx := len(x.Funds) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Funds[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] = 0x2a + } + } if x.AfterGas != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.AfterGas)) i-- @@ -2481,6 +2587,40 @@ func (x *fastReflection_MsgTestDependenciesResponse) ProtoMethods() *protoiface. break } } + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Funds", 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.Funds = append(x.Funds, &v1beta1.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Funds[len(x.Funds)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3469,6 +3609,8 @@ type MsgTestDependenciesResponse struct { BeforeGas uint64 `protobuf:"varint,3,opt,name=before_gas,json=beforeGas,proto3" json:"before_gas,omitempty"` // after_gas is used to test gas meter increasing. AfterGas uint64 `protobuf:"varint,4,opt,name=after_gas,json=afterGas,proto3" json:"after_gas,omitempty"` + // funds reports the funds from the implementation.Funds method. + Funds []*v1beta1.Coin `protobuf:"bytes,5,rep,name=funds,proto3" json:"funds,omitempty"` } func (x *MsgTestDependenciesResponse) Reset() { @@ -3519,6 +3661,13 @@ func (x *MsgTestDependenciesResponse) GetAfterGas() uint64 { return 0 } +func (x *MsgTestDependenciesResponse) GetFunds() []*v1beta1.Coin { + if x != nil { + return x.Funds + } + return nil +} + // QueryCounterRequest is used to query the counter value. type QueryCounterRequest struct { state protoimpl.MessageState @@ -3591,51 +3740,61 @@ var file_cosmos_accounts_testing_counter_v1_counter_proto_rawDesc = []byte{ 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x22, 0x2e, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, - 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, - 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x0a, 0x12, 0x4d, 0x73, 0x67, - 0x49, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, - 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x3b, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x49, 0x6e, - 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6e, 0x65, 0x77, 0x41, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x54, 0x65, 0x73, 0x74, 0x44, - 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x1b, - 0x4d, 0x73, 0x67, 0x54, 0x65, 0x73, 0x74, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, - 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x5f, 0x67, 0x61, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x47, 0x61, 0x73, 0x12, - 0x1b, 0x0a, 0x09, 0x61, 0x66, 0x74, 0x65, 0x72, 0x5f, 0x67, 0x61, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x08, 0x61, 0x66, 0x74, 0x65, 0x72, 0x47, 0x61, 0x73, 0x22, 0x15, 0x0a, 0x13, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x22, 0x2c, 0x0a, 0x14, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x42, 0xa2, 0x02, 0x0a, 0x26, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x67, 0x2e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x74, - 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x2f, 0x76, - 0x31, 0x3b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x04, 0x43, 0x41, - 0x54, 0x43, 0xaa, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x67, 0x5c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x2e, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x54, - 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x5c, 0x56, - 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x26, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, - 0x3a, 0x3a, 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, + 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2e, 0x0a, 0x07, + 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x69, 0x74, 0x69, + 0x61, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, + 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x11, 0x0a, 0x0f, + 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x2c, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x3b, 0x0a, + 0x1a, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, + 0x65, 0x77, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x09, 0x6e, 0x65, 0x77, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x4d, 0x73, + 0x67, 0x54, 0x65, 0x73, 0x74, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, + 0x73, 0x22, 0xf1, 0x01, 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x54, 0x65, 0x73, 0x74, 0x44, 0x65, 0x70, + 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, + 0x5f, 0x67, 0x61, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x62, 0x65, 0x66, 0x6f, + 0x72, 0x65, 0x47, 0x61, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x66, 0x74, 0x65, 0x72, 0x5f, 0x67, + 0x61, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x61, 0x66, 0x74, 0x65, 0x72, 0x47, + 0x61, 0x73, 0x12, 0x61, 0x0a, 0x05, 0x66, 0x75, 0x6e, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x30, 0xc8, 0xde, + 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, + 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x05, + 0x66, 0x75, 0x6e, 0x64, 0x73, 0x22, 0x15, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x2c, 0x0a, 0x14, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0xa2, 0x02, 0x0a, 0x26, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x04, 0x43, 0x41, 0x54, 0x43, 0xaa, 0x02, 0x22, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x54, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x31, + 0xca, 0x02, 0x22, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x5c, 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x2e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x54, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x5c, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x26, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, + 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x54, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x3a, 0x3a, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3660,13 +3819,15 @@ var file_cosmos_accounts_testing_counter_v1_counter_proto_goTypes = []interface{ (*MsgTestDependenciesResponse)(nil), // 5: cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse (*QueryCounterRequest)(nil), // 6: cosmos.accounts.testing.counter.v1.QueryCounterRequest (*QueryCounterResponse)(nil), // 7: cosmos.accounts.testing.counter.v1.QueryCounterResponse + (*v1beta1.Coin)(nil), // 8: cosmos.base.v1beta1.Coin } var file_cosmos_accounts_testing_counter_v1_counter_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 8, // 0: cosmos.accounts.testing.counter.v1.MsgTestDependenciesResponse.funds:type_name -> cosmos.base.v1beta1.Coin + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_cosmos_accounts_testing_counter_v1_counter_proto_init() } diff --git a/api/cosmos/accounts/v1/tx.pulsar.go b/api/cosmos/accounts/v1/tx.pulsar.go index 13444ee040..f91a9d4135 100644 --- a/api/cosmos/accounts/v1/tx.pulsar.go +++ b/api/cosmos/accounts/v1/tx.pulsar.go @@ -2,9 +2,11 @@ package accountsv1 import ( + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -14,11 +16,63 @@ import ( sync "sync" ) +var _ protoreflect.List = (*_MsgInit_4_list)(nil) + +type _MsgInit_4_list struct { + list *[]*v1beta1.Coin +} + +func (x *_MsgInit_4_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgInit_4_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgInit_4_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + (*x.list)[i] = concreteValue +} + +func (x *_MsgInit_4_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgInit_4_list) AppendMutable() protoreflect.Value { + v := new(v1beta1.Coin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgInit_4_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgInit_4_list) NewElement() protoreflect.Value { + v := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgInit_4_list) IsValid() bool { + return x.list != nil +} + var ( md_MsgInit protoreflect.MessageDescriptor fd_MsgInit_sender protoreflect.FieldDescriptor fd_MsgInit_account_type protoreflect.FieldDescriptor fd_MsgInit_message protoreflect.FieldDescriptor + fd_MsgInit_funds protoreflect.FieldDescriptor ) func init() { @@ -27,6 +81,7 @@ func init() { fd_MsgInit_sender = md_MsgInit.Fields().ByName("sender") fd_MsgInit_account_type = md_MsgInit.Fields().ByName("account_type") fd_MsgInit_message = md_MsgInit.Fields().ByName("message") + fd_MsgInit_funds = md_MsgInit.Fields().ByName("funds") } var _ protoreflect.Message = (*fastReflection_MsgInit)(nil) @@ -112,6 +167,12 @@ func (x *fastReflection_MsgInit) Range(f func(protoreflect.FieldDescriptor, prot return } } + if len(x.Funds) != 0 { + value := protoreflect.ValueOfList(&_MsgInit_4_list{list: &x.Funds}) + if !f(fd_MsgInit_funds, value) { + return + } + } } // Has reports whether a field is populated. @@ -133,6 +194,8 @@ func (x *fastReflection_MsgInit) Has(fd protoreflect.FieldDescriptor) bool { return x.AccountType != "" case "cosmos.accounts.v1.MsgInit.message": return x.Message != nil + case "cosmos.accounts.v1.MsgInit.funds": + return len(x.Funds) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit")) @@ -155,6 +218,8 @@ func (x *fastReflection_MsgInit) Clear(fd protoreflect.FieldDescriptor) { x.AccountType = "" case "cosmos.accounts.v1.MsgInit.message": x.Message = nil + case "cosmos.accounts.v1.MsgInit.funds": + x.Funds = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit")) @@ -180,6 +245,12 @@ func (x *fastReflection_MsgInit) Get(descriptor protoreflect.FieldDescriptor) pr case "cosmos.accounts.v1.MsgInit.message": value := x.Message return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.accounts.v1.MsgInit.funds": + if len(x.Funds) == 0 { + return protoreflect.ValueOfList(&_MsgInit_4_list{}) + } + listValue := &_MsgInit_4_list{list: &x.Funds} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit")) @@ -206,6 +277,10 @@ func (x *fastReflection_MsgInit) Set(fd protoreflect.FieldDescriptor, value prot x.AccountType = value.Interface().(string) case "cosmos.accounts.v1.MsgInit.message": x.Message = value.Message().Interface().(*anypb.Any) + case "cosmos.accounts.v1.MsgInit.funds": + lv := value.List() + clv := lv.(*_MsgInit_4_list) + x.Funds = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit")) @@ -231,6 +306,12 @@ func (x *fastReflection_MsgInit) Mutable(fd protoreflect.FieldDescriptor) protor x.Message = new(anypb.Any) } return protoreflect.ValueOfMessage(x.Message.ProtoReflect()) + case "cosmos.accounts.v1.MsgInit.funds": + if x.Funds == nil { + x.Funds = []*v1beta1.Coin{} + } + value := &_MsgInit_4_list{list: &x.Funds} + return protoreflect.ValueOfList(value) case "cosmos.accounts.v1.MsgInit.sender": panic(fmt.Errorf("field sender of message cosmos.accounts.v1.MsgInit is not mutable")) case "cosmos.accounts.v1.MsgInit.account_type": @@ -255,6 +336,9 @@ func (x *fastReflection_MsgInit) NewField(fd protoreflect.FieldDescriptor) proto case "cosmos.accounts.v1.MsgInit.message": m := new(anypb.Any) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.accounts.v1.MsgInit.funds": + list := []*v1beta1.Coin{} + return protoreflect.ValueOfList(&_MsgInit_4_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit")) @@ -336,6 +420,12 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { l = options.Size(x.Message) n += 1 + l + runtime.Sov(uint64(l)) } + if len(x.Funds) > 0 { + for _, e := range x.Funds { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -365,6 +455,22 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Funds) > 0 { + for iNdEx := len(x.Funds) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Funds[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] = 0x22 + } + } if x.Message != nil { encoded, err := options.Marshal(x.Message) if err != nil { @@ -542,6 +648,40 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Funds", 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.Funds = append(x.Funds, &v1beta1.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Funds[len(x.Funds)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1076,11 +1216,63 @@ func (x *fastReflection_MsgInitResponse) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.List = (*_MsgExecute_4_list)(nil) + +type _MsgExecute_4_list struct { + list *[]*v1beta1.Coin +} + +func (x *_MsgExecute_4_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgExecute_4_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgExecute_4_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + (*x.list)[i] = concreteValue +} + +func (x *_MsgExecute_4_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgExecute_4_list) AppendMutable() protoreflect.Value { + v := new(v1beta1.Coin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgExecute_4_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgExecute_4_list) NewElement() protoreflect.Value { + v := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgExecute_4_list) IsValid() bool { + return x.list != nil +} + var ( md_MsgExecute protoreflect.MessageDescriptor fd_MsgExecute_sender protoreflect.FieldDescriptor fd_MsgExecute_target protoreflect.FieldDescriptor fd_MsgExecute_message protoreflect.FieldDescriptor + fd_MsgExecute_funds protoreflect.FieldDescriptor ) func init() { @@ -1089,6 +1281,7 @@ func init() { fd_MsgExecute_sender = md_MsgExecute.Fields().ByName("sender") fd_MsgExecute_target = md_MsgExecute.Fields().ByName("target") fd_MsgExecute_message = md_MsgExecute.Fields().ByName("message") + fd_MsgExecute_funds = md_MsgExecute.Fields().ByName("funds") } var _ protoreflect.Message = (*fastReflection_MsgExecute)(nil) @@ -1174,6 +1367,12 @@ func (x *fastReflection_MsgExecute) Range(f func(protoreflect.FieldDescriptor, p return } } + if len(x.Funds) != 0 { + value := protoreflect.ValueOfList(&_MsgExecute_4_list{list: &x.Funds}) + if !f(fd_MsgExecute_funds, value) { + return + } + } } // Has reports whether a field is populated. @@ -1195,6 +1394,8 @@ func (x *fastReflection_MsgExecute) Has(fd protoreflect.FieldDescriptor) bool { return x.Target != "" case "cosmos.accounts.v1.MsgExecute.message": return x.Message != nil + case "cosmos.accounts.v1.MsgExecute.funds": + return len(x.Funds) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute")) @@ -1217,6 +1418,8 @@ func (x *fastReflection_MsgExecute) Clear(fd protoreflect.FieldDescriptor) { x.Target = "" case "cosmos.accounts.v1.MsgExecute.message": x.Message = nil + case "cosmos.accounts.v1.MsgExecute.funds": + x.Funds = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute")) @@ -1242,6 +1445,12 @@ func (x *fastReflection_MsgExecute) Get(descriptor protoreflect.FieldDescriptor) case "cosmos.accounts.v1.MsgExecute.message": value := x.Message return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.accounts.v1.MsgExecute.funds": + if len(x.Funds) == 0 { + return protoreflect.ValueOfList(&_MsgExecute_4_list{}) + } + listValue := &_MsgExecute_4_list{list: &x.Funds} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute")) @@ -1268,6 +1477,10 @@ func (x *fastReflection_MsgExecute) Set(fd protoreflect.FieldDescriptor, value p x.Target = value.Interface().(string) case "cosmos.accounts.v1.MsgExecute.message": x.Message = value.Message().Interface().(*anypb.Any) + case "cosmos.accounts.v1.MsgExecute.funds": + lv := value.List() + clv := lv.(*_MsgExecute_4_list) + x.Funds = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute")) @@ -1293,6 +1506,12 @@ func (x *fastReflection_MsgExecute) Mutable(fd protoreflect.FieldDescriptor) pro x.Message = new(anypb.Any) } return protoreflect.ValueOfMessage(x.Message.ProtoReflect()) + case "cosmos.accounts.v1.MsgExecute.funds": + if x.Funds == nil { + x.Funds = []*v1beta1.Coin{} + } + value := &_MsgExecute_4_list{list: &x.Funds} + return protoreflect.ValueOfList(value) case "cosmos.accounts.v1.MsgExecute.sender": panic(fmt.Errorf("field sender of message cosmos.accounts.v1.MsgExecute is not mutable")) case "cosmos.accounts.v1.MsgExecute.target": @@ -1317,6 +1536,9 @@ func (x *fastReflection_MsgExecute) NewField(fd protoreflect.FieldDescriptor) pr case "cosmos.accounts.v1.MsgExecute.message": m := new(anypb.Any) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.accounts.v1.MsgExecute.funds": + list := []*v1beta1.Coin{} + return protoreflect.ValueOfList(&_MsgExecute_4_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute")) @@ -1398,6 +1620,12 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods { l = options.Size(x.Message) n += 1 + l + runtime.Sov(uint64(l)) } + if len(x.Funds) > 0 { + for _, e := range x.Funds { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1427,6 +1655,22 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Funds) > 0 { + for iNdEx := len(x.Funds) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Funds[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] = 0x22 + } + } if x.Message != nil { encoded, err := options.Marshal(x.Message) if err != nil { @@ -1604,6 +1848,40 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Funds", 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.Funds = append(x.Funds, &v1beta1.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Funds[len(x.Funds)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3151,6 +3429,9 @@ type MsgInit struct { AccountType string `protobuf:"bytes,2,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"` // message is the message to be sent to the account. Message *anypb.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // funds contains the coins that the account wants to + // send alongside the request. + Funds []*v1beta1.Coin `protobuf:"bytes,4,rep,name=funds,proto3" json:"funds,omitempty"` } func (x *MsgInit) Reset() { @@ -3194,6 +3475,13 @@ func (x *MsgInit) GetMessage() *anypb.Any { return nil } +func (x *MsgInit) GetFunds() []*v1beta1.Coin { + if x != nil { + return x.Funds + } + return nil +} + // MsgInitResponse defines the Create response type for the Msg/Create RPC method. type MsgInitResponse struct { state protoimpl.MessageState @@ -3252,6 +3540,9 @@ type MsgExecute struct { Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"` // message is the message to be sent to the account. Message *anypb.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // funds contains the coins that the account wants to + // send alongside the request. + Funds []*v1beta1.Coin `protobuf:"bytes,4,rep,name=funds,proto3" json:"funds,omitempty"` } func (x *MsgExecute) Reset() { @@ -3295,6 +3586,13 @@ func (x *MsgExecute) GetMessage() *anypb.Any { return nil } +func (x *MsgExecute) GetFunds() []*v1beta1.Coin { + if x != nil { + return x.Funds + } + return nil +} + // MsgExecuteResponse defines the Execute response type for the Msg/Execute RPC method. type MsgExecuteResponse struct { state protoimpl.MessageState @@ -3428,78 +3726,93 @@ var file_cosmos_accounts_v1_tx_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x81, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, - 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x6c, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x49, 0x6e, - 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x30, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe4, 0x01, 0x0a, 0x07, 0x4d, 0x73, + 0x67, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, + 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x2e, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x61, 0x0a, 0x05, 0x66, 0x75, 0x6e, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, + 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x05, 0x66, 0x75, + 0x6e, 0x64, 0x73, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x22, 0x6c, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x30, 0x0a, 0x08, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xdc, + 0x01, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2e, 0x0a, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x61, 0x0a, + 0x05, 0x66, 0x75, 0x6e, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, + 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x05, 0x66, 0x75, 0x6e, 0x64, 0x73, + 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x46, 0x0a, + 0x12, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x79, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, - 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x22, 0x46, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7d, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x45, - 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, - 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, - 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x55, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, - 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x22, 0x63, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x45, 0x78, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7d, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x6e, + 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x6e, 0x64, + 0x6c, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x62, 0x75, 0x6e, + 0x64, 0x6c, 0x65, 0x72, 0x22, 0x63, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x47, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x32, 0x8e, 0x02, 0x0a, 0x03, 0x4d, 0x73, + 0x67, 0x12, 0x48, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, + 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x07, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, + 0x0a, 0x0d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, + 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, + 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, - 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x32, 0x8e, 0x02, 0x0a, - 0x03, 0x4d, 0x73, 0x67, 0x12, 0x48, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x1b, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, - 0x0a, 0x07, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x63, 0x0a, 0x0d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, - 0x6c, 0x65, 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, - 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xbb, 0x01, - 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, - 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, - 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xbb, 0x01, 0x0a, 0x16, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x76, 0x31, + 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3523,27 +3836,30 @@ var file_cosmos_accounts_v1_tx_proto_goTypes = []interface{}{ (*MsgExecuteBundle)(nil), // 4: cosmos.accounts.v1.MsgExecuteBundle (*MsgExecuteBundleResponse)(nil), // 5: cosmos.accounts.v1.MsgExecuteBundleResponse (*anypb.Any)(nil), // 6: google.protobuf.Any - (*UserOperation)(nil), // 7: cosmos.accounts.v1.UserOperation - (*UserOperationResponse)(nil), // 8: cosmos.accounts.v1.UserOperationResponse + (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin + (*UserOperation)(nil), // 8: cosmos.accounts.v1.UserOperation + (*UserOperationResponse)(nil), // 9: cosmos.accounts.v1.UserOperationResponse } var file_cosmos_accounts_v1_tx_proto_depIdxs = []int32{ - 6, // 0: cosmos.accounts.v1.MsgInit.message:type_name -> google.protobuf.Any - 6, // 1: cosmos.accounts.v1.MsgInitResponse.response:type_name -> google.protobuf.Any - 6, // 2: cosmos.accounts.v1.MsgExecute.message:type_name -> google.protobuf.Any - 6, // 3: cosmos.accounts.v1.MsgExecuteResponse.response:type_name -> google.protobuf.Any - 7, // 4: cosmos.accounts.v1.MsgExecuteBundle.operations:type_name -> cosmos.accounts.v1.UserOperation - 8, // 5: cosmos.accounts.v1.MsgExecuteBundleResponse.responses:type_name -> cosmos.accounts.v1.UserOperationResponse - 0, // 6: cosmos.accounts.v1.Msg.Init:input_type -> cosmos.accounts.v1.MsgInit - 2, // 7: cosmos.accounts.v1.Msg.Execute:input_type -> cosmos.accounts.v1.MsgExecute - 4, // 8: cosmos.accounts.v1.Msg.ExecuteBundle:input_type -> cosmos.accounts.v1.MsgExecuteBundle - 1, // 9: cosmos.accounts.v1.Msg.Init:output_type -> cosmos.accounts.v1.MsgInitResponse - 3, // 10: cosmos.accounts.v1.Msg.Execute:output_type -> cosmos.accounts.v1.MsgExecuteResponse - 5, // 11: cosmos.accounts.v1.Msg.ExecuteBundle:output_type -> cosmos.accounts.v1.MsgExecuteBundleResponse - 9, // [9:12] is the sub-list for method output_type - 6, // [6:9] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 6, // 0: cosmos.accounts.v1.MsgInit.message:type_name -> google.protobuf.Any + 7, // 1: cosmos.accounts.v1.MsgInit.funds:type_name -> cosmos.base.v1beta1.Coin + 6, // 2: cosmos.accounts.v1.MsgInitResponse.response:type_name -> google.protobuf.Any + 6, // 3: cosmos.accounts.v1.MsgExecute.message:type_name -> google.protobuf.Any + 7, // 4: cosmos.accounts.v1.MsgExecute.funds:type_name -> cosmos.base.v1beta1.Coin + 6, // 5: cosmos.accounts.v1.MsgExecuteResponse.response:type_name -> google.protobuf.Any + 8, // 6: cosmos.accounts.v1.MsgExecuteBundle.operations:type_name -> cosmos.accounts.v1.UserOperation + 9, // 7: cosmos.accounts.v1.MsgExecuteBundleResponse.responses:type_name -> cosmos.accounts.v1.UserOperationResponse + 0, // 8: cosmos.accounts.v1.Msg.Init:input_type -> cosmos.accounts.v1.MsgInit + 2, // 9: cosmos.accounts.v1.Msg.Execute:input_type -> cosmos.accounts.v1.MsgExecute + 4, // 10: cosmos.accounts.v1.Msg.ExecuteBundle:input_type -> cosmos.accounts.v1.MsgExecuteBundle + 1, // 11: cosmos.accounts.v1.Msg.Init:output_type -> cosmos.accounts.v1.MsgInitResponse + 3, // 12: cosmos.accounts.v1.Msg.Execute:output_type -> cosmos.accounts.v1.MsgExecuteResponse + 5, // 13: cosmos.accounts.v1.Msg.ExecuteBundle:output_type -> cosmos.accounts.v1.MsgExecuteBundleResponse + 11, // [11:14] is the sub-list for method output_type + 8, // [8:11] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_cosmos_accounts_v1_tx_proto_init() } diff --git a/core/appmodule/module.go b/core/appmodule/module.go index 192dbaacc3..b40ed444c7 100644 --- a/core/appmodule/module.go +++ b/core/appmodule/module.go @@ -4,6 +4,7 @@ import ( "context" "google.golang.org/grpc" + "google.golang.org/protobuf/runtime/protoiface" ) // AppModule is a tag interface for app module implementations to use as a basis @@ -86,3 +87,16 @@ type HasEndBlocker interface { // a block. EndBlock(context.Context) error } + +// MsgHandlerRouter is implemented by the runtime provider. +type MsgHandlerRouter interface { + // RegisterHandler is called by modules to register msg handler functions. + RegisterHandler(name string, handler func(ctx context.Context, msg protoiface.MessageV1) (msgResp protoiface.MessageV1, err error)) +} + +// HasMsgHandler is implemented by modules that instead of exposing msg server expose +// a set of handlers. +type HasMsgHandler interface { + // RegisterMsgHandlers is implemented by the module that will register msg handlers. + RegisterMsgHandlers(router MsgHandlerRouter) +} diff --git a/proto/cosmos/accounts/testing/counter/v1/counter.proto b/proto/cosmos/accounts/testing/counter/v1/counter.proto index 740e83b1c2..114aeb1b9a 100644 --- a/proto/cosmos/accounts/testing/counter/v1/counter.proto +++ b/proto/cosmos/accounts/testing/counter/v1/counter.proto @@ -4,6 +4,9 @@ package cosmos.accounts.testing.counter.v1; option go_package = "cosmossdk.io/x/accounts/testing/counter/v1"; +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; + // MsgInit defines a message which initializes the counter with a given amount. message MsgInit { // initial_value is the initial amount to set the counter to. @@ -39,6 +42,9 @@ message MsgTestDependenciesResponse { uint64 before_gas = 3; // after_gas is used to test gas meter increasing. uint64 after_gas = 4; + // funds reports the funds from the implementation.Funds method. + repeated cosmos.base.v1beta1.Coin funds = 5 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; } // QueryCounterRequest is used to query the counter value. diff --git a/proto/cosmos/accounts/v1/tx.proto b/proto/cosmos/accounts/v1/tx.proto index 0e5460ece8..824fe7cbb4 100644 --- a/proto/cosmos/accounts/v1/tx.proto +++ b/proto/cosmos/accounts/v1/tx.proto @@ -7,6 +7,8 @@ option go_package = "cosmossdk.io/x/accounts/v1"; import "google/protobuf/any.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos/accounts/v1/account_abstraction.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; // Msg defines the Msg service for the x/accounts module. service Msg { @@ -33,6 +35,10 @@ message MsgInit { string account_type = 2; // message is the message to be sent to the account. google.protobuf.Any message = 3; + // funds contains the coins that the account wants to + // send alongside the request. + repeated cosmos.base.v1beta1.Coin funds = 4 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; } // MsgInitResponse defines the Create response type for the Msg/Create RPC method. @@ -52,6 +58,10 @@ message MsgExecute { string target = 2; // message is the message to be sent to the account. google.protobuf.Any message = 3; + // funds contains the coins that the account wants to + // send alongside the request. + repeated cosmos.base.v1beta1.Coin funds = 4 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; } // MsgExecuteResponse defines the Execute response type for the Msg/Execute RPC method. diff --git a/tests/e2e/accounts/account_abstraction_test.go b/tests/e2e/accounts/account_abstraction_test.go index 7a04c91305..cc7c66aa70 100644 --- a/tests/e2e/accounts/account_abstraction_test.go +++ b/tests/e2e/accounts/account_abstraction_test.go @@ -35,12 +35,12 @@ func TestAccountAbstraction(t *testing.T) { _, aaAddr, err := ak.Init(ctx, "aa_minimal", accCreator, &rotationv1.MsgInit{ PubKeyBytes: privKey.PubKey().Bytes(), - }) + }, nil) require.NoError(t, err) _, aaFullAddr, err := ak.Init(ctx, "aa_full", accCreator, &rotationv1.MsgInit{ PubKeyBytes: privKey.PubKey().Bytes(), - }) + }, nil) require.NoError(t, err) aaAddrStr, err := app.AuthKeeper.AddressCodec().BytesToString(aaAddr) diff --git a/tests/e2e/accounts/wiring_test.go b/tests/e2e/accounts/wiring_test.go index 6fe1905f8d..86e8677940 100644 --- a/tests/e2e/accounts/wiring_test.go +++ b/tests/e2e/accounts/wiring_test.go @@ -6,7 +6,9 @@ import ( "testing" "cosmossdk.io/core/header" + storetypes "cosmossdk.io/store/types" counterv1 "cosmossdk.io/x/accounts/testing/counter/v1" + "cosmossdk.io/x/bank/testutil" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" ) @@ -17,24 +19,36 @@ import ( // - binary codec // - header service // - gas service +// - funds func TestDependencies(t *testing.T) { app := setupApp(t) ak := app.AccountsKeeper ctx := sdk.NewContext(app.CommitMultiStore(), false, app.Logger()).WithHeaderInfo(header.Info{ChainID: "chain-id"}) + ctx = ctx.WithGasMeter(storetypes.NewGasMeter(500_000)) _, counterAddr, err := ak.Init(ctx, "counter", accCreator, &counterv1.MsgInit{ InitialValue: 0, - }) + }, nil) require.NoError(t, err) // test dependencies - r, err := ak.Execute(ctx, counterAddr, []byte("test"), &counterv1.MsgTestDependencies{}) + creatorInitFunds := sdk.NewCoins(sdk.NewInt64Coin("stake", 100_000)) + err = testutil.FundAccount(ctx, app.BankKeeper, accCreator, creatorInitFunds) + require.NoError(t, err) + sentFunds := sdk.NewCoins(sdk.NewInt64Coin("stake", 50_000)) + r, err := ak.Execute( + ctx, + counterAddr, + accCreator, + &counterv1.MsgTestDependencies{}, + sentFunds, + ) require.NoError(t, err) res := r.(*counterv1.MsgTestDependenciesResponse) // test gas require.NotZero(t, res.BeforeGas) require.NotZero(t, res.AfterGas) - require.Equal(t, uint64(10), res.AfterGas-res.BeforeGas) + require.Equal(t, int(uint64(10)), int(res.AfterGas-res.BeforeGas)) // test header service require.Equal(t, ctx.HeaderInfo().ChainID, res.ChainId) @@ -43,4 +57,11 @@ func TestDependencies(t *testing.T) { wantAddr, err := app.AuthKeeper.AddressCodec().BytesToString(counterAddr) require.NoError(t, err) require.Equal(t, wantAddr, res.Address) + + // test funds + creatorFunds := app.BankKeeper.GetAllBalances(ctx, accCreator) + require.Equal(t, creatorInitFunds.Sub(sentFunds...), creatorFunds) + + accFunds := app.BankKeeper.GetAllBalances(ctx, counterAddr) + require.Equal(t, sentFunds, accFunds) } diff --git a/x/accounts/accountstd/exports.go b/x/accounts/accountstd/exports.go index c29272e6d6..2635351e3c 100644 --- a/x/accounts/accountstd/exports.go +++ b/x/accounts/accountstd/exports.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/x/accounts/internal/implementation" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" ) @@ -77,6 +78,10 @@ func SenderIsAccountsModule(ctx context.Context) bool { return bytes.Equal(Sender(ctx), accountsModuleAddress) } +// Funds returns if any funds were sent during the execute or init request. In queries this +// returns nil. +func Funds(ctx context.Context) sdk.Coins { return implementation.Funds(ctx) } + // ExecModule can be used to execute a message towards a module. func ExecModule[Resp any, RespProto implementation.ProtoMsgG[Resp], Req any, ReqProto implementation.ProtoMsgG[Req]](ctx context.Context, msg ReqProto) (RespProto, error) { return implementation.ExecModule[Resp, RespProto, Req, ReqProto](ctx, msg) diff --git a/x/accounts/coin_transfer.go b/x/accounts/coin_transfer.go new file mode 100644 index 0000000000..9d200adba2 --- /dev/null +++ b/x/accounts/coin_transfer.go @@ -0,0 +1,52 @@ +package accounts + +import ( + "google.golang.org/protobuf/proto" + + bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + "cosmossdk.io/core/address" + "cosmossdk.io/x/accounts/internal/implementation" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// protoV2GogoWrapper is a wrapper of a protov2 message into a gogo message. +// this is exceptionally allowed to enable accounts to be decoupled from +// the SDK, since x/accounts can support only protov1 in its APIs. +// But in order to keep it decoupled from the SDK we need to use the API module. +// This is a hack to make an API module type work in x/accounts. Once the SDK +// has protov2 support, we can migrate internal/implementation/encoding.go to +// work with protov2. +type protoV2GogoWrapper struct { + gogoProtoPlusV2 +} + +func (h protoV2GogoWrapper) XXX_MessageName() string { + return string(proto.MessageName(h.gogoProtoPlusV2)) +} + +func defaultCoinsTransferMsgFunc(addrCdc address.Codec) coinsTransferMsgFunc { + return func(from, to []byte, coins sdk.Coins) (implementation.ProtoMsg, implementation.ProtoMsg, error) { + fromAddr, err := addrCdc.BytesToString(from) + if err != nil { + return nil, nil, err + } + toAddr, err := addrCdc.BytesToString(to) + if err != nil { + return nil, nil, err + } + v2Coins := make([]*v1beta1.Coin, len(coins)) + for i, coin := range coins { + v2Coins[i] = &v1beta1.Coin{ + Denom: coin.Denom, + Amount: coin.Amount.String(), + } + } + return protoV2GogoWrapper{&bankv1beta1.MsgSend{ + FromAddress: fromAddr, + ToAddress: toAddr, + Amount: v2Coins, + }}, new(bankv1beta1.MsgSendResponse), nil + } +} diff --git a/x/accounts/genesis_test.go b/x/accounts/genesis_test.go index 561c14694f..f81bd669b5 100644 --- a/x/accounts/genesis_test.go +++ b/x/accounts/genesis_test.go @@ -20,15 +20,15 @@ func TestGenesis(t *testing.T) { // we init two accounts of the same type // we set counter to 10 - _, addr1, err := k.Init(ctx, "test", []byte("sender"), &types.Empty{}) + _, addr1, err := k.Init(ctx, "test", []byte("sender"), &types.Empty{}, nil) require.NoError(t, err) - _, err = k.Execute(ctx, addr1, []byte("sender"), &types.UInt64Value{Value: 10}) + _, err = k.Execute(ctx, addr1, []byte("sender"), &types.UInt64Value{Value: 10}, nil) require.NoError(t, err) // we set counter to 20 - _, addr2, err := k.Init(ctx, "test", []byte("sender"), &types.Empty{}) + _, addr2, err := k.Init(ctx, "test", []byte("sender"), &types.Empty{}, nil) require.NoError(t, err) - _, err = k.Execute(ctx, addr2, []byte("sender"), &types.UInt64Value{Value: 20}) + _, err = k.Execute(ctx, addr2, []byte("sender"), &types.UInt64Value{Value: 20}, nil) require.NoError(t, err) // export state diff --git a/x/accounts/internal/implementation/context.go b/x/accounts/internal/implementation/context.go index 5ae2c2fe3c..b47b7843a7 100644 --- a/x/accounts/internal/implementation/context.go +++ b/x/accounts/internal/implementation/context.go @@ -9,6 +9,8 @@ import ( "cosmossdk.io/core/header" "cosmossdk.io/core/store" "cosmossdk.io/x/accounts/internal/prefixstore" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var AccountStatePrefix = collections.NewPrefix(255) @@ -25,12 +27,21 @@ type contextValue struct { store store.KVStore // store is the prefixed store for the account. sender []byte // sender is the address of the entity invoking the account action. whoami []byte // whoami is the address of the account being invoked. + funds sdk.Coins // funds reports the coins sent alongside the request. parentContext context.Context // parentContext that was used to build the account context. moduleExec ModuleExecFunc // moduleExec is a function that executes a module message, when the resp type is known. moduleExecUntyped ModuleExecUntypedFunc // moduleExecUntyped is a function that executes a module message, when the resp type is unknown. moduleQuery ModuleQueryFunc // moduleQuery is a function that queries a module. } +func addCtx(ctx context.Context, value contextValue) context.Context { + return context.WithValue(ctx, contextKey{}, value) +} + +func getCtx(ctx context.Context) contextValue { + return ctx.Value(contextKey{}).(contextValue) +} + // MakeAccountContext creates a new account execution context given: // storeSvc: which fetches the x/accounts module store. // accountAddr: the address of the account being invoked, which is used to give the @@ -44,14 +55,16 @@ func MakeAccountContext( accNumber uint64, accountAddr []byte, sender []byte, + funds sdk.Coins, moduleExec ModuleExecFunc, moduleExecUntyped ModuleExecUntypedFunc, moduleQuery ModuleQueryFunc, ) context.Context { - return context.WithValue(ctx, contextKey{}, contextValue{ + return addCtx(ctx, contextValue{ store: makeAccountStore(ctx, storeSvc, accNumber), sender: sender, whoami: accountAddr, + funds: funds, parentContext: ctx, moduleExec: moduleExec, moduleExecUntyped: moduleExecUntyped, @@ -71,7 +84,7 @@ func makeAccountStore(ctx context.Context, storeSvc store.KVStoreService, accNum // ExecModuleUntyped can be used to execute a message towards a module, when the response type is unknown. func ExecModuleUntyped(ctx context.Context, msg ProtoMsg) (ProtoMsg, error) { // get sender - v := ctx.Value(contextKey{}).(contextValue) + v := getCtx(ctx) resp, err := v.moduleExecUntyped(v.parentContext, v.whoami, msg) if err != nil { @@ -84,7 +97,7 @@ func ExecModuleUntyped(ctx context.Context, msg ProtoMsg) (ProtoMsg, error) { // ExecModule can be used to execute a message towards a module. func ExecModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG[Req]](ctx context.Context, msg ReqProto) (RespProto, error) { // get sender - v := ctx.Value(contextKey{}).(contextValue) + v := getCtx(ctx) // execute module, unwrapping the original context. resp := RespProto(new(Resp)) @@ -100,7 +113,7 @@ func ExecModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG func QueryModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG[Req]](ctx context.Context, req ReqProto) (RespProto, error) { // we do not need to check the sender in a query because it is not a state transition. // we also unwrap the original context. - v := ctx.Value(contextKey{}).(contextValue) + v := getCtx(ctx) resp := RespProto(new(Resp)) err := v.moduleQuery(v.parentContext, req, resp) if err != nil { @@ -110,20 +123,21 @@ func QueryModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsg } // openKVStore returns the prefixed store for the account given the context. -func openKVStore(ctx context.Context) store.KVStore { - return ctx.Value(contextKey{}).(contextValue).store -} +func openKVStore(ctx context.Context) store.KVStore { return getCtx(ctx).store } // Sender returns the address of the entity invoking the account action. func Sender(ctx context.Context) []byte { - return ctx.Value(contextKey{}).(contextValue).sender + return getCtx(ctx).sender } // Whoami returns the address of the account being invoked. func Whoami(ctx context.Context) []byte { - return ctx.Value(contextKey{}).(contextValue).whoami + return getCtx(ctx).whoami } +// Funds returns the funds associated with the execution context. +func Funds(ctx context.Context) sdk.Coins { return getCtx(ctx).funds } + type headerService struct{ hs header.Service } func (h headerService) GetHeaderInfo(ctx context.Context) header.Info { @@ -132,9 +146,7 @@ func (h headerService) GetHeaderInfo(ctx context.Context) header.Info { var _ gas.Service = (*gasService)(nil) -type gasService struct { - gs gas.Service -} +type gasService struct{ gs gas.Service } func (g gasService) GetGasMeter(ctx context.Context) gas.Meter { return g.gs.GetGasMeter(getParentContext(ctx)) @@ -145,17 +157,15 @@ func (g gasService) GetBlockGasMeter(ctx context.Context) gas.Meter { } func (g gasService) WithGasMeter(ctx context.Context, meter gas.Meter) context.Context { - v := ctx.Value(contextKey{}).(contextValue) + v := getCtx(ctx) v.parentContext = g.gs.WithGasMeter(v.parentContext, meter) return context.WithValue(v.parentContext, contextKey{}, v) } func (g gasService) WithBlockGasMeter(ctx context.Context, meter gas.Meter) context.Context { - v := ctx.Value(contextKey{}).(contextValue) + v := getCtx(ctx) v.parentContext = g.gs.WithBlockGasMeter(v.parentContext, meter) - return context.WithValue(v.parentContext, contextKey{}, v) + return addCtx(v.parentContext, v) } -func getParentContext(ctx context.Context) context.Context { - return ctx.Value(contextKey{}).(contextValue).parentContext -} +func getParentContext(ctx context.Context) context.Context { return getCtx(ctx).parentContext } diff --git a/x/accounts/internal/implementation/context_test.go b/x/accounts/internal/implementation/context_test.go index 7aa33575ea..d5c3965798 100644 --- a/x/accounts/internal/implementation/context_test.go +++ b/x/accounts/internal/implementation/context_test.go @@ -18,7 +18,7 @@ func TestMakeAccountContext(t *testing.T) { sender := []byte("sender") sb := collections.NewSchemaBuilderFromAccessor(openKVStore) - accountCtx := MakeAccountContext(originalContext, storeService, 1, accountAddr, sender, nil, nil, nil) + accountCtx := MakeAccountContext(originalContext, storeService, 1, accountAddr, sender, nil, nil, nil, nil) // ensure whoami require.Equal(t, accountAddr, Whoami(accountCtx)) @@ -44,7 +44,7 @@ func TestMakeAccountContext(t *testing.T) { require.Equal(t, []byte{0, 0, 0, 0, 0, 0, 3, 232}, value) // ensure calling ExecModule works - accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module"), []byte("invoker"), func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { + accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module"), []byte("invoker"), nil, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { // ensure we unwrapped the context when invoking a module call require.Equal(t, originalContext, ctx) Merge(msgResp, &types.StringValue{Value: "module exec was called"}) @@ -56,7 +56,7 @@ func TestMakeAccountContext(t *testing.T) { require.True(t, Equal(&types.StringValue{Value: "module exec was called"}, resp)) // ensure calling ExecModuleUntyped works - accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module-untyped"), []byte("invoker"), nil, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module-untyped"), []byte("invoker"), nil, nil, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { require.Equal(t, originalContext, ctx) return &types.StringValue{Value: "module exec untyped was called"}, nil }, nil) @@ -67,7 +67,7 @@ func TestMakeAccountContext(t *testing.T) { // ensure calling QueryModule works, also by setting everything else communication related to nil // we can guarantee that exec paths do not impact query paths. - accountCtx = MakeAccountContext(originalContext, storeService, 1, nil, nil, nil, nil, func(ctx context.Context, req, resp ProtoMsg) error { + accountCtx = MakeAccountContext(originalContext, storeService, 1, nil, nil, nil, nil, nil, func(ctx context.Context, req, resp ProtoMsg) error { require.Equal(t, originalContext, ctx) Merge(resp, &types.StringValue{Value: "module query was called"}) return nil diff --git a/x/accounts/keeper.go b/x/accounts/keeper.go index c42d4778b3..89ef637f80 100644 --- a/x/accounts/keeper.go +++ b/x/accounts/keeper.go @@ -22,6 +22,7 @@ import ( "cosmossdk.io/x/accounts/internal/implementation" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( @@ -39,6 +40,11 @@ var ( AccountByNumber = collections.NewPrefix(2) ) +// coinsTransferMsgFunc defines a function that creates a message to send coins from one +// address to the other, and also a message that parses such response. +// This in most cases will be implemented as a bank.MsgSend creator, but we keep x/accounts independent of bank. +type coinsTransferMsgFunc = func(from, to []byte, coins sdk.Coins) (implementation.ProtoMsg, implementation.ProtoMsg, error) + // QueryRouter represents a router which can be used to route queries to the correct module. // It returns the handler given the message name, if multiple handlers are returned, then // it is up to the caller to choose which one to call. @@ -79,17 +85,19 @@ func NewKeeper( ) (Keeper, error) { sb := collections.NewSchemaBuilder(ss) keeper := Keeper{ - storeService: ss, - eventService: es, - addressCodec: addressCodec, - branchExecutor: bs, - msgRouter: execRouter, - signerProvider: signerProvider, - queryRouter: queryRouter, - AccountNumber: collections.NewSequence(sb, AccountNumberKey, "account_number"), - AccountsByType: collections.NewMap(sb, AccountTypeKeyPrefix, "accounts_by_type", collections.BytesKey, collections.StringValue), - AccountByNumber: collections.NewMap(sb, AccountByNumber, "account_by_number", collections.BytesKey, collections.Uint64Value), - AccountsState: collections.NewMap(sb, implementation.AccountStatePrefix, "accounts_state", collections.PairKeyCodec(collections.Uint64Key, collections.BytesKey), collections.BytesValue), + storeService: ss, + eventService: es, + addressCodec: addressCodec, + branchExecutor: bs, + msgRouter: execRouter, + signerProvider: signerProvider, + queryRouter: queryRouter, + makeSendCoinsMsg: defaultCoinsTransferMsgFunc(addressCodec), + Schema: collections.Schema{}, + AccountNumber: collections.NewSequence(sb, AccountNumberKey, "account_number"), + AccountsByType: collections.NewMap(sb, AccountTypeKeyPrefix, "accounts_by_type", collections.BytesKey, collections.StringValue), + AccountByNumber: collections.NewMap(sb, AccountByNumber, "account_by_number", collections.BytesKey, collections.Uint64Value), + AccountsState: collections.NewMap(sb, implementation.AccountStatePrefix, "accounts_state", collections.PairKeyCodec(collections.Uint64Key, collections.BytesKey), collections.BytesValue), } schema, err := sb.Build() @@ -107,13 +115,14 @@ func NewKeeper( type Keeper struct { // deps coming from the runtime - storeService store.KVStoreService - eventService event.Service - addressCodec address.Codec - branchExecutor branch.Service - msgRouter MsgRouter - signerProvider SignerProvider - queryRouter QueryRouter + storeService store.KVStoreService + eventService event.Service + addressCodec address.Codec + branchExecutor branch.Service + msgRouter MsgRouter + signerProvider SignerProvider + queryRouter QueryRouter + makeSendCoinsMsg coinsTransferMsgFunc accounts map[string]implementation.Implementation @@ -139,6 +148,7 @@ func (k Keeper) Init( accountType string, creator []byte, initRequest implementation.ProtoMsg, + funds sdk.Coins, ) (implementation.ProtoMsg, []byte, error) { impl, err := k.getImplementation(accountType) if err != nil { @@ -157,8 +167,13 @@ func (k Keeper) Init( return nil, nil, err } + // send funds, if provided + err = k.maybeSendFunds(ctx, creator, accountAddr, funds) + if err != nil { + return nil, nil, fmt.Errorf("unable to transfer funds: %w", err) + } // make the context and init the account - ctx = k.makeAccountContext(ctx, num, accountAddr, creator, false) + ctx = k.makeAccountContext(ctx, num, accountAddr, creator, funds, false) resp, err := impl.Init(ctx, initRequest) if err != nil { return nil, nil, err @@ -181,6 +196,7 @@ func (k Keeper) Execute( accountAddr []byte, sender []byte, execRequest implementation.ProtoMsg, + funds sdk.Coins, ) (implementation.ProtoMsg, error) { // get account type accountType, err := k.AccountsByType.Get(ctx, accountAddr) @@ -203,8 +219,13 @@ func (k Keeper) Execute( return nil, err } + err = k.maybeSendFunds(ctx, sender, accountAddr, funds) + if err != nil { + return nil, fmt.Errorf("unable to transfer coins to account: %w", err) + } + // make the context and execute the account state transition. - ctx = k.makeAccountContext(ctx, accountNum, accountAddr, sender, false) + ctx = k.makeAccountContext(ctx, accountNum, accountAddr, sender, funds, false) return impl.Execute(ctx, execRequest) } @@ -235,7 +256,7 @@ func (k Keeper) Query( } // make the context and execute the account query - ctx = k.makeAccountContext(ctx, accountNum, accountAddr, nil, true) + ctx = k.makeAccountContext(ctx, accountNum, accountAddr, nil, nil, true) return impl.Query(ctx, queryRequest) } @@ -254,7 +275,7 @@ func (k Keeper) makeAddress(accNum uint64) ([]byte, error) { } // makeAccountContext makes a new context for the given account. -func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, accountAddr, sender []byte, isQuery bool) context.Context { +func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, accountAddr, sender []byte, funds sdk.Coins, isQuery bool) context.Context { // if it's not a query we create a context that allows to do anything. if !isQuery { return implementation.MakeAccountContext( @@ -263,6 +284,7 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, ac accountNumber, accountAddr, sender, + funds, k.sendModuleMessage, k.sendModuleMessageUntyped, k.queryModule, @@ -277,6 +299,7 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, ac accountNumber, accountAddr, nil, + nil, func(ctx context.Context, sender []byte, msg, msgResp implementation.ProtoMsg) error { return fmt.Errorf("cannot execute in query context") }, @@ -365,6 +388,31 @@ func (k Keeper) queryModule(ctx context.Context, queryReq, queryResp implementat return handlers[0](ctx, queryReq, queryResp) } +// maybeSendFunds will send the provided coins between the provided addresses, if amt +// is not empty. +func (k Keeper) maybeSendFunds(ctx context.Context, from, to []byte, amt sdk.Coins) error { + if amt.IsZero() { + return nil + } + + msg, msgResp, err := k.makeSendCoinsMsg(from, to, amt) + if err != nil { + return err + } + + // send module message ensures that "from" cannot impersonate. + err = k.sendModuleMessage(ctx, from, msg, msgResp) + if err != nil { + return err + } + return nil +} + +type gogoProtoPlusV2 interface { + proto.Message + implementation.ProtoMsg +} + const msgInterfaceName = "cosmos.accounts.v1.MsgInterface" // creates a new interface type which is an alias of the proto message interface to avoid conflicts with sdk.Msg diff --git a/x/accounts/keeper_account_abstraction.go b/x/accounts/keeper_account_abstraction.go index fdca933a4b..3820baa3e9 100644 --- a/x/accounts/keeper_account_abstraction.go +++ b/x/accounts/keeper_account_abstraction.go @@ -101,7 +101,7 @@ func (k Keeper) authenticate( _, err = k.Execute(ctx, senderAddr, ModuleAccountAddress, &account_abstractionv1.MsgAuthenticate{ Bundler: bundler, UserOperation: op, - }) + }, nil) return err } @@ -139,7 +139,7 @@ func (k Keeper) opExecuteMessages( resp, err := k.Execute(ctx, senderAddr, ModuleAccountAddress, &account_abstractionv1.MsgExecute{ Bundler: bundler, ExecutionMessages: op.ExecutionMessages, - }) + }, nil) // here is where we check if the account handles execution messages // if it does not, then we simply execute the provided messages on behalf of the sender switch { @@ -197,7 +197,7 @@ func (k Keeper) payBundler( resp, err := k.Execute(ctx, senderAddr, ModuleAccountAddress, &account_abstractionv1.MsgPayBundler{ Bundler: bundler, BundlerPaymentMessages: op.BundlerPaymentMessages, - }) + }, nil) // here is where we check if the account handles bundler payment messages // if it does not, then we simply execute the provided messages on behalf of the sender switch { diff --git a/x/accounts/keeper_test.go b/x/accounts/keeper_test.go index baf3f7250d..be02ccb275 100644 --- a/x/accounts/keeper_test.go +++ b/x/accounts/keeper_test.go @@ -28,7 +28,7 @@ func TestKeeper_Init(t *testing.T) { t.Run("ok", func(t *testing.T) { sender := []byte("sender") - resp, addr, err := m.Init(ctx, "test", sender, &types.Empty{}) + resp, addr, err := m.Init(ctx, "test", sender, &types.Empty{}, nil) require.NoError(t, err) require.Equal(t, &types.Empty{}, resp) require.NotNil(t, addr) @@ -45,7 +45,7 @@ func TestKeeper_Init(t *testing.T) { }) t.Run("unknown account type", func(t *testing.T) { - _, _, err := m.Init(ctx, "unknown", []byte("sender"), &types.Empty{}) + _, _, err := m.Init(ctx, "unknown", []byte("sender"), &types.Empty{}, nil) require.ErrorIs(t, err, errAccountTypeNotFound) }) } @@ -56,17 +56,17 @@ func TestKeeper_Execute(t *testing.T) { // create account sender := []byte("sender") - _, accAddr, err := m.Init(ctx, "test", sender, &types.Empty{}) + _, accAddr, err := m.Init(ctx, "test", sender, &types.Empty{}, nil) require.NoError(t, err) t.Run("ok", func(t *testing.T) { - resp, err := m.Execute(ctx, accAddr, sender, &types.Empty{}) + resp, err := m.Execute(ctx, accAddr, sender, &types.Empty{}, nil) require.NoError(t, err) require.Equal(t, &types.Empty{}, resp) }) t.Run("unknown account", func(t *testing.T) { - _, err := m.Execute(ctx, []byte("unknown"), sender, &types.Empty{}) + _, err := m.Execute(ctx, []byte("unknown"), sender, &types.Empty{}, nil) require.ErrorIs(t, err, collections.ErrNotFound) }) @@ -85,7 +85,7 @@ func TestKeeper_Execute(t *testing.T) { return accAddr, nil }) - resp, err := m.Execute(ctx, accAddr, sender, &types.Int64Value{Value: 1000}) + resp, err := m.Execute(ctx, accAddr, sender, &types.Int64Value{Value: 1000}, nil) require.NoError(t, err) require.True(t, implementation.Equal(&types.Empty{}, resp)) }) @@ -99,7 +99,7 @@ func TestKeeper_Query(t *testing.T) { // create account sender := []byte("sender") - _, accAddr, err := m.Init(ctx, "test", sender, &types.Empty{}) + _, accAddr, err := m.Init(ctx, "test", sender, &types.Empty{}, nil) require.NoError(t, err) t.Run("ok", func(t *testing.T) { diff --git a/x/accounts/msg_server.go b/x/accounts/msg_server.go index a4dce56001..3d85db30e1 100644 --- a/x/accounts/msg_server.go +++ b/x/accounts/msg_server.go @@ -31,7 +31,7 @@ func (m msgServer) Init(ctx context.Context, request *v1.MsgInit) (*v1.MsgInitRe } // run account creation logic - resp, accAddr, err := m.k.Init(ctx, request.AccountType, creator, msg) + resp, accAddr, err := m.k.Init(ctx, request.AccountType, creator, msg, request.Funds) if err != nil { return nil, err } @@ -80,7 +80,7 @@ func (m msgServer) Execute(ctx context.Context, execute *v1.MsgExecute) (*v1.Msg } // run account execution logic - resp, err := m.k.Execute(ctx, targetAddr, senderAddr, req) + resp, err := m.k.Execute(ctx, targetAddr, senderAddr, req, execute.Funds) if err != nil { return nil, err } diff --git a/x/accounts/testing/counter/counter.go b/x/accounts/testing/counter/counter.go index 55aecb82fb..396fdaaa38 100644 --- a/x/accounts/testing/counter/counter.go +++ b/x/accounts/testing/counter/counter.go @@ -60,6 +60,7 @@ func (a Account) Init(ctx context.Context, msg *counterv1.MsgInit) (*counterv1.M if err != nil { return nil, err } + // check funds return &counterv1.MsgInitResponse{}, nil } @@ -114,17 +115,23 @@ func (a Account) TestDependencies(ctx context.Context, _ *counterv1.MsgTestDepen chainID := a.hs.GetHeaderInfo(ctx).ChainID // test gas meter - gasBefore := a.gs.GetGasMeter(ctx).Limit() - a.gs.GetGasMeter(ctx).Consume(gasBefore, "before") - a.gs.GetGasMeter(ctx).Consume(10, "test") - gasAfter := a.gs.GetGasMeter(ctx).Limit() - a.gs.GetGasMeter(ctx).Consume(gasBefore, "After") + gm := a.gs.GetGasMeter(ctx) + gasBefore := gm.Limit() - gm.Remaining() + gm.Consume(10, "test") + gasAfter := gm.Limit() - gm.Remaining() + + // test funds + funds := accountstd.Funds(ctx) + if len(funds) == 0 { + return nil, fmt.Errorf("expected funds") + } return &counterv1.MsgTestDependenciesResponse{ ChainId: chainID, Address: meStr, BeforeGas: gasBefore, AfterGas: gasAfter, + Funds: funds, }, nil } diff --git a/x/accounts/testing/counter/v1/counter.pb.go b/x/accounts/testing/counter/v1/counter.pb.go index 709db85ff7..b453f86397 100644 --- a/x/accounts/testing/counter/v1/counter.pb.go +++ b/x/accounts/testing/counter/v1/counter.pb.go @@ -5,6 +5,9 @@ package v1 import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -245,6 +248,8 @@ type MsgTestDependenciesResponse struct { BeforeGas uint64 `protobuf:"varint,3,opt,name=before_gas,json=beforeGas,proto3" json:"before_gas,omitempty"` // after_gas is used to test gas meter increasing. AfterGas uint64 `protobuf:"varint,4,opt,name=after_gas,json=afterGas,proto3" json:"after_gas,omitempty"` + // funds reports the funds from the implementation.Funds method. + Funds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"` } func (m *MsgTestDependenciesResponse) Reset() { *m = MsgTestDependenciesResponse{} } @@ -308,6 +313,13 @@ func (m *MsgTestDependenciesResponse) GetAfterGas() uint64 { return 0 } +func (m *MsgTestDependenciesResponse) GetFunds() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Funds + } + return nil +} + // QueryCounterRequest is used to query the counter value. type QueryCounterRequest struct { } @@ -407,30 +419,36 @@ func init() { } var fileDescriptor_21c9320877186411 = []byte{ - // 363 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x4f, 0x4f, 0xdb, 0x40, - 0x10, 0xc5, 0xe3, 0x36, 0xcd, 0x9f, 0x51, 0xab, 0xaa, 0x6e, 0x5a, 0xb9, 0x8d, 0x6a,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xe1, 0x1c, 0x45, 0x8c, 0x22, 0xe2, 0x48, 0xde, 0x9d, 0x05, 0xed, 0x37, - 0xf8, 0x36, 0xf5, 0x17, 0x34, 0xa2, 0x4b, 0xc6, 0x45, 0xc8, 0x63, 0x9d, 0xd9, 0x1c, 0xd5, 0xb5, - 0x1e, 0xc4, 0xb6, 0x03, 0x75, 0x16, 0xc7, 0x29, 0x12, 0x39, 0x1f, 0xcc, 0xa4, 0x90, 0x79, 0x95, - 0x31, 0x4e, 0x64, 0x8a, 0x61, 0xc2, 0xc8, 0xf9, 0x68, 0xaa, 0x18, 0xd2, 0x67, 0x64, 0xb7, 0xa1, - 0xc9, 0x26, 0x0a, 0x53, 0x3d, 0xad, 0xea, 0x69, 0x43, 0x83, 0x3e, 0xa3, 0xbc, 0xe7, 0x69, 0x86, - 0xe9, 0xed, 0xf6, 0xf3, 0xae, 0x33, 0x24, 0xe5, 0x75, 0xa0, 0xb5, 0x8b, 0x8b, 0x7e, 0x2d, 0xf8, - 0xf4, 0xf2, 0x8f, 0x1b, 0x71, 0xdc, 0x7b, 0x58, 0xbb, 0xd6, 0x6a, 0xed, 0x5a, 0x4f, 0x6b, 0xd7, - 0xba, 0xdf, 0xb8, 0x95, 0xd5, 0xc6, 0xad, 0x3c, 0x6e, 0xdc, 0xca, 0xc5, 0x9e, 0xb9, 0x58, 0x8a, - 0xaf, 0x7c, 0x2e, 0x83, 0x9b, 0xf7, 0x9e, 0xc4, 0xb8, 0xa6, 0xdf, 0xc2, 0xc1, 0x73, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xda, 0x84, 0xf8, 0xfc, 0x3f, 0x02, 0x00, 0x00, + // 449 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0x8e, 0x69, 0xd3, 0x34, 0x03, 0x08, 0x61, 0x02, 0x72, 0x53, 0xe1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0, 0xfd, 0x67, 0xa8, 0x1e, 0x1c, 0x1c, 0x5d, 0x2d, 0xd2, 0xe8, + 0x7a, 0x91, 0x46, 0x3f, 0x17, 0x69, 0xf4, 0x65, 0x99, 0xb6, 0xae, 0x97, 0x69, 0xeb, 0xdb, 0x32, + 0x6d, 0x7d, 0x7c, 0xee, 0xff, 0x4e, 0xe5, 0x19, 0x93, 0x9a, 0x7f, 0xfe, 0xdf, 0x5b, 0xcd, 0x37, + 0xdc, 0x53, 0x7a, 0xf5, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x99, 0xcd, 0x49, 0xa2, 0xd8, 0x02, 0x00, + 0x00, } func (m *MsgInit) Marshal() (dAtA []byte, err error) { @@ -583,6 +601,20 @@ func (m *MsgTestDependenciesResponse) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l + if len(m.Funds) > 0 { + for iNdEx := len(m.Funds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Funds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCounter(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } if m.AfterGas != 0 { i = encodeVarintCounter(dAtA, i, uint64(m.AfterGas)) i-- @@ -746,6 +778,12 @@ func (m *MsgTestDependenciesResponse) Size() (n int) { if m.AfterGas != 0 { n += 1 + sovCounter(uint64(m.AfterGas)) } + if len(m.Funds) > 0 { + for _, e := range m.Funds { + l = e.Size() + n += 1 + l + sovCounter(uint64(l)) + } + } return n } @@ -1214,6 +1252,40 @@ func (m *MsgTestDependenciesResponse) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Funds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCounter + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCounter + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Funds = append(m.Funds, types.Coin{}) + if err := m.Funds[len(m.Funds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCounter(dAtA[iNdEx:]) diff --git a/x/accounts/v1/tx.pb.go b/x/accounts/v1/tx.pb.go index ac2797d4db..6cb6be99f8 100644 --- a/x/accounts/v1/tx.pb.go +++ b/x/accounts/v1/tx.pb.go @@ -7,7 +7,10 @@ import ( context "context" fmt "fmt" types "github.com/cosmos/cosmos-sdk/codec/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -37,6 +40,9 @@ type MsgInit struct { AccountType string `protobuf:"bytes,2,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"` // message is the message to be sent to the account. Message *types.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // funds contains the coins that the account wants to + // send alongside the request. + Funds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"` } func (m *MsgInit) Reset() { *m = MsgInit{} } @@ -93,6 +99,13 @@ func (m *MsgInit) GetMessage() *types.Any { return nil } +func (m *MsgInit) GetFunds() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Funds + } + return nil +} + // MsgInitResponse defines the Create response type for the Msg/Create RPC method. type MsgInitResponse struct { // account_address is the address of the newly created account. @@ -156,6 +169,9 @@ type MsgExecute struct { Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"` // message is the message to be sent to the account. Message *types.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // funds contains the coins that the account wants to + // send alongside the request. + Funds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"` } func (m *MsgExecute) Reset() { *m = MsgExecute{} } @@ -212,6 +228,13 @@ func (m *MsgExecute) GetMessage() *types.Any { return nil } +func (m *MsgExecute) GetFunds() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Funds + } + return nil +} + // MsgExecuteResponse defines the Execute response type for the Msg/Execute RPC method. type MsgExecuteResponse struct { // response is the response returned by the account implementation. @@ -372,38 +395,44 @@ func init() { func init() { proto.RegisterFile("cosmos/accounts/v1/tx.proto", fileDescriptor_29c2b6d8a13d4189) } var fileDescriptor_29c2b6d8a13d4189 = []byte{ - // 491 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0xcd, 0x24, 0x90, 0xd0, 0x9b, 0x42, 0xd1, 0x08, 0x15, 0xe3, 0x4a, 0x56, 0x1a, 0x10, 0x84, - 0xaa, 0x1a, 0xd3, 0xc0, 0xaa, 0xbb, 0x54, 0xe2, 0xb5, 0x88, 0x10, 0x16, 0x6c, 0xd8, 0x20, 0xc7, - 0x1e, 0x46, 0x11, 0x89, 0xc7, 0xf2, 0x9d, 0x54, 0xf1, 0x02, 0x09, 0xf8, 0x00, 0xc4, 0xa7, 0xf4, - 0x33, 0x58, 0x76, 0xc9, 0x12, 0x25, 0x8b, 0xfe, 0x06, 0xb2, 0x3d, 0xe3, 0x04, 0x68, 0x42, 0xa5, - 0xee, 0x3c, 0x73, 0xce, 0x3d, 0x0f, 0xcd, 0x35, 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 0x4e, 0xe5, 0x74, 0xee, 0x54, 0x7e, 0xce, 0x9d, 0xca, 0x3b, 0xbb, 0x50, 0xc3, - 0xf0, 0x23, 0x1b, 0x4a, 0x77, 0xba, 0xfc, 0xe7, 0x0f, 0xea, 0xf9, 0x0a, 0x3d, 0xfe, 0x1d, 0x00, - 0x00, 0xff, 0xff, 0x38, 0x4c, 0xe4, 0x12, 0x7b, 0x04, 0x00, 0x00, + // 583 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0x8e, 0x9b, 0x36, 0xa1, 0x9b, 0x42, 0xd1, 0xaa, 0x2a, 0xae, 0x2b, 0xb9, 0x69, 0x40, 0x10, + 0xaa, 0xb2, 0x6e, 0x02, 0xa7, 0xde, 0x12, 0xc4, 0xdf, 0x21, 0x42, 0x58, 0x70, 0xe1, 0x82, 0xfc, + 0xb3, 0x5d, 0xac, 0x26, 0xde, 0xc8, 0xb3, 0x8e, 0x92, 0x03, 0x12, 0xe2, 0x01, 0x10, 0xcf, 0xc1, + 0xa9, 0x8f, 0xd1, 0x63, 0x8f, 0x1c, 0x10, 0xa0, 0x04, 0xa9, 0xaf, 0x81, 0x6c, 0xef, 0x3a, 0x01, + 0x9a, 0xd0, 0x23, 0xa7, 0xec, 0xce, 0x7c, 0xf3, 0xcd, 0x7c, 0x5f, 0x66, 0x8d, 0xb6, 0x3d, 0x0e, + 0x3d, 0x0e, 0x96, 0xe3, 0x79, 0x3c, 0x0e, 0x05, 0x58, 0x83, 0x86, 0x25, 0x86, 0xa4, 0x1f, 0x71, + 0xc1, 0x31, 0xce, 0x92, 0x44, 0x25, 0xc9, 0xa0, 0x61, 0x6c, 0x31, 0xce, 0x59, 0x97, 0x5a, 0x29, + 0xc2, 0x8d, 0x8f, 0x2c, 0x27, 0x1c, 0x65, 0x70, 0xe3, 0x86, 0xe4, 0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, 0x8b, 0xf3, 0x39, 0xa5, 0x87, 0xae, 0xfe, 0xfe, 0x2f, 0xdc, + 0x5a, 0x5c, 0x98, 0xa1, 0x8c, 0xfd, 0xcb, 0xa0, 0x54, 0x13, 0x63, 0xe5, 0xfd, 0xf9, 0xc9, 0x9e, + 0xd6, 0x7e, 0x70, 0x3a, 0x36, 0xb5, 0xb3, 0xb1, 0xa9, 0xfd, 0x18, 0x9b, 0xda, 0xa7, 0x89, 0x59, + 0x38, 0x9b, 0x98, 0x85, 0x2f, 0x13, 0xb3, 0xf0, 0xda, 0xc8, 0xd8, 0xc0, 0x3f, 0x26, 0x01, 0xb7, + 0x86, 0xb3, 0x9f, 0x3d, 0xb7, 0x94, 0xae, 0xd0, 0xfd, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x16, + 0x7f, 0x4c, 0xfa, 0x78, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -586,6 +615,20 @@ func (m *MsgInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Funds) > 0 { + for iNdEx := len(m.Funds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Funds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } if m.Message != nil { { size, err := m.Message.MarshalToSizedBuffer(dAtA[:i]) @@ -677,6 +720,20 @@ func (m *MsgExecute) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Funds) > 0 { + for iNdEx := len(m.Funds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Funds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } if m.Message != nil { { size, err := m.Message.MarshalToSizedBuffer(dAtA[:i]) @@ -851,6 +908,12 @@ func (m *MsgInit) Size() (n int) { l = m.Message.Size() n += 1 + l + sovTx(uint64(l)) } + if len(m.Funds) > 0 { + for _, e := range m.Funds { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } return n } @@ -889,6 +952,12 @@ func (m *MsgExecute) Size() (n int) { l = m.Message.Size() n += 1 + l + sovTx(uint64(l)) } + if len(m.Funds) > 0 { + for _, e := range m.Funds { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } return n } @@ -1074,6 +1143,40 @@ func (m *MsgInit) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Funds", 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.Funds = append(m.Funds, types1.Coin{}) + if err := m.Funds[len(m.Funds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1342,6 +1445,40 @@ func (m *MsgExecute) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Funds", 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.Funds = append(m.Funds, types1.Coin{}) + if err := m.Funds[len(m.Funds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])