feat: Add proto annotations for Amino JSON (#13501)
* add legacy_amino_name * make-proto-gen * remove useless omitempty * add annotations * Add proto annotations * Add more annotations * update cosmos-proto * Add message scalar? * Add comments * Fix comment * lint proto files * proto-gen * go mod tidy * Add multisig encoding * Add field name * Format proto * proto-gen * Update proto/cosmos/msg/v1/msg.proto Co-authored-by: Aaron Craelius <aaron@regen.network> * Add dont_omitempty whenever we have nullable=false * proto-gen * Remove problematic annotations * put legacy_amino in subpackage * proto-gen * Fixes * legacy_amino.v1 * add non-working proto * Generate in separate package * Remove `cosmos.msg` prefix * make proto-gen * remove v1 too * make proto-format * Add field option * format * proto-gen * Use underscores * update legacy_amino -> amino * update to `key_field` * make proto-format * make proto-gen Co-authored-by: Aaron Craelius <aaron@regen.network>
This commit is contained in:
+18
-15
@@ -6,6 +6,7 @@ package types
|
||||
import (
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/cosmos-proto"
|
||||
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
io "io"
|
||||
@@ -204,25 +205,27 @@ func init() {
|
||||
func init() { proto.RegisterFile("cosmos/base/v1beta1/coin.proto", fileDescriptor_189a96714eafc2df) }
|
||||
|
||||
var fileDescriptor_189a96714eafc2df = []byte{
|
||||
// 286 bytes of a gzipped FileDescriptorProto
|
||||
// 312 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xce, 0x2f, 0xce,
|
||||
0xcd, 0x2f, 0xd6, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4,
|
||||
0x4f, 0xce, 0xcf, 0xcc, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xc8, 0xeb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1e, 0xc9, 0x31,
|
||||
0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb,
|
||||
0x31, 0x44, 0x29, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0x42, 0x43, 0x17,
|
||||
0x4a, 0xe9, 0x16, 0xa7, 0x64, 0xeb, 0x97, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xc3, 0xdb,
|
||||
0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x33, 0x9a, 0x20, 0xf6, 0xd7, 0x01, 0x00, 0x00,
|
||||
0x54, 0x4a, 0x12, 0xa2, 0x34, 0x1e, 0x22, 0x01, 0xd5, 0x07, 0x91, 0x12, 0x4c, 0xcc, 0xcd, 0xcc,
|
||||
0xcb, 0xd7, 0x07, 0x93, 0x10, 0x21, 0xa5, 0x28, 0x2e, 0x16, 0xe7, 0xfc, 0xcc, 0x3c, 0x21, 0x11,
|
||||
0x2e, 0xd6, 0x94, 0xd4, 0xbc, 0xfc, 0x5c, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x08, 0x47,
|
||||
0xc8, 0x8c, 0x8b, 0x2d, 0x31, 0x37, 0xbf, 0x34, 0xaf, 0x44, 0x82, 0x09, 0x24, 0xec, 0x24, 0x77,
|
||||
0xe2, 0x9e, 0x3c, 0xc3, 0xad, 0x7b, 0xf2, 0xcc, 0x9e, 0x79, 0x25, 0x97, 0xb6, 0xe8, 0x72, 0x41,
|
||||
0x4d, 0xf7, 0xcc, 0x2b, 0x59, 0xf1, 0x7c, 0x83, 0x16, 0x63, 0x10, 0x54, 0xb5, 0x15, 0xcb, 0x8b,
|
||||
0x05, 0xf2, 0x8c, 0x4a, 0x11, 0x5c, 0xec, 0x2e, 0xa9, 0xc9, 0x78, 0x8c, 0x37, 0x44, 0x33, 0x5e,
|
||||
0x12, 0x66, 0xbc, 0x4b, 0x6a, 0x32, 0x92, 0xf1, 0x2e, 0xa9, 0xc9, 0x68, 0x26, 0x9b, 0x73, 0x71,
|
||||
0x78, 0xe6, 0x95, 0x04, 0x80, 0x83, 0x46, 0x9b, 0x8b, 0x39, 0x33, 0xaf, 0x04, 0x62, 0x30, 0xc2,
|
||||
0x04, 0x0c, 0x07, 0x06, 0x81, 0x54, 0x81, 0x34, 0xba, 0xa4, 0x26, 0xc3, 0x35, 0xa6, 0xa4, 0x26,
|
||||
0xa3, 0x6b, 0xc4, 0xb4, 0x1a, 0xa4, 0xca, 0xc9, 0xe5, 0xc6, 0x43, 0x39, 0x86, 0x86, 0x47, 0x72,
|
||||
0x0c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7,
|
||||
0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x94, 0x9e, 0x59, 0x92,
|
||||
0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0x0b, 0x0d, 0x75, 0x28, 0xa5, 0x5b, 0x9c, 0x92, 0xad, 0x5f,
|
||||
0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x74, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff,
|
||||
0x33, 0xcc, 0xd5, 0x87, 0xef, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *Coin) Equal(that interface{}) bool {
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: amino/amino.proto
|
||||
|
||||
package amino
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
descriptorpb "google.golang.org/protobuf/types/descriptorpb"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
var E_Name = &proto.ExtensionDesc{
|
||||
ExtendedType: (*descriptorpb.MessageOptions)(nil),
|
||||
ExtensionType: (*string)(nil),
|
||||
Field: 11110001,
|
||||
Name: "amino.name",
|
||||
Tag: "bytes,11110001,opt,name=name",
|
||||
Filename: "amino/amino.proto",
|
||||
}
|
||||
|
||||
var E_MessageEncoding = &proto.ExtensionDesc{
|
||||
ExtendedType: (*descriptorpb.MessageOptions)(nil),
|
||||
ExtensionType: (*string)(nil),
|
||||
Field: 11110002,
|
||||
Name: "amino.message_encoding",
|
||||
Tag: "bytes,11110002,opt,name=message_encoding",
|
||||
Filename: "amino/amino.proto",
|
||||
}
|
||||
|
||||
var E_Encoding = &proto.ExtensionDesc{
|
||||
ExtendedType: (*descriptorpb.FieldOptions)(nil),
|
||||
ExtensionType: (*string)(nil),
|
||||
Field: 11110003,
|
||||
Name: "amino.encoding",
|
||||
Tag: "bytes,11110003,opt,name=encoding",
|
||||
Filename: "amino/amino.proto",
|
||||
}
|
||||
|
||||
var E_FieldName = &proto.ExtensionDesc{
|
||||
ExtendedType: (*descriptorpb.FieldOptions)(nil),
|
||||
ExtensionType: (*string)(nil),
|
||||
Field: 11110004,
|
||||
Name: "amino.field_name",
|
||||
Tag: "bytes,11110004,opt,name=field_name",
|
||||
Filename: "amino/amino.proto",
|
||||
}
|
||||
|
||||
var E_DontOmitempty = &proto.ExtensionDesc{
|
||||
ExtendedType: (*descriptorpb.FieldOptions)(nil),
|
||||
ExtensionType: (*bool)(nil),
|
||||
Field: 11110005,
|
||||
Name: "amino.dont_omitempty",
|
||||
Tag: "varint,11110005,opt,name=dont_omitempty",
|
||||
Filename: "amino/amino.proto",
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterExtension(E_Name)
|
||||
proto.RegisterExtension(E_MessageEncoding)
|
||||
proto.RegisterExtension(E_Encoding)
|
||||
proto.RegisterExtension(E_FieldName)
|
||||
proto.RegisterExtension(E_DontOmitempty)
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("amino/amino.proto", fileDescriptor_115c1f70afec6bc5) }
|
||||
|
||||
var fileDescriptor_115c1f70afec6bc5 = []byte{
|
||||
// 284 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4c, 0xcc, 0xcd, 0xcc,
|
||||
0xcb, 0xd7, 0x07, 0x93, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xac, 0x60, 0x8e, 0x94, 0x42,
|
||||
0x7a, 0x7e, 0x7e, 0x7a, 0x4e, 0xaa, 0x3e, 0x58, 0x30, 0xa9, 0x34, 0x4d, 0x3f, 0x25, 0xb5, 0x38,
|
||||
0xb9, 0x28, 0xb3, 0xa0, 0x24, 0xbf, 0x08, 0xa2, 0xd0, 0xca, 0x8c, 0x8b, 0x25, 0x2f, 0x31, 0x37,
|
||||
0x55, 0x48, 0x5e, 0x0f, 0xa2, 0x54, 0x0f, 0xa6, 0x54, 0xcf, 0x37, 0xb5, 0xb8, 0x38, 0x31, 0x3d,
|
||||
0xd5, 0xbf, 0xa0, 0x24, 0x33, 0x3f, 0xaf, 0x58, 0xe2, 0x63, 0xcf, 0x32, 0x56, 0x05, 0x46, 0x0d,
|
||||
0xce, 0x20, 0xb0, 0x7a, 0x2b, 0x5f, 0x2e, 0x81, 0x5c, 0x88, 0x82, 0xf8, 0xd4, 0xbc, 0xe4, 0xfc,
|
||||
0x94, 0xcc, 0xbc, 0x74, 0xc2, 0x66, 0x7c, 0x82, 0x99, 0xc1, 0x0f, 0xd5, 0xeb, 0x0a, 0xd5, 0x6a,
|
||||
0x65, 0xc3, 0xc5, 0x01, 0x37, 0x46, 0x16, 0xc3, 0x18, 0xb7, 0xcc, 0xd4, 0x9c, 0x14, 0x98, 0x21,
|
||||
0x9f, 0x61, 0x86, 0xc0, 0x75, 0x58, 0xd9, 0x73, 0x71, 0xa5, 0x81, 0x94, 0xc4, 0x83, 0xbd, 0x42,
|
||||
0x40, 0xff, 0x17, 0x98, 0x7e, 0x4e, 0xb0, 0x1e, 0x3f, 0x90, 0x6f, 0xdc, 0xb9, 0xf8, 0x52, 0xf2,
|
||||
0xf3, 0x4a, 0xe2, 0xf3, 0x73, 0x33, 0x4b, 0x52, 0x73, 0x0b, 0x4a, 0x2a, 0x09, 0x19, 0xf2, 0x15,
|
||||
0x62, 0x08, 0x47, 0x10, 0x2f, 0x48, 0x9f, 0x3f, 0x4c, 0x9b, 0x93, 0xeb, 0x89, 0x47, 0x72, 0x8c,
|
||||
0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72,
|
||||
0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x69, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7,
|
||||
0xe7, 0xea, 0x27, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0x43, 0x29, 0xdd, 0xe2, 0x94, 0x6c, 0xfd, 0x92,
|
||||
0xca, 0x82, 0xd4, 0x62, 0xfd, 0x92, 0x0a, 0x48, 0x24, 0x26, 0xb1, 0x81, 0x6d, 0x35, 0x06, 0x04,
|
||||
0x00, 0x00, 0xff, 0xff, 0xa9, 0xa0, 0x4d, 0x6f, 0xda, 0x01, 0x00, 0x00,
|
||||
}
|
||||
Reference in New Issue
Block a user