github.com/cosmos/cosmos-sdk@v0.50.10/proto/amino/amino.proto (about)

     1  syntax = "proto3";
     2  
     3  package amino;
     4  
     5  import "google/protobuf/descriptor.proto";
     6  
     7  // TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be updated.
     8  // We need this right now because gogoproto codegen needs to import the extension.
     9  option go_package = "github.com/cosmos/cosmos-sdk/types/tx/amino";
    10  
    11  extend google.protobuf.MessageOptions {
    12    // name is the string used when registering a concrete
    13    // type into the Amino type registry, via the Amino codec's
    14    // `RegisterConcrete()` method. This string MUST be at most 39
    15    // characters long, or else the message will be rejected by the
    16    // Ledger hardware device.
    17    string name = 11110001;
    18  
    19    // encoding describes the encoding format used by Amino for the given
    20    // message. The field type is chosen to be a string for
    21    // flexibility, but it should ideally be short and expected to be
    22    // machine-readable, for example "base64" or "utf8_json". We
    23    // highly recommend to use underscores for word separation instead of spaces.
    24    //
    25    // If left empty, then the Amino encoding is expected to be the same as the
    26    // Protobuf one.
    27    //
    28    // This annotation should not be confused with the `encoding`
    29    // one which operates on the field level.
    30    string message_encoding = 11110002;
    31  }
    32  
    33  extend google.protobuf.FieldOptions {
    34    // encoding describes the encoding format used by Amino for
    35    // the given field. The field type is chosen to be a string for
    36    // flexibility, but it should ideally be short and expected to be
    37    // machine-readable, for example "base64" or "utf8_json". We
    38    // highly recommend to use underscores for word separation instead of spaces.
    39    //
    40    // If left empty, then the Amino encoding is expected to be the same as the
    41    // Protobuf one.
    42    //
    43    // This annotation should not be confused with the
    44    // `message_encoding` one which operates on the message level.
    45    string encoding = 11110003;
    46  
    47    // field_name sets a different field name (i.e. key name) in
    48    // the amino JSON object for the given field.
    49    //
    50    // Example:
    51    //
    52    // message Foo {
    53    //   string bar = 1 [(amino.field_name) = "baz"];
    54    // }
    55    //
    56    // Then the Amino encoding of Foo will be:
    57    // `{"baz":"some value"}`
    58    string field_name = 11110004;
    59  
    60    // dont_omitempty sets the field in the JSON object even if
    61    // its value is empty, i.e. equal to the Golang zero value. To learn what
    62    // the zero values are, see https://go.dev/ref/spec#The_zero_value.
    63    //
    64    // Fields default to `omitempty`, which is the default behavior when this
    65    // annotation is unset. When set to true, then the field value in the
    66    // JSON object will be set, i.e. not `undefined`.
    67    //
    68    // Example:
    69    //
    70    // message Foo {
    71    //   string bar = 1;
    72    //   string baz = 2 [(amino.dont_omitempty) = true];
    73    // }
    74    //
    75    // f := Foo{};
    76    // out := AminoJSONEncoder(&f);
    77    // out == {"baz":""}
    78    bool dont_omitempty = 11110005;
    79  
    80    // oneof_name sets the type name for the given field oneof field.  This is used
    81    // by the Amino JSON encoder to encode the type of the oneof field, and must be the same string in
    82    // the RegisterConcrete() method usage used to register the concrete type.
    83    string oneof_name = 11110006;
    84  }