Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 4 KB

PROTO-AMINO.md

File metadata and controls

40 lines (31 loc) · 4 KB

protobuf/amino info

This is for developers developing Telescope.

protobuf options

  • gogoproto.customname it's a pure Golang thing. We can skip.
  • gogoproto.jsontag : impacts amino encoding. It's in the format of (gogoproto.jsontag) = "foo_bar,omitempty", and the omitempty part is optional. This means that the field name will be foo_bar.
  • json_name : it changes the ProtoJSON field name, doesn't impact amino. We can skip.
  • gogoproto.moretags : only used for YAML, we can skip.

amino encoding

The table below is from scrtlabs

Amino types and how they're represented in JSON

Amino JSON Note Source
string string tendermint/go-amino
bool boolean tendermint/go-amino
int string tendermint/go-amino
int64 string tendermint/go-amino
uint string tendermint/go-amino
uint64 string tendermint/go-amino
int8 number tendermint/go-amino
int16 number tendermint/go-amino
int32 number tendermint/go-amino
uint8 number tendermint/go-amino
uint16 number tendermint/go-amino
uint32 number tendermint/go-amino
Dec string Must have 18 digits after the decimal point
Int string
Timestamp string RFC 3339 tendermint/go-amino
Duration string Duration is int64 https://pkg.go.dev/time?utm_source=gopls#Duration

See examples in: